Bugfix.
Debugging info added.
This commit is contained in:
parent
85ded6e500
commit
312cbc86e9
@ -1089,14 +1089,11 @@ void WS2812FX::deserializeMap(uint8_t n) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(5)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEBUG_PRINT(F("Reading LED map from "));
|
DEBUG_PRINT(F("Reading LED map from "));
|
||||||
DEBUG_PRINTLN(fileName);
|
DEBUG_PRINTLN(fileName);
|
||||||
|
@ -425,14 +425,11 @@ void deserializeConfigFromFS() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(1)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEBUG_PRINTLN(F("Reading settings from /cfg.json..."));
|
DEBUG_PRINTLN(F("Reading settings from /cfg.json..."));
|
||||||
|
|
||||||
@ -456,14 +453,11 @@ void serializeConfig() {
|
|||||||
|
|
||||||
DEBUG_PRINTLN(F("Writing settings to /cfg.json..."));
|
DEBUG_PRINTLN(F("Writing settings to /cfg.json..."));
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(2)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonArray rev = doc.createNestedArray("rev");
|
JsonArray rev = doc.createNestedArray("rev");
|
||||||
rev.add(1); //major settings revision
|
rev.add(1); //major settings revision
|
||||||
@ -777,14 +771,11 @@ void serializeConfig() {
|
|||||||
bool deserializeConfigSec() {
|
bool deserializeConfigSec() {
|
||||||
DEBUG_PRINTLN(F("Reading settings from /wsec.json..."));
|
DEBUG_PRINTLN(F("Reading settings from /wsec.json..."));
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(3)) return false;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool success = readObjectFromFile("/wsec.json", nullptr, &doc);
|
bool success = readObjectFromFile("/wsec.json", nullptr, &doc);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -829,14 +820,11 @@ bool deserializeConfigSec() {
|
|||||||
void serializeConfigSec() {
|
void serializeConfigSec() {
|
||||||
DEBUG_PRINTLN(F("Writing settings to /wsec.json..."));
|
DEBUG_PRINTLN(F("Writing settings to /wsec.json..."));
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(4)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonObject nw = doc.createNestedObject("nw");
|
JsonObject nw = doc.createNestedObject("nw");
|
||||||
|
|
||||||
|
@ -1066,6 +1066,7 @@ function updateSelectedFx()
|
|||||||
var parent = gId('fxlist');
|
var parent = gId('fxlist');
|
||||||
var selEffectInput = parent.querySelector(`input[name="fx"][value="${selectedFx}"]`);
|
var selEffectInput = parent.querySelector(`input[name="fx"][value="${selectedFx}"]`);
|
||||||
if (selEffectInput) selEffectInput.checked = true;
|
if (selEffectInput) selEffectInput.checked = true;
|
||||||
|
console.log(selEffectInput);
|
||||||
|
|
||||||
var selElement = parent.querySelector('.selected');
|
var selElement = parent.querySelector('.selected');
|
||||||
if (selElement) selElement.classList.remove('selected');
|
if (selElement) selElement.classList.remove('selected');
|
||||||
@ -1106,7 +1107,7 @@ function makeWS() {
|
|||||||
jsonTimeout = null;
|
jsonTimeout = null;
|
||||||
lastUpdate = new Date();
|
lastUpdate = new Date();
|
||||||
clearErrorToast();
|
clearErrorToast();
|
||||||
gId('connind').style.backgroundColor = "var(--c-l)";
|
gId('connind').style.backgroundColor = "var(--c-l)";
|
||||||
// json object should contain json.info AND json.state (but may not)
|
// json object should contain json.info AND json.state (but may not)
|
||||||
var i = json.info;
|
var i = json.info;
|
||||||
if (i) {
|
if (i) {
|
||||||
|
@ -272,7 +272,7 @@ void sappends(char stype, const char* key, char* val);
|
|||||||
void prepareHostname(char* hostname);
|
void prepareHostname(char* hostname);
|
||||||
void _setRandomColor(bool _sec, bool fromButton);
|
void _setRandomColor(bool _sec, bool fromButton);
|
||||||
bool isAsterisksOnly(const char* str, byte maxLen);
|
bool isAsterisksOnly(const char* str, byte maxLen);
|
||||||
bool requestJSONBufferLock();
|
bool requestJSONBufferLock(uint8_t module=255);
|
||||||
void releaseJSONBufferLock();
|
void releaseJSONBufferLock();
|
||||||
|
|
||||||
//wled_eeprom.cpp
|
//wled_eeprom.cpp
|
||||||
|
@ -576,14 +576,11 @@ void decodeIRJson(uint32_t code)
|
|||||||
JsonObject jsonCmdObj;
|
JsonObject jsonCmdObj;
|
||||||
|
|
||||||
DEBUG_PRINTLN(F("IR JSON buffer requested."));
|
DEBUG_PRINTLN(F("IR JSON buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(6)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sprintf_P(objKey, PSTR("\"0x%lX\":"), (unsigned long)code);
|
sprintf_P(objKey, PSTR("\"0x%lX\":"), (unsigned long)code);
|
||||||
|
|
||||||
|
@ -917,15 +917,12 @@ void serveJson(AsyncWebServerRequest* request)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
AsyncJsonResponse* response = new AsyncJsonResponse(JSON_BUFFER_SIZE);
|
AsyncJsonResponse* response = new AsyncJsonResponse(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(7)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AsyncJsonResponse *response = new AsyncJsonResponse(&doc);
|
AsyncJsonResponse *response = new AsyncJsonResponse(&doc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
JsonObject lDoc = response->getRoot();
|
JsonObject lDoc = response->getRoot();
|
||||||
|
|
||||||
|
@ -92,12 +92,9 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
|||||||
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
|
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
|
||||||
DEBUG_PRINTLN(F("MQTT JSON buffer requested."));
|
DEBUG_PRINTLN(F("MQTT JSON buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(8)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (payload[0] == '{') { //JSON API
|
if (payload[0] == '{') { //JSON API
|
||||||
deserializeJson(doc, payloadStr);
|
deserializeJson(doc, payloadStr);
|
||||||
|
@ -22,14 +22,11 @@ bool applyPreset(byte index, byte callMode)
|
|||||||
deserializeState(fdo, callMode, index);
|
deserializeState(fdo, callMode, index);
|
||||||
} else {
|
} else {
|
||||||
DEBUG_PRINTLN(F("Apply preset JSON buffer requested."));
|
DEBUG_PRINTLN(F("Apply preset JSON buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(9)) return false;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
errorFlag = readObjectFromFileUsingId(filename, index, &doc) ? ERR_NONE : ERR_FS_PLOAD;
|
errorFlag = readObjectFromFileUsingId(filename, index, &doc) ? ERR_NONE : ERR_FS_PLOAD;
|
||||||
JsonObject fdo = doc.as<JsonObject>();
|
JsonObject fdo = doc.as<JsonObject>();
|
||||||
@ -57,14 +54,11 @@ void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj)
|
|||||||
|
|
||||||
if (!fileDoc) {
|
if (!fileDoc) {
|
||||||
DEBUG_PRINTLN(F("Save preset JSON buffer requested."));
|
DEBUG_PRINTLN(F("Save preset JSON buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(10)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sObj = doc.to<JsonObject>();
|
sObj = doc.to<JsonObject>();
|
||||||
if (pname) sObj["n"] = pname;
|
if (pname) sObj["n"] = pname;
|
||||||
|
@ -415,14 +415,11 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
//USERMODS
|
//USERMODS
|
||||||
if (subPage == 8)
|
if (subPage == 8)
|
||||||
{
|
{
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(11)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonObject um = doc.createNestedObject("um");
|
JsonObject um = doc.createNestedObject("um");
|
||||||
|
|
||||||
|
@ -131,15 +131,20 @@ bool isAsterisksOnly(const char* str, byte maxLen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool requestJSONBufferLock()
|
bool requestJSONBufferLock(uint8_t module)
|
||||||
{
|
{
|
||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
|
|
||||||
while (jsonBufferLock && millis()-now < 1000) delay(1); // wait for a second for buffer lock
|
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)
|
fileDoc = &doc; // used for applying presets (presets.cpp)
|
||||||
doc.clear();
|
doc.clear();
|
||||||
return true;
|
return true;
|
||||||
@ -148,8 +153,11 @@ bool requestJSONBufferLock()
|
|||||||
|
|
||||||
void releaseJSONBufferLock()
|
void releaseJSONBufferLock()
|
||||||
{
|
{
|
||||||
#ifndef WLED_USE_DYNAMIC_JSON
|
DEBUG_PRINT(F("JSON buffer released. ("));
|
||||||
|
DEBUG_PRINT(jsonBufferLock);
|
||||||
|
DEBUG_PRINTLN(")");
|
||||||
fileDoc = nullptr;
|
fileDoc = nullptr;
|
||||||
jsonBufferLock = false;
|
#ifndef WLED_USE_DYNAMIC_JSON
|
||||||
#endif
|
jsonBufferLock = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
|
|||||||
#ifndef WLED_USE_DYNAMIC_JSON
|
#ifndef WLED_USE_DYNAMIC_JSON
|
||||||
WLED_GLOBAL StaticJsonDocument<JSON_BUFFER_SIZE> doc;
|
WLED_GLOBAL StaticJsonDocument<JSON_BUFFER_SIZE> doc;
|
||||||
#endif
|
#endif
|
||||||
WLED_GLOBAL volatile bool jsonBufferLock _INIT(false);
|
WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
|
||||||
|
|
||||||
// enable additional debug output
|
// enable additional debug output
|
||||||
#ifdef WLED_DEBUG
|
#ifdef WLED_DEBUG
|
||||||
|
@ -382,14 +382,11 @@ void deEEP() {
|
|||||||
|
|
||||||
DEBUG_PRINTLN(F("Preset file not found, attempting to load from EEPROM"));
|
DEBUG_PRINTLN(F("Preset file not found, attempting to load from EEPROM"));
|
||||||
DEBUGFS_PRINTLN(F("Allocating saving buffer for dEEP"));
|
DEBUGFS_PRINTLN(F("Allocating saving buffer for dEEP"));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(12)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonObject sObj = doc.to<JsonObject>();
|
JsonObject sObj = doc.to<JsonObject>();
|
||||||
sObj.createNestedObject("0");
|
sObj.createNestedObject("0");
|
||||||
@ -469,6 +466,7 @@ void deEEP() {
|
|||||||
File f = WLED_FS.open("/presets.json", "w");
|
File f = WLED_FS.open("/presets.json", "w");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
errorFlag = ERR_FS_GENERAL;
|
errorFlag = ERR_FS_GENERAL;
|
||||||
|
releaseJSONBufferLock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
serializeJson(doc, f);
|
serializeJson(doc, f);
|
||||||
|
@ -44,14 +44,11 @@ void handleSerial()
|
|||||||
else if (next == '{') { //JSON API
|
else if (next == '{') { //JSON API
|
||||||
bool verboseResponse = false;
|
bool verboseResponse = false;
|
||||||
DEBUG_PRINTLN(F("Serial JSON buffer requested."));
|
DEBUG_PRINTLN(F("Serial JSON buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(13)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Serial.setTimeout(100);
|
Serial.setTimeout(100);
|
||||||
DeserializationError error = deserializeJson(doc, Serial);
|
DeserializationError error = deserializeJson(doc, Serial);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -111,19 +111,18 @@ void initServer()
|
|||||||
bool isConfig = false;
|
bool isConfig = false;
|
||||||
{ //scope JsonDocument so it releases its buffer
|
{ //scope JsonDocument so it releases its buffer
|
||||||
DEBUG_PRINTLN(F("HTTP JSON buffer requested."));
|
DEBUG_PRINTLN(F("HTTP JSON buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(14)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DeserializationError error = deserializeJson(doc, (uint8_t*)(request->_tempObject));
|
DeserializationError error = deserializeJson(doc, (uint8_t*)(request->_tempObject));
|
||||||
JsonObject root = doc.as<JsonObject>();
|
JsonObject root = doc.as<JsonObject>();
|
||||||
if (error || root.isNull()) {
|
if (error || root.isNull()) {
|
||||||
request->send(400, "application/json", F("{\"error\":9}")); return;
|
releaseJSONBufferLock();
|
||||||
|
request->send(400, "application/json", F("{\"error\":9}"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const String& url = request->url();
|
const String& url = request->url();
|
||||||
isConfig = url.indexOf("cfg") > -1;
|
isConfig = url.indexOf("cfg") > -1;
|
||||||
|
@ -36,15 +36,12 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp
|
|||||||
}
|
}
|
||||||
bool verboseResponse = false;
|
bool verboseResponse = false;
|
||||||
{ //scope JsonDocument so it releases its buffer
|
{ //scope JsonDocument so it releases its buffer
|
||||||
DEBUG_PRINTLN(F("WS JSON receive buffer requested."));
|
DEBUG_PRINTLN(F("WS JSON receive buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(15)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DeserializationError error = deserializeJson(doc, data, len);
|
DeserializationError error = deserializeJson(doc, data, len);
|
||||||
JsonObject root = doc.as<JsonObject>();
|
JsonObject root = doc.as<JsonObject>();
|
||||||
@ -116,15 +113,12 @@ void sendDataWs(AsyncWebSocketClient * client)
|
|||||||
AsyncWebSocketMessageBuffer * buffer;
|
AsyncWebSocketMessageBuffer * buffer;
|
||||||
|
|
||||||
{ //scope JsonDocument so it releases its buffer
|
{ //scope JsonDocument so it releases its buffer
|
||||||
DEBUG_PRINTLN(F("WS JSON send buffer requested."));
|
DEBUG_PRINTLN(F("WS JSON send buffer requested."));
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(16)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonObject state = doc.createNestedObject("state");
|
JsonObject state = doc.createNestedObject("state");
|
||||||
serializeState(state);
|
serializeState(state);
|
||||||
|
@ -253,14 +253,11 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
// add reserved and usermod pins as d.um_p array
|
// add reserved and usermod pins as d.um_p array
|
||||||
oappend(SET_F("d.um_p=[6,7,8,9,10,11"));
|
oappend(SET_F("d.um_p=[6,7,8,9,10,11"));
|
||||||
|
|
||||||
#ifdef WLED_USE_DYNAMIC_JSON
|
#ifdef WLED_USE_DYNAMIC_JSON
|
||||||
DynamicJsonDocument doc(2048); // 2k is enough for usermods
|
DynamicJsonDocument doc(2048); // 2k is enough for usermods
|
||||||
#else
|
#else
|
||||||
if (!requestJSONBufferLock()) {
|
if (!requestJSONBufferLock(17)) return;
|
||||||
DEBUG_PRINTLN(F("ERROR: Locking JSON buffer failed!"));
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonObject mods = doc.createNestedObject(F("um"));
|
JsonObject mods = doc.createNestedObject(F("um"));
|
||||||
usermods.addToConfig(mods);
|
usermods.addToConfig(mods);
|
||||||
|
Loading…
Reference in New Issue
Block a user