From ecc89dcf589c88a1b8b1677859cb707bbeae55d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sat, 20 May 2017 08:29:26 +0200 Subject: [PATCH] Fix relay status retrieving --- code/espurna/relay.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) {