diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 96f884a27..5ca8a804d 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -170,7 +170,7 @@ void resetPidProfile(pidProfile_t *pidProfile) .iterm_rotation = false, .smart_feedforward = false, .iterm_relax = ITERM_RELAX_RP, - .iterm_relax_cutoff = 20, + .iterm_relax_cutoff = ITERM_RELAX_CUTOFF_DEFAULT, .iterm_relax_type = ITERM_RELAX_SETPOINT, .acro_trainer_angle_limit = 20, .acro_trainer_lookahead_ms = 50, @@ -574,8 +574,9 @@ void pidInitConfig(const pidProfile_t *pidProfile) pidCoefficient[axis].Kf = FEEDFORWARD_SCALE * (pidProfile->pid[axis].F / 100.0f); } #ifdef USE_INTEGRATED_YAW_CONTROL - if (!pidProfile->use_integrated_yaw) { -#endif + if (!pidProfile->use_integrated_yaw) +#endif + { pidCoefficient[FD_YAW].Ki *= 2.5f; } diff --git a/src/test/unit/pid_unittest.cc b/src/test/unit/pid_unittest.cc index 796046b8b..1a3035c3f 100644 --- a/src/test/unit/pid_unittest.cc +++ b/src/test/unit/pid_unittest.cc @@ -94,6 +94,9 @@ void setDefaultTestSettings(void) { pidProfile->pid[PID_YAW] = { 70, 45, 20, 60 }; pidProfile->pid[PID_LEVEL] = { 50, 50, 75, 0 }; + // Compensate for the upscaling done without 'use_integrated_yaw' + pidProfile->pid[PID_YAW].I = pidProfile->pid[PID_YAW].I / 2.5f; + pidProfile->pidSumLimit = PIDSUM_LIMIT; pidProfile->pidSumLimitYaw = PIDSUM_LIMIT_YAW; pidProfile->yaw_lowpass_hz = 0;