From 09109a8f750a4b727e3b6d7ea5a62dc4583cc8b6 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 8 Jan 2026 18:07:03 -0500 Subject: [PATCH] Switch back to hex representation for UDP message CMD values. --- README.md | 10 +++++----- src/main.cpp | 15 +++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a53a598..c293a2a 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The first and second four byte integers values are 4039196302 and 3194769291 res | Filter_1 | Value: 4039196302 | Unsigned Int | 32 | | Filter_2 | Value: 3194769291 | Unsigned Int | 32 | | MessageID | This is used to identify and ignore duplicate messages. Due to the unreliable nature of UDP, and the slow embedded processors, sending multiple duplicate messages some few milliseconds (10) apart can help ensure the devices get all their messages | Unsigned Int | 32 | -| CMD | Value: 0 | Unsigned Char | 8 | +| CMD | Value: 0x00 | Unsigned Char | 8 | | TargetID | This is the target ID mask for the broadcast message. | Unsigned Int | 32 | ### CMD_SETLEVELS @@ -39,7 +39,7 @@ The first and second four byte integers values are 4039196302 and 3194769291 res | Filter_1 | Value: 4039196302 | Unsigned Int | 32 | | Filter_2 | Value: 3194769291 | Unsigned Int | 32 | | MessageID | This is used to identify and ignore duplicate messages. Due to the unreliable nature of UDP, and the slow embedded processors, sending multiple duplicate messages some few milliseconds (10) apart can help ensure the devices get all their messages | Unsigned Int | 32 | -| CMD | Value: 1 | Unsigned Char | 8 | +| CMD | Value: 0x01 | Unsigned Char | 8 | | TargetID | This is the target ID mask for the broadcast message. | Unsigned Int | 32 | | RampTime | This is the time in milliseconds over which the color will be changed | Unsigned Int | 32 | | Red | This is the level for the "red" GPIO pin. Values from 0 to 255 | Unsigned Char | 8 | @@ -59,7 +59,7 @@ The CMD, RampTime and NumColors value/bits are at the head of the message. The n | Filter_1 | Value: 4039196302 | Unsigned Int | 32 | | Filter_2 | Value: 3194769291 | Unsigned Int | 32 | | MessageID | This is used to identify and ignore duplicate messages. Due to the unreliable nature of UDP, and the slow embedded processors, sending multiple duplicate messages some few milliseconds (10) apart can help ensure the devices get all their messages | Unsigned Int | 32 | -| CMD | Value: 2 | Unsigned Char | 8 | +| CMD | Value: 0x02 | Unsigned Char | 8 | | TargetID | This is the target ID mask for the broadcast message. | Unsigned Int | 32 | | RampTime | This is the time in milliseconds over which the color will be changed | Unsigned Int | 32 | | NumColors | This is the number of color triplets in the message | Unsigned Char | 8 | @@ -77,7 +77,7 @@ The CMD, RampTime and NumColors value/bits are at the head of the message. The n | Filter_1 | Value: 4039196302 | Unsigned Int | 32 | | Filter_2 | Value: 3194769291 | Unsigned Int | 32 | | MessageID | This is used to identify and ignore duplicate messages. Due to the unreliable nature of UDP, and the slow embedded processors, sending multiple duplicate messages some few milliseconds (10) apart can help ensure the devices get all their messages | Unsigned Int | 32 | -| CMD | Value: 3 | Unsigned Char | 8 | +| CMD | Value: 0x03 | Unsigned Char | 8 | | TargetID | This is the target ID mask for the broadcast message. | Unsigned Int | 32 | ### CMD_UPDATESTATUS @@ -89,5 +89,5 @@ From the controller's perspective this command triggers the updateBoardStatus() | Filter_1 | Value: 4039196302 | Unsigned Int | 32 | | Filter_2 | Value: 3194769291 | Unsigned Int | 32 | | MessageID | This is used to identify and ignore duplicate messages. Due to the unreliable nature of UDP, and the slow embedded processors, sending multiple duplicate messages some few milliseconds (10) apart can help ensure the devices get all their messages | Unsigned Int | 32 | -| CMD | Value: 4 | Unsigned Char | 8 | +| CMD | Value: 0x04 | Unsigned Char | 8 | | TargetID | This is the target ID mask for the broadcast message. | Unsigned Int | 32 | \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 9625a03..bc12e46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,15 +27,14 @@ const unsigned int HOSTPORT = 80; const String STATUSURL = "/l/boardstatus.php"; // UDP Command values -#define CMD_OFF 0 -#define CMD_SETLEVELS 1 -#define CMD_AUTOPATTERN 2 -#define CMD_AUTODISABLE 3 -#define CMD_UPDATESTATUS 4 - +#define CMD_OFF 0x00 +#define CMD_SETLEVELS 0x01 +#define CMD_AUTOPATTERN 0x02 +#define CMD_AUTODISABLE 0x03 +#define CMD_UPDATESTATUS 0x04 // Auto-cycler state conditions -#define AUTO_DISABLED 0x00 -#define AUTO_ACTIVE 0x01 +#define AUTO_DISABLED 0x00 +#define AUTO_ACTIVE 0x01 // Maximum analog output level #define MAX_ANALOG 255