Skip to content

Commit 3455e48

Browse files
committed
Add powerUp to begin(), increase powerUp delay
- Found I could create a hang condition on startup with some code. a: Now power up the radio on begin() to simplify things b: Increase delay to 5ms for powerUp, although it should only take 2ms tops, this prevents the hanging condition.
1 parent 2f7e448 commit 3455e48

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

RF24.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ void RF24::begin(void)
399399
flush_rx();
400400
flush_tx();
401401

402+
powerUp();
403+
delay(5);
402404
//Enable PTX, do not write CE high so radio will remain in standby I mode ( 130us max to transition to RX or TX instead of 1500us from powerUp )
403405
write_register(CONFIG, ( read_register(CONFIG) ) & ~_BV(PRIM_RX) );
404406

@@ -449,7 +451,7 @@ void RF24::powerDown(void)
449451
void RF24::powerUp(void)
450452
{
451453
write_register(CONFIG,read_register(CONFIG) | _BV(PWR_UP));
452-
delay(2);
454+
delay(5);
453455
}
454456

455457
/******************************************************************/

RF24.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@ class RF24
996996
* - Changes to read() functionality have increased reliability and response
997997
* - Extended timeout periods have been added to aid in noisy or otherwise unreliable environments
998998
* - Delays have been removed where possible to ensure maximum efficiency
999+
* - Untested: Arduino Due and ATTiny 84/85 support: Do NOT #include <SPI.h> with ATTiny.
9991000
* - More! See the links below and class documentation for more info.
10001001
*
10011002
* If issues are discovered with the documentation, please report them here: <a href="https://github.com/TMRh20/tmrh20.github.io/issues"> here</a>
@@ -1025,5 +1026,5 @@ class RF24
10251026
*/
10261027

10271028
#endif // __RF24_H__
1028-
// vim:ai:cin:sts=2 sw=2 ft=cpp
1029+
10291030

0 commit comments

Comments
 (0)