bugfixing LED routine (not yet fixed)

This commit is contained in:
Klaus K Wilting 2018-04-25 12:09:22 +02:00
parent 0ca1aa5fd0
commit 391ad0fe90

View File

@ -409,17 +409,21 @@ uint64_t uptime() {
#endif #endif
previousLEDState = LEDState; previousLEDState = LEDState;
blinkdone = LEDState ? true : false; blinkdone = LEDState ? true : false; // if LED was turned on, a blink was done
} }
}; // switchLED() }; // switchLED()
void switchLEDstate() { void switchLEDstate() {
if (LEDInterval) // LED is blinking, wait until time elapsed, then toggle LED if (LEDInterval) // LED is blinking, wait until time elapsed, then toggle LED
LEDState = ((currentMillis % LEDInterval) < LEDBlinkduration) ? LED_ON : LED_OFF; LEDState = ((currentMillis % LEDInterval) < LEDBlinkduration) ? LED_ON : LED_OFF;
else // check if in oneblink mode else // check if in oneblink mode
if (!blinkdone) { // keep LED on until one blink is done
if (!blinkdone) // keep LED on until one blink is done
LEDState = (currentMillis % LEDBlinkduration) > 0 ? LED_ON : LED_OFF; LEDState = (currentMillis % LEDBlinkduration) > 0 ? LED_ON : LED_OFF;
} // switchLEDstate() } // switchLEDstate()
#endif #endif