1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Fix divide by zero error which resulted in way too many LED updates

being sent.

This was the root cause of the loop time increase that was seen.
This commit is contained in:
Dominic Clifton 2014-06-08 15:20:43 +01:00
parent 57cfac24ec
commit 0e59bc7b02

View file

@ -509,7 +509,8 @@ void updateLedStrip(void)
uint8_t rollScale = abs(rcCommand[ROLL]) / 50;
uint8_t pitchScale = abs(rcCommand[PITCH]) / 50;
nextIndicatorFlashAt = now + (LED_STRIP_5HZ / max(rollScale, pitchScale));
uint8_t scale = max(rollScale, pitchScale);
nextIndicatorFlashAt = now + (LED_STRIP_5HZ / max(1, scale));
if (indicatorFlashState == 0) {
indicatorFlashState = 1;