1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

prevent divide by zero

This commit is contained in:
Thorsten Laux 2019-01-07 15:52:57 +01:00
parent ad253c146b
commit 998845be3e

View file

@ -607,8 +607,10 @@ void pidInitConfig(const pidProfile_t *pidProfile)
#ifdef USE_THRUST_LINEARIZATION
thrustLinearization = pidProfile->thrustLinearization / 100.0f;
thrustLinearizationReciprocal = 1.0f / thrustLinearization;
thrustLinearizationB = (1.0f - thrustLinearization) / (2.0f * thrustLinearization);
if (thrustLinearization != 0.0f) {
thrustLinearizationReciprocal = 1.0f / thrustLinearization;
thrustLinearizationB = (1.0f - thrustLinearization) / (2.0f * thrustLinearization);
}
#endif
}