Removed magic number

This commit is contained in:
Martin Budden 2017-08-25 08:36:29 +01:00
parent 879778aeef
commit c086772e0b
1 changed files with 2 additions and 1 deletions

View File

@ -415,7 +415,8 @@ 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 (gyroRate > 1990.0f || gyroRate < -1990.0f) { #define GYRO_POTENTIAL_OVERFLOW_RATE 1990.0f
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.
// This can cause an overflow and sign reversal in the output. // This can cause an overflow and sign reversal in the output.
// Overflow and sign reversal seems to result in a gyro value of +1996 or -1996. // Overflow and sign reversal seems to result in a gyro value of +1996 or -1996.