Skip to content

Commit

Permalink
Add flag to prevent polling. Fix header type change.
Browse files Browse the repository at this point in the history
- Introduce FLAG_NO_POLL which (optionally) prevents the network device
from responding to NETWORK_POLL requests
- Ensure the header.type is unmodified after fragmented writes per #64
- Considering this a bug because the behavior is inconsistent with a
standard write
  • Loading branch information
TMRh20 committed Nov 27, 2015
1 parent 8552324 commit cce19b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 6 additions & 6 deletions RF24Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ uint8_t RF24Network::update(void)


if(header->type == NETWORK_POLL ){
//Serial.println("Send poll");
header->to_node = header->from_node;
header->from_node = node_address;
//delay((node_address%5)*3);
write(header->to_node,USER_TX_TO_PHYSICAL_ADDRESS);
if( !(networkFlags & FLAG_NO_POLL) ){
header->to_node = header->from_node;
header->from_node = node_address;
write(header->to_node,USER_TX_TO_PHYSICAL_ADDRESS);
}
continue;
}
uint8_t val = enqueue(header);
Expand Down Expand Up @@ -763,7 +763,7 @@ bool RF24Network::write(RF24NetworkHeader& header,const void* message, uint16_t
#endif

}

header.type = type;
#if !defined (DUAL_HEAD_RADIO)
if(networkFlags & FLAG_FAST_FRAG){
radio.startListening();
Expand Down
3 changes: 3 additions & 0 deletions RF24Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
#define FLAG_BYPASS_HOLDS 2

#define FLAG_FAST_FRAG 4

#define FLAG_NO_POLL 8

class RF24;

Expand Down Expand Up @@ -755,6 +757,7 @@ class RF24Network
* |FLAG_HOLD_INCOMING| 1(bit_1) | INTERNAL: Set automatically when a fragmented payload will exceed the available cache |
* |FLAG_BYPASS_HOLDS| 2(bit_2) | EXTERNAL: Can be used to prevent holds from blocking. Note: Holds are disabled & re-enabled by RF24Mesh when renewing addresses. This will cause data loss if incoming data exceeds the available cache space|
* |FLAG_FAST_FRAG| 4(bit_3) | INTERNAL: Replaces the fastFragTransfer variable, and allows for faster transfers between directly connected nodes. |
* |FLAG_NO_POLL| 8(bit_4) | EXTERNAL/USER: Disables NETWORK_POLL responses on a node-by-node basis. |
*
*/
uint8_t networkFlags;
Expand Down

0 comments on commit cce19b2

Please sign in to comment.