Skip to content

Commit 99c7d62

Browse files
authored
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 54063b3 commit 99c7d62

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
@@ -136,7 +136,6 @@ uint8_t ESBNetwork<radio_t>::update(void)
136136

137137
while (radio.available()) {
138138
if (millis() > timeout) {
139-
radio.flush_rx();
140139
return NETWORK_OVERRUN;
141140
}
142141
#if defined(ENABLE_DYNAMIC_PAYLOADS) && !defined(XMEGA_D3)
@@ -145,6 +144,10 @@ uint8_t ESBNetwork<radio_t>::update(void)
145144
frame_size = MAX_FRAME_SIZE;
146145
#endif
147146

147+
if (!frame_size) {
148+
return NETWORK_CORRUPTION;
149+
}
150+
148151
// Fetch the payload, and see if this was the last one.
149152
radio.read(frame_buffer, frame_size);
150153

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)