Commit 3455e489 authored by TMRh20's avatar TMRh20

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.
parent 2f7e4489
...@@ -399,6 +399,8 @@ void RF24::begin(void) ...@@ -399,6 +399,8 @@ void RF24::begin(void)
flush_rx(); flush_rx();
flush_tx(); flush_tx();
powerUp();
delay(5);
//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 ) //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 )
write_register(CONFIG, ( read_register(CONFIG) ) & ~_BV(PRIM_RX) ); write_register(CONFIG, ( read_register(CONFIG) ) & ~_BV(PRIM_RX) );
...@@ -449,7 +451,7 @@ void RF24::powerDown(void) ...@@ -449,7 +451,7 @@ void RF24::powerDown(void)
void RF24::powerUp(void) void RF24::powerUp(void)
{ {
write_register(CONFIG,read_register(CONFIG) | _BV(PWR_UP)); write_register(CONFIG,read_register(CONFIG) | _BV(PWR_UP));
delay(2); delay(5);
} }
/******************************************************************/ /******************************************************************/
......
...@@ -996,6 +996,7 @@ private: ...@@ -996,6 +996,7 @@ private:
* - Changes to read() functionality have increased reliability and response * - Changes to read() functionality have increased reliability and response
* - Extended timeout periods have been added to aid in noisy or otherwise unreliable environments * - Extended timeout periods have been added to aid in noisy or otherwise unreliable environments
* - Delays have been removed where possible to ensure maximum efficiency * - Delays have been removed where possible to ensure maximum efficiency
* - Untested: Arduino Due and ATTiny 84/85 support: Do NOT #include <SPI.h> with ATTiny.
* - More! See the links below and class documentation for more info. * - More! See the links below and class documentation for more info.
* *
* If issues are discovered with the documentation, please report them here: <a href="https://github.com/TMRh20/tmrh20.github.io/issues"> here</a> * 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 @@ private: ...@@ -1025,5 +1026,5 @@ private:
*/ */
#endif // __RF24_H__ #endif // __RF24_H__
// vim:ai:cin:sts=2 sw=2 ft=cpp
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment