Browse Source

RFBridge: Intercept remote messages

fastled
Xose Pérez 7 years ago
parent
commit
dc9fc63a89
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      code/espurna/rfbridge.ino

+ 19
- 0
code/espurna/rfbridge.ino View File

@ -107,7 +107,26 @@ void _rfbDecode() {
}
if (action == RF_CODE_RFIN) {
DEBUG_MSG_P(PSTR("[RFBRIDGE] Forward message '%s'\n"), buffer);
// Look for the code
unsigned char id, state;
bool found = false;
for (id=0; id<relayCount(); id++) {
for (state=0; state<2; state++) {
String code = _rfbRetrieve(id, state == 1);
if (code.length()) {
if (code.endsWith(&buffer[12])) {
found = true;
break;
}
}
}
if (found) break;
}
if (found) relayStatus(id, state == 1);
}
}


Loading…
Cancel
Save