Added missing main segment check

This commit is contained in:
mxklb 2023-11-17 01:41:23 +01:00
parent 1602c4434f
commit ababf58deb

View File

@ -120,6 +120,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
// update status info
realtimeIP = clientIP;
byte wChannel = 0;
uint16_t dmxChannelCount = 0;
uint16_t totalLen = strip.getLengthTotal();
uint16_t availDMXLen = 0;
uint16_t dataOffset = DMXAddress;
@ -144,13 +145,13 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
case DMX_MODE_SINGLE_RGB: // 3-4 channels: [R,G,B] + W (if present)
if (uni != e131Universe) return;
uint16_t dmxChannelCount;
dmxChannelCount = strip.hasWhiteChannel() ? 4 : 3;
if (availDMXLen < dmxChannelCount) return;
realtimeLock(realtimeTimeoutMs, mde);
if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return;
dmxChannelCount = useMainSegmentOnly ? strip.getMainSegment().hasWhite() : strip.hasWhiteChannel() ? 4 : 3;
if (availDMXLen < dmxChannelCount) return;
wChannel = dmxChannelCount == 4 ? e131_data[dataOffset+3] : 0;
for (uint16_t i = 0; i < totalLen; i++)
setRealtimePixel(i, e131_data[dataOffset+0], e131_data[dataOffset+1], e131_data[dataOffset+2], wChannel);
@ -158,12 +159,13 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
case DMX_MODE_SINGLE_DRGB: // 4-5 channels: [Dimmer,R,G,B] + W (if present)
if (uni != e131Universe) return;
dmxChannelCount = strip.hasWhiteChannel() ? 5 : 4;
if (availDMXLen < dmxChannelCount) return;
realtimeLock(realtimeTimeoutMs, mde);
if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return;
dmxChannelCount = useMainSegmentOnly ? strip.getMainSegment().hasWhite() : strip.hasWhiteChannel() ? 5 : 4;
if (availDMXLen < dmxChannelCount) return;
if (bri != e131_data[dataOffset+0]) {
bri = e131_data[dataOffset+0];
strip.setBrightness(bri, true);