Skip to content

Commit 639dc4f

Browse files
committed
Extra Pipes
Add support for any number of 'pipes' that are available for addressing. Allows wider range of addressing on NRF52x devices
1 parent a334fa6 commit 639dc4f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

RF24Network.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void ESBNetwork<radio_t>::begin(uint8_t _channel, uint16_t _node_address)
103103
setup_address();
104104

105105
// Open up all listening pipes
106-
uint8_t i = 6;
106+
uint8_t i = NUM_PIPES;
107107
while (i--)
108108
radio.openReadingPipe(i, pipe_address(_node_address, i));
109109

@@ -956,7 +956,7 @@ void ESBNetwork<radio_t>::logicalToPhysicalAddress(logicalToPhysicalStruct* conv
956956
//}
957957
}
958958
else if (is_descendant(*to_node)) {
959-
pre_conversion_send_pipe = 5; // Send to its listening pipe
959+
pre_conversion_send_pipe = NUM_PIPES - 1; // Send to its listening pipe
960960
// If the node is a direct child,
961961
if (is_direct_child(*to_node)) {
962962
// Send directly
@@ -1131,7 +1131,7 @@ bool ESBNetwork<radio_t>::is_valid_address(uint16_t node)
11311131
#endif
11321132
while (node) {
11331133
uint8_t digit = node & 0x07;
1134-
if (digit < 1 || digit > 5) {
1134+
if (digit < 1 || digit > (NUM_PIPES - 1)) {
11351135
result = false;
11361136
IF_SERIAL_DEBUG_MINIMAL(printf_P(PSTR("*** WARNING *** Invalid address 0%o\n\r"), origNode););
11371137
break;
@@ -1181,7 +1181,7 @@ template<class radio_t>
11811181
uint64_t ESBNetwork<radio_t>::pipe_address(uint16_t node, uint8_t pipe)
11821182
{
11831183

1184-
static uint8_t address_translation[] = {0xc3, 0x3c, 0x33, 0xce, 0x3e, 0xe3, 0xec};
1184+
static uint8_t address_translation[] = {0xc3, 0x3c, 0x33, 0xce, 0x3e, 0xe3, 0xec, 0xee, 0xed};
11851185
uint64_t result = 0xCCCCCCCCCCLL;
11861186
uint8_t* out = reinterpret_cast<uint8_t*>(&result);
11871187

RF24Network_config.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@
8181
/** Enable dynamic payloads - If using different types of nRF24L01 modules, some may be incompatible when using this feature **/
8282
#define ENABLE_DYNAMIC_PAYLOADS
8383
#endif // DISABLE_DYNAMIC_PAYLOADS
84+
85+
// The number of 'pipes' available for addressing in the current device
86+
// Networks with NRF24L01 devices only have 6 pipes
87+
// NRF52x networks support up to 8 pipes
88+
#define NUM_PIPES 6
8489

8590
/* Debug Options */
8691
//#define SERIAL_DEBUG

0 commit comments

Comments
 (0)