From 7d4a2f88541015eaeadb32efc267eb3daea23037 Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Fri, 9 Feb 2018 12:40:51 +0200 Subject: [PATCH] FHSS: Start broadcast schedule when bc intervals are known --- source/Service_Libs/fhss/fhss_ws.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index d8b7505f24e..33fa61c2c5d 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -33,6 +33,8 @@ // Enable this flag to use channel traces #define FHSS_CHANNEL_DEBUG +static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure); + fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer) { if (!fhss_api || !fhss_configuration || !fhss_timer) { @@ -111,6 +113,14 @@ static int fhss_ws_handle_state_set(fhss_structure_t *fhss_structure, fhss_state { (void) pan_id; if (fhss_state == FHSS_SYNCHRONIZED) { + uint32_t fhss_broadcast_interval = fhss_structure->fhss_conf.fhss_ws_configuration.fhss_broadcast_interval; + uint8_t fhss_bc_dwell_interval = fhss_structure->fhss_conf.fhss_ws_configuration.fhss_bc_dwell_interval; + // Start broadcast schedule when BC intervals are known + if (fhss_broadcast_interval && fhss_bc_dwell_interval) { + fhss_broadcast_handler(fhss_structure->fhss_api, 0); + } + // Start unicast schedule + fhss_ws_update_uc_channel_callback(fhss_structure); fhss_start_timer(fhss_structure, fhss_structure->fhss_conf.fhss_ws_configuration.fhss_uc_dwell_interval*1000, fhss_superframe_handler); }