diff --git a/platformio.ini b/platformio.ini index c4e79a71..31cd30bd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -102,6 +102,14 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT # ------------------------------------------------------------------------------ build_flags = -g -w -DMQTT_MAX_PACKET_SIZE=1024 -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL -DBEARSSL_SSL_BASIC + #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here) + -D _IR_ENABLE_DEFAULT_=false + -D DECODE_HASH=true + -D DECODE_NEC=true + -D DECODE_SONY=true + -D DECODE_SAMSUNG=true + -D DECODE_LG=true + build_flags_esp8266 = ${common.build_flags} -DESP8266 build_flags_esp32 = ${common.build_flags} -DARDUINO_ARCH_ESP32 diff --git a/wled00/wled00.ino b/wled00/wled00.ino index fda0a110..325cc73e 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -119,7 +119,7 @@ #endif //version code in format yymmddb (b = daily build) -#define VERSION 2002292 +#define VERSION 2003031 char versionString[] = "0.9.1"; diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index b0da6451..acfc8dce 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -621,7 +621,7 @@ bool applyPreset(byte index, bool loadBri = true) return true; } -void savePreset(byte index) +void savePreset(byte index, bool persist = true) { if (index > 16) return; if (index < 1) {saveSettingsToEEPROM();return;} @@ -653,7 +653,7 @@ void savePreset(byte index) memcpy(EEPROM.getDataPtr() +i+2, seg, 240); } - commit(); + if (persist) commit(); savedToPresets(); currentPreset = index; isPreset = true; @@ -689,7 +689,7 @@ void applyMacro(byte index) } -void saveMacro(byte index, String mc, bool sing=true) //only commit on single save, not in settings +void saveMacro(byte index, String mc, bool persist = true) //only commit on single save, not in settings { index-=1; if (index > 15) return; @@ -698,5 +698,5 @@ void saveMacro(byte index, String mc, bool sing=true) //only commit on single sa { EEPROM.write(i, mc.charAt(i-s)); } - if (sing) commit(); + if (persist) commit(); } diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 69a7d9b7..d3897149 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -372,6 +372,13 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) DEBUG_PRINT("API req: "); DEBUG_PRINTLN(req); + //write presets and macros saved to flash directly? + bool persistSaves = true; + pos = req.indexOf("NP"); + if (pos > 0) { + persistSaves = false; + } + //save macro, requires &MS=() format pos = req.indexOf("&MS="); if (pos > 0) { @@ -381,7 +388,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) int en = req.indexOf(')'); String mc = req.substring(pos); if (en > 0) mc = req.substring(pos, en); - saveMacro(i, mc); + saveMacro(i, mc, persistSaves); } pos = req.indexOf("IN"); @@ -461,7 +468,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) if (pos > 0) presetApplyBri = (req.charAt(pos+3) != '0'); pos = req.indexOf("PS="); //saves current in preset - if (pos > 0) savePreset(getNumVal(&req, pos)); + if (pos > 0) savePreset(getNumVal(&req, pos), persistSaves); //apply preset if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) { diff --git a/wled00/wled19_json.ino b/wled00/wled19_json.ino index 4d935973..237912d6 100644 --- a/wled00/wled19_json.ino +++ b/wled00/wled19_json.ino @@ -156,8 +156,11 @@ bool deserializeState(JsonObject root) colorUpdated(noNotification ? NOTIFIER_CALL_MODE_NO_NOTIFY : NOTIFIER_CALL_MODE_DIRECT_CHANGE); + //write presets to flash directly? + bool persistSaves = !(root["np"] | false); + ps = root["psave"] | -1; - if (ps >= 0) savePreset(ps); + if (ps >= 0) savePreset(ps, persistSaves); return stateResponse; }