@@ -213,9 +213,9 @@ uint8_t ESBNetwork<radio_t>::update(void)
213213 header->to_node = header->from_node ;
214214 header->from_node = node_address;
215215 #ifdef SLOW_ADDR_POLL_RESPONSE
216- delay (parent_pipe + SLOW_ADDR_POLL_RESPONSE );
216+ RF24NETWORK_DELAY (parent_pipe + SLOW_ADDR_POLL_RESPONSE );
217217 #else
218- delay (parent_pipe);
218+ RF24NETWORK_DELAY (parent_pipe);
219219 #endif
220220 write (header->to_node , USER_TX_TO_PHYSICAL_ADDRESS );
221221 }
@@ -786,9 +786,7 @@ bool ESBNetwork<radio_t>::main_write(RF24NetworkHeader& header, const void* mess
786786 ok = _write (header, ((char *)message) + offset, fragmentLen, writeDirect);
787787
788788 if (!ok) {
789- const uint32_t retry_delay_start = millis ();
790- while (millis () - retry_delay_start < 2 ) {
791- }
789+ RF24NETWORK_DELAY (2 );
792790 ++retriesPerFrag;
793791 }
794792 else {
@@ -902,7 +900,7 @@ bool ESBNetwork<radio_t>::write(uint16_t to_node, uint8_t sendType)
902900 IF_RF24NETWORK_DEBUG (printf_P (PSTR (" MAC Sending to 0%o via 0%o on pipe %x\n\r " ), to_node, conversion.send_node , conversion.send_pipe ));
903901 /* *Write it*/
904902 if (sendType == TX_ROUTED && conversion.send_node == to_node && isAckType) {
905- delay (2 );
903+ RF24NETWORK_DELAY (2 );
906904 }
907905 ok = write_to_pipe (conversion.send_node , conversion.send_pipe , conversion.multicast );
908906
@@ -1266,6 +1264,16 @@ void ESBNetwork<radio_t>::pipe_address(uint16_t node, uint8_t pipe, uint8_t* add
12661264 IF_RF24NETWORK_DEBUG (uint32_t * top = reinterpret_cast <uint32_t *>(address + 1 ); printf_P (PSTR (" NET Pipe %i on node 0%o has address %x%x\n\r " ), pipe, node, *top, *address));
12671265}
12681266
1267+ /* *****************************************************************/
1268+
1269+ template <class radio_t >
1270+ void ESBNetwork<radio_t >::RF24NetworkDelay (uint32_t delay)
1271+ {
1272+ uint32_t timer = millis ();
1273+ while (millis () - timer < delay) {
1274+ }
1275+ }
1276+
12691277/* *********************** Sleep Mode ******************************************/
12701278
12711279#if defined ENABLE_SLEEP_MODE
@@ -1307,8 +1315,8 @@ bool ESBNetwork<radio_t>::sleepNode(unsigned int cycles, int interruptPin, uint8
13071315
13081316 while (sleep_cycles_remaining) {
13091317 sleep_mode (); // System sleeps here
1310- } // The WDT_vect interrupt wakes the MCU from here
1311- sleep_disable (); // System continues execution here when watchdog timed out
1318+ } // The WDT_vect interrupt wakes the MCU from here
1319+ sleep_disable (); // System continues execution here when watchdog timed out
13121320 detachInterrupt (interruptPin);
13131321
13141322 #if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
0 commit comments