1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

Thrust linear code optimisations (#12720)

remove conditions on thrust linear calculation
This commit is contained in:
ctzsnooze 2023-05-25 05:36:00 +10:00 committed by GitHub
parent f4e8b421c2
commit 23a416b431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -324,12 +324,7 @@ float pidCompensateThrustLinearization(float throttle)
float pidApplyThrustLinearization(float motorOutput) float pidApplyThrustLinearization(float motorOutput)
{ {
if (pidRuntime.thrustLinearization != 0.0f) { motorOutput *= 1.0f + pidRuntime.thrustLinearization * sq(1.0f - motorOutput);
if (motorOutput > 0.0f) {
const float motorOutputReversed = (1.0f - motorOutput);
motorOutput *= 1.0f + sq(motorOutputReversed) * pidRuntime.thrustLinearization;
}
}
return motorOutput; return motorOutput;
} }
#endif #endif