Skip to content

Commit

Permalink
Fix for available() function
Browse files Browse the repository at this point in the history
- Need to re-enable to radio to receive IF returning 0 IF various conditions are met while CRC is good, or else the radio will appear to hang and not receive anything
  • Loading branch information
TMRh20 committed Dec 21, 2023
1 parent 58c6e62 commit d42d32e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/TMRh20/nrf_to_nrf"
},
"version": "1.2.8",
"version": "1.2.9",
"export": {
"exclude": [
".github/*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=nrf_to_nrf
version=1.2.8
version=1.2.9
author=TMRh20
maintainer=TMRh20
sentence=NRF52840 to NRF24L01+ ESB communication
Expand Down
6 changes: 4 additions & 2 deletions src/nrf_to_nrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ bool nrf_to_nrf::available(uint8_t* pipe_num)
uint8_t tmpIV[CCM_IV_SIZE];
NRF_RADIO->EVENTS_CRCOK = 0;
if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 4) {
NRF_RADIO->TASKS_START = 1;
return 0;
}
*pipe_num = (uint8_t)NRF_RADIO->RXMATCH;
Expand Down Expand Up @@ -277,12 +278,14 @@ bool nrf_to_nrf::available(uint8_t* pipe_num)
if (DPL) {
if (!decrypt(&rxBuffer[1], rxBuffer[0] - CCM_IV_SIZE - CCM_COUNTER_SIZE)) {
Serial.println("DECRYPT FAIL");
NRF_RADIO->TASKS_START = 1;
return 0;
}
}
else {
if (!decrypt(&rxBuffer[1], staticPayloadSize - CCM_IV_SIZE - CCM_COUNTER_SIZE)) {
Serial.println("DECRYPT FAIL");
NRF_RADIO->TASKS_START = 1;
return 0;
}
}
Expand All @@ -304,11 +307,10 @@ bool nrf_to_nrf::available(uint8_t* pipe_num)
payloadAvailable = true;
return 1;
}
if (NRF_RADIO->EVENTS_CRCERROR) {
if(NRF_RADIO->EVENTS_CRCERROR) {
NRF_RADIO->EVENTS_CRCERROR = 0;
NRF_RADIO->TASKS_START = 1;
}

return 0;
}

Expand Down

0 comments on commit d42d32e

Please sign in to comment.