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:
parent
7205520dc2
commit
fcf0559d2f
1 changed files with 2 additions and 2 deletions
|
@ -674,8 +674,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