mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-17 13:22:53 +01:00
feat: add TPS alerts to UI
This commit is contained in:
parent
7ee89c74d0
commit
e729c774a1
@ -11,6 +11,10 @@
|
||||
text="Bitaxe frequency is set low - See settings">
|
||||
</p-message>
|
||||
|
||||
<p-message *ngIf="info.tps_error" severity="error" styleClass="w-full mb-4 py-4 border-round-xl"
|
||||
text="TPS546 Error: {{info.tps_error}} Make sure to check your Power Supply.">
|
||||
</p-message>
|
||||
|
||||
<div class="grid" *ngIf="info$ | async as info; else loading">
|
||||
<div class="col-12">
|
||||
<div class="grid">
|
||||
@ -26,9 +30,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<ng-container>
|
||||
Average:
|
||||
Average:
|
||||
<span class="text-green-500 font-medium">
|
||||
{{calculateAverage(hashrateData) | hashSuffix}}
|
||||
</span>
|
||||
@ -51,9 +55,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<ng-container>
|
||||
Average:
|
||||
Average:
|
||||
<span class="text-green-500 font-medium">
|
||||
{{calculateEfficiencyAverage(hashrateData, powerData) | number: '1.2-2'}} <small>J/TH</small>
|
||||
</span>
|
||||
@ -159,7 +163,7 @@
|
||||
<div class="grid">
|
||||
<div class="col-12">
|
||||
|
||||
<h6>ASIC Temperature
|
||||
<h6>ASIC Temperature
|
||||
<span style="float: right;">
|
||||
<ng-template #noTemp>--</ng-template>
|
||||
<ng-container *ngIf="info.temp > 0; else noTemp">
|
||||
|
@ -44,5 +44,6 @@ export interface ISystemInfo {
|
||||
|
||||
boardtemp1?: number,
|
||||
boardtemp2?: number,
|
||||
overheat_mode: number
|
||||
overheat_mode: number,
|
||||
tps_error?: string
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nvs_config.h"
|
||||
#include "vcore.h"
|
||||
#include "connect.h"
|
||||
#include "../power/TPS546.h"
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
@ -585,6 +586,11 @@ static esp_err_t GET_system_info(httpd_req_t * req)
|
||||
|
||||
cJSON_AddNumberToObject(root, "fanspeed", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_perc);
|
||||
cJSON_AddNumberToObject(root, "fanrpm", GLOBAL_STATE->POWER_MANAGEMENT_MODULE.fan_rpm);
|
||||
|
||||
const char* tps_error = TPS546_get_error_message();
|
||||
if (tps_error != NULL) {
|
||||
cJSON_AddStringToObject(root, "tps_error", tps_error);
|
||||
}
|
||||
|
||||
free(ssid);
|
||||
free(hostname);
|
||||
|
@ -764,8 +764,19 @@ uint16_t TPS546_check_status(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Global variable to store the TPS error message for the UI
|
||||
static char tps_error_message[128] = {0};
|
||||
|
||||
const char* TPS546_get_error_message() {
|
||||
return tps_error_message;
|
||||
}
|
||||
|
||||
|
||||
static esp_err_t TPS546_parse_status(uint16_t status) {
|
||||
uint8_t u8_value;
|
||||
|
||||
// Clear previous error message
|
||||
tps_error_message[0] = '\0';
|
||||
|
||||
if (status & TPS546_STATUS_BUSY) {
|
||||
ESP_LOGI(TAG, "TPS546 is busy");
|
||||
@ -774,22 +785,27 @@ static esp_err_t TPS546_parse_status(uint16_t status) {
|
||||
|
||||
if (status & TPS546_STATUS_OFF) {
|
||||
ESP_LOGI(TAG, "TPS546 is off");
|
||||
strcat(tps_error_message, "TPS546 is off. ");
|
||||
}
|
||||
|
||||
if (status & TPS546_STATUS_VOUT_OV) {
|
||||
ESP_LOGI(TAG, "TPS546 VOUT is out of range");
|
||||
strcat(tps_error_message, "VOUT is out of range. ");
|
||||
}
|
||||
|
||||
if (status & TPS546_STATUS_IOUT_OC) {
|
||||
ESP_LOGI(TAG, "TPS546 IOUT is out of range");
|
||||
strcat(tps_error_message, "IOUT is out of range. ");
|
||||
}
|
||||
|
||||
if (status & TPS546_STATUS_VIN_UV) {
|
||||
ESP_LOGI(TAG, "TPS546 VIN is out of range");
|
||||
strcat(tps_error_message, "VIN is out of range. ");
|
||||
}
|
||||
|
||||
if (status & TPS546_STATUS_TEMP) {
|
||||
ESP_LOGI(TAG, "TPS546 TEMP Status Error");
|
||||
strcat(tps_error_message, "Temperature error. ");
|
||||
//the host should check STATUS_TEMPERATURE for more information.
|
||||
if (smb_read_byte(PMBUS_STATUS_TEMPERATURE, &u8_value) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Could not read STATUS_TEMPERATURE");
|
||||
@ -800,6 +816,7 @@ static esp_err_t TPS546_parse_status(uint16_t status) {
|
||||
|
||||
if (status & TPS546_STATUS_CML) {
|
||||
ESP_LOGI(TAG, "TPS546 CML Status Error");
|
||||
strcat(tps_error_message, "Communication error. ");
|
||||
//the host should check STATUS_CML for more information.
|
||||
if (smb_read_byte(PMBUS_STATUS_CML, &u8_value) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Could not read STATUS_CML");
|
||||
@ -1012,4 +1029,3 @@ esp_err_t TPS546_init_fault_interrupt(void * isr_handler, void * global_state) {
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -147,4 +147,6 @@ void TPS546_print_status(void);
|
||||
uint16_t TPS546_check_status(void);
|
||||
esp_err_t TPS546_clear_faults(void);
|
||||
|
||||
const char* TPS546_get_error_message(void); //Get the current TPS error message
|
||||
|
||||
#endif /* TPS546_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user