Added conditional compile for dynamic JSON buffer.

- WLED_USE_DYNAMIC_JSON
Minor fixes.
This commit is contained in:
Blaz Kristan
2021-11-07 11:58:16 +01:00
parent f7de055f67
commit f8da8f6929
17 changed files with 111 additions and 44 deletions

View File

@@ -91,14 +91,19 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
colorUpdated(CALL_MODE_DIRECT_CHANGE);
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
if (payload[0] == '{') { //JSON API
//DynamicJsonDocument doc(JSON_BUFFER_SIZE);
#ifdef WLED_USE_DYNAMIC_JSON
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
#else
while (jsonBufferLock) delay(1);
jsonBufferLock = true;
doc.clear();
#endif
deserializeJson(doc, payloadStr);
fileDoc = &doc;
deserializeState(doc.as<JsonObject>());
fileDoc = nullptr;
jsonBufferLock = false;
} else { //HTTP API
String apireq = "win&";