mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Reset ITerm after crash
This commit is contained in:
parent
d031b038eb
commit
3bae1e78e2
1 changed files with 3 additions and 0 deletions
|
@ -422,6 +422,9 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
||||||
errorRate = currentPidSetpoint - gyroRate;
|
errorRate = currentPidSetpoint - gyroRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// reset ITerm, since accumulated error before crash is now meaningless
|
||||||
|
// and ITerm windup during crash recovery can be extreme, especially on yaw axis
|
||||||
|
axisPID_I[axis] = 0.0f;
|
||||||
if (cmpTimeUs(currentTimeUs, crashDetectedAtUs) > crashTimeLimitUs
|
if (cmpTimeUs(currentTimeUs, crashDetectedAtUs) > crashTimeLimitUs
|
||||||
|| (motorMixRange < 1.0f
|
|| (motorMixRange < 1.0f
|
||||||
&& ABS(gyro.gyroADCf[FD_ROLL]) < crashRecoveryRate
|
&& ABS(gyro.gyroADCf[FD_ROLL]) < crashRecoveryRate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue