[SX126x] Added option to read data even after CRC error
This commit is contained in:
parent
75335bdff3
commit
58640e2801
1 changed files with 5 additions and 1 deletions
|
@ -534,9 +534,10 @@ int16_t SX126x::readData(uint8_t* data, size_t len) {
|
|||
|
||||
// check integrity CRC
|
||||
uint16_t irq = getIrqStatus();
|
||||
int16_t crcState = ERR_NONE;
|
||||
if((irq & SX126X_IRQ_CRC_ERR) || (irq & SX126X_IRQ_HEADER_ERR)) {
|
||||
clearIrqStatus();
|
||||
return(ERR_CRC_MISMATCH);
|
||||
crcState = ERR_CRC_MISMATCH;
|
||||
}
|
||||
|
||||
// get packet length
|
||||
|
@ -552,6 +553,9 @@ int16_t SX126x::readData(uint8_t* data, size_t len) {
|
|||
// clear interrupt flags
|
||||
state = clearIrqStatus();
|
||||
|
||||
// check if CRC failed - this is done after reading data to give user the option to keep them
|
||||
RADIOLIB_ASSERT(crcState);
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue