Correct single RGB & DRGB modes to explicitly utilize white

This commit is contained in:
mxklb 2023-11-09 00:04:56 +01:00
parent 41bc799c3f
commit 376a83fc31

View File

@ -142,32 +142,33 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
return; // nothing to do return; // nothing to do
break; break;
case DMX_MODE_SINGLE_RGB: // 3 channel: [R,G,B] case DMX_MODE_SINGLE_RGB: // 3-4 channels: [R,G,B] + W (if present)
if (uni != e131Universe) return; if (uni != e131Universe) return;
if (availDMXLen < 3) return; const uint16_t dmxChannelCount = strip.hasWhiteChannel() ? 4 : 3;
if (availDMXLen < dmxChannelCount) return;
realtimeLock(realtimeTimeoutMs, mde); realtimeLock(realtimeTimeoutMs, mde);
if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return; if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return;
wChannel = (availDMXLen > 3) ? e131_data[dataOffset+3] : 0; wChannel = dmxChannelCount == 4 ? e131_data[dataOffset+3] : 0;
for (uint16_t i = 0; i < totalLen; i++) for (uint16_t i = 0; i < totalLen; i++)
setRealtimePixel(i, e131_data[dataOffset+0], e131_data[dataOffset+1], e131_data[dataOffset+2], wChannel); setRealtimePixel(i, e131_data[dataOffset+0], e131_data[dataOffset+1], e131_data[dataOffset+2], wChannel);
break; break;
case DMX_MODE_SINGLE_DRGB: // 4 channel: [Dimmer,R,G,B] case DMX_MODE_SINGLE_DRGB: // 4-5 channels: [Dimmer,R,G,B] + W (if present)
if (uni != e131Universe) return; if (uni != e131Universe) return;
if (availDMXLen < 4) return; const uint16_t dmxChannelCount = strip.hasWhiteChannel() ? 5 : 4;
if (availDMXLen < dmxChannelCount) return;
realtimeLock(realtimeTimeoutMs, mde); realtimeLock(realtimeTimeoutMs, mde);
if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return; if (realtimeOverride && !(realtimeMode && useMainSegmentOnly)) return;
wChannel = (availDMXLen > 4) ? e131_data[dataOffset+4] : 0;
if (bri != e131_data[dataOffset+0]) { if (bri != e131_data[dataOffset+0]) {
bri = e131_data[dataOffset+0]; bri = e131_data[dataOffset+0];
strip.setBrightness(bri, true); strip.setBrightness(bri, true);
} }
wChannel = dmxChannelCount == 5 ? e131_data[dataOffset+4] : 0;
for (uint16_t i = 0; i < totalLen; i++) for (uint16_t i = 0; i < totalLen; i++)
setRealtimePixel(i, e131_data[dataOffset+1], e131_data[dataOffset+2], e131_data[dataOffset+3], wChannel); setRealtimePixel(i, e131_data[dataOffset+1], e131_data[dataOffset+2], e131_data[dataOffset+3], wChannel);
break; break;