|
@ -212,14 +212,17 @@ void relaySave() { |
|
|
EEPROM.commit(); |
|
|
EEPROM.commit(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void relayRetrieve() { |
|
|
|
|
|
|
|
|
void relayRetrieve(bool invert) { |
|
|
recursive = true; |
|
|
recursive = true; |
|
|
unsigned char bit = 1; |
|
|
unsigned char bit = 1; |
|
|
unsigned char mask = EEPROM.read(0); |
|
|
|
|
|
|
|
|
unsigned char mask = invert ? ~EEPROM.read(0) : EEPROM.read(0); |
|
|
for (unsigned int i=0; i < _relays.size(); i++) { |
|
|
for (unsigned int i=0; i < _relays.size(); i++) { |
|
|
relayStatus(i, ((mask & bit) == bit)); |
|
|
relayStatus(i, ((mask & bit) == bit)); |
|
|
bit += bit; |
|
|
bit += bit; |
|
|
} |
|
|
} |
|
|
|
|
|
if (invert) { |
|
|
|
|
|
relaySave(); |
|
|
|
|
|
} |
|
|
recursive = false; |
|
|
recursive = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -454,7 +457,13 @@ void relaySetup() { |
|
|
if (relayMode == RELAY_MODE_OFF) relayStatus(i, false); |
|
|
if (relayMode == RELAY_MODE_OFF) relayStatus(i, false); |
|
|
if (relayMode == RELAY_MODE_ON) relayStatus(i, true); |
|
|
if (relayMode == RELAY_MODE_ON) relayStatus(i, true); |
|
|
} |
|
|
} |
|
|
|
|
|
<<<<<<< HEAD |
|
|
if (relayMode == RELAY_MODE_SAME) relayRetrieve(); |
|
|
if (relayMode == RELAY_MODE_SAME) relayRetrieve(); |
|
|
|
|
|
======= |
|
|
|
|
|
|
|
|
|
|
|
if (relayMode == RELAY_MODE_SAME) relayRetrieve(false); |
|
|
|
|
|
if (relayMode == RELAY_MODE_TOOGLE) relayRetrieve(true); |
|
|
|
|
|
>>>>>>> Enable revert state mode |
|
|
|
|
|
|
|
|
relaySetupAPI(); |
|
|
relaySetupAPI(); |
|
|
relaySetupMQTT(); |
|
|
relaySetupMQTT(); |
|
|