Skip to content

Commit

Permalink
Fix for tx mode
Browse files Browse the repository at this point in the history
- Found when disabling auto-ack the radio would hang in between states. This should ensure TX is only enabled if disabled.
  • Loading branch information
TMRh20 committed May 13, 2023
1 parent 4ce8eec commit 825843d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/nrf_to_nrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,14 @@ bool nrf_to_nrf::write(void *buf, uint8_t len, bool multicast) {
}
memset(&radioData[2], 0, staticPayloadSize);
memcpy(&radioData[2], buf, len);
NRF_RADIO->EVENTS_TXREADY = 0;
NRF_RADIO->TASKS_TXEN = 1;
while (NRF_RADIO->EVENTS_TXREADY == 0);
NRF_RADIO->EVENTS_TXREADY = 0;
// radioData[0] = ackPID++;

if(NRF_RADIO->STATE < 9){
NRF_RADIO->EVENTS_TXREADY = 0;
NRF_RADIO->TASKS_TXEN = 1;
while (NRF_RADIO->EVENTS_TXREADY == 0);
NRF_RADIO->EVENTS_TXREADY = 0;
}

NRF_RADIO->EVENTS_END = 0;
NRF_RADIO->TASKS_START = 1;
while (NRF_RADIO->EVENTS_END == 0) {
Expand Down Expand Up @@ -525,6 +528,9 @@ void nrf_to_nrf::openReadingPipe(uint8_t child, uint64_t address) {
// Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
// Serial.println(NRF_RADIO->RXADDRESSES);
}

/**********************************************************************************************************/

void nrf_to_nrf::openWritingPipe(uint64_t address) {
uint32_t base = address >> 8;
uint32_t prefix = address & 0xFF;
Expand Down

0 comments on commit 825843d

Please sign in to comment.