Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions wled00/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 1 addition & 4 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,17 +854,14 @@ 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);
#else
WLED_GLOBAL StaticJsonDocument<JSON_BUFFER_SIZE> 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)
Expand Down
Loading