jgromes / RadioLib

Universal wireless communication library for embedded devices
https://jgromes.github.io/RadioLib/
MIT License
1.52k stars 382 forks source link

CC1101: Flush TX buffer after receive timeout? #520

Closed matthias-bs closed 2 years ago

matthias-bs commented 2 years ago

In src/modules/CC1101/CC1101.cpp:

In CC1101::receive():

  // wait for packet or timeout
  uint32_t start = _mod->micros();
  while(!_mod->digitalRead(_mod->getIrq())) {
    _mod->yield();

    if(_mod->micros() - start > timeout) {
      standby();
      SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_TX);
      return(RADIOLIB_ERR_RX_TIMEOUT);
    }
  }

From reading the code, I would have expected that the RX buffer should be flushed after a RX timeout, not the TX buffer.

jgromes commented 2 years ago

That's most likely a copy-paste error from TX timeout handling.

Fixed in the latest commit, thanks for reporting!