Browse Source

Fix rfbridge OFF button toggling relay (#303)

fastled
Xose Pérez 7 years ago
parent
commit
1758efc995
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      code/espurna/rfbridge.ino

+ 6
- 3
code/espurna/rfbridge.ino View File

@ -157,19 +157,22 @@ void _rfbDecode() {
DEBUG_MSG_P(PSTR("[RFBRIDGE] Forward message '%s'\n"), buffer);
// Look for the code
unsigned char id, status;
unsigned char id;
unsigned char status = 0;
bool found = false;
for (id=0; id<relayCount(); id++) {
String code_on = rfbRetrieve(id, true);
String code_off = rfbRetrieve(id, false);
if (code_on.length() && code_off.length()) {
if (code_on.endsWith(&buffer[12])) {
found = true;
DEBUG_MSG_P(PSTR("[RFBRIDGE] Match ON code for relay %d\n"), id);
status = 1;
found = true;
}
if (code_off.endsWith(&buffer[12])) {
DEBUG_MSG_P(PSTR("[RFBRIDGE] Match OFF code for relay %d\n"), id);
if (found) status = 2;
found = true;
if (status == 1) status = 2;
}
}
if (found) break;


Loading…
Cancel
Save