Async response bugfix.

This commit is contained in:
Blaz Kristan 2021-11-05 23:00:38 +01:00
parent 1bc15a8507
commit b93d72296c
3 changed files with 6 additions and 3 deletions

View File

@ -914,7 +914,10 @@ void serveJson(AsyncWebServerRequest* request)
} }
//AsyncJsonResponse* response = new AsyncJsonResponse(JSON_BUFFER_SIZE); //AsyncJsonResponse* response = new AsyncJsonResponse(JSON_BUFFER_SIZE);
while (jsonBufferLock) delay(1);
jsonBufferLock = true; jsonBufferLock = true;
doc.clear();
AsyncJsonResponse *response = new AsyncJsonResponse(&doc); AsyncJsonResponse *response = new AsyncJsonResponse(&doc);
JsonObject lDoc = response->getRoot(); JsonObject lDoc = response->getRoot();

View File

@ -68,9 +68,9 @@ class AsyncJsonResponse: public AsyncAbstractResponse {
_code = 200; _code = 200;
_contentType = JSON_MIMETYPE; _contentType = JSON_MIMETYPE;
if(isArray) if(isArray)
_root = ref->as<JsonArray>(); _root = ref->to<JsonArray>();
else else
_root = ref->as<JsonObject>(); _root = ref->to<JsonObject>();
} }
AsyncJsonResponse(size_t maxJsonBufferSize = DYNAMIC_JSON_DOCUMENT_SIZE, bool isArray=false) : _jsonBuffer(maxJsonBufferSize), _isValid{false} { AsyncJsonResponse(size_t maxJsonBufferSize = DYNAMIC_JSON_DOCUMENT_SIZE, bool isArray=false) : _jsonBuffer(maxJsonBufferSize), _isValid{false} {

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2111041 #define VERSION 2111051
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG