Skip to content

Commit

Permalink
Merge pull request #29 from shufps/cherry-picked-2.3.0-changes
Browse files Browse the repository at this point in the history
Cherry picked 2.3.0 changes
  • Loading branch information
shufps authored Oct 19, 2024
2 parents 3f530cb + ae77273 commit da429d8
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 40 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ else()
message(FATAL_ERROR "Environment variable BOARD is not set")
endif()

message(STATUS "Selected board: $ENV{BOARD}")

# not longer used
#add_definitions(-DDISPLAY_TTGO)
Expand Down
11 changes: 9 additions & 2 deletions components/connect/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ static const char *TAG = "wifi station";

static int s_retry_num = 0;

static char s_ip_addr[20]={0};
static char s_ip_addr[20] = {0};
static bool ip_valid = false;

bool connect_get_ip_addr(char *buf, size_t buf_len) {
bool connect_get_ip_addr(char *buf, size_t buf_len)
{
strncpy(buf, s_ip_addr, buf_len);
return ip_valid;
}
Expand Down Expand Up @@ -90,6 +91,7 @@ static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_
ESP_LOGI(TAG, "Device ip: %s", s_ip_addr);
s_retry_num = 0;
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
MINER_set_wifi_status(WIFI_CONNECTED, 0);
}
}

Expand Down Expand Up @@ -167,6 +169,11 @@ esp_netif_t *wifi_init_sta(const char *wifi_ssid, const char *wifi_pass)
.threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD,
// .sae_pwe_h2e = ESP_WIFI_SAE_MODE,
// .sae_h2e_identifier = EXAMPLE_H2E_IDENTIFIER,
.btm_enabled = 1,
.rm_enabled = 1,
.scan_method = WIFI_ALL_CHANNEL_SCAN,
.sort_method = WIFI_CONNECT_AP_BY_SIGNAL,
.pmf_cfg = {.capable = true, .required = false},
},
};
strncpy((char *) wifi_sta_config.sta.ssid, wifi_ssid, sizeof(wifi_sta_config.sta.ssid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
</div>
<div class="field grid p-fluid">
<label htmlFor="wifiPass" class="col-12 mb-2 md:col-2 md:mb-0">WiFi Password:</label>
<div class="col-12 md:col-10">
<input pInputText id="wifiPass" formControlName="wifiPass" type="password" />
<div class="col-12 md:col-10 p-input-icon-right">
<i *ngIf="form.get('wifiPass')?.dirty" class="pi"
[ngClass]="{'pi-eye': !showWifiPassword, 'pi-eye-slash': showWifiPassword}"
(click)="toggleWifiPasswordVisibility()" style="cursor: pointer;"></i>
<input pInputText id="wifiPass" formControlName="wifiPass"
[type]="showWifiPassword ? 'text' : 'password'"
placeholder="Enter WiFi password" />
</div>
</div>
<div class="field grid p-fluid">
Expand Down Expand Up @@ -45,11 +50,35 @@
</div>
<div class="field grid p-fluid">
<label htmlFor="stratumPassword" class="col-12 mb-2 md:col-2 md:mb-0">Stratum Password:</label>
<div class="col-12 md:col-10">
<input pInputText id="stratumPassword" formControlName="stratumPassword" type="password" />
<div class="col-12 md:col-10 p-input-icon-right">
<i *ngIf="form.get('stratumPassword')?.dirty" class="pi"
[ngClass]="{'pi-eye': !showStratumPassword, 'pi-eye-slash': showStratumPassword}"
(click)="toggleStratumPasswordVisibility()" style="cursor: pointer;"></i>
<input pInputText id="stratumPassword" formControlName="stratumPassword"
[type]="showStratumPassword ? 'text' : 'password'"
placeholder="Enter stratum password" />
</div>
</div>

<ng-container *ngIf="!devToolsOpen && ASICModel == eASICModel.BM1366">

<div class="field grid p-fluid">
<label class="col-12 mb-2 md:col-2 md:mb-0" htmlFor="frequency">Frequency</label>
<div class="col-12 md:col-10">
<p-dropdown [options]="BM1366DropdownFrequency" optionLabel="name" optionValue="value"
formControlName="frequency"></p-dropdown>
</div>
</div>


<div class="field grid p-fluid">
<label class="col-12 mb-2 md:col-2 md:mb-0" htmlFor="coreVoltage">Core Voltage</label>
<p-dropdown class="col-12 md:col-10" [options]="BM1366CoreVoltage" optionLabel="name"
optionValue="value" formControlName="coreVoltage"></p-dropdown>
</div>

</ng-container>

<ng-container *ngIf="!devToolsOpen && ASICModel == eASICModel.BM1368">

<div class="field grid p-fluid">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pi {
right: 1rem;
font-size: 1.5rem;
top: 1rem;
}
41 changes: 37 additions & 4 deletions main/http_server/axe-os/src/app/components/edit/edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ export class EditComponent implements OnInit {

@Input() uri = '';

public BM1366DropdownFrequency = [
{ name: '400', value: 400 },
{ name: '425', value: 425 },
{ name: '450', value: 450 },
{ name: '475', value: 475 },
{ name: '485 (default)', value: 485 },
{ name: '500', value: 500 },
{ name: '525', value: 525 },
{ name: '550', value: 550 },
{ name: '575', value: 575 },
];

public BM1366CoreVoltage = [
{ name: '1100', value: 1100 },
{ name: '1150', value: 1150 },
{ name: '1200 (default)', value: 1200 },
{ name: '1250', value: 1250 },
{ name: '1300', value: 1300 },
];

public BM1368DropdownFrequency = [
{ name: '400', value: 400 },
{ name: '425', value: 425 },
Expand Down Expand Up @@ -93,10 +113,10 @@ export class EditComponent implements OnInit {
Validators.max(65353)
]],
stratumUser: [info.stratumUser, [Validators.required]],
stratumPassword: ['password', [Validators.required]],
stratumPassword: ['*****', [Validators.required]],
hostname: [info.hostname, [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: ['password'],
wifiPass: ['*****'],
coreVoltage: [info.coreVoltage, [Validators.required]],
frequency: [info.frequency, [Validators.required]],
autofanspeed: [info.autofanspeed == 1, [Validators.required]],
Expand Down Expand Up @@ -133,10 +153,13 @@ export class EditComponent implements OnInit {

const form = this.form.getRawValue();

if (form.wifiPass === 'password') {
// Allow an empty wifi password
form.wifiPass = form.wifiPass == null ? '' : form.wifiPass;

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

Expand All @@ -152,4 +175,14 @@ export class EditComponent implements OnInit {
});
}

showStratumPassword: boolean = false;
toggleStratumPasswordVisibility() {
this.showStratumPassword = !this.showStratumPassword;
}

showWifiPassword: boolean = false;
toggleWifiPasswordVisibility() {
this.showWifiPassword = !this.showWifiPassword;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ export class HomeComponent implements OnInit, OnDestroy {
} else if (info.stratumURL.includes('solo.d-central.tech')) {
const address = info.stratumUser.split('.')[0];
return `https://solo.d-central.tech/#/app/${address}`;
} else if (info.stratumURL.includes('solo.ckpool.org')) {
} else if (/solo[46]?.ckpool.org/.test(info.stratumURL)) {
const address = info.stratumUser.split('.')[0];
return `https://solostats.ckpool.org/stats/${address}`;
return `https://solo.ckpool.org/users/${address}`;
} else {
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ <h2>Realtime Logs <button pButton (click)="toggleLogs()" style="margin-left: 15p
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class LogsComponent implements OnDestroy, AfterViewChecked {
this.websocketSubscription = this.websocketService.ws$.subscribe({
next: (val) => {
this.logs.push(val);
if (this.logs.length > 100) {
if (this.logs.length > 256) {
this.logs.shift();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ export class SettingsComponent {
Validators.max(65353)
]],
stratumUser: [info.stratumUser, [Validators.required]],
stratumPassword: ['password', [Validators.required]],
stratumPassword: ['*****', [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: ['password'],
wifiPass: ['*****'],
coreVoltage: [info.coreVoltage, [Validators.required]],
frequency: [info.frequency, [Validators.required]],
autofanspeed: [info.autofanspeed == 1, [Validators.required]],
Expand Down Expand Up @@ -118,10 +118,13 @@ export class SettingsComponent {
form.autofanspeed = form.autofanspeed == true ? 1 : 0;
form.autoscreenoff = form.autoscreenoff == true ? 1 : 0;

if (form.wifiPass === 'password') {
// Allow an empty wifi password
form.wifiPass = form.wifiPass == null ? '' : form.wifiPass;

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

Expand Down Expand Up @@ -159,9 +162,13 @@ export class SettingsComponent {
this.toastrService.error(event.statusText, 'Error');
}
}
else if (event instanceof HttpErrorResponse)
{
this.toastrService.error(event.error, 'Error');
}
},
error: (err) => {
this.toastrService.error('Uploaded Error', 'Error');
this.toastrService.error(err.error, 'Error');
},
complete: () => {
this.firmwareUpdateProgress = null;
Expand Down Expand Up @@ -194,9 +201,13 @@ export class SettingsComponent {
this.toastrService.error(event.statusText, 'Error');
}
}
else if (event instanceof HttpErrorResponse)
{
this.toastrService.error(event.error, 'Error');
}
},
error: (err) => {
this.toastrService.error('Upload Error', 'Error');
this.toastrService.error(err.error, 'Error');
},
complete: () => {
this.websiteUpdateProgress = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
<div class="close" (click)="showEdit = false">&#10006;</div>
<h1>{{selectedAxeOs.ip}}</h1>
<app-edit [uri]="'http://' + selectedAxeOs.ip"></app-edit>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
</ng-container>


<p-button (click)="restart()" id="restart" label="Restart" severity="danger"></p-button>
<li id="restart-container">
<p-button (click)="restart()" id="restart" label="Restart" severity="danger"></p-button>
</li>

</ul>
</ul>
10 changes: 7 additions & 3 deletions main/http_server/axe-os/src/app/layout/styles/layout/_menu.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.layout-sidebar {
position: fixed;
width: 300px;
width: 250px;
height: calc(100vh - 9rem);
z-index: 999;
overflow-y: auto;
Expand Down Expand Up @@ -135,6 +135,10 @@
}

#restart {
padding: 2rem 1rem;
display: block;
display: inline-block;
}

#restart-container {
margin: 2rem 1rem;
display: flex;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

&.layout-static {
.layout-main-container {
margin-left: 300px;
margin-left: 250px;
}

&.layout-static-inactive {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
color: var(--surface-900);
font-size: 1.5rem;
font-weight: 500;
width: 300px;
width: 250px;
border-radius: 12px;

img {
Expand Down
8 changes: 7 additions & 1 deletion main/http_server/axe-os/src/app/pipes/hash-suffix.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ export class HashSuffixPipe implements PipeTransform {
const scaledValue = value / Math.pow(1000, power);
const suffix = suffixes[power];

return scaledValue.toFixed(1) + suffix;
if (scaledValue < 10) {
return scaledValue.toFixed(2) + suffix;
} else if (scaledValue < 100) {
return scaledValue.toFixed(1) + suffix;
}

return scaledValue.toFixed(0) + suffix;
}


Expand Down
19 changes: 16 additions & 3 deletions main/http_server/axe-os/src/app/services/github-update.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';


interface GithubRelease {
id: number;
tag_name: string;
name: string;
prerelease: boolean;
}

@Injectable({
providedIn: 'root'
Expand All @@ -12,8 +21,12 @@ export class GithubUpdateService {
) { }


public getReleases() {
return this.httpClient.get(`https://github.com/shufps/ESP-Miner-NerdQAxePlus/releases`) as Observable<any[]>;
public getReleases(): Observable<GithubRelease[]> {
return this.httpClient.get<GithubRelease[]>(
'https://github.com/shufps/ESP-Miner-NerdQAxePlus/releases'
).pipe(
map((releases: GithubRelease[]) => releases.filter((release: GithubRelease) => !release.prerelease))
);
}

}
}
4 changes: 2 additions & 2 deletions main/http_server/axe-os/src/app/services/loading.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export class LoadingService {
subscriber.next(value);
},
error: (err) => {
subscriber.next(err);
this.loading$.next(false);
subscriber.error(err);
},
complete: () => {
this.loading$.next(false);
Expand All @@ -30,4 +31,3 @@ export class LoadingService {
}
}
}

1 change: 1 addition & 0 deletions main/http_server/axe-os/src/models/enum/eASICModel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum eASICModel {
BM1366 = 'BM1366',
BM1368 = 'BM1368',
BM1370 = 'BM1370',
}
4 changes: 2 additions & 2 deletions main/http_server/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ static esp_err_t PATCH_update_settings(httpd_req_t *req)
if ((item = cJSON_GetObjectItem(root, "hostname")) != NULL) {
nvs_config_set_string(NVS_CONFIG_HOSTNAME, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "coreVoltage")) != NULL) {
if ((item = cJSON_GetObjectItem(root, "coreVoltage")) != NULL && item->valueint > 0) {
nvs_config_set_u16(NVS_CONFIG_ASIC_VOLTAGE, item->valueint);
}
if ((item = cJSON_GetObjectItem(root, "frequency")) != NULL) {
if ((item = cJSON_GetObjectItem(root, "frequency")) != NULL && item->valueint > 0) {
nvs_config_set_u16(NVS_CONFIG_ASIC_FREQ, item->valueint);
}
if ((item = cJSON_GetObjectItem(root, "flipscreen")) != NULL) {
Expand Down
Loading

0 comments on commit da429d8

Please sign in to comment.