diff --git a/RF24Network.cpp b/RF24Network.cpp index 623413a8..d4747129 100644 --- a/RF24Network.cpp +++ b/RF24Network.cpp @@ -208,13 +208,13 @@ uint8_t RF24Network::update(void) uint8_t val = enqueue(header); if (multicastRelay) { - IF_SERIAL_DEBUG_ROUTING(printf_P(PSTR("%u: MAC FWD multicast frame from 0%o to level %u\n"), millis(), header->from_node, multicast_level + 1);); + IF_SERIAL_DEBUG_ROUTING(printf_P(PSTR("%u: MAC FWD multicast frame from 0%o to level %u\n"), millis(), header->from_node, _multicast_level + 1);); if ((node_address >> 3) != 0) { // for all but the first level of nodes, those not directly connected to the master, we add the total delay per level delayMicroseconds(600 * 4); } delayMicroseconds((node_address % 4) * 600); - write(levelToAddress(multicast_level) << 3, USER_TX_MULTICAST); + write(levelToAddress(_multicast_level) << 3, USER_TX_MULTICAST); } if (val == 2) { //External data received return EXTERNAL_DATA_TYPE; @@ -638,7 +638,7 @@ bool RF24Network::multicast(RF24NetworkHeader &header, const void *message, uint // Fill out the header header.to_node = NETWORK_MULTICAST_ADDRESS; header.from_node = node_address; - return write(header, message, len, levelToAddress(level > 3 ? multicast_level : level)); + return write(header, message, len, levelToAddress(level > 3 ? _multicast_level : level)); } #endif @@ -1011,7 +1011,7 @@ void RF24Network::setup_address(void) #if defined(RF24NetworkMulticast) count++; } - multicast_level = count; + _multicast_level = count; #else } #endif @@ -1101,7 +1101,7 @@ bool RF24Network::is_valid_address(uint16_t node) void RF24Network::multicastLevel(uint8_t level) { - multicast_level = level; + _multicast_level = level; radio.stopListening(); radio.openReadingPipe(0, pipe_address(levelToAddress(level), 0)); radio.startListening(); diff --git a/RF24Network.h b/RF24Network.h index 1820e5f8..66b8d689 100644 --- a/RF24Network.h +++ b/RF24Network.h @@ -753,6 +753,13 @@ class RF24Network */ uint8_t networkFlags; +protected: + + #if defined(RF24NetworkMulticast) + uint8_t _multicast_level; /* The current node's network level (used for multicast TX/RX-ing) */ + #endif + uint16_t node_address; /** Logical node address of this unit, 1 .. UINT_MAX */ + private: /** @@ -794,10 +801,11 @@ class RF24Network uint8_t enqueue(RF24NetworkHeader *header); /* - * Called from begin(), this sets up the radio to act as according to a logical node address. + * Called from begin(), this sets up the radio to act accordingly per the + * logical `_node_address` parameter passed to `begin()`. * * Based on the value of the private member `node_address`, the resulting confiuration affects - * private members `node_mask`, `parent_node`, `parent_pipe`, and `multicast_level`. + * private members `node_mask`, `parent_node`, `parent_pipe`, and `_multicast_level`. */ void setup_address(void); @@ -838,10 +846,6 @@ class RF24Network RF24 &radio; /** Underlying radio driver, provides link/physical layers */ - #if defined(RF24NetworkMulticast) - uint8_t multicast_level; /* The current node's network level (used for multicast TX/RX-ing) */ - #endif - uint16_t node_address; /** Logical node address of this unit, 1 .. UINT_MAX */ uint8_t frame_size; /* The outgoing frame's total size including the header info. Ranges [8, MAX_PAYLOAD_SIZE] */ const static unsigned int max_frame_payload_size = MAX_FRAME_SIZE - sizeof(RF24NetworkHeader); /* always 24 bytes to compensate for the frame's header */