mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Exclude MPU6000 gyro from yaw overflow handling
This commit is contained in:
parent
dc58e526d4
commit
7fd3b143ca
1 changed files with 4 additions and 1 deletions
|
@ -415,6 +415,7 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
||||||
}
|
}
|
||||||
if (axis == FD_YAW) {
|
if (axis == FD_YAW) {
|
||||||
// on yaw axis, prevent "yaw spin to the moon" after crash by constraining errorRate
|
// on yaw axis, prevent "yaw spin to the moon" after crash by constraining errorRate
|
||||||
|
#if !(defined(USE_GYRO_SPI_MPU6000) || defined(USE_GYRO_SPI_ICM20649))
|
||||||
#define GYRO_POTENTIAL_OVERFLOW_RATE 1990.0f
|
#define GYRO_POTENTIAL_OVERFLOW_RATE 1990.0f
|
||||||
if (gyroRate > GYRO_POTENTIAL_OVERFLOW_RATE || gyroRate < -GYRO_POTENTIAL_OVERFLOW_RATE) {
|
if (gyroRate > GYRO_POTENTIAL_OVERFLOW_RATE || gyroRate < -GYRO_POTENTIAL_OVERFLOW_RATE) {
|
||||||
// ICM gyros are specified to +/- 2000 deg/sec, in a crash they can go out of spec.
|
// ICM gyros are specified to +/- 2000 deg/sec, in a crash they can go out of spec.
|
||||||
|
@ -423,7 +424,9 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
||||||
// If there is a sign reversal we will actually increase crash-induced yaw spin
|
// If there is a sign reversal we will actually increase crash-induced yaw spin
|
||||||
// so best thing to do is set error to zero.
|
// so best thing to do is set error to zero.
|
||||||
errorRate = 0.0f;
|
errorRate = 0.0f;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
errorRate = constrainf(errorRate, -crashLimitYaw, crashLimitYaw);
|
errorRate = constrainf(errorRate, -crashLimitYaw, crashLimitYaw);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue