From 7bc67f8d182e59ec8680e498ab03b1e45f9e66a9 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 16 Jul 2022 12:49:33 +0200 Subject: [PATCH] Reset bistable relays up to detected amount of ports --- tasmota/tasmota_support/support_tasmota.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 42b4e1733..a601168a8 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -318,8 +318,8 @@ void SetDevicePower(power_t rpower, uint32_t source) { // Reset bistable relay here to fix non-interlock situations due to fast switching if (TasmotaGlobal.rel_bistable) { // If bistable relays in the mix reset them after 40ms - delay(40); // About 5 x operation time - for (uint32_t i = 0; i < MAX_RELAYS; i++) { + delay(40); // Keep energized for about 5 x operation time + for (uint32_t i = 0; i < port; i++) { // Reset up to detected amount of ports if (bitRead(TasmotaGlobal.rel_bistable, i)) { DigitalWrite(GPIO_REL1, i, bitRead(TasmotaGlobal.rel_inverted, i) ? 1 : 0); }