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>
This commit is contained in:
coral 2023-05-26 05:58:40 -07:00 committed by GitHub
parent 3520f9e9c2
commit 7d84de6690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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; uint32_t start = htonl(p->channelOffset) / ddpChannelsPerLed;
start += DMXAddress / ddpChannelsPerLed; start += DMXAddress / ddpChannelsPerLed;

View File

@ -53,8 +53,8 @@ typedef struct ip_addr ip4_addr_t;
#define DDP_PUSH_FLAG 0x01 #define DDP_PUSH_FLAG 0x01
#define DDP_TIMECODE_FLAG 0x10 #define DDP_TIMECODE_FLAG 0x10
#define DDP_TYPE_RGB24 0x0A #define DDP_TYPE_RGB24 0x0B // 00 001 011 (RGB , 8 bits per channel, 3 channels)
#define DDP_TYPE_RGBW32 0x1A #define DDP_TYPE_RGBW32 0x1B // 00 011 011 (RGBW, 8 bits per channel, 4 channels)
#define ARTNET_OPCODE_OPDMX 0x5000 #define ARTNET_OPCODE_OPDMX 0x5000
#define ARTNET_OPCODE_OPPOLL 0x2000 #define ARTNET_OPCODE_OPPOLL 0x2000