Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ void Segment::setGeometry(uint16_t i1, uint16_t i2, uint8_t grp, uint8_t spc, ui
return;
}
if (i1 < Segment::maxWidth || (i1 >= Segment::maxWidth*Segment::maxHeight && i1 < strip.getLengthTotal())) start = i1; // Segment::maxWidth equals strip.getLengthTotal() for 1D
stop = i2 > Segment::maxWidth*Segment::maxHeight ? MIN(i2,strip.getLengthTotal()) : constrain(i2, 1, Segment::maxWidth);
stop = i2 > Segment::maxWidth*Segment::maxHeight && i1 >= Segment::maxWidth*Segment::maxHeight ? MIN(i2,strip.getLengthTotal()) : constrain(i2, 1, Segment::maxWidth); // check for 2D trailing strip
startY = 0;
stopY = 1;
#ifndef WLED_DISABLE_2D
Expand Down
4 changes: 3 additions & 1 deletion wled00/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ bool sendLiveLedsWs(uint32_t wsClient)
#ifndef WLED_DISABLE_2D
if (strip.isMatrix && n>1 && (i/Segment::maxWidth)%n) i += Segment::maxWidth * (n-1);
#endif
uint32_t c = strip.getPixelColor(i);
uint32_t c = 0;
if (strip.getMappedPixelIndex(i) < 0xFFFF) // draw ledmap gaps gaps in black
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe compare with < getLengthTotal()) instead of 0xFFFF ? This would also catch pixels that are mapped to "somewhere outside", which should also be handled as "black" so users know these pixels are not visible.
For better performance, you could cache the value of getLengthTotal() before entering the getPixelColor() loop.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did use 0xFFFF on purpose: if your map is larger than the set number of pixels, i.e. the hardware setup is wrong, it will not display the map correctly. on the other hand: using getLengthTotal() would hint at such an error and may be more useful to the struggeling user ;)

c = strip.getPixelColor(i);
uint8_t r = R(c);
uint8_t g = G(c);
uint8_t b = B(c);
Expand Down