Skip to content

Commit

Permalink
Fixed a problem with disabled buttons reverting to pin 0 causing conf…
Browse files Browse the repository at this point in the history
…lict
  • Loading branch information
Aircoookie committed Jun 30, 2021
1 parent 2009608 commit 8b6cc70
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 8 additions & 10 deletions wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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"];
Expand Down
4 changes: 0 additions & 4 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8b6cc70

Please sign in to comment.