mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Thrust linear code optimisations (#12720)
remove conditions on thrust linear calculation
This commit is contained in:
parent
f4e8b421c2
commit
23a416b431
1 changed files with 1 additions and 6 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue