Finish LED pattern before low-power sleep
Wait until no LEDs are blinking anymore before going to sleep. Decrement LED blink counter before acting on the value, otherwise LED state will always lag behind.
This commit is contained in:
@@ -520,6 +520,13 @@ int8_t _sleep(const uint32_t sleepingMS, const bool smartSleep, const uint8_t in
|
||||
transportPowerDown();
|
||||
#endif
|
||||
|
||||
#if defined (MY_DEFAULT_TX_LED_PIN) || defined(MY_DEFAULT_RX_LED_PIN) || defined(MY_DEFAULT_ERR_LED_PIN)
|
||||
// Wait until leds finish their blinking pattern
|
||||
while (ledsBlinking()) {
|
||||
doYield();
|
||||
}
|
||||
#endif
|
||||
|
||||
setIndication(INDICATION_SLEEP);
|
||||
|
||||
int8_t result = MY_SLEEP_NOT_POSSIBLE; // default
|
||||
|
||||
Reference in New Issue
Block a user