From 03642c088570ce469979d921d0d99cc318e3cab8 Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Wed, 3 Jan 2024 04:22:48 -0600 Subject: [PATCH] Modify available() function - 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 --- src/nrf_to_nrf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nrf_to_nrf.cpp b/src/nrf_to_nrf.cpp index 0f32a49..2e6845c 100644 --- a/src/nrf_to_nrf.cpp +++ b/src/nrf_to_nrf.cpp @@ -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