Sync: commaai/panda:master into sunnypilot/panda:master-new

This commit is contained in:
Jason Wen
2025-04-07 21:03:12 -04:00
committed by GitHub

View File

@@ -19,7 +19,7 @@ void fan_init(void) {
// Call this at FAN_TICK_FREQ
void fan_tick(void) {
const float FAN_I = 0.001f;
const float FAN_I = 6.5f;
const uint8_t FAN_STALL_THRESHOLD_MAX = 8U;
if (current_board->fan_max_rpm > 0U) {
@@ -74,7 +74,7 @@ void fan_tick(void) {
if (fan_state.target_rpm == 0U) {
fan_state.error_integral = 0.0f;
} else {
float error = fan_state.target_rpm - fan_rpm_fast;
float error = (fan_state.target_rpm - fan_rpm_fast) / ((float) current_board->fan_max_rpm);
fan_state.error_integral += FAN_I * error;
}
fan_state.error_integral = CLAMP(fan_state.error_integral, 0U, current_board->fan_max_pwm);