Let SignalRGB keep the clock awake at night

New "Wake at night" setting (prmExt.wledWakeAtNight, web UI only): while
WLED frames arrive, the night schedule is ignored and the clock runs as by
day. Night mode returns as soon as the frames time out. The manual night
toggle, radar and HA Tubes switch still win.

The field uses the former padding byte of prmExt; MAGIC_VALUE_EXT is now
0x5702 and 0x5701 settings are migrated, so existing SignalRGB settings
are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-03 00:04:15 +01:00
1 parent 7d5cd3bf8d
commit 6b1d20acde
5 files changed
+48 -16

No files matched your search

+22 -10
View File
@@ -15,7 +15,9 @@
// gap between tubes (neoShow()), so fewer updates mean less risk of tube flicker.
// Settings (web page and the Home Assistant "SignalRGB" switch): prmExt.wledEnable, prmExt.wledDarkWithTubes (dark
// while the backlight would be off: night, radar, HA Tubes switch), prmExt.wledUseBrightness (scale by the RGB
// brightness and auto dim instead of only the RGB_MAX_BRIGHTNESS cap).
// brightness and auto dim instead of only the RGB_MAX_BRIGHTNESS cap), prmExt.wledWakeAtNight (while frames arrive,
// the night schedule is ignored: tubes and LEDs run as by day; the manual night toggle, radar and HA Tubes switch
// still win. Night mode returns as soon as the frames time out).
//_______________________________________________________________________________________________________________________
#if !defined(ESP8266) || !defined(USE_NEOPIXEL)
@@ -130,26 +132,35 @@ void wledSetup() {
wledReady = true;
}
//Used by evalShutoffTime(): true while the night schedule should be ignored.
boolean wledWakesNight() {
return prmExt.wledWakeAtNight && wledLive;
}
//Called from loop() and Fdelay(). Follows prmExt.wledEnable, reads frames and shows them.
void wledHandle() {
static unsigned long lastShow = 0;
static boolean wasLive = false;
if (!wledReady) return;
if (prmExt.wledEnable != wledRunning) {
if (prmExt.wledEnable) wledBegin();
else wledEnd();
}
if (!wledRunning) return;
wledReceive(wledUdp, false);
wledReceive(wledDdp, true);
if (wledRunning) {
wledReceive(wledUdp, false);
wledReceive(wledDdp, true);
if (wledLive && ((millis() - wledLastPacket) > wledTimeout)) {
wledLive = false; //doAnimationMakuna() takes over again
DPRINTLN("WLED: realtime frames stopped");
}
}
if (wledLive != wasLive) {
wasLive = wledLive;
if (prmExt.wledWakeAtNight) evalShutoffTime(); //wake or sleep now, not at the next second
}
if (!wledLive) return;
if ((millis() - wledLastPacket) > wledTimeout) {
wledLive = false; //doAnimationMakuna() takes over again
DPRINTLN("WLED: realtime frames stopped");
return;
}
if (alarmON || EEPROMsaving) return; //the alarm flash wins
if ((millis() - lastShow) < (1000ul / WLED_MAX_FPS)) return;
lastShow = millis();
@@ -267,5 +278,6 @@ void wledRoutes() {
#else
void wledSetup() {}
void wledHandle() {}
boolean wledWakesNight() { return false; }
void wledRoutes() {}
#endif