From a35b702e480e5e8630cba54105a9ebb1792af177 Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Thu, 20 Sep 2018 11:26:23 +0300 Subject: [PATCH] FHSS: Increased min random of tx poll Because of bad synchronization, unicast packet was sent immediately after broadcast channel when receiver had not yet changed to unicast. --- source/Service_Libs/fhss/fhss_ws.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 66b17c20b6e..d5aa4fc67c2 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -163,12 +163,12 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay) // Should return to own (unicast) listening channel after broadcast channel next_channel = fhss_structure->rx_channel; /* Start timer with random timeout to trigger unicast TX queue poll event. - * Min random is 50us. + * Min random is 1/30 of the TX slot length. * Max random is 1/10 of the TX slot length. * Event timer resolution is 50us. */ uint32_t txrx_slot_length_us = fhss_structure->ws->txrx_slot_length_ms * 1000; - uint16_t uc_min_random = 1; + uint16_t uc_min_random = (txrx_slot_length_us / 30) / 50; uint16_t uc_max_random = (txrx_slot_length_us / 10) / 50; bool tx_allowed = fhss_ws_check_tx_allowed(fhss_structure); if (!tx_allowed) {