mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
address style requests
This commit is contained in:
parent
e1ff2566c6
commit
0086932946
1 changed files with 5 additions and 3 deletions
|
@ -607,7 +607,7 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
|
||||||
currentPidSetpoint = 0.0f;
|
currentPidSetpoint = 0.0f;
|
||||||
}
|
}
|
||||||
#endif // USE_YAW_SPIN_RECOVERY
|
#endif // USE_YAW_SPIN_RECOVERY
|
||||||
|
|
||||||
// -----calculate error rate
|
// -----calculate error rate
|
||||||
const float gyroRate = gyro.gyroADCf[axis]; // Process variable from gyro output in deg/sec
|
const float gyroRate = gyro.gyroADCf[axis]; // Process variable from gyro output in deg/sec
|
||||||
float errorRate = currentPidSetpoint - gyroRate; // r - y
|
float errorRate = currentPidSetpoint - gyroRate; // r - y
|
||||||
|
@ -635,10 +635,12 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, const rollAndPitchT
|
||||||
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;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue