Skip to content

Commit 4345b32

Browse files
committed
protect WS2812FX::resetSegments boundsOnly path
the "boundsOnly" case can lead to ldsrgb re-allocation - better to protect it with segmentMux, too
1 parent 3934438 commit 4345b32

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

wled00/FX_fcn.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,6 +2405,8 @@ void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly
24052405
_mainSegment = 0;
24062406
esp32SemGive(segmentMux);
24072407
} else { //WLEDMM boundsonly
2408+
// WLEDMM protect against parallel access while drawing
2409+
if (esp32SemTake(segmentMux, 2100) != pdTRUE) return; // wait long, but don't wait forever
24082410
for (segment &seg : _segments) {
24092411
#ifndef WLED_DISABLE_2D
24102412
seg.start = 0;
@@ -2417,6 +2419,7 @@ void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly
24172419
#endif
24182420
seg.allocLeds();
24192421
}
2422+
esp32SemGive(segmentMux);
24202423
}
24212424
}
24222425

0 commit comments

Comments
 (0)