From 3d9d658a7e551ded1e079e1bc2b0ed3b0a7c67ca Mon Sep 17 00:00:00 2001 From: mxklb Date: Sat, 18 Nov 2023 15:23:34 +0100 Subject: [PATCH] Less loops if main segment only length < totalLen --- wled00/e131.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/e131.cpp b/wled00/e131.cpp index 704d7d74..22ceec1d 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -153,7 +153,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ if (availDMXLen < dmxChannelCount) return; wChannel = dmxChannelCount == 4 ? e131_data[dataOffset+3] : 0; - for (uint16_t i = 0; i < totalLen; i++) + for (uint16_t i = 0; i < useMainSegmentOnly ? strip.getMainSegment().length() : totalLen; i++) setRealtimePixel(i, e131_data[dataOffset+0], e131_data[dataOffset+1], e131_data[dataOffset+2], wChannel); break; @@ -172,7 +172,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ } wChannel = dmxChannelCount == 5 ? e131_data[dataOffset+4] : 0; - for (uint16_t i = 0; i < totalLen; i++) + for (uint16_t i = 0; i < useMainSegmentOnly ? strip.getMainSegment().length() : totalLen; i++) setRealtimePixel(i, e131_data[dataOffset+1], e131_data[dataOffset+2], e131_data[dataOffset+3], wChannel); break;