Add SignalRGB control via WLED emulation
The clock answers like a WLED device (mDNS _wled._tcp, /json/info, /json/state, realtime UDP on 21324 and DDP on 4048), so SignalRGB can drive the 4 backlight LEDs, one per tube, LED 0 = left tube. Frames are shown at most 30 times a second (WLED_MAX_FPS); the normal effect returns 2.5 s after they stop, and the alarm flash still wins. Three new settings on the RGB page: enable (also a Home Assistant switch), stay dark while the tubes are off, and scale by the RGB brightness. They are stored in EEPROM after prm with their own magic value, so the update does not factory-reset the clock. page.js and site.css are now sent with no-cache: browsers kept them for a year and ran the old script after a web UI update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c4e0c29791
commit
ae87849e75
9 files changed
+446
-20
No files matched your search
@@ -603,16 +603,43 @@ void kitt() {
|
||||
}
|
||||
|
||||
|
||||
//prm.rgbBrightness, scaled by the light sensor when auto dim is on. Also used by wled.ino.
|
||||
long neoUserBrightness() {
|
||||
long b = prm.rgbBrightness;
|
||||
if (autoBrightness) {
|
||||
b = (b*lx)/long(MAXIMUM_LUX/2);
|
||||
if (b < c_MinBrightness)
|
||||
b = c_MinBrightness;
|
||||
}
|
||||
return min(b,long(RGB_MAX_BRIGHTNESS)); //safety only
|
||||
}
|
||||
|
||||
//Shows a frame from wled.ino: rgb[] holds one R,G,B triple per tube, leftmost tube first
|
||||
//(digit position 0 is the rightmost tube, hence the reversed index).
|
||||
void neoShowFrame(const uint8_t* rgb, long brightness) {
|
||||
strip.SetBrightness(brightness); //before SetPixelColor(), which scales by it
|
||||
for (int i=0;i<PixelCount;i++) {
|
||||
strip.SetPixelColor(i,black); //pixels without a tube stay dark
|
||||
}
|
||||
for (int t=0;t<maxDigits;t++) {
|
||||
const uint8_t* c = rgb + 3*(maxDigits-1-t);
|
||||
setPixels(t, RgbColor(c[0],c[1],c[2]));
|
||||
}
|
||||
neoShow();
|
||||
}
|
||||
|
||||
void doAnimationMakuna() {
|
||||
static unsigned long lastRun = 0;
|
||||
|
||||
if (EEPROMsaving) return;
|
||||
|
||||
|
||||
if (alarmON) {
|
||||
alarmLight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (wledLive) return; //SignalRGB drives the LEDs (wled.ino)
|
||||
|
||||
if ((prm.rgbEffect <=1) && ((millis()-lastRun)<1000)) return; //fix color
|
||||
if ((millis()-lastRun)<max(FPS_MSEC,258-prm.rgbSpeed)) return;
|
||||
lastRun = millis();
|
||||
@@ -624,13 +651,7 @@ static unsigned long lastRun = 0;
|
||||
}
|
||||
|
||||
colorStep = max(1,prm.rgbSpeed/5);
|
||||
neoBrightness = prm.rgbBrightness;
|
||||
if (autoBrightness) {
|
||||
neoBrightness = (neoBrightness*lx)/long(MAXIMUM_LUX/2);
|
||||
if (neoBrightness< c_MinBrightness)
|
||||
neoBrightness = c_MinBrightness;
|
||||
}
|
||||
neoBrightness = min(neoBrightness,long(RGB_MAX_BRIGHTNESS)); //safety only
|
||||
neoBrightness = neoUserBrightness();
|
||||
strip.SetBrightness(neoBrightness);
|
||||
//DPRINTLN(" NeoBrightness:"); DPRINT(neoBrightness);
|
||||
|
||||
|
||||
Reference in new issue
Block a user