Skip to content

Commit

Permalink
passed deviceModel to web UI for usage as prefix on the esp-miner.bin…
Browse files Browse the repository at this point in the history
… for updates
  • Loading branch information
shufps committed Oct 20, 2024
1 parent c257ae4 commit 7f6022e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h5>Overview</h5>
<table *ngIf="info$ | async as info">
<tr>
<td>Model:</td>
<td>{{info.ASICModel}}</td>
<td>{{info.deviceModel}} ({{info.ASICModel}})</td>
</tr>
<tr>
<td>Uptime:</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class SettingsComponent {
public firmwareUpdateProgress: number | null = null;
public websiteUpdateProgress: number | null = null;


public deviceModel: string = "";
public devToolsOpen: boolean = false;
public eASICModel = eASICModel;
public ASICModel!: eASICModel;
Expand Down Expand Up @@ -54,6 +54,7 @@ export class SettingsComponent {

this.info$.pipe(this.loadingService.lockUIUntilComplete())
.subscribe(info => {
this.deviceModel = info.deviceModel;
this.ASICModel = info.ASICModel;
this.form = this.fb.group({
flipscreen: [info.flipscreen == 1],
Expand Down Expand Up @@ -142,9 +143,10 @@ export class SettingsComponent {

otaUpdate(event: FileUploadHandlerEvent) {
const file = event.files[0];
const expectedFileName = `esp-miner-${this.deviceModel}.bin`;

if (file.name != 'esp-miner.bin') {
this.toastrService.error('Incorrect file, looking for esp-miner.bin.', 'Error');
if (file.name !== expectedFileName) {
this.toastrService.error(`Incorrect file, looking for ${expectedFileName}.`, 'Error');
return;
}

Expand All @@ -157,13 +159,10 @@ export class SettingsComponent {
} else if (event.type === HttpEventType.Response) {
if (event.ok) {
this.toastrService.success('Firmware updated', 'Success!');

} else {
this.toastrService.error(event.statusText, 'Error');
}
}
else if (event instanceof HttpErrorResponse)
{
} else if (event instanceof HttpErrorResponse) {
this.toastrService.error(event.error, 'Error');
}
},
Expand Down
1 change: 1 addition & 0 deletions main/http_server/axe-os/src/app/services/system.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const defaultInfo: ISystemInfo = {
asicCount: 1,
smallCoreCount: 672,
ASICModel: eASICModel.BM1368,
deviceModel: "NerdQAxe+",
stratumURL: "public-pool.io",
stratumPort: 21496,
stratumUser: "bc1q99n3pu025yyu0jlywpmwzalyhm36tg5u37w20d.bitaxe-U1",
Expand Down
1 change: 1 addition & 0 deletions main/http_server/axe-os/src/models/ISystemInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface ISystemInfo {
asicCount: number,
smallCoreCount: number,
ASICModel: eASICModel,
deviceModel: string,
stratumURL: string,
stratumPort: number,
stratumUser: string,
Expand Down
1 change: 1 addition & 0 deletions main/http_server/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ static esp_err_t GET_system_info(httpd_req_t *req)
cJSON_AddNumberToObject(root, "asicCount", board->getAsicCount());
cJSON_AddNumberToObject(root, "smallCoreCount", (board->getAsics()) ? board->getAsics()->getSmallCoreCount() : 0);
cJSON_AddStringToObject(root, "ASICModel", board->getAsicModel());
cJSON_AddStringToObject(root, "deviceModel", board->getDeviceModel());
cJSON_AddStringToObject(root, "stratumURL", stratumURL);
cJSON_AddNumberToObject(root, "stratumPort", nvs_config_get_u16(NVS_CONFIG_STRATUM_PORT, CONFIG_STRATUM_PORT));
cJSON_AddStringToObject(root, "stratumUser", stratumUser);
Expand Down

0 comments on commit 7f6022e

Please sign in to comment.