diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index 3281f8733..333ad0a94 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -1634,7 +1634,7 @@ uint16_t WS2812FX::mode_fire_2012(void) { // Step 1. Cool down every cell a little for( int i = SEGMENT.start; i < SEGMENT.stop; i++) { - _locked[i] = qsub8(_locked[i], random8(0, ((COOLING * 10) / SEGLEN) + 2)); + _locked[i] = qsub8(_locked[i], random8(0, (((20 + SEGMENT.speed /3) * 10) / SEGLEN) + 2)); } // Step 2. Heat from each cell drifts 'up' and diffuses a little @@ -1653,7 +1653,7 @@ uint16_t WS2812FX::mode_fire_2012(void) CRGB color = ColorFromPalette( currentPalette, min(_locked[j],240), 255, LINEARBLEND); setPixelColor(j, color.red, color.green, color.blue); } - return 10 + (uint16_t)(255 - SEGMENT.speed)/6; + return 20; } diff --git a/wled00/src/dependencies/json/AsyncJson-v6.h b/wled00/src/dependencies/json/AsyncJson-v6.h index 72af53c09..c6ceeaf53 100644 --- a/wled00/src/dependencies/json/AsyncJson-v6.h +++ b/wled00/src/dependencies/json/AsyncJson-v6.h @@ -15,11 +15,7 @@ #include "ArduinoJson-v6.h" #include -#if ARDUINOJSON_VERSION_MAJOR == 5 - #define ARDUINOJSON_5_COMPATIBILITY -#else - #define DYNAMYC_JSON_DOCUMENT_SIZE 4096 -#endif +#define DYNAMYC_JSON_DOCUMENT_SIZE 4096 constexpr const char* JSON_MIMETYPE = "application/json"; @@ -57,27 +53,13 @@ class ChunkPrint : public Print { class AsyncJsonResponse: public AsyncAbstractResponse { private: -#ifdef ARDUINOJSON_5_COMPATIBILITY - DynamicJsonBuffer _jsonBuffer; -#else DynamicJsonDocument _jsonBuffer; -#endif JsonVariant _root; bool _isValid; public: -#ifdef ARDUINOJSON_5_COMPATIBILITY - AsyncJsonResponse(bool isArray=false): _isValid{false} { - _code = 200; - _contentType = JSON_MIMETYPE; - if(isArray) - _root = _jsonBuffer.createArray(); - else - _root = _jsonBuffer.createObject(); - } -#else AsyncJsonResponse(size_t maxJsonBufferSize = DYNAMYC_JSON_DOCUMENT_SIZE, bool isArray=false) : _jsonBuffer(maxJsonBufferSize), _isValid{false} { _code = 200; _contentType = JSON_MIMETYPE; @@ -86,18 +68,13 @@ class AsyncJsonResponse: public AsyncAbstractResponse { else _root = _jsonBuffer.createNestedObject(); } -#endif ~AsyncJsonResponse() {} JsonVariant & getRoot() { return _root; } bool _sourceValid() const { return _isValid; } size_t setLength() { -#ifdef ARDUINOJSON_5_COMPATIBILITY - _contentLength = _root.measureLength(); -#else _contentLength = measureJson(_root); -#endif if (_contentLength) { _isValid = true; } return _contentLength; @@ -108,16 +85,12 @@ class AsyncJsonResponse: public AsyncAbstractResponse { size_t _fillBuffer(uint8_t *data, size_t len){ ChunkPrint dest(data, _sentLength, len); -#ifdef ARDUINOJSON_5_COMPATIBILITY - _root.printTo( dest ) ; -#else serializeJson(_root, dest); -#endif return len; } }; -typedef std::function ArJsonRequestHandlerFunction; +typedef std::function ArJsonRequestHandlerFunction; class AsyncCallbackJsonWebHandler: public AsyncWebHandler { private: @@ -126,18 +99,12 @@ protected: WebRequestMethodComposite _method; ArJsonRequestHandlerFunction _onRequest; int _contentLength; -#ifndef ARDUINOJSON_5_COMPATIBILITY const size_t maxJsonBufferSize; -#endif int _maxContentLength; public: -#ifdef ARDUINOJSON_5_COMPATIBILITY - AsyncCallbackJsonWebHandler(const String& uri, ArJsonRequestHandlerFunction onRequest) - : _uri(uri), _method(HTTP_POST|HTTP_PUT|HTTP_PATCH), _onRequest(onRequest), _maxContentLength(16384) {} -#else + AsyncCallbackJsonWebHandler(const String& uri, ArJsonRequestHandlerFunction onRequest, size_t maxJsonBufferSize=DYNAMYC_JSON_DOCUMENT_SIZE) : _uri(uri), _method(HTTP_POST|HTTP_PUT|HTTP_PATCH), _onRequest(onRequest), maxJsonBufferSize(maxJsonBufferSize), _maxContentLength(16384) {} -#endif void setMethod(WebRequestMethodComposite method){ _method = method; } void setMaxContentLength(int maxContentLength){ _maxContentLength = maxContentLength; } @@ -161,16 +128,10 @@ public: if(_onRequest) { if (request->_tempObject != NULL) { -#ifdef ARDUINOJSON_5_COMPATIBILITY - DynamicJsonBuffer jsonBuffer; - JsonVariant json = jsonBuffer.parse((uint8_t*)(request->_tempObject)); - if (json.success()) { -#else DynamicJsonDocument jsonBuffer(this->maxJsonBufferSize); DeserializationError error = deserializeJson(jsonBuffer, (uint8_t*)(request->_tempObject)); if(!error) { - JsonVariant json = jsonBuffer.as(); -#endif + JsonObject json = jsonBuffer.as(); _onRequest(request, json); return; diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 2f7e4c27c..6aa5092fd 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -98,7 +98,7 @@ //version code in format yymmddb (b = daily build) -#define VERSION 1908211 +#define VERSION 1908251 char versionString[] = "0.8.5-dev"; diff --git a/wled00/wled18_server.ino b/wled00/wled18_server.ino index c0881161a..b9ceb9e8b 100644 --- a/wled00/wled18_server.ino +++ b/wled00/wled18_server.ino @@ -70,8 +70,7 @@ void initServer() serveJson(request); }); - AsyncCallbackJsonWebHandler* handler = new AsyncCallbackJsonWebHandler("/json", [](AsyncWebServerRequest *request, JsonVariant &json) { - JsonObject root = json.to(); + AsyncCallbackJsonWebHandler* handler = new AsyncCallbackJsonWebHandler("/json", [](AsyncWebServerRequest *request, JsonObject root) { if (root.isNull()){request->send(500, "application/json", "{\"error\":\"Parsing failed\"}"); return;} if (deserializeState(root)) { serveJson(request); return; } //if JSON contains "v" (verbose response) request->send(200, "application/json", "{\"success\":true}");