Skip to content

Commit

Permalink
Merge branch 'lvgl' of https://github.com/mutatrum/ESP-Miner into lvg…
Browse files Browse the repository at this point in the history
…l-all-the-things
  • Loading branch information
mutatrum committed Nov 30, 2024
2 parents 06d048c + fea4f01 commit 378e913
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-factory-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: ["102", "202", "204", "401", "402", "403", "601"]
build_type: ["102", "202", "204", "205", "401", "402", "403", "601"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: ["102", "202", "204", "401", "402", "403", "601"]
build_type: ["102", "202", "204", "205", "401", "402", "403", "601"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release-recovery-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build & Release Recovery Images [Pre-Release]

on:
release:
types: [prereleased]

jobs:
build:
runs-on: ubuntu-latest
name: "Recovery ${{ matrix.build_type }}"
strategy:
fail-fast: false
matrix:
build_type: ["102", "202", "204", "205", "401", "402", "403", "601"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build web dist
working-directory: ./main/http_server/axe-os
run: |
npm ci
npm run build
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.3.1
target: esp32s3
command: GITHUB_ACTIONS="true" idf.py build
path: '.'
- name: Disable self test on recovery images.
run: "sed -i 's/selftest,data,u16,1/selftest,data,u16,0/g' config-${{ matrix.build_type }}.cvs"
- name: "esp-idf build recovery config for ${{ matrix.build_type }}"
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.3.1
target: esp32s3
command: /opt/esp/idf/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate config-${{ matrix.build_type }}.cvs config.bin 0x6000
path: '.'
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- run: pip install esptool
- name: "Create recovery image for ${{ matrix.build_type }}-${{ github.ref_name }}"
run: "./merge_bin.sh -c esp-miner-recovery-${{ matrix.build_type }}-${{ github.ref_name }}.bin"
- name: Release esp-miner.bin
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
files: "esp-miner-recovery-${{ matrix.build_type }}-${{ github.ref_name }}.bin"
56 changes: 56 additions & 0 deletions .github/workflows/release-recovery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build & Release Recovery Images [Release]

on:
release:
types: [released]

jobs:
build:
runs-on: ubuntu-latest
name: "Recovery ${{ matrix.build_type }}"
strategy:
fail-fast: false
matrix:
build_type: ["102", "202", "204", "205", "401", "402", "403", "601"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build web dist
working-directory: ./main/http_server/axe-os
run: |
npm ci
npm run build
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.3.1
target: esp32s3
command: GITHUB_ACTIONS="true" idf.py build
path: '.'
- name: Disable self test on recovery images.
run: "sed -i 's/selftest,data,u16,1/selftest,data,u16,0/g' config-${{ matrix.build_type }}.cvs"
- name: "esp-idf build recovery config for ${{ matrix.build_type }}"
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.3.1
target: esp32s3
command: /opt/esp/idf/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate config-${{ matrix.build_type }}.cvs config.bin 0x6000
path: '.'
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- run: pip install esptool
- name: "Create recovery image for ${{ matrix.build_type }}-${{ github.ref_name }}"
run: "./merge_bin.sh -c esp-miner-recovery-${{ matrix.build_type }}-${{ github.ref_name }}.bin"
- name: Release esp-miner.bin
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "esp-miner-recovery-${{ matrix.build_type }}-${{ github.ref_name }}.bin"
4 changes: 2 additions & 2 deletions components/stratum/stratum_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ void STRATUM_V1_initialize_buffer()
{
json_rpc_buffer = malloc(BUFFER_SIZE);
json_rpc_buffer_size = BUFFER_SIZE;
memset(json_rpc_buffer, 0, BUFFER_SIZE);
if (json_rpc_buffer == NULL) {
printf("Error: Failed to allocate memory for buffer\n");
exit(1);
}
memset(json_rpc_buffer, 0, BUFFER_SIZE);
}

void cleanup_stratum_buffer()
Expand Down Expand Up @@ -235,7 +235,7 @@ void STRATUM_V1_parse(StratumApiV1Message * message, const char * stratum_json)
}
new_work->merkle_branches = malloc(HASH_SIZE * new_work->n_merkle_branches);
for (size_t i = 0; i < new_work->n_merkle_branches; i++) {
hex2bin(cJSON_GetArrayItem(merkle_branch, i)->valuestring, new_work->merkle_branches + HASH_SIZE * i, HASH_SIZE * 2);
hex2bin(cJSON_GetArrayItem(merkle_branch, i)->valuestring, new_work->merkle_branches + HASH_SIZE * i, HASH_SIZE);
}

new_work->version = strtoul(cJSON_GetArrayItem(params, 5)->valuestring, NULL, 16);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h4>Loading...</h4>
</div>
</div>
<span class="text-red-500 font-medium">{{info.sharesRejected | number: '1.0-0'}} </span>
<span class="text-500">rejected</span>
<span class="text-500">rejected</span> <span class="font-medium"> ({{(info.sharesRejected / (info.sharesAccepted + info.sharesRejected) * 100) | number: '1.2-2'}}%)</span>
</div>
</div>

Expand Down Expand Up @@ -222,4 +222,4 @@ <h5>Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }})
</div>


</ng-container>
</ng-container>
Original file line number Diff line number Diff line change
@@ -1,35 +0,0 @@
input[type="text"],
input[type="number"],
input[type="password"],
input[type="range"] {
min-width: 250px;
max-width: 90%;
}

select {
min-width: 268px;
max-width: 90%;
}

.restart {
margin-bottom: 1.5rem;

}

@media only screen and (min-width:900px) {

input[type="text"],
input[type="password"],
input[type="number"],
input[type="range"] {
min-width: 500px
}

select {
min-width: 518px
}
}

a {
color: white;
}
Original file line number Diff line number Diff line change
@@ -1,62 +1,10 @@
import { HttpErrorResponse, HttpEventType } from '@angular/common/http';
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { map, Observable, shareReplay, startWith } from 'rxjs';
import { LoadingService } from 'src/app/services/loading.service';
import { SystemService } from 'src/app/services/system.service';

@Component({
selector: 'app-network',
templateUrl: './network.component.html',
styleUrls: ['./network.component.scss']
styleUrls: ['./network.component.scss'],
})
export class NetworkComponent {

public form!: FormGroup;

public info$: Observable<any>;

constructor(
private fb: FormBuilder,
private systemService: SystemService,
private toastr: ToastrService,
private toastrService: ToastrService,
private loadingService: LoadingService,
) {
this.info$ = this.systemService.getInfo().pipe(shareReplay({refCount: true, bufferSize: 1}))

this.info$.pipe(this.loadingService.lockUIUntilComplete())
.subscribe(info => {
this.form = this.fb.group({
hostname: [info.hostname, [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: ['*****'],
});
});

}

public updateSystem() {

const form = this.form.getRawValue();

// Allow an empty wifi password
form.wifiPass = form.wifiPass == null ? '' : form.wifiPass;

if (form.wifiPass === '*****') {
delete form.wifiPass;
}

this.systemService.updateSystem(undefined, form)
.pipe(this.loadingService.lockUIUntilComplete())
.subscribe({
next: () => {
this.toastr.success('Success!', 'Saved.');
},
error: (err: HttpErrorResponse) => {
this.toastr.error('Error.', `Could not save. ${err.message}`);
}
});
}
constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2>Latest Release: {{latestRelease.name}}</h2>
<div class="card">
<h2>Update Firmware <span *ngIf="firmwareUpdateProgress != null">{{firmwareUpdateProgress}}%</span></h2>
<!-- <input type="file" id="file" (change)="otaUpdate($event)" accept=".bin"> -->
<p-fileUpload [customUpload]="true" mode="basic" accept=".bin" (uploadHandler)="otaUpdate($event)"
<p-fileUpload #firmwareUpload [customUpload]="true" mode="basic" accept=".bin" (uploadHandler)="otaUpdate($event)"
[auto]="true" chooseLabel="Browse"></p-fileUpload>

<small>(esp-miner.bin)</small>
Expand All @@ -46,7 +46,7 @@ <h2>Update Firmware <span *ngIf="firmwareUpdateProgress != null">{{firmwareUpdat
<div class="card">
<h2>Update Website <span *ngIf="websiteUpdateProgress != null">{{websiteUpdateProgress}}%</span></h2>

<p-fileUpload [customUpload]="true" mode="basic" accept=".bin" (uploadHandler)="otaWWWUpdate($event)"
<p-fileUpload #websiteUpload [customUpload]="true" mode="basic" accept=".bin" (uploadHandler)="otaWWWUpdate($event)"
[auto]="true" chooseLabel="Browse"></p-fileUpload>

<small>(www.bin)</small>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HttpErrorResponse, HttpEventType } from '@angular/common/http';
import { Component } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { FileUploadHandlerEvent } from 'primeng/fileupload';
import { FileUploadHandlerEvent, FileUpload } from 'primeng/fileupload';
import { map, Observable, shareReplay, startWith } from 'rxjs';
import { GithubUpdateService } from 'src/app/services/github-update.service';
import { LoadingService } from 'src/app/services/loading.service';
Expand Down Expand Up @@ -31,6 +31,9 @@ export class SettingsComponent {

public info$: Observable<any>;

@ViewChild('firmwareUpload') firmwareUpload!: FileUpload;
@ViewChild('websiteUpload') websiteUpload!: FileUpload;

constructor(
private fb: FormBuilder,
private systemService: SystemService,
Expand Down Expand Up @@ -132,7 +135,8 @@ export class SettingsComponent {

otaUpdate(event: FileUploadHandlerEvent) {
const file = event.files[0];

this.firmwareUpload.clear(); // clear the file upload component

if (file.name != 'esp-miner.bin') {
this.toastrService.error('Incorrect file, looking for esp-miner.bin.', 'Error');
return;
Expand Down Expand Up @@ -168,6 +172,8 @@ export class SettingsComponent {

otaWWWUpdate(event: FileUploadHandlerEvent) {
const file = event.files[0];
this.websiteUpload.clear(); // clear the file upload component

if (file.name != 'www.bin') {
this.toastrService.error('Incorrect file, looking for www.bin.', 'Error');
return;
Expand All @@ -182,22 +188,23 @@ export class SettingsComponent {
this.websiteUpdateProgress = Math.round((event.loaded / (event.total as number)) * 100);
} else if (event.type === HttpEventType.Response) {
if (event.ok) {
this.toastrService.success('Website updated', 'Success!');
setTimeout(() => {
this.toastrService.success('Website updated', 'Success!');
window.location.reload();
}, 1000);

}, 2000);
} else {
this.toastrService.error(event.statusText, 'Error');
}
}
else if (event instanceof HttpErrorResponse)
{
this.toastrService.error(event.error, 'Error');
const errorMessage = event.error?.message || event.message || 'Unknown error occurred';
this.toastrService.error(errorMessage, 'Error');
}
},
error: (err) => {
this.toastrService.error(err.error, 'Error');
const errorMessage = err.error?.message || err.message || 'Unknown error occurred';
this.toastrService.error(errorMessage, 'Error');
},
complete: () => {
this.websiteUpdateProgress = null;
Expand Down
5 changes: 2 additions & 3 deletions main/http_server/axe-os/src/app/services/system.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ export class SystemService {
'Content-Type': 'application/octet-stream', // Set the content type
},
}).subscribe({
next: (e) => {

next: (event) => {
subscriber.next(event);
},
error: (err) => {
subscriber.error(err)
},
complete: () => {
subscriber.next()
subscriber.complete();
}
});
Expand Down
1 change: 1 addition & 0 deletions main/tasks/power_management_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
nvs_config_set_u16(NVS_CONFIG_ASIC_FREQ, 50);
nvs_config_set_u16(NVS_CONFIG_FAN_SPEED, 100);
nvs_config_set_u16(NVS_CONFIG_AUTO_FAN_SPEED, 0);
nvs_config_set_u16(NVS_CONFIG_OVERHEAT_MODE, 1);
exit(EXIT_FAILURE);
}
break;
Expand Down

0 comments on commit 378e913

Please sign in to comment.