From fcf0559d2f74f055e8c8a11a9d39d0578ed07cd8 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Fri, 23 Sep 2016 12:56:06 +1200 Subject: [PATCH] Cleaned up LED_STRIP indicator blink frequency calculation. --- src/main/io/ledstrip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index 061fb4579d..3ce7f5b4b7 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -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 {