Default button pin allocation on 1st boot.

This commit is contained in:
Blaž Kristan 2021-07-07 10:18:00 +02:00
parent d28158bc74
commit 07d74ee692

View File

@ -169,8 +169,10 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
}
} else {
// new install/missing configuration (button 0 has defaults)
if (fromFS)
for (uint8_t s=1; s<WLED_MAX_BUTTONS; s++) {
if (fromFS) {
uint8_t s=0;
if (pinManager.allocatePin(btnPin[0])) s++; // do not clear button 0 if pin successfully allocated
for (; s<WLED_MAX_BUTTONS; s++) {
btnPin[s] = -1;
buttonType[s] = BTN_TYPE_NONE;
macroButton[s] = 0;
@ -178,6 +180,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
macroDoublePress[s] = 0;
}
}
}
CJSON(touchThreshold,btn_obj[F("tt")]);
CJSON(buttonPublishMqtt,btn_obj["mqtt"]);