mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Fixed - reset all PID controller terms when PASSTHRU_MODE is active (#14058)
* [wing] reset all PID controller terms when PASSTHRU_MODE is active * Update src/main/flight/pid.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/flight/pid.c Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Update src/main/flight/pid.c Co-authored-by: Mark Haslinghuis <mark@numloq.nl> --------- Co-authored-by: Petr Ledvina <ledvinap@gmail.com> Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
This commit is contained in:
parent
f6985a8bfa
commit
60d35fa886
1 changed files with 11 additions and 1 deletions
|
@ -1475,9 +1475,19 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_WING
|
||||||
|
// When PASSTHRU_MODE is active - reset all PIDs to zero so the aircraft won't snap out of control
|
||||||
|
// because of accumulated PIDs once PASSTHRU_MODE gets disabled.
|
||||||
|
bool isFixedWingAndPassthru = isFixedWing() && FLIGHT_MODE(PASSTHRU_MODE);
|
||||||
|
#endif // USE_WING
|
||||||
// Disable PID control if at zero throttle or if gyro overflow detected
|
// Disable PID control if at zero throttle or if gyro overflow detected
|
||||||
// This may look very innefficient, but it is done on purpose to always show real CPU usage as in flight
|
// This may look very innefficient, but it is done on purpose to always show real CPU usage as in flight
|
||||||
if (!pidRuntime.pidStabilisationEnabled || gyroOverflowDetected()) {
|
if (!pidRuntime.pidStabilisationEnabled
|
||||||
|
|| gyroOverflowDetected()
|
||||||
|
#ifdef USE_WING
|
||||||
|
|| isFixedWingAndPassthru
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
for (int axis = FD_ROLL; axis <= FD_YAW; ++axis) {
|
for (int axis = FD_ROLL; axis <= FD_YAW; ++axis) {
|
||||||
pidData[axis].P = 0;
|
pidData[axis].P = 0;
|
||||||
pidData[axis].I = 0;
|
pidData[axis].I = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue