New isPinOk()

This commit is contained in:
Blaz Kristan
2022-09-23 14:35:17 +02:00
parent 222b92807e
commit d86d88c7b7
3 changed files with 55 additions and 52 deletions

View File

@@ -200,7 +200,11 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
int8_t pin = btn["pin"][0] | -1;
if (pin > -1 && pinManager.allocatePin(pin, false, PinOwner::Button)) {
btnPin[s] = pin;
#ifdef ESP32
pinMode(btnPin[s], buttonType[s]==BTN_TYPE_PUSH_ACT_HIGH ? INPUT_PULLDOWN : INPUT_PULLUP);
#else
pinMode(btnPin[s], INPUT_PULLUP);
#endif
} else {
btnPin[s] = -1;
}