fix relay not turning on at boot (#5315)

These changes eliminate an elaborate race condition
* add dedicated function to handle on/off and relay
* add clarifying comment on output set order
* add define for relay delay, honor forceOff in all cases
This commit is contained in:
Damian Schneider
2026-01-31 17:40:53 +01:00
committed by GitHub
parent 2c4ed4249d
commit 1ca55e42af
5 changed files with 21 additions and 14 deletions

View File

@@ -156,7 +156,7 @@ class DeepSleepUsermod : public Usermod {
delay(1000); // just in case: give user a short ~10s window to turn LEDs on in UI (delaycounter is 10 by default)
return;
}
if (powerup == false && delaycounter) { // delay sleep in case a preset is being loaded and turnOnAtBoot is disabled (handleIO() does enable offMode temporarily in this case)
if (powerup == false && delaycounter) { // delay sleep in case a preset is being loaded and turnOnAtBoot is disabled (beginStrip() / handleIO() does enable offMode temporarily in this case)
delaycounter--;
if (delaycounter == 1 && offMode) { // force turn on, no matter the settings (device is bricked if user set sleepDelay=0, no bootup preset and turnOnAtBoot=false)
if (briS == 0) bri = 10; // turn on and set low brightness to avoid automatic turn off