diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fbe900f..91619a89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ### WLED version 0.11.0 +#### Build 2011290 + +- Release of WLED 0.11.0 "Mirai" +- Workaround for weird empty %f Espalexa issue +- Fixed crash on saving preset with HTTP API `PS` +- Improved performance for color changes in non-main segment + #### Build 2011270 - Added tooltips for speed and intensity sliders (PR #1378) diff --git a/wled00/json.cpp b/wled00/json.cpp index d8d8f57e..7c3ce05f 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -68,6 +68,7 @@ void deserializeSegment(JsonObject elem, byte it) if (i == 1) {colSec[0] = rgbw[0]; colSec[1] = rgbw[1]; colSec[2] = rgbw[2]; colSec[3] = rgbw[3];} } else { //normal case, apply directly to segment (=> no transition!) seg.colors[i] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF))); + if (seg.mode == FX_MODE_STATIC) strip.trigger(); //instant refresh } } } diff --git a/wled00/presets.cpp b/wled00/presets.cpp index e5e2015f..7fd2e5d2 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -37,33 +37,37 @@ bool applyPreset(byte index) void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj) { if (index == 0 || index > 250) return; - bool docAlloc = fileDoc; + bool docAlloc = (fileDoc != nullptr); JsonObject sObj = saveobj; if (!docAlloc) { DEBUGFS_PRINTLN(F("Allocating saving buffer")); - fileDoc = new DynamicJsonDocument(JSON_BUFFER_SIZE); - sObj = fileDoc->to(); + DynamicJsonDocument lDoc(JSON_BUFFER_SIZE); + sObj = lDoc.to(); if (pname) sObj["n"] = pname; - } else { + DEBUGFS_PRINTLN(F("Save current state")); + serializeState(sObj, true); + currentPreset = index; + + writeObjectToFileUsingId("/presets.json", index, &lDoc); + } else { //from JSON API DEBUGFS_PRINTLN(F("Reuse recv buffer")); sObj.remove(F("psave")); sObj.remove(F("v")); - } - if (!sObj["o"]) { - DEBUGFS_PRINTLN(F("Save current state")); - serializeState(sObj, true, sObj["ib"], sObj["sb"]); - currentPreset = index; - } - sObj.remove("o"); - sObj.remove("ib"); - sObj.remove("sb"); - sObj.remove(F("error")); - sObj.remove(F("time")); + if (!sObj["o"]) { + DEBUGFS_PRINTLN(F("Save current state")); + serializeState(sObj, true, sObj["ib"], sObj["sb"]); + currentPreset = index; + } + sObj.remove("o"); + sObj.remove("ib"); + sObj.remove("sb"); + sObj.remove(F("error")); + sObj.remove(F("time")); - writeObjectToFileUsingId("/presets.json", index, fileDoc); - if (!docAlloc) delete fileDoc; + writeObjectToFileUsingId("/presets.json", index, fileDoc); + } presetsModifiedTime = now(); //unix time updateFSInfo(); } diff --git a/wled00/src/dependencies/espalexa/Espalexa.h b/wled00/src/dependencies/espalexa/Espalexa.h index cf42f9ff..b0962c49 100644 --- a/wled00/src/dependencies/espalexa/Espalexa.h +++ b/wled00/src/dependencies/espalexa/Espalexa.h @@ -144,8 +144,11 @@ private: char buf_col[80] = ""; //color support if (static_cast(dev->getType()) > 2) - sprintf_P(buf_col,PSTR(",\"hue\":%u,\"sat\":%u,\"effect\":\"none\",\"xy\":[%f,%f]") - ,dev->getHue(), dev->getSat(), dev->getX(), dev->getY()); + //TODO: %f is not working for some reason on ESP8266 in v0.11.0 (was fine in 0.10.2). Need to investigate + //sprintf_P(buf_col,PSTR(",\"hue\":%u,\"sat\":%u,\"effect\":\"none\",\"xy\":[%f,%f]") + // ,dev->getHue(), dev->getSat(), dev->getX(), dev->getY()); + sprintf_P(buf_col,PSTR(",\"hue\":%u,\"sat\":%u,\"effect\":\"none\",\"xy\":[%s,%s]"),dev->getHue(), dev->getSat(), + ((String)dev->getX()).c_str(), ((String)dev->getY()).c_str()); char buf_ct[16] = ""; //white spectrum support diff --git a/wled00/wled.h b/wled00/wled.h index 6a9048a5..f56bc1e8 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2011270 +#define VERSION 2011290 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG