Skip to content

Commit

Permalink
Modify available() function
Browse files Browse the repository at this point in the history
- Return when DPL packet is to big as DPL functionality takes 2-bytes:
 a: with CRC disabled, packet max size is 125
 b: with CRC enabled, packet max size is 123
- Return if packet too large
  • Loading branch information
TMRh20 committed Jan 3, 2024
1 parent d42d32e commit 03642c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nrf_to_nrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,15 @@ bool nrf_to_nrf::available(uint8_t* pipe_num)
uint32_t counter = 0;
uint8_t tmpIV[CCM_IV_SIZE];
NRF_RADIO->EVENTS_CRCOK = 0;
if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 4) {
if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 4 && NRF_RADIO->CRCCNF != 0) {
NRF_RADIO->TASKS_START = 1;
return 0;
}else
if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 2 && NRF_RADIO->CRCCNF == 0) {
NRF_RADIO->TASKS_START = 1;
return 0;
}

*pipe_num = (uint8_t)NRF_RADIO->RXMATCH;
if (!DPL && acksEnabled(*pipe_num) == false) {
#if defined CCM_ENCRYPTION_ENABLED
Expand Down

0 comments on commit 03642c0

Please sign in to comment.