Bugfix.
Debugging info added.
This commit is contained in:
@@ -131,15 +131,20 @@ bool isAsterisksOnly(const char* str, byte maxLen)
|
||||
}
|
||||
|
||||
|
||||
bool requestJSONBufferLock()
|
||||
bool requestJSONBufferLock(uint8_t module)
|
||||
{
|
||||
unsigned long now = millis();
|
||||
|
||||
while (jsonBufferLock && millis()-now < 1000) delay(1); // wait for a second for buffer lock
|
||||
|
||||
if (millis()-now >= 1000) return false; // waiting time-outed
|
||||
if (millis()-now >= 1000) {
|
||||
DEBUG_PRINT(F("ERROR: Locking JSON buffer failed! ("));
|
||||
DEBUG_PRINT(jsonBufferLock);
|
||||
DEBUG_PRINTLN(")");
|
||||
return false; // waiting time-outed
|
||||
}
|
||||
|
||||
jsonBufferLock = true;
|
||||
jsonBufferLock = module ? module : 255;
|
||||
fileDoc = &doc; // used for applying presets (presets.cpp)
|
||||
doc.clear();
|
||||
return true;
|
||||
@@ -148,8 +153,11 @@ bool requestJSONBufferLock()
|
||||
|
||||
void releaseJSONBufferLock()
|
||||
{
|
||||
#ifndef WLED_USE_DYNAMIC_JSON
|
||||
DEBUG_PRINT(F("JSON buffer released. ("));
|
||||
DEBUG_PRINT(jsonBufferLock);
|
||||
DEBUG_PRINTLN(")");
|
||||
fileDoc = nullptr;
|
||||
jsonBufferLock = false;
|
||||
#endif
|
||||
#ifndef WLED_USE_DYNAMIC_JSON
|
||||
jsonBufferLock = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user