1
0
Fork 0
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:
Kevin Plaizier 2022-10-06 18:15:42 -06:00 committed by GitHub
parent 7ba88137e7
commit a2a5f596fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {