From 8b6cc708e77303231d7c7188fd039b892b279afc Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 30 Jun 2021 12:33:51 +0200 Subject: [PATCH 1/6] Fixed a problem with disabled buttons reverting to pin 0 causing conflict --- CHANGELOG.md | 4 ++++ wled00/cfg.cpp | 18 ++++++++---------- wled00/wled.cpp | 4 ---- wled00/wled.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8adcd896..88ced99ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ### Builds after release 0.12.0 +#### Build 2106301 + +- Fixed a problem with disabled buttons reverting to pin 0 causing conflict + #### Build 2106300 - Version bump to 0.13.0-b0 "Toki" diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index e594f2b75..ed64b1c34 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -23,7 +23,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { getStringFromJson(serverDescription, id[F("name")], 33); getStringFromJson(alexaInvocationName, id[F("inv")], 33); - JsonObject nw_ins_0 = doc["nw"][F("ins")][0]; + JsonObject nw_ins_0 = doc["nw"]["ins"][0]; getStringFromJson(clientSSID, nw_ins_0[F("ssid")], 33); //int nw_ins_0_pskl = nw_ins_0[F("pskl")]; //The WiFi PSK is normally not contained in the regular file for security reasons. @@ -129,14 +129,12 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { uint8_t s = 0; for (JsonObject btn : hw_btn_ins) { CJSON(buttonType[s], btn["type"]); - int8_t pin = btn[F("pin")][0] | -1; - if (pin > -1) { - if (pinManager.allocatePin(pin,false)) { - btnPin[s] = pin; - pinMode(btnPin[s], INPUT_PULLUP); - } else { - btnPin[s] = -1; - } + int8_t pin = btn["pin"][0] | -1; + if (pin > -1 && pinManager.allocatePin(pin,false)) { + btnPin[s] = pin; + pinMode(btnPin[s], INPUT_PULLUP); + } else { + btnPin[s] = -1; } JsonArray hw_btn_ins_0_macros = btn[F("macros")]; CJSON(macroButton[s], hw_btn_ins_0_macros[0]); @@ -736,7 +734,7 @@ bool deserializeConfigSec() { bool success = readObjectFromFile("/wsec.json", nullptr, &doc); if (!success) return false; - JsonObject nw_ins_0 = doc["nw"][F("ins")][0]; + JsonObject nw_ins_0 = doc["nw"]["ins"][0]; getStringFromJson(clientPass, nw_ins_0["psk"], 65); JsonObject ap = doc["ap"]; diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 2ac5dd00e..02eb0ce77 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -390,10 +390,6 @@ void WLED::beginStrip() // init relay pin if (rlyPin>=0) digitalWrite(rlyPin, (rlyMde ? bri : !bri)); - - // disable button if it is "pressed" unintentionally - //if (btnPin>=0 && buttonType == BTN_TYPE_PUSH && isButtonPressed()) - // buttonType = BTN_TYPE_NONE; } void WLED::initAP(bool resetAP) diff --git a/wled00/wled.h b/wled00/wled.h index c04a3b6bf..2bcfa6b61 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2106300 +#define VERSION 2106301 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG From 7483d3b229aeba6dfae03d15c3e71d05a71e18b5 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 30 Jun 2021 18:21:56 +0200 Subject: [PATCH 2/6] Fixed settings page broken by using "%" in input fields (fixes #1516 ) --- CHANGELOG.md | 4 ++++ wled00/wled.h | 2 +- wled00/xml.cpp | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88ced99ca..c53f4e744 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ### Builds after release 0.12.0 +#### Build 2106302 + +- Fixed settings page broken by using "%" in input fields + #### Build 2106301 - Fixed a problem with disabled buttons reverting to pin 0 causing conflict diff --git a/wled00/wled.h b/wled00/wled.h index 2bcfa6b61..662f84b0f 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2106301 +#define VERSION 2106302 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG diff --git a/wled00/xml.cpp b/wled00/xml.cpp index c12991fe6..aef0ec297 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -158,13 +158,24 @@ void sappends(char stype, const char* key, char* val) { switch(stype) { - case 's': //string (we can interpret val as char*) + case 's': { //string (we can interpret val as char*) oappend("d.Sf."); oappend(key); oappend(".value=\""); - oappend(val); + //convert "%" to "%%" to make EspAsyncWebServer happy + char buf[130]; + uint8_t len = strlen(val) +1; + uint8_t s = 0; + for (uint8_t i = 0; i < len; i++) { + buf[i+s] = val[i]; + if (val[i] == '%') { + s++; buf[i+s] = '%'; + } + } + + oappend(buf); oappend("\";"); - break; + break; } case 'm': //message oappend(SET_F("d.getElementsByClassName")); oappend(key); From 4aa53aa5a50c899ead4d035a3fbb0d4b1b77846b Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 30 Jun 2021 21:53:22 +0200 Subject: [PATCH 3/6] Adjust input field widths --- platformio.ini | 4 +- wled00/data/settings_leds.htm | 30 ++++----- wled00/data/settings_wifi.htm | 26 ++++---- wled00/data/style.css | 8 ++- wled00/html_settings.h | 121 +++++++++++++++++----------------- 5 files changed, 99 insertions(+), 90 deletions(-) diff --git a/platformio.ini b/platformio.ini index f30db4e08..7b50f693f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -261,7 +261,7 @@ build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED [env:esp32dev] board = esp32dev -platform = espressif32@3.2 +platform = espressif32@2.0 build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 lib_ignore = @@ -270,7 +270,7 @@ lib_ignore = [env:esp32_eth] board = esp32-poe -platform = espressif32@3.2 +platform = espressif32@2.0 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 diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 53c935764..6767f5da9 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -252,11 +252,11 @@ Color Order:
-Pin: -Clock: - - - +Pin: +Clock: + + +
Start:  
@@ -315,7 +315,7 @@ Reverse (rotated 180°):
Enable automatic brightness limiter:
- Maximum Current: mA
+ Maximum Current: mA

- Touch threshold:
- IR pin:  
+ IR pin:    ×
IR info
- Relay pin: Invert  ×
+ Relay pin: Invert  ×

Defaults

Turn LEDs on after power up/reset:
- Default brightness: (0-255)

- Apply preset at boot (0 uses defaults) + Default brightness: (0-255)

+ Apply preset at boot (0 uses defaults)

Use Gamma correction for color: (strongly recommended)
Use Gamma correction for brightness: (not recommended)

- Brightness factor: % + Brightness factor: %

Transitions

Crossfade:
- Transition Time: ms
+ Transition Time: ms
Enable Palette transitions:

Timed light

- Default Duration: min
- Default Target brightness:
+ Default Duration: min
+ Default Target brightness:
Mode:
Network password:

Static IP (leave at 0.0.0.0 for DHCP):
- . - . - . -
+ . + . + . +
Static gateway:
- . - . - . -
+ . + . + . +
Static subnet mask:
- . - . - . -
+ . + . + . +
mDNS address (leave empty for no mDNS):
http:// .local
Client IP: Not connected
@@ -52,7 +52,7 @@ AP SSID (leave empty for no AP):

Hide AP name:
AP password (leave empty for open):

- Access Point WiFi channel:
+ Access Point WiFi channel:
AP opens:
Network password:

Static IP (leave at 0.0.0.0 for DHCP):
. . .
Static gateway:
. . .
Static subnet mask:
. - . .
-mDNS address (leave empty for no mDNS):
http:// .local
Client IP: Not connected
-

Configure Access Point

AP SSID (leave empty for no AP):

Hide AP name:
-AP password (leave empty for open):

-Access Point WiFi channel:
AP opens:
AP IP: Not active

Experimental

-Disable WiFi sleep:
-Can help with connectivity issues.
+class="small" min="0" max="255" required> . . .
Static gateway:
. . .
+Static subnet mask:
. . .
mDNS address (leave empty for no mDNS):
http:// .local
Client IP: Not connected +

Configure Access Point

AP SSID (leave empty for no AP):
+
Hide AP name:
AP password (leave empty for open):

Access Point WiFi channel:
AP opens: +
AP IP: +Not active

Experimental

Disable WiFi sleep:
Can help with connectivity issues.
Do not enable if WiFi is working correctly, increases power consumption.

Ethernet Type