From 8a30343025a9905b58233ef9505de5c62569ec1e Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Mon, 2 Oct 2023 06:39:38 -0600 Subject: [PATCH] Properly restore reading pipe0 Should only capture the pipe0 address if pipe0 is being set for a reading pipe. --- src/nrf_to_nrf.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nrf_to_nrf.cpp b/src/nrf_to_nrf.cpp index b6e7e8c..0b98e21 100644 --- a/src/nrf_to_nrf.cpp +++ b/src/nrf_to_nrf.cpp @@ -848,6 +848,8 @@ void nrf_to_nrf::openReadingPipe(uint8_t child, uint64_t address) NRF_RADIO->BASE0 = base; NRF_RADIO->PREFIX0 &= ~(0xFF); NRF_RADIO->PREFIX0 |= prefix; + rxBase = NRF_RADIO->BASE0; + rxPrefix = NRF_RADIO->PREFIX0; } else if (child < 4) { // prefixes AP1-3 are in prefix0 NRF_RADIO->BASE1 = base; @@ -860,8 +862,7 @@ void nrf_to_nrf::openReadingPipe(uint8_t child, uint64_t address) NRF_RADIO->PREFIX1 |= prefix << (8 * (child - 4)); } NRF_RADIO->RXADDRESSES |= 1 << child; - rxBase = NRF_RADIO->BASE0; - rxPrefix = NRF_RADIO->PREFIX0; + // Serial.println(addrConv32(NRF_RADIO->BASE1),HEX); // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX); // Serial.println(NRF_RADIO->RXADDRESSES); @@ -907,6 +908,8 @@ void nrf_to_nrf::openReadingPipe(uint8_t child, const uint8_t* address) NRF_RADIO->BASE0 = base; NRF_RADIO->PREFIX0 &= ~(0xFF); NRF_RADIO->PREFIX0 |= prefix; + rxBase = NRF_RADIO->BASE0; + rxPrefix = NRF_RADIO->PREFIX0; } else if (child < 4) { // prefixes AP1-3 are in prefix0 NRF_RADIO->BASE1 = base; @@ -919,8 +922,7 @@ void nrf_to_nrf::openReadingPipe(uint8_t child, const uint8_t* address) NRF_RADIO->PREFIX1 |= prefix << (8 * (child - 4)); } NRF_RADIO->RXADDRESSES |= 1 << child; - rxBase = NRF_RADIO->BASE0; - rxPrefix = NRF_RADIO->PREFIX0; + // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX); // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX); // Serial.println(NRF_RADIO->RXADDRESSES);