mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 04:45:24 +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);
|
||||
}
|
||||
|
||||
// correct throttle so it won't clip any outputs
|
||||
if (minMotor + throttle < 0.0f) {
|
||||
throttle = -minMotor;
|
||||
} else if (maxMotor + throttle > 1.0f) {
|
||||
throttle = 1.0f - maxMotor;
|
||||
}
|
||||
// constrain throttle so it won't clip any outputs
|
||||
throttle = constrainf(throttle, -minMotor, 1.0f - maxMotor);
|
||||
}
|
||||
|
||||
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