mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Merge pull request #11410 from t-8ch/interlock-delay-fix
only perform interlock delay once
This commit is contained in:
commit
d2087549bb
@ -556,18 +556,22 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source)
|
|||||||
((POWER_ON == state) || ((POWER_TOGGLE == state) && !(TasmotaGlobal.power & mask)))
|
((POWER_ON == state) || ((POWER_TOGGLE == state) && !(TasmotaGlobal.power & mask)))
|
||||||
) {
|
) {
|
||||||
interlock_mutex = true; // Clear all but masked relay in interlock group if new set requested
|
interlock_mutex = true; // Clear all but masked relay in interlock group if new set requested
|
||||||
|
bool perform_interlock_delay = false;
|
||||||
for (uint32_t i = 0; i < MAX_INTERLOCKS; i++) {
|
for (uint32_t i = 0; i < MAX_INTERLOCKS; i++) {
|
||||||
if (Settings.interlock[i] & mask) { // Find interlock group
|
if (Settings.interlock[i] & mask) { // Find interlock group
|
||||||
for (uint32_t j = 0; j < TasmotaGlobal.devices_present; j++) {
|
for (uint32_t j = 0; j < TasmotaGlobal.devices_present; j++) {
|
||||||
power_t imask = 1 << j;
|
power_t imask = 1 << j;
|
||||||
if ((Settings.interlock[i] & imask) && (TasmotaGlobal.power & imask) && (mask != imask)) {
|
if ((Settings.interlock[i] & imask) && (TasmotaGlobal.power & imask) && (mask != imask)) {
|
||||||
ExecuteCommandPower(j +1, POWER_OFF, SRC_IGNORE);
|
ExecuteCommandPower(j +1, POWER_OFF, SRC_IGNORE);
|
||||||
delay(50); // Add some delay to make sure never have more than one relay on
|
perform_interlock_delay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; // An interlocked relay is only present in one group so quit
|
break; // An interlocked relay is only present in one group so quit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (perform_interlock_delay) {
|
||||||
|
delay(50); // Add some delay to make sure never have more than one relay on
|
||||||
|
}
|
||||||
interlock_mutex = false;
|
interlock_mutex = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user