diff --git a/RF24Network.cpp b/RF24Network.cpp index 7b963eba..ae135392 100644 --- a/RF24Network.cpp +++ b/RF24Network.cpp @@ -56,6 +56,7 @@ ESBNetwork::ESBNetwork(radio_t& _radio) : radio(_radio), frame_size(MAX multicastRelay = 0; #if defined (multichannel) baseChannel = 0; + initialChannel = 255; #endif } #else @@ -71,6 +72,7 @@ ESBNetwork::ESBNetwork(radio_t& _radio) : radio(_radio), next_frame(fra multicastRelay = 0; #if defined (multichannel) baseChannel = 0; + initialChannel = 255; #endif } #endif @@ -91,8 +93,12 @@ void ESBNetwork::begin(uint8_t _channel, uint16_t _node_address) if (_channel != USE_CURRENT_CHANNEL) radio.setChannel(_channel); + + if(initialChannel == 255){ + initialChannel = radio.getChannel(); + } #if defined (multichannel) - baseChannel = USE_CURRENT_CHANNEL == 255 ? radio.getChannel() : _channel; + baseChannel = USE_CURRENT_CHANNEL == 255 ? initialChannel : _channel; networkChannel = baseChannel; #endif //radio.enableDynamicAck(); diff --git a/RF24Network.h b/RF24Network.h index 0f39d57f..bd1d7c3c 100644 --- a/RF24Network.h +++ b/RF24Network.h @@ -978,6 +978,7 @@ class ESBNetwork #if defined (multichannel) uint8_t baseChannel; uint8_t networkChannel; + uint8_t initialChannel; #endif /** @} */