Skip to content

Commit 0e03517

Browse files
WantCluemutatrum
authored andcommitted
hotfix fan controller, increase minimum and add ap mode fan speed (#896)
1 parent e09e1e8 commit 0e03517

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

main/tasks/power_management_task.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
4848
pid_setPoint = (double)nvs_config_get_u16(NVS_CONFIG_TEMP_TARGET, pid_setPoint);
4949
pid_init(&pid, &pid_input, &pid_output, &pid_setPoint, pid_p, pid_i, pid_d, PID_P_ON_E, PID_DIRECT);
5050
pid_set_sample_time(&pid, POLL_RATE - 1);
51-
pid_set_output_limits(&pid, 15, 100);
51+
pid_set_output_limits(&pid, 25, 100);
5252
pid_set_mode(&pid, AUTOMATIC);
5353
pid_set_controller_direction(&pid, PID_REVERSE);
5454
pid_initialize(&pid);
@@ -110,9 +110,15 @@ void POWER_MANAGEMENT_task(void * pvParameters)
110110
Thermal_set_fan_percent(GLOBAL_STATE->device_model, pid_output / 100.0);
111111
ESP_LOGI(TAG, "Temp: %.1f°C, SetPoint: %.1f°C, Output: %.1f%%", pid_input, pid_setPoint, pid_output);
112112
} else {
113-
ESP_LOGW(TAG, "Ignoring invalid temperature reading: %.1f°C", power_management->chip_temp_avg);
113+
// Set fan to 70% in AP mode when temperature reading is invalid
114+
if (GLOBAL_STATE->SYSTEM_MODULE.ap_enabled) {
115+
ESP_LOGW(TAG, "AP mode with invalid temperature reading: %.1f°C - Setting fan to 70%%", power_management->chip_temp_avg);
116+
power_management->fan_perc = 70;
117+
Thermal_set_fan_percent(GLOBAL_STATE->device_model, 0.7);
118+
} else {
119+
ESP_LOGW(TAG, "Ignoring invalid temperature reading: %.1f°C", power_management->chip_temp_avg);
120+
}
114121
}
115-
116122
} else {
117123
float fs = (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100);
118124
power_management->fan_perc = fs;

0 commit comments

Comments
 (0)