diff --git a/tasmota/support_button.ino b/tasmota/support_button.ino index 1e1192605..4dc5aa097 100644 --- a/tasmota/support_button.ino +++ b/tasmota/support_button.ino @@ -87,7 +87,11 @@ void ButtonInit(void) for (uint32_t i = 0; i < MAX_KEYS; i++) { if (PinUsed(GPIO_KEY1, i)) { Button.present++; +#ifdef ESP8266 pinMode(Pin(GPIO_KEY1, i), bitRead(Button.no_pullup_mask, i) ? INPUT : ((16 == Pin(GPIO_KEY1, i)) ? INPUT_PULLDOWN_16 : INPUT_PULLUP)); +#else // ESP32 + pinMode(Pin(GPIO_KEY1, i), bitRead(Button.no_pullup_mask, i) ? INPUT : INPUT_PULLUP); +#endif } #ifdef USE_ADC else if (PinUsed(GPIO_ADC_BUTTON, i) || PinUsed(GPIO_ADC_BUTTON_INV, i)) { diff --git a/tasmota/support_switch.ino b/tasmota/support_switch.ino index 1c0a8e12d..fa31106b7 100644 --- a/tasmota/support_switch.ino +++ b/tasmota/support_switch.ino @@ -202,7 +202,11 @@ void SwitchInit(void) Switch.last_state[i] = 1; // Init global to virtual switch state; if (PinUsed(GPIO_SWT1, i)) { Switch.present++; +#ifdef ESP8266 pinMode(Pin(GPIO_SWT1, i), bitRead(Switch.no_pullup_mask, i) ? INPUT : ((16 == Pin(GPIO_SWT1, i)) ? INPUT_PULLDOWN_16 : INPUT_PULLUP)); +#else // ESP32 + pinMode(Pin(GPIO_SWT1, i), bitRead(Switch.no_pullup_mask, i) ? INPUT : INPUT_PULLUP); +#endif if (ac_detect) { Switch.state[i] = 0x80 + 2 * AC_PERIOD; Switch.last_state[i] = 0; // Will set later in the debouncing code