mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Configurable saturation limit for Airmode
This commit is contained in:
parent
8b85c57723
commit
9b826f4373
4 changed files with 9 additions and 8 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "debug.h"
|
||||
|
@ -814,12 +815,12 @@ void mixTable(void)
|
|||
|
||||
if (rollPitchYawMixRange > throttleRange) {
|
||||
motorLimitReached = true;
|
||||
float mixReduction = (float) throttleRange / rollPitchYawMixRange;
|
||||
for (i = 0; i < motorCount; i++) {
|
||||
rollPitchYawMix[i] = (rollPitchYawMix[i] * throttleRange) / rollPitchYawMixRange;
|
||||
|
||||
// Get the max correction from center when agressivity enabled. (Some setups don't like this option)
|
||||
if (mixerConfig->agressive_airmode) throttleMin = throttleMax = throttleMin + (throttleRange / 2);
|
||||
rollPitchYawMix[i] = lrintf((float) rollPitchYawMix[i] * mixReduction);
|
||||
}
|
||||
// Get the maximum correction by setting offset to center. Only active below 50% of saturation levels to reduce spazzing out in crashes
|
||||
if (mixReduction > (mixerConfig->airmode_saturation_limit / 100.0f)) throttleMin = throttleMax = throttleMin + (throttleRange / 2);
|
||||
} else {
|
||||
motorLimitReached = false;
|
||||
throttleMin = throttleMin + (rollPitchYawMixRange / 2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue