mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-04-07 14:43:54 +08:00
Merge branch 'comma-master-20240407' into sync-20250407
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