protect WS2812FX::resetSegments boundsOnly path

the "boundsOnly" case can lead to ldsrgb re-allocation - better to protect it with segmentMux, too
This commit is contained in:
Frank
2025-12-22 18:33:46 +01:00
parent 39344382c7
commit 4345b32f97

View File

@@ -2405,6 +2405,8 @@ void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly
_mainSegment = 0;
esp32SemGive(segmentMux);
} else { //WLEDMM boundsonly
// WLEDMM protect against parallel access while drawing
if (esp32SemTake(segmentMux, 2100) != pdTRUE) return; // wait long, but don't wait forever
for (segment &seg : _segments) {
#ifndef WLED_DISABLE_2D
seg.start = 0;
@@ -2417,6 +2419,7 @@ void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly
#endif
seg.allocLeds();
}
esp32SemGive(segmentMux);
}
}