mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Merge pull request #7866 from joelucid/fix_abs_control
fix abs control #7863
This commit is contained in:
commit
8984a7195f
1 changed files with 5 additions and 4 deletions
|
@ -1335,12 +1335,13 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
||||||
¤tPidSetpoint, &errorRate);
|
¤tPidSetpoint, &errorRate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const float iterm = pidData[axis].I;
|
const float previousIterm = pidData[axis].I;
|
||||||
float itermErrorRate = errorRate;
|
float itermErrorRate = errorRate;
|
||||||
|
|
||||||
#if defined(USE_ITERM_RELAX)
|
#if defined(USE_ITERM_RELAX)
|
||||||
if (!launchControlActive) {
|
if (!launchControlActive && !inCrashRecoveryMode) {
|
||||||
applyItermRelax(axis, iterm, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
applyItermRelax(axis, previousIterm, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
||||||
|
errorRate = currentPidSetpoint - gyroRate;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1361,7 +1362,7 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
||||||
#else
|
#else
|
||||||
const float Ki = pidCoefficient[axis].Ki;
|
const float Ki = pidCoefficient[axis].Ki;
|
||||||
#endif
|
#endif
|
||||||
pidData[axis].I = constrainf(iterm + Ki * itermErrorRate * dynCi, -itermLimit, itermLimit);
|
pidData[axis].I = constrainf(previousIterm + Ki * itermErrorRate * dynCi, -itermLimit, itermLimit);
|
||||||
|
|
||||||
// -----calculate pidSetpointDelta
|
// -----calculate pidSetpointDelta
|
||||||
float pidSetpointDelta = 0;
|
float pidSetpointDelta = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue