1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 15:25:36 +03:00

Cleaned up LED_STRIP indicator blink frequency calculation.

This commit is contained in:
Michael Keller 2016-09-23 12:56:06 +12:00
parent 7205520dc2
commit fcf0559d2f

View file

@ -674,8 +674,8 @@ static void applyLedIndicatorLayer(bool updateNow, uint32_t *timer)
if (rxIsReceivingSignal()) {
// calculate update frequency
int scale = MAX(ABS(rcCommand[ROLL]), ABS(rcCommand[PITCH])); // 0 - 500
scale += (50 - INDICATOR_DEADBAND); // start increasing frequency right after deadband
*timer += LED_STRIP_HZ(5) * 50 / MAX(50, scale); // 5 - 50Hz update, 2.5 - 25Hz blink
scale = scale - INDICATOR_DEADBAND; // start increasing frequency right after deadband
*timer += LED_STRIP_HZ(5 + (45 * scale) / (500 - INDICATOR_DEADBAND)); // 5 - 50Hz update, 2.5 - 25Hz blink
flash = !flash;
} else {