From 4345b32f974c36dd758673d020c0ec0503d7f24c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 22 Dec 2025 18:33:46 +0100 Subject: [PATCH] protect WS2812FX::resetSegments boundsOnly path the "boundsOnly" case can lead to ldsrgb re-allocation - better to protect it with segmentMux, too --- wled00/FX_fcn.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 563ff11d..d33843cb 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -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); } }