Reset bistable relays up to detected amount of ports

This commit is contained in:
Theo Arends 2022-07-16 12:49:33 +02:00
parent 571a2afce5
commit 7bc67f8d18

View File

@ -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);
}