From 23a416b43192ff4a562c78d5e12b11578c13dcba Mon Sep 17 00:00:00 2001 From: ctzsnooze Date: Thu, 25 May 2023 05:36:00 +1000 Subject: [PATCH] Thrust linear code optimisations (#12720) remove conditions on thrust linear calculation --- src/main/flight/pid.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 8189d019cf..270cdd9255 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -324,12 +324,7 @@ float pidCompensateThrustLinearization(float throttle) float pidApplyThrustLinearization(float motorOutput) { - if (pidRuntime.thrustLinearization != 0.0f) { - if (motorOutput > 0.0f) { - const float motorOutputReversed = (1.0f - motorOutput); - motorOutput *= 1.0f + sq(motorOutputReversed) * pidRuntime.thrustLinearization; - } - } + motorOutput *= 1.0f + pidRuntime.thrustLinearization * sq(1.0f - motorOutput); return motorOutput; } #endif