diff --git a/README.md b/README.md index f68418b..076449d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # Network Layer for nRF24L01(+) radios Please see the full documentation at http://maniacbug.github.com/RF24Network/index.html + +Update: Returntype of function update changed from void to bool. +Advantage of this change: If there is through-trafic on a node you can act inside the sketch. diff --git a/RF24Network.cpp b/RF24Network.cpp index 07d438a..33f0317 100644 --- a/RF24Network.cpp +++ b/RF24Network.cpp @@ -50,14 +50,16 @@ void RF24Network::begin(uint8_t _channel, uint16_t _node_address ) /******************************************************************/ -void RF24Network::update(void) +bool RF24Network::update(void) { // if there is data ready uint8_t pipe_num; - while ( radio.available(&pipe_num) ) + boolean has_message=false; + while ( radio.isValid() && radio.available(&pipe_num) ) { // Dump the payloads until we've gotten everything boolean done = false; + has_message=true; while (!done) { // Fetch the payload, and see if this was the last one. @@ -98,6 +100,7 @@ void RF24Network::update(void) #endif } } + return has_message; } /******************************************************************/ diff --git a/RF24Network.h b/RF24Network.h index 4d599c4..7315c35 100644 --- a/RF24Network.h +++ b/RF24Network.h @@ -104,7 +104,7 @@ class RF24Network * This function must be called regularly to keep the layer going. This is where all * the action happens! */ - void update(void); + bool update(void); /** * Test whether there is a message available for this node