Compare commits
2
Commits
9f960fae17
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b1d20acde | ||
|
|
7d5cd3bf8d |
No files matched your search
@@ -103,9 +103,13 @@ GPIO0 to GND, tap RST to GND, then release GPIO0.
|
|||||||
6. Done (2026-10-25): SignalRGB via WLED emulation (`wled.ino`, `USE_WLED_REALTIME`,
|
6. Done (2026-10-25): SignalRGB via WLED emulation (`wled.ino`, `USE_WLED_REALTIME`,
|
||||||
`WLED_MAX_FPS` 30: no flicker, no loop stalls). SignalRGB's WLED plugin only sends as many LEDs as the channel's component has (needs 4). LED order checked:
|
`WLED_MAX_FPS` 30: no flicker, no loop stalls). SignalRGB's WLED plugin only sends as many LEDs as the channel's component has (needs 4). LED order checked:
|
||||||
SignalRGB LED 0 = left tube, `tubePixels` {0,1,2,3} is right. Settings `wledEnable` /
|
SignalRGB LED 0 = left tube, `tubePixels` {0,1,2,3} is right. Settings `wledEnable` /
|
||||||
`wledDarkWithTubes` / `wledUseBrightness` live in `prmExt`, stored in EEPROM after `prm` with
|
`wledDarkWithTubes` / `wledUseBrightness` / `wledWakeAtNight` live in `prmExt`, stored in EEPROM
|
||||||
their own magic value: never add fields to `prm` (a `MAGIC_VALUE` bump factory-resets the
|
after `prm` with their own magic value: never add fields to `prm` (a `MAGIC_VALUE` bump
|
||||||
clock, WiFi included). HA switch "SignalRGB".
|
factory-resets the clock, WiFi included). `prmExt` 0x5702 added `wledWakeAtNight` in the old
|
||||||
|
padding byte and migrates 0x5701; it has no padding left, so the next field needs a real
|
||||||
|
migration. HA switch "SignalRGB".
|
||||||
|
`wledWakeAtNight` ("Wake at night", web UI only): while frames arrive, `evalShutoffTime()` keeps
|
||||||
|
day mode during the night schedule; the manual night toggle, radar and HA Tubes switch still win.
|
||||||
7. Done (2026-10-29, on the clock): new web UI. Source `firmware/uniclock/web/index.html`
|
7. Done (2026-10-29, on the clock): new web UI. Source `firmware/uniclock/web/index.html`
|
||||||
(one file, no jQuery, controls generated from the `PAGES` table), gzipped by `web/gzip_web.py`
|
(one file, no jQuery, controls generated from the `PAGES` table), gzipped by `web/gzip_web.py`
|
||||||
to `data/index.html.gz` (12 KB, was 147 KB), served by one `serveStatic` with `no-cache`.
|
to `data/index.html.gz` (12 KB, was 147 KB), served by one `serveStatic` with `no-cache`.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# IN-12 nixie clock: open firmware
|
# IN-12 nixie clock: open firmware
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Replacement firmware for a RetroModding **NixieIN12v2** WiFi nixie clock (the 5 V, USB-C version
|
Replacement firmware for a RetroModding **NixieIN12v2** WiFi nixie clock (the 5 V, USB-C version
|
||||||
sold on AliExpress): 4x IN-12 tubes, 2x IN-3 neon dots, 4 WS2812 LEDs, an ESP8266 (ESP-12) and a
|
sold on AliExpress): 4x IN-12 tubes, 2x IN-3 neon dots, 4 WS2812 LEDs, an ESP8266 (ESP-12) and a
|
||||||
light sensor. The closed stock firmware (SV1.3) is replaced by
|
light sensor. The closed stock firmware (SV1.3) is replaced by
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 392 KiB |
@@ -446,13 +446,18 @@ struct {
|
|||||||
// Adding them to `prm` would change its layout, and the MAGIC_VALUE check would then factory-reset
|
// Adding them to `prm` would change its layout, and the MAGIC_VALUE check would then factory-reset
|
||||||
// the clock (WiFi settings included). If the magic value doesn't match (first boot after the update),
|
// the clock (WiFi settings included). If the magic value doesn't match (first boot after the update),
|
||||||
// loadEEPROM() sets these defaults and leaves `prm` alone.
|
// loadEEPROM() sets these defaults and leaves `prm` alone.
|
||||||
#define MAGIC_VALUE_EXT 0x5701
|
// 0x5701 had no wledWakeAtNight; it sat in what was the padding byte, so the other fields kept their place and
|
||||||
|
// loadEEPROM() takes them over.
|
||||||
|
#define MAGIC_VALUE_EXT 0x5702
|
||||||
|
#define MAGIC_VALUE_EXT_5701 0x5701
|
||||||
struct {
|
struct {
|
||||||
boolean wledEnable = false; //SignalRGB/WLED realtime control of the backlight (wled.ino)
|
boolean wledEnable = false; //SignalRGB/WLED realtime control of the backlight (wled.ino)
|
||||||
boolean wledDarkWithTubes = true; //WLED frames stay dark while the tubes/backlight are off
|
boolean wledDarkWithTubes = true; //WLED frames stay dark while the tubes/backlight are off
|
||||||
boolean wledUseBrightness = true; //WLED frames are scaled by the RGB brightness (and auto dim)
|
boolean wledUseBrightness = true; //WLED frames are scaled by the RGB brightness (and auto dim)
|
||||||
|
boolean wledWakeAtNight = false; //while WLED frames arrive, the night schedule is ignored (evalShutoffTime())
|
||||||
uint16_t magic = MAGIC_VALUE_EXT;
|
uint16_t magic = MAGIC_VALUE_EXT;
|
||||||
} prmExt;
|
} prmExt;
|
||||||
|
static_assert(offsetof(decltype(prmExt), magic) == 4, "prmExt layout changed: MAGIC_VALUE_EXT_5701 migration no longer fits");
|
||||||
|
|
||||||
#define EEPROM_SIZE (sizeof(prm) + sizeof(prmExt)) //no extra reserved space for future growth: a change to either struct needs its own magic value bumped
|
#define EEPROM_SIZE (sizeof(prm) + sizeof(prmExt)) //no extra reserved space for future growth: a change to either struct needs its own magic value bumped
|
||||||
|
|
||||||
@@ -1415,6 +1420,10 @@ void handleConfigChanged(AsyncWebServerRequest *request) {
|
|||||||
else if (key == "wledUseBrightness") {
|
else if (key == "wledUseBrightness") {
|
||||||
prmExt.wledUseBrightness = (value == "true");
|
prmExt.wledUseBrightness = (value == "true");
|
||||||
}
|
}
|
||||||
|
else if (key == "wledWakeAtNight") {
|
||||||
|
prmExt.wledWakeAtNight = (value == "true");
|
||||||
|
evalShutoffTime(); //takes effect now, not at the next second
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (key == "wifiSsid") {
|
else if (key == "wifiSsid") {
|
||||||
value.toCharArray(prm.wifiSsid,sizeof(prm.wifiSsid));
|
value.toCharArray(prm.wifiSsid,sizeof(prm.wifiSsid));
|
||||||
@@ -1653,6 +1662,7 @@ if (useTemp > 1)
|
|||||||
doc["wledEnable"] = prmExt.wledEnable;
|
doc["wledEnable"] = prmExt.wledEnable;
|
||||||
doc["wledDarkWithTubes"] = prmExt.wledDarkWithTubes;
|
doc["wledDarkWithTubes"] = prmExt.wledDarkWithTubes;
|
||||||
doc["wledUseBrightness"] = prmExt.wledUseBrightness;
|
doc["wledUseBrightness"] = prmExt.wledUseBrightness;
|
||||||
|
doc["wledWakeAtNight"] = prmExt.wledWakeAtNight;
|
||||||
#endif
|
#endif
|
||||||
doc["wifiMode"] = prm.wifiMode;
|
doc["wifiMode"] = prm.wifiMode;
|
||||||
doc["wifiSsid"] = prm.wifiSsid;
|
doc["wifiSsid"] = prm.wifiSsid;
|
||||||
@@ -2126,6 +2136,10 @@ void loadEEPROM() {
|
|||||||
EEPROM.get(EEPROM_addr, prm);
|
EEPROM.get(EEPROM_addr, prm);
|
||||||
DPRINT(" version:"); DPRINTLN(prm.magic);
|
DPRINT(" version:"); DPRINTLN(prm.magic);
|
||||||
EEPROM.get(EEPROM_addr + sizeof(prm), prmExt);
|
EEPROM.get(EEPROM_addr + sizeof(prm), prmExt);
|
||||||
|
if (prmExt.magic == MAGIC_VALUE_EXT_5701) { //older layout: keep its settings, the new one starts off
|
||||||
|
prmExt.wledWakeAtNight = false;
|
||||||
|
prmExt.magic = MAGIC_VALUE_EXT;
|
||||||
|
}
|
||||||
if (prmExt.magic != MAGIC_VALUE_EXT) resetPrmExt();
|
if (prmExt.magic != MAGIC_VALUE_EXT) resetPrmExt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2134,6 +2148,7 @@ void resetPrmExt() {
|
|||||||
prmExt.wledEnable = false;
|
prmExt.wledEnable = false;
|
||||||
prmExt.wledDarkWithTubes = true;
|
prmExt.wledDarkWithTubes = true;
|
||||||
prmExt.wledUseBrightness = true;
|
prmExt.wledUseBrightness = true;
|
||||||
|
prmExt.wledWakeAtNight = false;
|
||||||
prmExt.magic = MAGIC_VALUE_EXT;
|
prmExt.magic = MAGIC_VALUE_EXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2931,7 +2946,7 @@ void evalShutoffTime(void) { // Determine whether tubes should be turned to NI
|
|||||||
static bool prevShutoffState = true;
|
static bool prevShutoffState = true;
|
||||||
if ( (((mn_off < mn_on) && (mn >= mn_off) && (mn < mn_on))) || // Nighttime
|
if ( (((mn_off < mn_on) && (mn >= mn_off) && (mn < mn_on))) || // Nighttime
|
||||||
((mn_off > mn_on) && ((mn >= mn_off) || (mn < mn_on)))) {
|
((mn_off > mn_on) && ((mn >= mn_off) || (mn < mn_on)))) {
|
||||||
if (!manualOverride) displayON = false;
|
if (!manualOverride) displayON = wledWakesNight(); //SignalRGB frames can keep day mode (wled.ino)
|
||||||
if (prevShutoffState == true) manualOverride = false;
|
if (prevShutoffState == true) manualOverride = false;
|
||||||
prevShutoffState = false;
|
prevShutoffState = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -15,7 +15,9 @@
|
|||||||
// gap between tubes (neoShow()), so fewer updates mean less risk of tube flicker.
|
// 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
|
// 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
|
// 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)
|
#if !defined(ESP8266) || !defined(USE_NEOPIXEL)
|
||||||
@@ -130,26 +132,35 @@ void wledSetup() {
|
|||||||
wledReady = true;
|
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.
|
//Called from loop() and Fdelay(). Follows prmExt.wledEnable, reads frames and shows them.
|
||||||
void wledHandle() {
|
void wledHandle() {
|
||||||
static unsigned long lastShow = 0;
|
static unsigned long lastShow = 0;
|
||||||
|
static boolean wasLive = false;
|
||||||
|
|
||||||
if (!wledReady) return;
|
if (!wledReady) return;
|
||||||
if (prmExt.wledEnable != wledRunning) {
|
if (prmExt.wledEnable != wledRunning) {
|
||||||
if (prmExt.wledEnable) wledBegin();
|
if (prmExt.wledEnable) wledBegin();
|
||||||
else wledEnd();
|
else wledEnd();
|
||||||
}
|
}
|
||||||
if (!wledRunning) return;
|
if (wledRunning) {
|
||||||
|
wledReceive(wledUdp, false);
|
||||||
wledReceive(wledUdp, false);
|
wledReceive(wledDdp, true);
|
||||||
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 (!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 (alarmON || EEPROMsaving) return; //the alarm flash wins
|
||||||
if ((millis() - lastShow) < (1000ul / WLED_MAX_FPS)) return;
|
if ((millis() - lastShow) < (1000ul / WLED_MAX_FPS)) return;
|
||||||
lastShow = millis();
|
lastShow = millis();
|
||||||
@@ -267,5 +278,6 @@ void wledRoutes() {
|
|||||||
#else
|
#else
|
||||||
void wledSetup() {}
|
void wledSetup() {}
|
||||||
void wledHandle() {}
|
void wledHandle() {}
|
||||||
|
boolean wledWakesNight() { return false; }
|
||||||
void wledRoutes() {}
|
void wledRoutes() {}
|
||||||
#endif
|
#endif
|
||||||
@@ -130,7 +130,7 @@ const SAMPLE = {
|
|||||||
enableAutoShutoff: true, dayTime: "07:00", nightTime: "22:30", dayBright: 72, nightBright: 10, manualOverride: false,
|
enableAutoShutoff: true, dayTime: "07:00", nightTime: "22:30", dayBright: 72, nightBright: 10, manualOverride: false,
|
||||||
animMode: 6, alarmEnable: false, alarmTime: "06:30", alarmPeriod: 15, enableRadar: false, radarTimeout: 5,
|
animMode: 6, alarmEnable: false, alarmTime: "06:30", alarmPeriod: 15, enableRadar: false, radarTimeout: 5,
|
||||||
rgbEffect: 1, rgbBrightness: 120, rgbFixColor: 30, rgbSpeed: 50, rgbDir: false, rgbMinBrightness: 8,
|
rgbEffect: 1, rgbBrightness: 120, rgbFixColor: 30, rgbSpeed: 50, rgbDir: false, rgbMinBrightness: 8,
|
||||||
wledEnable: true, wledDarkWithTubes: true, wledUseBrightness: true,
|
wledEnable: true, wledDarkWithTubes: true, wledUseBrightness: true, wledWakeAtNight: false,
|
||||||
wifiMode: true, wifiSsid: "dlink-iot", wifiPsw: "", wifiPswSet: true, ApSsid: "UNICLOCK", ApPsw: "", ApPswSet: false,
|
wifiMode: true, wifiSsid: "dlink-iot", wifiPsw: "", wifiPswSet: true, ApSsid: "UNICLOCK", ApPsw: "", ApPswSet: false,
|
||||||
NtpServer: "pool.ntp.org", firmware: "", mqttBrokerAddr: "10.1.1.175", mqttBrokerUser: "mqtt", mqttBrokerPsw: "",
|
NtpServer: "pool.ntp.org", firmware: "", mqttBrokerAddr: "10.1.1.175", mqttBrokerUser: "mqtt", mqttBrokerPsw: "",
|
||||||
mqttBrokerPswSet: true, mqttEnable: true, mqttBrokerRefresh: 30, dateMode: 0, dateRepeatMin: 3, tempRepeatMin: 1,
|
mqttBrokerPswSet: true, mqttEnable: true, mqttBrokerRefresh: 30, dateMode: 0, dateRepeatMin: 3, tempRepeatMin: 1,
|
||||||
@@ -281,6 +281,7 @@ const PAGES = [
|
|||||||
{ t: "sw", k: "wledEnable", l: "SignalRGB control", h: "The clock shows up in SignalRGB as a WLED device" },
|
{ t: "sw", k: "wledEnable", l: "SignalRGB control", h: "The clock shows up in SignalRGB as a WLED device" },
|
||||||
{ t: "sw", k: "wledDarkWithTubes", l: "Off with the tubes", h: "LEDs stay dark while the tubes are off" },
|
{ t: "sw", k: "wledDarkWithTubes", l: "Off with the tubes", h: "LEDs stay dark while the tubes are off" },
|
||||||
{ t: "sw", k: "wledUseBrightness", l: "Use backlight brightness", h: "Off: colours exactly as SignalRGB sends them" },
|
{ t: "sw", k: "wledUseBrightness", l: "Use backlight brightness", h: "Off: colours exactly as SignalRGB sends them" },
|
||||||
|
{ t: "sw", k: "wledWakeAtNight", l: "Wake at night", h: "Tubes and LEDs stay on at night while SignalRGB sends colours", show: () => cfg.enableAutoShutoff },
|
||||||
{ t: "info", k: "wledLive", l: "Receiving colours", f: v => v ? "yes" : "no" }] }
|
{ t: "info", k: "wledLive", l: "Receiving colours", f: v => v ? "yes" : "no" }] }
|
||||||
] },
|
] },
|
||||||
{ id: "network", l: "Network", cards: [
|
{ id: "network", l: "Network", cards: [
|
||||||
|
|||||||
Reference in new issue
Block a user