Skip to content

Commit

Permalink
Fix bug in RF Bridge when RF code contains the stop byte. Check overf…
Browse files Browse the repository at this point in the history
…low (#357)
  • Loading branch information
xoseperez committed Jan 5, 2018
1 parent 4cf6e92 commit 82177f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions code/espurna/rfbridge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,14 @@ void _rfbReceive() {
//DEBUG_MSG_P(PSTR("[RFBRIDGE] Received 0x%02X\n"), c);

if (receiving) {
if (c == RF_CODE_STOP) {
if (c == RF_CODE_STOP && (_uartpos == 1 || _uartpos == 10)) {
_rfbDecode();
receiving = false;
} else {
} else if (_uartpos < 10) {
_uartbuf[_uartpos++] = c;
} else {
// wrong message, should have received a RF_CODE_STOP
receiving = false;
}
} else if (c == RF_CODE_START) {
_uartpos = 0;
Expand Down

0 comments on commit 82177f5

Please sign in to comment.