Skip to content

Commit 2d913f8

Browse files
committed
Small changes after rebase and review marks
1 parent eaa1603 commit 2d913f8

File tree

5 files changed

+45
-47
lines changed

5 files changed

+45
-47
lines changed

main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SRCS
3333
"./power/INA260.c"
3434
"./power/power.c"
3535
"./power/vcore.c"
36-
"mining_controller.c" # Added mining controller
36+
"mining_controller.c"
3737

3838
INCLUDE_DIRS
3939
"."

main/global_state.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ typedef struct
111111
bool ASIC_initalized;
112112
bool psram_is_available;
113113

114-
// New fields for mining state and task handles
115114
bool mining_enabled;
116115
TaskHandle_t power_management_task_handle;
117116
TaskHandle_t stratum_task_handle;

main/http_server/axe-os/src/app/layout/app.menu.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
<li id="restart-container">
99
<p-button (click)="restart()" id="restart" label="Restart" severity="primary"></p-button>
1010
</li>
11+
1112
</ul>

main/http_server/axe-os/src/app/services/system.service.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,12 @@ export class SystemService {
7272
statsLimit: 360,
7373
statsDuration: 2,
7474
fanrpm: 0,
75-
76-
boardtemp1: 30,
77-
boardtemp2: 40,
78-
overheat_mode: 0,
79-
miningEnabled: true
80-
}
81-
).pipe(delay(1000));
82-
}
75+
boardtemp1: 30,
76+
boardtemp2: 40,
77+
overheat_mode: 0,
78+
miningEnabled: true
79+
}
80+
).pipe(delay(1000));
8381
}
8482

8583
public getStatistics(uri: string = ''): Observable<ISystemStatistics> {

main/tasks/power_management_task.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -96,46 +96,46 @@ void POWER_MANAGEMENT_task(void * pvParameters)
9696
// goto looper; // This goto is problematic, consider refactoring if used
9797
// }
9898

99-
//overheat mode if the voltage regulator or ASIC is too hot
100-
if ((power_management->vr_temp > TPS546_THROTTLE_TEMP || power_management->chip_temp_avg > THROTTLE_TEMP) && (power_management->frequency_value > 50 || power_management->voltage > 1000)) {
101-
ESP_LOGE(TAG, "OVERHEAT! VR: %fC ASIC %fC", power_management->vr_temp, power_management->chip_temp_avg );
102-
power_management->fan_perc = 100;
103-
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, 1);
104-
105-
// Turn off core voltage
106-
VCORE_set_voltage(0.0f, GLOBAL_STATE);
107-
108-
nvs_config_set_u16(NVS_CONFIG_ASIC_VOLTAGE, 1000);
109-
nvs_config_set_u16(NVS_CONFIG_ASIC_FREQ, 50);
110-
nvs_config_set_u16(NVS_CONFIG_FAN_SPEED, 100);
111-
nvs_config_set_u16(NVS_CONFIG_AUTO_FAN_SPEED, 0);
112-
nvs_config_set_u16(NVS_CONFIG_OVERHEAT_MODE, 1);
113-
exit(EXIT_FAILURE);
114-
}
115-
//enable the PID auto control for the FAN if set
116-
if (nvs_config_get_u16(NVS_CONFIG_AUTO_FAN_SPEED, 1) == 1) {
117-
// Ignore invalid temperature readings (-1) during startup
118-
if (power_management->chip_temp_avg >= 0) {
119-
pid_input = power_management->chip_temp_avg;
120-
pid_compute(&pid);
121-
power_management->fan_perc = (uint16_t) pid_output;
122-
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, pid_output / 100.0);
123-
ESP_LOGI(TAG, "Temp: %.1f°C, SetPoint: %.1f°C, Output: %.1f%%", pid_input, pid_setPoint, pid_output);
124-
} else {
125-
// Set fan to 70% in AP mode when temperature reading is invalid
126-
if (GLOBAL_STATE->SYSTEM_MODULE.ap_enabled) {
127-
ESP_LOGW(TAG, "AP mode with invalid temperature reading: %.1f°C - Setting fan to 70%%", power_management->chip_temp_avg);
128-
power_management->fan_perc = 70;
129-
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, 0.7);
99+
//overheat mode if the voltage regulator or ASIC is too hot
100+
if ((power_management->vr_temp > TPS546_THROTTLE_TEMP || power_management->chip_temp_avg > THROTTLE_TEMP) && (power_management->frequency_value > 50 || power_management->voltage > 1000)) {
101+
ESP_LOGE(TAG, "OVERHEAT! VR: %fC ASIC %fC", power_management->vr_temp, power_management->chip_temp_avg );
102+
power_management->fan_perc = 100;
103+
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, 1);
104+
105+
// Turn off core voltage
106+
VCORE_set_voltage(0.0f, GLOBAL_STATE);
107+
108+
nvs_config_set_u16(NVS_CONFIG_ASIC_VOLTAGE, 1000);
109+
nvs_config_set_u16(NVS_CONFIG_ASIC_FREQ, 50);
110+
nvs_config_set_u16(NVS_CONFIG_FAN_SPEED, 100);
111+
nvs_config_set_u16(NVS_CONFIG_AUTO_FAN_SPEED, 0);
112+
nvs_config_set_u16(NVS_CONFIG_OVERHEAT_MODE, 1);
113+
exit(EXIT_FAILURE);
114+
}
115+
//enable the PID auto control for the FAN if set
116+
if (nvs_config_get_u16(NVS_CONFIG_AUTO_FAN_SPEED, 1) == 1) {
117+
// Ignore invalid temperature readings (-1) during startup
118+
if (power_management->chip_temp_avg >= 0) {
119+
pid_input = power_management->chip_temp_avg;
120+
pid_compute(&pid);
121+
power_management->fan_perc = (uint16_t) pid_output;
122+
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, pid_output / 100.0);
123+
ESP_LOGI(TAG, "Temp: %.1f°C, SetPoint: %.1f°C, Output: %.1f%%", pid_input, pid_setPoint, pid_output);
130124
} else {
131-
ESP_LOGW(TAG, "Ignoring invalid temperature reading: %.1f°C", power_management->chip_temp_avg);
125+
// Set fan to 70% in AP mode when temperature reading is invalid
126+
if (GLOBAL_STATE->SYSTEM_MODULE.ap_enabled) {
127+
ESP_LOGW(TAG, "AP mode with invalid temperature reading: %.1f°C - Setting fan to 70%%", power_management->chip_temp_avg);
128+
power_management->fan_perc = 70;
129+
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, 0.7);
130+
} else {
131+
ESP_LOGW(TAG, "Ignoring invalid temperature reading: %.1f°C", power_management->chip_temp_avg);
132+
}
132133
}
134+
} else {
135+
float fs = (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100);
136+
power_management->fan_perc = fs;
137+
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, (float) fs / 100.0);
133138
}
134-
} else {
135-
float fs = (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100);
136-
power_management->fan_perc = fs;
137-
Thermal_set_fan_percent(GLOBAL_STATE->DEVICE_CONFIG, (float) fs / 100.0);
138-
}
139139

140140
// Read the state of plug sense pin
141141
// if (power_management->HAS_PLUG_SENSE) {

0 commit comments

Comments
 (0)