From 0234017ca1e2b9bede3d05b2477e0ed90721cd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Tue, 15 Mar 2022 09:55:23 +0100 Subject: [PATCH] Merge branch 'master' into master-merge --- .github/ISSUE_TEMPLATE/bug.yml | 2 +- CHANGELOG.md | 24 +++++++++++++++++- platformio.ini | 2 +- platformio_override.ini.sample | 17 +++++++++++++ .../usermod_v2_auto_save.h | 2 +- .../word-clock-matrix/word-clock-matrix.cpp | 4 +-- wled00/bus_wrapper.h | 2 +- wled00/button.cpp | 25 +++++++++++-------- wled00/fcn_declare.h | 4 +-- wled00/ir.cpp | 2 +- wled00/json.cpp | 2 +- wled00/presets.cpp | 6 ++--- wled00/wled.h | 8 ++++-- 13 files changed, 73 insertions(+), 27 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 0a8e61e8f..ac2a12149 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -45,7 +45,7 @@ body: attributes: label: What version of WLED? description: You can find this in by going to Config -> Security & Updates -> Scroll to Bottom. Copy and paste the entire line after "Server message" - placeholder: "e.g. WLED 0.13.0-b7 (build 2202222)" + placeholder: "e.g. WLED 0.13.1 (build 2203150)" validations: required: true - type: dropdown diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d2fc81da..5c25fc32d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,28 @@ ## WLED changelog -### Builds after release 0.12.0 +### WLED release 0.13.1 + +#### Build 2203150 + +- Version bump to v0.13.1 "Toki" +- Fix persistent preset bug, preventing save of new presets + +### WLED release 0.13.0 + +#### Build 2203142 + +- Release of WLED v0.13.0 "Toki" +- Reduce APA102 hardware SPI frequency to 5Mhz +- Remove `persistent` parameter in `savePreset()` + +### Builds between releases 0.12.0 and 0.13.0 + +#### Build 2203140 + +- Added factory reset by pressing button 0 for >10 seconds +- Added ability to set presets from DMX Effect mode +- Simplified label hiding JS in user interface +- Fixed JSON `{"live":true}` indefinite realtime mode #### Build 2203080 diff --git a/platformio.ini b/platformio.ini index ee227904a..15975d854 100644 --- a/platformio.ini +++ b/platformio.ini @@ -337,7 +337,7 @@ platform = ${esp32.platform} platform_packages = ${esp32.platform_packages} upload_speed = 921600 build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 +build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 -D WLED_DISABLE_BLYNK lib_deps = ${esp32.lib_deps} board_build.partitions = ${esp32.default_partitions} diff --git a/platformio_override.ini.sample b/platformio_override.ini.sample index c8fb311fe..422a5f7e9 100644 --- a/platformio_override.ini.sample +++ b/platformio_override.ini.sample @@ -19,6 +19,11 @@ build_flags = ${common.build_flags_esp8266} ; *** Use custom settings from file my_config.h -DWLED_USE_MY_CONFIG ; ********************************************************************* +; +; +; *** To use the below defines/overrides, copy and paste each onto it's own line just below build_flags in the section above. +; +; disable specific features ; -D WLED_DISABLE_OTA ; -D WLED_DISABLE_ALEXA ; -D WLED_DISABLE_BLYNK @@ -44,3 +49,15 @@ build_flags = ${common.build_flags_esp8266} ; for the Magic Home LED Controller use PWM pins 5,12,13,15 ; for the H801 controller use PINs 15,13,12,14 (W2 = 04) ; for the BW-LT11 controller use PINs 12,4,14,5 +; +; set the name of the module - make sure there is a quote-backslash-quote before the name and a backslash-quote-quote after the name +; -D SERVERNAME="\"WLED\"" +; +; set the number of LEDs +; -D DEFAULT_LED_COUNT=30 +; +; set milliampere limit when using ESP pin to power leds +; -D ABL_MILLIAMPS_DEFAULT =850 +; +; enable IR by setting remote type +; -D IRTYPE=0 //0 Remote disabled | 1 24-key RGB | 2 24-key with CT | 3 40-key blue | 4 40-key RGB | 5 21-key RGB | 6 6-key black | 7 9-key red | 8 JSON remote diff --git a/usermods/usermod_v2_auto_save/usermod_v2_auto_save.h b/usermods/usermod_v2_auto_save/usermod_v2_auto_save.h index 720f5abbc..4cd728d8f 100644 --- a/usermods/usermod_v2_auto_save/usermod_v2_auto_save.h +++ b/usermods/usermod_v2_auto_save/usermod_v2_auto_save.h @@ -64,8 +64,8 @@ class AutoSaveUsermod : public Usermod { PSTR("~ %02d-%02d %02d:%02d:%02d ~"), month(localTime), day(localTime), hour(localTime), minute(localTime), second(localTime)); - savePreset(autoSavePreset, true, presetNameBuffer); cacheInvalidate++; // force reload of presets + savePreset(autoSavePreset, presetNameBuffer); } void inline displayOverlay() { diff --git a/usermods/word-clock-matrix/word-clock-matrix.cpp b/usermods/word-clock-matrix/word-clock-matrix.cpp index 5c8985f17..628b52625 100644 --- a/usermods/word-clock-matrix/word-clock-matrix.cpp +++ b/usermods/word-clock-matrix/word-clock-matrix.cpp @@ -65,7 +65,7 @@ void hourChime() //strip.resetSegments(); selectWordSegments(true); colorUpdated(CALL_MODE_FX_CHANGED); - savePreset(13, false); + //savePreset(255); selectWordSegments(false); //strip.getSegment(0).setOption(0, true); strip.getSegment(0).setOption(2, true); @@ -299,7 +299,7 @@ void userLoop() if (minute(localTime) == 1){ //turn off background segment; strip.getSegment(0).setOption(2, false); - //applyPreset(13); + //applyPreset(255); } } } diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index 7950b8fd4..2ea04475f 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -133,7 +133,7 @@ #endif //APA102 -#define B_HS_DOT_3 NeoPixelBrightnessBus //hardware SPI +#define B_HS_DOT_3 NeoPixelBrightnessBus //hardware SPI #define B_SS_DOT_3 NeoPixelBrightnessBus //soft SPI //LPD8806 diff --git a/wled00/button.cpp b/wled00/button.cpp index 98775b63a..b7489052a 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -4,11 +4,12 @@ * Physical IO */ -#define WLED_DEBOUNCE_THRESHOLD 50 //only consider button input of at least 50ms as valid (debouncing) -#define WLED_LONG_PRESS 600 //long press if button is released after held for at least 600ms -#define WLED_DOUBLE_PRESS 350 //double press if another press within 350ms after a short press -#define WLED_LONG_REPEATED_ACTION 333 //how often a repeated action (e.g. dimming) is fired on long press on button IDs >0 -#define WLED_LONG_AP 6000 //how long the button needs to be held to activate WLED-AP +#define WLED_DEBOUNCE_THRESHOLD 50 // only consider button input of at least 50ms as valid (debouncing) +#define WLED_LONG_PRESS 600 // long press if button is released after held for at least 600ms +#define WLED_DOUBLE_PRESS 350 // double press if another press within 350ms after a short press +#define WLED_LONG_REPEATED_ACTION 300 // how often a repeated action (e.g. dimming) is fired on long press on button IDs >0 +#define WLED_LONG_AP 5000 // how long button 0 needs to be held to activate WLED-AP +#define WLED_LONG_FACTORY_RESET 10000 // how long button 0 needs to be held to trigger a factory reset static const char _mqtt_topic_button[] PROGMEM = "%s/button/%d"; // optimize flash usage @@ -237,12 +238,14 @@ void handleButton() bool doublePress = buttonWaitTime[b]; //did we have a short press before? buttonWaitTime[b] = 0; - if (b == 0 && dur > 2*WLED_LONG_AP) { //very long press on button 0 (when released) - WLED_FS.format(); - clearEEPROM(); - doReboot = true; - } else if (b == 0 && dur > WLED_LONG_AP) { //long press on button 0 (when released) - WLED::instance().initAP(true); + if (b == 0 && dur > WLED_LONG_AP) { // long press on button 0 (when released) + if (dur > WLED_LONG_FACTORY_RESET) { // factory reset if pressed > 10 seconds + WLED_FS.format(); + clearEEPROM(); + doReboot = true; + } else { + WLED::instance().initAP(true); + } } else if (!buttonLongPressed[b]) { //short press //NOTE: this interferes with double click handling in usermods so usermod needs to implement full button handling if (b != 1 && !macroDoublePress[b]) { //don't wait for double press on buttons without a default action if no double press macro set diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 1404d013a..31faa05e4 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -193,8 +193,8 @@ void handlePlaylist(); void handlePresets(); bool applyPreset(byte index, byte callMode = CALL_MODE_DIRECT_CHANGE, bool fromJson = false); inline bool applyTemporaryPreset() {return applyPreset(255);}; -void savePreset(byte index, bool persist = true, const char* pname = nullptr, JsonObject saveobj = JsonObject()); -inline void saveTemporaryPreset() {savePreset(255, false);}; +void savePreset(byte index, const char* pname = nullptr, JsonObject saveobj = JsonObject()); +inline void saveTemporaryPreset() {savePreset(255);}; void deletePreset(byte index); //set.cpp diff --git a/wled00/ir.cpp b/wled00/ir.cpp index a3c6328b1..9222845b5 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -695,7 +695,7 @@ void decodeIRJson(uint32_t code) char pname[33]; sprintf_P(pname, PSTR("IR Preset %d"), psave); fdo.clear(); - if (psave > 0 && psave < 251) savePreset(psave, true, pname, fdo); + if (psave > 0 && psave < 251) savePreset(psave, pname, fdo); } } releaseJSONBufferLock(); diff --git a/wled00/json.cpp b/wled00/json.cpp index 2d6de84a5..39c26a3ce 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -335,7 +335,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) byte ps = root[F("psave")]; if (ps > 0) { DEBUG_PRINTLN(F("Saving preset")); - savePreset(ps, true, nullptr, root); + savePreset(ps, nullptr, root); } else { ps = root[F("pdel")]; //deletion if (ps > 0) { diff --git a/wled00/presets.cpp b/wled00/presets.cpp index 62f481f67..8e8493243 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -76,14 +76,14 @@ void handlePresets() } //called from handleSet(PS=) [network callback (fileDoc==nullptr), IR (irrational), deserializeState, UDP] and deserializeState() [network callback (filedoc!=nullptr)] -void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj) +void savePreset(byte index, const char* pname, JsonObject saveobj) { - if (index == 0 || (index > 250 && persist) || (index<255 && !persist)) return; - + if (index == 0 || (index > 250 && index < 255)) return; char tmp[12]; JsonObject sObj = saveobj; bool bufferAllocated = false; + bool persist = (index != 255); const char *filename = persist ? "/presets.json" : "/tmp.json"; if (!fileDoc) { diff --git a/wled00/wled.h b/wled00/wled.h index 045dc60e2..4aeda4e3d 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2203141 +#define VERSION 2203151 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG @@ -296,7 +296,11 @@ WLED_GLOBAL uint16_t transitionDelay _INIT(750); // default crossfade duratio WLED_GLOBAL byte briMultiplier _INIT(100); // % of brightness to set (to limit power, if you set it to 50 and set bri to 255, actual brightness will be 127) // User Interface CONFIG -WLED_GLOBAL char serverDescription[33] _INIT("WLED"); // Name of module +#ifndef SERVERNAME +WLED_GLOBAL char serverDescription[33] _INIT("WLED"); // Name of module - use default +#else +WLED_GLOBAL char serverDescription[33] _INIT(SERVERNAME); // use predefined name +#endif WLED_GLOBAL bool syncToggleReceive _INIT(false); // UIs which only have a single button for sync should toggle send+receive if this is true, only send otherwise WLED_GLOBAL bool simplifiedUI _INIT(false); // enable simplified UI WLED_GLOBAL byte cacheInvalidate _INIT(0); // used to invalidate browser cache when switching from regular to simplified UI