From 7d84de6690016cb33055a89d1017c54209b40ef7 Mon Sep 17 00:00:00 2001 From: coral Date: Fri, 26 May 2023 05:58:40 -0700 Subject: [PATCH] Fix errors in DDP implementation (#3193) * fix DDP spec * Adjust DDP type byte to latest spec Allow receiving of RGBW DDP with either old or new bits per channel value --------- Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com> --- wled00/e131.cpp | 2 +- wled00/src/dependencies/e131/ESPAsyncE131.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wled00/e131.cpp b/wled00/e131.cpp index 1c16e148b..2a80de37e 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -25,7 +25,7 @@ void handleDDPPacket(e131_packet_t* p) { } } - uint8_t ddpChannelsPerLed = (p->dataType == DDP_TYPE_RGBW32) ? 4 : 3; // data type 0x1A is RGBW (type 3, 8 bit/channel) + uint8_t ddpChannelsPerLed = (p->dataType & 0b00111000 == 0b011) ? 4 : 3; // data type 0x1B (formerly 0x1A) is RGBW (type 3, 8 bit/channel) uint32_t start = htonl(p->channelOffset) / ddpChannelsPerLed; start += DMXAddress / ddpChannelsPerLed; diff --git a/wled00/src/dependencies/e131/ESPAsyncE131.h b/wled00/src/dependencies/e131/ESPAsyncE131.h index 3132ca6c1..40d7154e2 100644 --- a/wled00/src/dependencies/e131/ESPAsyncE131.h +++ b/wled00/src/dependencies/e131/ESPAsyncE131.h @@ -53,8 +53,8 @@ typedef struct ip_addr ip4_addr_t; #define DDP_PUSH_FLAG 0x01 #define DDP_TIMECODE_FLAG 0x10 -#define DDP_TYPE_RGB24 0x0A -#define DDP_TYPE_RGBW32 0x1A +#define DDP_TYPE_RGB24 0x0B // 00 001 011 (RGB , 8 bits per channel, 3 channels) +#define DDP_TYPE_RGBW32 0x1B // 00 011 011 (RGBW, 8 bits per channel, 4 channels) #define ARTNET_OPCODE_OPDMX 0x5000 #define ARTNET_OPCODE_OPPOLL 0x2000