diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index a4b0daaf..84068878 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -234,6 +234,7 @@ void relaySave() { bit += bit; } EEPROM.write(EEPROM_RELAY_STATUS, mask); + DEBUG_MSG_P(PSTR("[RELAY] Saving mask: %d\n"), mask); EEPROM.commit(); } @@ -241,8 +242,10 @@ void relayRetrieve(bool invert) { recursive = true; unsigned char bit = 1; unsigned char mask = invert ? ~EEPROM.read(EEPROM_RELAY_STATUS) : EEPROM.read(EEPROM_RELAY_STATUS); - for (unsigned int i=0; i < _relays.size(); i++) { - relayStatus(i, ((mask & bit) == bit)); + DEBUG_MSG_P(PSTR("[RELAY] Retrieving mask: %d\n"), mask); + for (unsigned int id=0; id < _relays.size(); id++) { + _relays[id].scheduledStatus = ((mask & bit) == bit); + _relays[id].scheduledReport = true; bit += bit; } if (invert) {