Make heartbeat LED play nice with other LEDs (#10423)
This commit is contained in:
co-authored by
GitHub
parent
a8a785bbb7
commit
5512185cfe
@@ -95,20 +95,9 @@ int32_t StatusLEDModule::runOnce()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (power_state != charging && power_state != charged && !doing_fast_blink) {
|
|
||||||
if (CHARGE_LED_state == LED_STATE_ON) {
|
|
||||||
CHARGE_LED_state = LED_STATE_OFF;
|
|
||||||
my_interval = 999;
|
|
||||||
} else {
|
|
||||||
CHARGE_LED_state = LED_STATE_ON;
|
|
||||||
my_interval = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we want a LED to be dedicated to the simple hearbeat, we can use that instead of the charge LED
|
// If we want a LED to be dedicated to the simple hearbeat, we can use that instead of the charge LED
|
||||||
#if defined(LED_HEARTBEAT)
|
#if defined(LED_HEARTBEAT)
|
||||||
if (!config.device.led_heartbeat_disabled) {
|
if (power_state != charging && power_state != charged && !doing_fast_blink && !config.device.led_heartbeat_disabled) {
|
||||||
if (HEARTBEAT_LED_state == LED_STATE_ON) {
|
if (HEARTBEAT_LED_state == LED_STATE_ON) {
|
||||||
HEARTBEAT_LED_state = LED_STATE_OFF;
|
HEARTBEAT_LED_state = LED_STATE_OFF;
|
||||||
my_interval = 999;
|
my_interval = 999;
|
||||||
@@ -117,6 +106,19 @@ int32_t StatusLEDModule::runOnce()
|
|||||||
my_interval = 1;
|
my_interval = 1;
|
||||||
}
|
}
|
||||||
digitalWrite(LED_HEARTBEAT, HEARTBEAT_LED_state);
|
digitalWrite(LED_HEARTBEAT, HEARTBEAT_LED_state);
|
||||||
|
} else {
|
||||||
|
HEARTBEAT_LED_state = LED_STATE_OFF;
|
||||||
|
digitalWrite(LED_HEARTBEAT, HEARTBEAT_LED_state);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (power_state != charging && power_state != charged && !doing_fast_blink && !config.device.led_heartbeat_disabled) {
|
||||||
|
if (CHARGE_LED_state == LED_STATE_ON) {
|
||||||
|
CHARGE_LED_state = LED_STATE_OFF;
|
||||||
|
my_interval = 999;
|
||||||
|
} else {
|
||||||
|
CHARGE_LED_state = LED_STATE_ON;
|
||||||
|
my_interval = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis() || doing_fast_blink) {
|
if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis() || doing_fast_blink) {
|
||||||
|
|||||||
Reference in New Issue
Block a user