mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
Merge pull request #9647 from etracer65/mixer_crashflip_div0
Fix division by zero in mixer crashflip
This commit is contained in:
commit
5f8fc1e6f9
1 changed files with 1 additions and 1 deletions
|
@ -699,7 +699,7 @@ static void applyFlipOverAfterCrashModeToMotors(void)
|
||||||
signYaw = 0;
|
signYaw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float cosPhi = (stickDeflectionPitchAbs + stickDeflectionRollAbs) / (sqrtf(2.0f) * stickDeflectionLength);
|
const float cosPhi = (stickDeflectionLength > 0) ? (stickDeflectionPitchAbs + stickDeflectionRollAbs) / (sqrtf(2.0f) * stickDeflectionLength) : 0;
|
||||||
const float cosThreshold = sqrtf(3.0f)/2.0f; // cos(PI/6.0f)
|
const float cosThreshold = sqrtf(3.0f)/2.0f; // cos(PI/6.0f)
|
||||||
|
|
||||||
if (cosPhi < cosThreshold) {
|
if (cosPhi < cosThreshold) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue