Skip to content

Commit

Permalink
Account for an 'invalid' radio
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed Sep 26, 2013
1 parent 59b347e commit bd2bc20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion RF24Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ void RF24Network::begin(uint8_t _channel, uint16_t _node_address )

node_address = _node_address;

if ( ! radio.isValid() )
return;

// Set up the radio the way we want it to look
radio.setChannel(_channel);
radio.setDataRate(RF24_1MBPS);
Expand All @@ -54,7 +57,7 @@ void RF24Network::update(void)
{
// if there is data ready
uint8_t pipe_num;
while ( radio.available(&pipe_num) )
while ( radio.isValid() && radio.available(&pipe_num) )
{
// Dump the payloads until we've gotten everything
boolean done = false;
Expand Down
1 change: 1 addition & 0 deletions RF24Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct RF24NetworkHeader
/**
* Default constructor
*
* Simply constructs a blank header
*/
RF24NetworkHeader() {}
Expand Down

0 comments on commit bd2bc20

Please sign in to comment.