mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
use constrainf instead of nexted else statement
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
This commit is contained in:
parent
7ba88137e7
commit
a2a5f596fb
1 changed files with 2 additions and 6 deletions
|
@ -454,12 +454,8 @@ static void applyMixerAdjustmentLinear(float *motorMix, const bool airmodeEnable
|
||||||
minMotor = MIN(motorMix[i], minMotor);
|
minMotor = MIN(motorMix[i], minMotor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct throttle so it won't clip any outputs
|
// constrain throttle so it won't clip any outputs
|
||||||
if (minMotor + throttle < 0.0f) {
|
throttle = constrainf(throttle, -minMotor, 1.0f - maxMotor);
|
||||||
throttle = -minMotor;
|
|
||||||
} else if (maxMotor + throttle > 1.0f) {
|
|
||||||
throttle = 1.0f - maxMotor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyMixerAdjustment(float *motorMix, const float motorMixMin, const float motorMixMax, const bool airmodeEnabled) {
|
static void applyMixerAdjustment(float *motorMix, const float motorMixMin, const float motorMixMax, const bool airmodeEnabled) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue