Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in function update #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 5 additions & 2 deletions RF24Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -98,6 +100,7 @@ void RF24Network::update(void)
#endif
}
}
return has_message;
}

/******************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion RF24Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down