fix: Add overheat alert, knob colors & max, chart dots & label

This commit is contained in:
mrv777 2024-09-27 18:17:15 -05:00
parent 0dff6f87aa
commit 6ae6ec43af
3 changed files with 38 additions and 14 deletions

View File

@ -21,8 +21,7 @@ import { ANSIPipe } from './pipes/ansi.pipe';
import { DateAgoPipe } from './pipes/date-ago.pipe';
import { HashSuffixPipe } from './pipes/hash-suffix.pipe';
import { PrimeNGModule } from './prime-ng.module';
import { MessageModule } from 'primeng/message';
const components = [
AppComponent,
@ -55,7 +54,8 @@ const components = [
BrowserAnimationsModule,
CommonModule,
PrimeNGModule,
AppLayoutModule
AppLayoutModule,
MessageModule
],
providers: [
{ provide: LocationStrategy, useClass: HashLocationStrategy },

View File

@ -1,7 +1,13 @@
<ng-template #loading>
<h4>Loading...</h4>
</ng-template>
<ng-container>
<ng-container *ngIf="info$ | async as info; else loading">
<!-- Temp warning alert -->
<p-message *ngIf="info.overheat_mode"
severity="error"
styleClass="w-full mb-4 py-4 border-round-xl"
text="Bitaxe has overheated - See settings">
</p-message>
<div class="grid" *ngIf="info$ | async as info; else loading">
<div class="col-12">
@ -95,14 +101,15 @@
<h5>Power</h5>
<div class="grid text-center">
<div class="col-4">
<p-knob [min]="3" [max]="50" [readonly]="true" [(ngModel)]="info.power"
<p-knob [min]="3" [max]="max(50, info.power)" [readonly]="true" [(ngModel)]="info.power"
valueTemplate="{value}W"></p-knob>
Power
</div>
<div class="col-4">
<p-knob [min]="4.5" [max]="5.5" [readonly]="true" [(ngModel)]="info.voltage"
valueTemplate="{value}V"></p-knob>
valueTemplate="{value}V"
[valueColor]="info.voltage < 4.8 ? '#ff0000' : 'var(--primary-color, Black)'"></p-knob>
Input Voltage
<span class="danger" *ngIf="info.voltage < 4.8">&nbsp; Danger: Low voltage</span>
</div>
@ -122,8 +129,10 @@
<h5>Heat</h5>
<div class="grid text-center">
<div class="col-6">
<p-knob [min]="20" [max]="75" [readonly]="true" [(ngModel)]="info.temp"
valueTemplate="{value}C"></p-knob>
<p-knob [min]="20" [max]="max(75, info.temp)" [readonly]="true" [(ngModel)]="info.temp"
valueTemplate="{value}C"
[valueColor]="info.temp >= 70 ? '#ff0000' : 'var(--primary-color, Black)'">
</p-knob>
ASIC Temperature
<span class="danger" *ngIf="info.temp >= 70">&nbsp;
@ -132,7 +141,8 @@
</div>
<div class="col-6" *ngIf="info.vrTemp > 0">
<p-knob [min]="20" [max]="145" [readonly]="true" [(ngModel)]="info.vrTemp"
valueTemplate="{value}C"></p-knob>
valueTemplate="{value}C"
[valueColor]="info.vrTemp >= 105 ? '#ff0000' : 'var(--primary-color, Black)'"></p-knob>
Voltage Regulator Temperature
<span class="danger" *ngIf="info.vrTemp >= 105">&nbsp;
@ -172,7 +182,7 @@
<h5>Performance</h5>
<div class="grid text-center">
<div class="col-6">
<p-knob [min]="100" [max]="800" [readonly]="true" [(ngModel)]="info.frequency"
<p-knob [min]="100" [max]="max(800, info.frequency)" [readonly]="true" [(ngModel)]="info.frequency"
valueTemplate="{value}Mhz"></p-knob>
ASIC Frequency
</div>

View File

@ -12,7 +12,6 @@ import { ISystemInfo } from 'src/models/ISystemInfo';
})
export class HomeComponent {
public info$: Observable<ISystemInfo>;
public quickLink$: Observable<string | undefined>;
@ -46,7 +45,8 @@ export class HomeComponent {
backgroundColor: primaryColor,
borderColor: primaryColor,
tension: .4,
pointRadius: 1,
pointRadius: 2,
pointHoverRadius: 5,
borderWidth: 1
},
@ -61,7 +61,19 @@ export class HomeComponent {
labels: {
color: textColor
}
}
},
tooltip: {
callbacks: {
label: function(tooltipItem: any) {
let label = tooltipItem.dataset.label || '';
if (label) {
label += ': ';
}
label += HashSuffixPipe.transform(tooltipItem.raw);
return label;
}
}
},
},
scales: {
x: {
@ -160,7 +172,9 @@ export class HomeComponent {
}
max(a: number, b: number): number {
return Math.max(a, b);
}
}