Browse Source

Fix relay status retrieving

fastled
Xose Pérez 7 years ago
parent
commit
ecc89dcf58
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      code/espurna/relay.ino

+ 5
- 2
code/espurna/relay.ino View File

@ -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) {


Loading…
Cancel
Save