Skip to content

Commit 2775b16

Browse files
committed
clarifications (minor)
* replace delay by vTaskDelay (same behaviour) * degrade user message to debug (expected behaviour -> no message) * add pdMS_TO_TICKS to esp32SemTake macro (future proof)
1 parent 655330d commit 2775b16

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

wled00/json.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,9 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
540540
#ifdef ARDUINO_ARCH_ESP32
541541
// WLEDMM: Acquire strip lock right before segment operations (deferred for better UX)
542542
suspendStripService = true; // temporarily lock out strip updates
543-
delay(2); // WLEDMM experimental - de-serialize takes time, so allow other tasks to run
543+
vTaskDelay(pdMS_TO_TICKS(2)); // WLEDMM trigger a short task context switch
544544
if (strip.isServicing()) {
545-
USER_PRINTLN(F("deserializeState(): strip is still drawing effects."));
545+
DEBUG_PRINTLN(F("deserializeState(): strip is still drawing effects."));
546546
strip.waitUntilIdle();
547547
}
548548
#endif

wled00/wled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ WLED_GLOBAL volatile bool OTAisRunning _INIT(false); // WLEDMM temporaril
771771
WLED_GLOBAL SemaphoreHandle_t busDrawMux _INIT(nullptr);
772772
WLED_GLOBAL SemaphoreHandle_t segmentMux _INIT(nullptr);
773773
WLED_GLOBAL SemaphoreHandle_t jsonBufferLockMutex _INIT(nullptr);
774-
#define esp32SemTake(mux,timeout) xSemaphoreTakeRecursive(mux, timeout) // convenience macro that expands to xSemaphoreTakeRecursive
774+
#define esp32SemTake(mux,timeout) xSemaphoreTakeRecursive(mux, pdMS_TO_TICKS(timeout)) // convenience macro that expands to xSemaphoreTakeRecursive - timeout is in milliseconds
775775
#define esp32SemGive(mux) xSemaphoreGiveRecursive(mux) // convenience macro that expands to xSemaphoreGiveRecursive
776776
#define WLED_create_spinlock(theSname) static portMUX_TYPE theSname = portMUX_INITIALIZER_UNLOCKED
777777
#else

0 commit comments

Comments
 (0)