From 912156df2ae30ac0a5b50656ba32c50e1d82026d Mon Sep 17 00:00:00 2001 From: Andrew Andrianov Date: Fri, 26 Feb 2021 22:24:30 +0300 Subject: [PATCH 1/3] MyTransportHal: Implement MY_TRANSPORT_SEND_RETRIES Signed-off-by: Andrew Andrianov --- MyConfig.h | 9 +++++++++ hal/transport/MyTransportHAL.cpp | 8 ++++++++ keywords.txt | 1 + 3 files changed, 18 insertions(+) diff --git a/MyConfig.h b/MyConfig.h index 0aa451420..a93f7a6cc 100755 --- a/MyConfig.h +++ b/MyConfig.h @@ -1111,6 +1111,15 @@ #define MY_TRANSPORT_DISCOVERY_INTERVAL_MS (20*60*1000ul) #endif +/** + * @def MY_TRANSPORT_SEND_RETRIES + * @brief If defined to a positive number N, the node will try to send the payload to the + * uplink up to N times before actually failing. Useful when working in a noisy environment + * @note Setting this option too high will + * + */ +//#define MY_TRANSPORT_SEND_RETRIES (5) + /** *@def MY_TRANSPORT_UPLINK_CHECK_DISABLED *@brief If defined, disables uplink check to GW during transport initialisation diff --git a/hal/transport/MyTransportHAL.cpp b/hal/transport/MyTransportHAL.cpp index 7fdd6cd9d..5166bc35f 100644 --- a/hal/transport/MyTransportHAL.cpp +++ b/hal/transport/MyTransportHAL.cpp @@ -173,7 +173,15 @@ bool transportHALSend(const uint8_t nextRecipient, const MyMessage *outMsg, cons const uint8_t finalLength = len; #endif +#ifdef MY_TRANSPORT_SEND_RETRIES + uint8_t retries = MY_TRANSPORT_SEND_RETRIES; + bool result = false; + while (retries-- && (!result)) { + result = transportSend(nextRecipient, (void *)tx_data, finalLength, noACK); + } +#else bool result = transportSend(nextRecipient, (void *)tx_data, finalLength, noACK); +#endif TRANSPORT_HAL_DEBUG(PSTR("THA:SND:MSG LEN=%" PRIu8 ",RES=%" PRIu8 "\n"), finalLength, result); return result; } diff --git a/keywords.txt b/keywords.txt index d63941799..46a130b37 100755 --- a/keywords.txt +++ b/keywords.txt @@ -66,6 +66,7 @@ MY_SIGNAL_REPORT_ENABLED LITERAL1 MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS LITERAL1 MY_SMART_SLEEP_WAIT_DURATION_MS LITERAL1 MY_TRANSPORT_CHKUPL_INTERVAL_MS LITERAL1 +MY_TRANSPORT_SEND_RETRIES LITERAL1 MY_TRANSPORT_DISCOVERY_INTERVAL_MS LITERAL1 MY_TRANSPORT_MAX_TSM_FAILURES LITERAL1 MY_TRANSPORT_MAX_TX_FAILURES LITERAL1 From d79a46520b96adbf1c81a8f7f4447a2a7ccf6187 Mon Sep 17 00:00:00 2001 From: Andrew Andrianov Date: Sat, 27 Feb 2021 14:39:20 +0300 Subject: [PATCH 2/3] RF24Registers: Allow user to adjust RF24_SET_ARD && RF24_SET_ARC Signed-off-by: Andrew Andrianov --- hal/transport/RF24/driver/RF24registers.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hal/transport/RF24/driver/RF24registers.h b/hal/transport/RF24/driver/RF24registers.h index ab30f00c7..d06fc09fa 100644 --- a/hal/transport/RF24/driver/RF24registers.h +++ b/hal/transport/RF24/driver/RF24registers.h @@ -41,10 +41,14 @@ #define RF24_CRC_16 (3) // ARD, auto retry delay +#ifndef RF24_SET_ARD #define RF24_SET_ARD (5) //=1500us +#endif // ARD, auto retry count +#ifndef RF24_SET_ARC #define RF24_SET_ARC (15) +#endif // nRF24L01(+) register definitions #define RF24_REG_NRF_CONFIG (0x00) From fa169a910f9584f6670c5f990888d276c09779ca Mon Sep 17 00:00:00 2001 From: Olivier Date: Sun, 22 Oct 2023 21:37:35 +0200 Subject: [PATCH 3/3] Update keywords.txt --- keywords.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keywords.txt b/keywords.txt index 46a130b37..5ee9a836e 100755 --- a/keywords.txt +++ b/keywords.txt @@ -66,7 +66,7 @@ MY_SIGNAL_REPORT_ENABLED LITERAL1 MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS LITERAL1 MY_SMART_SLEEP_WAIT_DURATION_MS LITERAL1 MY_TRANSPORT_CHKUPL_INTERVAL_MS LITERAL1 -MY_TRANSPORT_SEND_RETRIES LITERAL1 +MY_TRANSPORT_SEND_RETRIES LITERAL1 MY_TRANSPORT_DISCOVERY_INTERVAL_MS LITERAL1 MY_TRANSPORT_MAX_TSM_FAILURES LITERAL1 MY_TRANSPORT_MAX_TX_FAILURES LITERAL1