|
|
@ -17,15 +17,6 @@ bool recursive = false; |
|
|
|
unsigned char dualRelayStatus = 0; |
|
|
|
#endif
|
|
|
|
|
|
|
|
#define RELAY_MODE_OFF 0
|
|
|
|
#define RELAY_MODE_ON 1
|
|
|
|
#define RELAY_MODE_SAME 2
|
|
|
|
|
|
|
|
#define RELAY_SYNC_ANY 0
|
|
|
|
#define RELAY_SYNC_NONE_OR_ONE 1
|
|
|
|
#define RELAY_SYNC_ONE 2
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// RELAY
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
@ -98,8 +89,14 @@ void relaySync(unsigned char id) { |
|
|
|
byte relaySync = getSetting("relaySync", String(RELAY_SYNC)).toInt(); |
|
|
|
bool status = relayStatus(id); |
|
|
|
|
|
|
|
// If RELAY_SYNC_SAME all relays should have the same state
|
|
|
|
if (relaySync == RELAY_SYNC_SAME) { |
|
|
|
for (unsigned short i=0; i<_relays.size(); i++) { |
|
|
|
if (i != id) relayStatus(i, status); |
|
|
|
} |
|
|
|
|
|
|
|
// If NONE_OR_ONE or ONE and setting ON we should set OFF all the others
|
|
|
|
if (status) { |
|
|
|
} else if (status) { |
|
|
|
if (relaySync != RELAY_SYNC_ANY) { |
|
|
|
for (unsigned short i=0; i<_relays.size(); i++) { |
|
|
|
if (i != id) relayStatus(i, false); |
|
|
|