diff --git a/tasmota/tasmota_support/support_button_v4.ino b/tasmota/tasmota_support/support_button_v4.ino index 3b7850ed7..cf85b6dd5 100644 --- a/tasmota/tasmota_support/support_button_v4.ino +++ b/tasmota/tasmota_support/support_button_v4.ino @@ -134,6 +134,11 @@ void ButtonProbe(void) { uint32_t not_activated; for (uint32_t i = 0; i < MAX_KEYS_SET; i++) { + if (!bitRead(Button.used, i)) { + Button.probe_mutex = false; + return; + } + if (PinUsed(GPIO_KEY1, i)) { #if defined(SOC_TOUCH_VERSION_1) || defined(SOC_TOUCH_VERSION_2) if (bitRead(TouchButton.touch_mask, i)) { @@ -147,11 +152,9 @@ void ButtonProbe(void) { } else #endif // ESP32 SOC_TOUCH_VERSION_1 or SOC_TOUCH_VERSION_2 not_activated = (digitalRead(Pin(GPIO_KEY1, i)) != bitRead(Button.inverted_mask, i)); - } - else if (bitRead(Button.used, i)) { + } else { not_activated = (bitRead(Button.virtual_pin, i) != bitRead(Button.inverted_mask, i)); } - else { continue; } if (not_activated) { diff --git a/tasmota/tasmota_support/support_switch_v4.ino b/tasmota/tasmota_support/support_switch_v4.ino index d2871ca08..50bc7d428 100644 --- a/tasmota/tasmota_support/support_switch_v4.ino +++ b/tasmota/tasmota_support/support_switch_v4.ino @@ -138,13 +138,16 @@ void SwitchProbe(void) { uint32_t not_activated; for (uint32_t i = 0; i < MAX_SWITCHES_SET; i++) { + if (!bitRead(Switch.used, i)) { + Switch.probe_mutex = false; + return; + } + if (PinUsed(GPIO_SWT1, i)) { not_activated = digitalRead(Pin(GPIO_SWT1, i)); - } - else if (bitRead(Switch.used, i)) { + } else { not_activated = bitRead(Switch.virtual_pin, i); } - else { continue; } // Olimex user_switch2.c code to fix 50Hz induced pulses if (not_activated) {