mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
incorporate style feedback
This commit is contained in:
parent
0086932946
commit
5a1d84cdae
1 changed files with 5 additions and 5 deletions
|
@ -629,20 +629,20 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
|
||||||
// -----calculate I component
|
// -----calculate I component
|
||||||
float itermErrorRate;
|
float itermErrorRate;
|
||||||
if (itermRelax) {
|
if (itermRelax) {
|
||||||
const float gyroTargetHigh = pt1FilterApply(&windupLpf[axis][0], currentPidSetpoint);
|
const float gyroTargetLow = pt1FilterApply(&windupLpf[axis][0], currentPidSetpoint);
|
||||||
const float gyroTargetLow = pt1FilterApply(&windupLpf[axis][1], currentPidSetpoint);
|
const float gyroTargetHigh = pt1FilterApply(&windupLpf[axis][1], currentPidSetpoint);
|
||||||
DEBUG_SET(DEBUG_ITERM_RELAX, 0, gyroTargetHigh);
|
DEBUG_SET(DEBUG_ITERM_RELAX, 0, gyroTargetHigh);
|
||||||
DEBUG_SET(DEBUG_ITERM_RELAX, 1, gyroTargetLow);
|
DEBUG_SET(DEBUG_ITERM_RELAX, 1, gyroTargetLow);
|
||||||
const float gmax = MAX(gyroTargetHigh, gyroTargetLow);
|
const float gmax = MAX(gyroTargetHigh, gyroTargetLow);
|
||||||
const float gmin = MIN(gyroTargetHigh, gyroTargetLow);
|
const float gmin = MIN(gyroTargetHigh, gyroTargetLow);
|
||||||
if (gyroRate >= gmin && gyroRate <= gmax) {
|
if (gyroRate >= gmin && gyroRate <= gmax) {
|
||||||
itermErrorRate = 0.0f;
|
itermErrorRate = 0.0f;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
itermErrorRate = (gyroRate > gmax ? gmax : gmin ) - gyroRate;
|
itermErrorRate = (gyroRate > gmax ? gmax : gmin ) - gyroRate;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
itermErrorRate = errorRate;
|
||||||
}
|
}
|
||||||
else itermErrorRate = errorRate;
|
|
||||||
|
|
||||||
const float ITerm = pidData[axis].I;
|
const float ITerm = pidData[axis].I;
|
||||||
const float ITermNew = constrainf(ITerm + pidCoefficient[axis].Ki * itermErrorRate * dynCi, -itermLimit, itermLimit);
|
const float ITermNew = constrainf(ITerm + pidCoefficient[axis].Ki * itermErrorRate * dynCi, -itermLimit, itermLimit);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue