diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 481bb09d6e6..c48f5a73a09 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -297,6 +297,15 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay) if (!fhss_structure) { return; } + + if (fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval == 0 || fhss_structure->ws->fhss_configuration.fhss_broadcast_interval == 0) { + // stop broadcast schedule + fhss_structure->ws->is_on_bc_channel = false; + fhss_structure->ws->synchronization_time = 0; + fhss_structure->ws->broadcast_timer_running = false; + return; + } + int32_t delay_us = fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api) - fhss_structure->ws->next_bc_timeout; // Assume this was initial call for this function without timer if (!fhss_structure->ws->bc_slot && !fhss_structure->ws->next_bc_timeout) { @@ -332,14 +341,6 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay) fhss_structure->ws->bc_slot %= fhss_structure->number_of_channels; } - - if (fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval == 0 || fhss_structure->ws->fhss_configuration.fhss_broadcast_interval == 0) { - // stop broadcast schedule - fhss_structure->ws->is_on_bc_channel = false; - fhss_structure->ws->synchronization_time = 0; - fhss_structure->ws->broadcast_timer_running = false; - return; - } if (fhss_structure->ws->is_on_bc_channel == false) { fhss_ws_start_timer(fhss_structure, MS_TO_US(fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) - (delay_us * fhss_structure->platform_functions.fhss_resolution_divider), fhss_broadcast_handler); fhss_structure->ws->is_on_bc_channel = true;