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:
parent
a2c6264d55
commit
41fb37a264
6 changed files with 111 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue