Add CMD_UPDATESTATUS message. Add CW and WW to all color relevant UDP messages.

This commit is contained in:
Junior 2026-01-08 18:00:42 -05:00
parent dc1485e6e8
commit 31462c5683

View File

@ -27,10 +27,11 @@ const unsigned int HOSTPORT = 80;
const String STATUSURL = "/l/boardstatus.php"; const String STATUSURL = "/l/boardstatus.php";
// UDP Command values // UDP Command values
#define CMD_OFF 0x00 #define CMD_OFF 0
#define CMD_SETLEVELS 0x01 #define CMD_SETLEVELS 1
#define CMD_AUTOPATTERN 0x02 #define CMD_AUTOPATTERN 2
#define CMD_AUTODISABLE 0x03 #define CMD_AUTODISABLE 3
#define CMD_UPDATESTATUS 4
// Auto-cycler state conditions // Auto-cycler state conditions
#define AUTO_DISABLED 0x00 #define AUTO_DISABLED 0x00
@ -292,6 +293,8 @@ bool processMessage() {
memcpy(&autoColors[0].red, (char*)buff + 21, 1); memcpy(&autoColors[0].red, (char*)buff + 21, 1);
memcpy(&autoColors[0].green, (char*)buff + 22, 1); memcpy(&autoColors[0].green, (char*)buff + 22, 1);
memcpy(&autoColors[0].blue, (char*)buff + 23, 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 ) { if ( MAX_ANALOG != 255 ) {
autoColors[0].red = map(autoColors[0].red, 0, 255, 0, MAX_ANALOG); autoColors[0].red = map(autoColors[0].red, 0, 255, 0, MAX_ANALOG);
autoColors[0].green = map(autoColors[0].green, 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; redStatic = autoColors[0].red;
greenStatic = autoColors[0].green; greenStatic = autoColors[0].green;
blueStatic = autoColors[0].blue; blueStatic = autoColors[0].blue;
warmwhiteStatic = autoColors[0].warmwhite;
coolwhiteStatic = autoColors[0].coolwhite;
if ( DEBUG ) { if ( DEBUG ) {
String debugOutput = "Setting Levels: "; String debugOutput = "Setting Levels: ";
debugOutput += String(redStatic) + ", "; debugOutput += String(redStatic) + ", ";
debugOutput += String(greenStatic) + ", "; debugOutput += String(greenStatic) + ", ";
debugOutput += String(blueStatic) + ", "; debugOutput += String(blueStatic) + ", ";
debugOutput += String(warmwhiteStatic) + ", ";
debugOutput += String(coolwhiteStatic) + ", ";
debugOutput += String(rampDuration); debugOutput += String(rampDuration);
Serial.println(debugOutput); Serial.println(debugOutput);
} }
@ -324,7 +331,9 @@ bool processMessage() {
memcpy(&autoColors[i].red, (char*)buff + 22 + (i*7), 1); memcpy(&autoColors[i].red, (char*)buff + 22 + (i*7), 1);
memcpy(&autoColors[i].green, (char*)buff + 23 + (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].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 ) { if ( MAX_ANALOG != 255 ) {
autoColors[i].red = map(autoColors[i].red, 0, 255, 0, MAX_ANALOG); autoColors[i].red = map(autoColors[i].red, 0, 255, 0, MAX_ANALOG);
autoColors[i].green = map(autoColors[i].green, 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].red) + ", ";
debugOutput += String(autoColors[i].green) + ", "; debugOutput += String(autoColors[i].green) + ", ";
debugOutput += String(autoColors[i].blue) + ", "; debugOutput += String(autoColors[i].blue) + ", ";
debugOutput += String(autoColors[i].warmwhite) + ", ";
debugOutput += String(autoColors[i].coolwhite) + ", ";
debugOutput += String(autoColors[i].restDuration) + "], "; debugOutput += String(autoColors[i].restDuration) + "], ";
} }
} }
@ -353,6 +364,8 @@ bool processMessage() {
autoColors[0].red = redStatic; autoColors[0].red = redStatic;
autoColors[0].green = greenStatic; autoColors[0].green = greenStatic;
autoColors[0].blue = blueStatic; autoColors[0].blue = blueStatic;
autoColors[0].warmwhite = warmwhiteStatic;
autoColors[0].coolwhite = coolwhiteStatic;
rampDuration = 1000; rampDuration = 1000;
if ( DEBUG ) { if ( DEBUG ) {
String debugOutput = "Resetting Levels to static: "; String debugOutput = "Resetting Levels to static: ";
@ -376,10 +389,18 @@ bool processMessage() {
redStatic = 0; redStatic = 0;
greenStatic = 0; greenStatic = 0;
blueStatic = 0; blueStatic = 0;
warmwhiteStatic = 0;
coolwhiteStatic = 0;
if ( DEBUG ) Serial.println("Shutting off LEDs"); if ( DEBUG ) Serial.println("Shutting off LEDs");
return true; return true;
} }
if ( command == CMD_UPDATESTATUS ) {
sendDeviceStatus();
if ( DEBUG ) Serial.println("Status update requested");
return true;
}
return false; return false;
} }