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

Merge pull request #1208 from mikeller/cleanup_ledstrip_blink_frequency

Cleaned up LED_STRIP indicator blink frequency calculation.
This commit is contained in:
Martin Budden 2016-10-15 13:24:41 +01:00 committed by GitHub
commit 1d6240c9d5

View file

@ -675,8 +675,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 {