Skip to content

Commit 556b9b3

Browse files
TMRh202bndy5
authored andcommitted
Add new type (#250)
- Add NETWORK_CORRUPTION type - No longer need to flush_rx() if available is stuck in a loop, just return NETWORK_OVERRUN
1 parent 36e1ff1 commit 556b9b3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

RF24Network.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ uint8_t RF24Network::update(void)
129129

130130
while (radio.available()) {
131131
if (millis() > timeout) {
132-
radio.flush_rx();
133132
return NETWORK_OVERRUN;
134133
}
135134
#if defined(ENABLE_DYNAMIC_PAYLOADS) && !defined(XMEGA_D3)
@@ -138,6 +137,10 @@ uint8_t RF24Network::update(void)
138137
frame_size = MAX_FRAME_SIZE;
139138
#endif
140139

140+
if (!frame_size) {
141+
return NETWORK_CORRUPTION;
142+
}
143+
141144
// Fetch the payload, and see if this was the last one.
142145
radio.read(frame_buffer, frame_size);
143146

RF24Network.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,15 @@
123123
//#define NETWORK_ACK_REQUEST 192
124124

125125
/**
126-
* Messages of this type indicate the network is being overrun with data & the RX FIFO has been flushed.
126+
* Messages of this type indicate the network is being overrun with data.
127127
**/
128128
#define NETWORK_OVERRUN 160
129129

130+
/**
131+
* Messages of this type indicate radio data corruption & the RX FIFO has been flushed.
132+
**/
133+
#define NETWORK_CORRUPTION 161
134+
130135
/**
131136
* Messages of this type signal the sender that a network-wide transmission has been completed.
132137
*

0 commit comments

Comments
 (0)