From 2775b16141d6d82c57931c6fd2cb18965367de9e Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 23 Dec 2025 01:59:59 +0100 Subject: [PATCH] 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) --- wled00/json.cpp | 4 ++-- wled00/wled.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index efb692da..ded1be1f 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -540,9 +540,9 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) #ifdef ARDUINO_ARCH_ESP32 // WLEDMM: Acquire strip lock right before segment operations (deferred for better UX) suspendStripService = true; // temporarily lock out strip updates - delay(2); // WLEDMM experimental - de-serialize takes time, so allow other tasks to run + vTaskDelay(pdMS_TO_TICKS(2)); // WLEDMM trigger a short task context switch if (strip.isServicing()) { - USER_PRINTLN(F("deserializeState(): strip is still drawing effects.")); + DEBUG_PRINTLN(F("deserializeState(): strip is still drawing effects.")); strip.waitUntilIdle(); } #endif diff --git a/wled00/wled.h b/wled00/wled.h index f3abbb7d..b87368bc 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -771,7 +771,7 @@ WLED_GLOBAL volatile bool OTAisRunning _INIT(false); // WLEDMM temporaril WLED_GLOBAL SemaphoreHandle_t busDrawMux _INIT(nullptr); WLED_GLOBAL SemaphoreHandle_t segmentMux _INIT(nullptr); WLED_GLOBAL SemaphoreHandle_t jsonBufferLockMutex _INIT(nullptr); -#define esp32SemTake(mux,timeout) xSemaphoreTakeRecursive(mux, timeout) // convenience macro that expands to xSemaphoreTakeRecursive +#define esp32SemTake(mux,timeout) xSemaphoreTakeRecursive(mux, pdMS_TO_TICKS(timeout)) // convenience macro that expands to xSemaphoreTakeRecursive - timeout is in milliseconds #define esp32SemGive(mux) xSemaphoreGiveRecursive(mux) // convenience macro that expands to xSemaphoreGiveRecursive #define WLED_create_spinlock(theSname) static portMUX_TYPE theSname = portMUX_INITIALIZER_UNLOCKED #else