Skip to content

Commit

Permalink
Less loops if main segment only length < totalLen
Browse files Browse the repository at this point in the history
  • Loading branch information
mxklb committed Nov 18, 2023
1 parent bdd667d commit 3d9d658
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/e131.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit 3d9d658

Please sign in to comment.