Browse Source

Apply relay boot mask only on first 8 relays

ota
Xose Pérez 6 years ago
parent
commit
63f6a14bc0
1 changed files with 13 additions and 6 deletions
  1. +13
    -6
      code/espurna/relay.ino

+ 13
- 6
code/espurna/relay.ino View File

@ -507,27 +507,34 @@ void _relayBoot() {
DEBUG_MSG_P(PSTR("[RELAY] Retrieving mask: %d\n"), mask); DEBUG_MSG_P(PSTR("[RELAY] Retrieving mask: %d\n"), mask);
// Walk the relays // Walk the relays
bool status = false;
bool status;
for (unsigned int i=0; i<_relays.size(); i++) { for (unsigned int i=0; i<_relays.size(); i++) {
unsigned char boot_mode = getSetting("relayBoot", i, RELAY_BOOT_MODE).toInt(); unsigned char boot_mode = getSetting("relayBoot", i, RELAY_BOOT_MODE).toInt();
DEBUG_MSG_P(PSTR("[RELAY] Relay #%d boot mode %d\n"), i, boot_mode); DEBUG_MSG_P(PSTR("[RELAY] Relay #%d boot mode %d\n"), i, boot_mode);
status = false;
switch (boot_mode) { switch (boot_mode) {
case RELAY_BOOT_SAME: case RELAY_BOOT_SAME:
status = ((mask & bit) == bit);
if (i < 8) {
status = ((mask & bit) == bit);
}
break; break;
case RELAY_BOOT_TOGGLE: case RELAY_BOOT_TOGGLE:
status = ((mask & bit) != bit);
mask ^= bit;
trigger_save = true;
if (i < 8) {
status = ((mask & bit) != bit);
mask ^= bit;
trigger_save = true;
}
break; break;
case RELAY_BOOT_ON: case RELAY_BOOT_ON:
status = true; status = true;
break; break;
case RELAY_BOOT_OFF: case RELAY_BOOT_OFF:
default: default:
status = false;
break; break;
} }
_relays[i].current_status = !status; _relays[i].current_status = !status;
_relays[i].target_status = status; _relays[i].target_status = status;
#if RELAY_PROVIDER == RELAY_PROVIDER_STM #if RELAY_PROVIDER == RELAY_PROVIDER_STM


Loading…
Cancel
Save