mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
Sync: commaai/panda:master into sunnypilot/panda:master-new
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user