Skip to content

Commit

Permalink
Properly restore reading pipe0
Browse files Browse the repository at this point in the history
Should only capture the pipe0 address if pipe0 is being set for a reading pipe.
  • Loading branch information
TMRh20 committed Oct 2, 2023
1 parent 07c6163 commit 8a30343
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/nrf_to_nrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 8a30343

Please sign in to comment.