setRealtimePixel robustness improvement

avoid drawing negative pixel addresses (could happen when  arlsOffset is < 0)
This commit is contained in:
Frank
2025-12-22 01:38:49 +01:00
parent d3291cc5e5
commit 7459cbd2e2

View File

@@ -692,7 +692,7 @@ void handleNotifications()
void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w)
{
int pix = i + arlsOffset;
if (pix < theStripLength) { // WLEDMM use cached length
if (unsigned(pix) < theStripLength) { // WLEDMM use cached length
if (!arlsDisableGammaCorrection && gammaCorrectCol) {
r = gamma8(r);
g = gamma8(g);
@@ -701,7 +701,7 @@ void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w)
}
if (useMainSegmentOnly) {
//Segment &seg = strip.getMainSegment();
if ((theMainSeg) && (pix < theMainSegLength)) theMainSeg->setPixelColor(pix, r, g, b, w); // WLEDMM used cached main segment
if ((theMainSeg) && (unsigned(pix) < theMainSegLength)) theMainSeg->setPixelColor(pix, r, g, b, w); // WLEDMM used cached main segment
} else {
strip.setPixelColor(pix, r, g, b, w);
}