1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Clean code for yaw spin recovery

This commit is contained in:
ctzsnooze 2018-04-22 22:45:29 +10:00 committed by Michael Keller
parent a2c6264d55
commit 41fb37a264
6 changed files with 111 additions and 7 deletions

View file

@ -59,6 +59,8 @@
#include "sensors/battery.h"
#include "sensors/gyro.h"
PG_REGISTER_WITH_RESET_TEMPLATE(mixerConfig_t, mixerConfig, PG_MIXER_CONFIG, 0);
#ifndef TARGET_DEFAULT_MIXER
@ -763,6 +765,14 @@ NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensation)
throttle = applyThrottleLimit(throttle);
}
// Handle yaw spin recovery - throttle is set to zero to prevent flyaway
// and to give the mixer full authority to stop the spin
#ifdef USE_YAW_SPIN_RECOVERY
if (gyroYawSpinDetected()) {
throttle = 0.0f;
}
#endif // USE_YAW_SPIN_RECOVERY
// Find roll/pitch/yaw desired output
float motorMix[MAX_SUPPORTED_MOTORS];
float motorMixMax = 0, motorMixMin = 0;