From 31462c56830ab91c5315224a4963ddc33b4303a4 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 8 Jan 2026 18:00:42 -0500 Subject: [PATCH] Add CMD_UPDATESTATUS message. Add CW and WW to all color relevant UDP messages. --- src/main.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7446fc6..9625a03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,10 +27,11 @@ const unsigned int HOSTPORT = 80; const String STATUSURL = "/l/boardstatus.php"; // UDP Command values -#define CMD_OFF 0x00 -#define CMD_SETLEVELS 0x01 -#define CMD_AUTOPATTERN 0x02 -#define CMD_AUTODISABLE 0x03 +#define CMD_OFF 0 +#define CMD_SETLEVELS 1 +#define CMD_AUTOPATTERN 2 +#define CMD_AUTODISABLE 3 +#define CMD_UPDATESTATUS 4 // Auto-cycler state conditions #define AUTO_DISABLED 0x00 @@ -292,6 +293,8 @@ bool processMessage() { memcpy(&autoColors[0].red, (char*)buff + 21, 1); memcpy(&autoColors[0].green, (char*)buff + 22, 1); memcpy(&autoColors[0].blue, (char*)buff + 23, 1); + memcpy(&autoColors[0].warmwhite, (char*)buff + 24, 1); + memcpy(&autoColors[0].coolwhite, (char*)buff + 25, 1); if ( MAX_ANALOG != 255 ) { autoColors[0].red = map(autoColors[0].red, 0, 255, 0, MAX_ANALOG); autoColors[0].green = map(autoColors[0].green, 0, 255, 0, MAX_ANALOG); @@ -300,11 +303,15 @@ bool processMessage() { redStatic = autoColors[0].red; greenStatic = autoColors[0].green; blueStatic = autoColors[0].blue; + warmwhiteStatic = autoColors[0].warmwhite; + coolwhiteStatic = autoColors[0].coolwhite; if ( DEBUG ) { String debugOutput = "Setting Levels: "; debugOutput += String(redStatic) + ", "; debugOutput += String(greenStatic) + ", "; debugOutput += String(blueStatic) + ", "; + debugOutput += String(warmwhiteStatic) + ", "; + debugOutput += String(coolwhiteStatic) + ", "; debugOutput += String(rampDuration); Serial.println(debugOutput); } @@ -324,7 +331,9 @@ bool processMessage() { memcpy(&autoColors[i].red, (char*)buff + 22 + (i*7), 1); memcpy(&autoColors[i].green, (char*)buff + 23 + (i*7), 1); memcpy(&autoColors[i].blue, (char*)buff + 24 + (i*7), 1); - memcpy(&autoColors[i].restDuration, (char*)buff + 25 + (i*7), 4); + memcpy(&autoColors[i].warmwhite, (char*)buff + 25 + (i*7), 1); + memcpy(&autoColors[i].coolwhite, (char*)buff + 26 + (i*7), 1); + memcpy(&autoColors[i].restDuration, (char*)buff + 27 + (i*7), 4); if ( MAX_ANALOG != 255 ) { autoColors[i].red = map(autoColors[i].red, 0, 255, 0, MAX_ANALOG); autoColors[i].green = map(autoColors[i].green, 0, 255, 0, MAX_ANALOG); @@ -335,6 +344,8 @@ bool processMessage() { debugOutput += String(autoColors[i].red) + ", "; debugOutput += String(autoColors[i].green) + ", "; debugOutput += String(autoColors[i].blue) + ", "; + debugOutput += String(autoColors[i].warmwhite) + ", "; + debugOutput += String(autoColors[i].coolwhite) + ", "; debugOutput += String(autoColors[i].restDuration) + "], "; } } @@ -353,6 +364,8 @@ bool processMessage() { autoColors[0].red = redStatic; autoColors[0].green = greenStatic; autoColors[0].blue = blueStatic; + autoColors[0].warmwhite = warmwhiteStatic; + autoColors[0].coolwhite = coolwhiteStatic; rampDuration = 1000; if ( DEBUG ) { String debugOutput = "Resetting Levels to static: "; @@ -376,10 +389,18 @@ bool processMessage() { redStatic = 0; greenStatic = 0; blueStatic = 0; + warmwhiteStatic = 0; + coolwhiteStatic = 0; if ( DEBUG ) Serial.println("Shutting off LEDs"); return true; } + if ( command == CMD_UPDATESTATUS ) { + sendDeviceStatus(); + if ( DEBUG ) Serial.println("Status update requested"); + return true; + } + return false; }