diff --git a/wled00/util.cpp b/wled00/util.cpp index 8ac46c77df..5063c1180b 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -262,6 +262,13 @@ size_t utf8_strlen(const char *s) return len; } +// Runtime state private to this file - previously WLED_GLOBAL, a leftover from +// when all state lived in one big extern block regardless of who used it. +#if defined(ARDUINO_ARCH_ESP32) +static SemaphoreHandle_t jsonBufferLockMutex = xSemaphoreCreateRecursiveMutex(); +#endif +static volatile uint8_t jsonBufferLock = 0; + //threading/network callback details: https://github.com/wled-dev/WLED/pull/2336#discussion_r762276994 bool requestJSONBufferLock(uint8_t moduleID) { diff --git a/wled00/wled.h b/wled00/wled.h index 9bafb49196..bee7dbf9c2 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -854,9 +854,7 @@ WLED_GLOBAL int8_t spi_sclk _INIT(SPISCLKPIN); #endif // global ArduinoJson buffer -#if defined(ARDUINO_ARCH_ESP32) -WLED_GLOBAL SemaphoreHandle_t jsonBufferLockMutex _INIT(xSemaphoreCreateRecursiveMutex()); -#endif +// jsonBufferLockMutex/jsonBufferLock are private to util.cpp - see there. #ifdef BOARD_HAS_PSRAM // if board has PSRAM, use it for JSON document (allocated in setup()) WLED_GLOBAL JsonDocument *pDoc _INIT(nullptr); @@ -864,7 +862,6 @@ WLED_GLOBAL JsonDocument *pDoc _INIT(nullptr); WLED_GLOBAL StaticJsonDocument gDoc; WLED_GLOBAL JsonDocument *pDoc _INIT(&gDoc); #endif -WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0); // enable additional debug output #if defined(WLED_DEBUG_HOST)