diff --git a/sonoff/support_button.ino b/sonoff/support_button.ino index 880f354d1..ed5cecce6 100644 --- a/sonoff/support_button.ino +++ b/sonoff/support_button.ino @@ -54,7 +54,7 @@ void ButtonInit(void) for (byte i = 0; i < MAX_KEYS; i++) { if (pin[GPIO_KEY1 +i] < 99) { buttons_found++; - pinMode(pin[GPIO_KEY1 +i], (16 == pin[GPIO_KEY1 +i]) ? INPUT_PULLDOWN_16 : bitRead(key_no_pullup, i) ? INPUT : INPUT_PULLUP); + pinMode(pin[GPIO_KEY1 +i], bitRead(key_no_pullup, i) ? INPUT : ((16 == pin[GPIO_KEY1 +i]) ? INPUT_PULLDOWN_16 : INPUT_PULLUP)); } } } diff --git a/sonoff/support_switch.ino b/sonoff/support_switch.ino index 7a085347e..cb685cb81 100644 --- a/sonoff/support_switch.ino +++ b/sonoff/support_switch.ino @@ -121,7 +121,7 @@ void SwitchInit(void) lastwallswitch[i] = 1; // Init global to virtual switch state; if (pin[GPIO_SWT1 +i] < 99) { switches_found++; - pinMode(pin[GPIO_SWT1 +i], (16 == pin[GPIO_SWT1 +i]) ? INPUT_PULLDOWN_16 : bitRead(switch_no_pullup, i) ? INPUT : INPUT_PULLUP); + pinMode(pin[GPIO_SWT1 +i], bitRead(switch_no_pullup, i) ? INPUT : ((16 == pin[GPIO_SWT1 +i]) ? INPUT_PULLDOWN_16 : INPUT_PULLUP)); lastwallswitch[i] = digitalRead(pin[GPIO_SWT1 +i]); // Set global now so doesn't change the saved power state on first switch check } switch_virtual[i] = lastwallswitch[i];