Browse Source

Fix bug in RF Bridge when RF code contains the stop byte. Check overflow (#357)

i18n
Xose Pérez 6 years ago
parent
commit
82177f5669
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      code/espurna/rfbridge.ino

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

@ -252,11 +252,14 @@ void _rfbReceive() {
//DEBUG_MSG_P(PSTR("[RFBRIDGE] Received 0x%02X\n"), c); //DEBUG_MSG_P(PSTR("[RFBRIDGE] Received 0x%02X\n"), c);
if (receiving) { if (receiving) {
if (c == RF_CODE_STOP) {
if (c == RF_CODE_STOP && (_uartpos == 1 || _uartpos == 10)) {
_rfbDecode(); _rfbDecode();
receiving = false; receiving = false;
} else {
} else if (_uartpos < 10) {
_uartbuf[_uartpos++] = c; _uartbuf[_uartpos++] = c;
} else {
// wrong message, should have received a RF_CODE_STOP
receiving = false;
} }
} else if (c == RF_CODE_START) { } else if (c == RF_CODE_START) {
_uartpos = 0; _uartpos = 0;


Loading…
Cancel
Save