From 77b1e2c1400e755d13bfd9345bd235075b056ad4 Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Wed, 19 Mar 2014 03:43:13 -0600 Subject: [PATCH] - Slight modification to reUseTX cmd - put the CE HIGH, LOW changes in the cmd for non-internal use - Put the clearing of MAX_RT in the reUse cmd for non-internal use - Removed unneeded delay from writeBlocking() --- RF24.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/RF24.cpp b/RF24.cpp index d8cdd94..0ce3e65 100644 --- a/RF24.cpp +++ b/RF24.cpp @@ -480,11 +480,7 @@ bool RF24::writeBlocking( const void* buf, uint8_t len ) while ( (read_register(FIFO_STATUS) & _BV(FIFO_FULL))){ //Blocking only if FIFO is full. This will loop and block until TX is successful if( get_status() & _BV(MAX_RT)){ - write_register(STATUS,_BV(MAX_RT) ); //Clear max retry flag reUseTX(); //Set re-transmit - ce(LOW); //Re-Transfer packet - ce(HIGH); - delayMicroseconds(15); } } @@ -496,10 +492,12 @@ bool RF24::writeBlocking( const void* buf, uint8_t len ) void RF24::reUseTX(){ + write_register(STATUS,_BV(MAX_RT) ); //Clear max retry flag csn(LOW); SPI.transfer( REUSE_TX_PL ); csn(HIGH); - + ce(LOW); //Re-Transfer packet + ce(HIGH); } /****************************************************************************/ @@ -518,8 +516,6 @@ bool RF24::writeFast( const void* buf, uint8_t len ) if( get_status() & _BV(MAX_RT)){ write_register(STATUS,_BV(MAX_RT) ); //Clear max retry flag reUseTX(); //Set re-transmit - ce(LOW); //Re-Transfer packet - ce(HIGH); delayMicroseconds(15); //CE needs to stay high for 10us, for TX_REUSE to engage return 0; //Return 0. The previous payload has been retransmitted //From the user perspective, if you get a 0, just keep trying to send the same payload