Fixed a problem with disabled buttons reverting to pin 0 causing conflict

This commit is contained in:
cschwinne 2021-06-30 12:33:51 +02:00
parent 200960899e
commit 8b6cc708e7
4 changed files with 13 additions and 15 deletions

View File

@ -2,6 +2,10 @@
### Builds after release 0.12.0 ### Builds after release 0.12.0
#### Build 2106301
- Fixed a problem with disabled buttons reverting to pin 0 causing conflict
#### Build 2106300 #### Build 2106300
- Version bump to 0.13.0-b0 "Toki" - Version bump to 0.13.0-b0 "Toki"

View File

@ -23,7 +23,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
getStringFromJson(serverDescription, id[F("name")], 33); getStringFromJson(serverDescription, id[F("name")], 33);
getStringFromJson(alexaInvocationName, id[F("inv")], 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); getStringFromJson(clientSSID, nw_ins_0[F("ssid")], 33);
//int nw_ins_0_pskl = nw_ins_0[F("pskl")]; //int nw_ins_0_pskl = nw_ins_0[F("pskl")];
//The WiFi PSK is normally not contained in the regular file for security reasons. //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; uint8_t s = 0;
for (JsonObject btn : hw_btn_ins) { for (JsonObject btn : hw_btn_ins) {
CJSON(buttonType[s], btn["type"]); CJSON(buttonType[s], btn["type"]);
int8_t pin = btn[F("pin")][0] | -1; int8_t pin = btn["pin"][0] | -1;
if (pin > -1) { if (pin > -1 && pinManager.allocatePin(pin,false)) {
if (pinManager.allocatePin(pin,false)) { btnPin[s] = pin;
btnPin[s] = pin; pinMode(btnPin[s], INPUT_PULLUP);
pinMode(btnPin[s], INPUT_PULLUP); } else {
} else { btnPin[s] = -1;
btnPin[s] = -1;
}
} }
JsonArray hw_btn_ins_0_macros = btn[F("macros")]; JsonArray hw_btn_ins_0_macros = btn[F("macros")];
CJSON(macroButton[s], hw_btn_ins_0_macros[0]); CJSON(macroButton[s], hw_btn_ins_0_macros[0]);
@ -736,7 +734,7 @@ bool deserializeConfigSec() {
bool success = readObjectFromFile("/wsec.json", nullptr, &doc); bool success = readObjectFromFile("/wsec.json", nullptr, &doc);
if (!success) return false; 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); getStringFromJson(clientPass, nw_ins_0["psk"], 65);
JsonObject ap = doc["ap"]; JsonObject ap = doc["ap"];

View File

@ -390,10 +390,6 @@ void WLED::beginStrip()
// init relay pin // init relay pin
if (rlyPin>=0) if (rlyPin>=0)
digitalWrite(rlyPin, (rlyMde ? bri : !bri)); 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) void WLED::initAP(bool resetAP)

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // 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 //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG