mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 06:45:16 +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:
commit
1d6240c9d5
1 changed files with 2 additions and 2 deletions
|
@ -675,8 +675,8 @@ static void applyLedIndicatorLayer(bool updateNow, uint32_t *timer)
|
||||||
if (rxIsReceivingSignal()) {
|
if (rxIsReceivingSignal()) {
|
||||||
// calculate update frequency
|
// calculate update frequency
|
||||||
int scale = MAX(ABS(rcCommand[ROLL]), ABS(rcCommand[PITCH])); // 0 - 500
|
int scale = MAX(ABS(rcCommand[ROLL]), ABS(rcCommand[PITCH])); // 0 - 500
|
||||||
scale += (50 - INDICATOR_DEADBAND); // start increasing frequency right after deadband
|
scale = scale - INDICATOR_DEADBAND; // start increasing frequency right after deadband
|
||||||
*timer += LED_STRIP_HZ(5) * 50 / MAX(50, scale); // 5 - 50Hz update, 2.5 - 25Hz blink
|
*timer += LED_STRIP_HZ(5 + (45 * scale) / (500 - INDICATOR_DEADBAND)); // 5 - 50Hz update, 2.5 - 25Hz blink
|
||||||
|
|
||||||
flash = !flash;
|
flash = !flash;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue