diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 6368da98f5a..809b0c3a0db 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -275,11 +275,11 @@ static uint32_t fhss_ws_calculate_ufsi(fhss_structure_t *fhss_structure, uint32_ cur_slot = fhss_structure->number_of_channels; } cur_slot--; - uint32_t remaining_time_ms = get_remaining_slots_us(fhss_structure, fhss_unicast_handler, fhss_structure->ws->fhss_configuration.fhss_uc_dwell_interval*1000) / 1000; + uint32_t remaining_time_ms = divide_integer(get_remaining_slots_us(fhss_structure, fhss_unicast_handler, fhss_structure->ws->fhss_configuration.fhss_uc_dwell_interval*1000), 1000); uint32_t time_to_tx = 0; uint32_t cur_time = fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api); if (cur_time < tx_time) { - time_to_tx = (tx_time - cur_time) / 1000; + time_to_tx = divide_integer((tx_time - cur_time), 1000); } uint64_t ms_since_seq_start = (cur_slot * dwell_time) + (dwell_time-remaining_time_ms) + time_to_tx; uint32_t seq_length = 0x10000; @@ -316,7 +316,7 @@ static uint16_t fhss_ws_calculate_destination_slot(fhss_ws_neighbor_timing_info_ seq_length = neighbor_timing_info->uc_timing_info.unicast_number_of_channels; } uint32_t dest_ms_since_seq_start = own_ceil((float)((uint64_t)ufsi*seq_length*dwell_time) / DEF_2E24); - return (own_floor(((float)((tx_time - ufsi_timestamp)/1000 + dest_ms_since_seq_start) / dwell_time)) % seq_length); + return (own_floor(((float)(divide_integer((tx_time - ufsi_timestamp),1000) + dest_ms_since_seq_start) / dwell_time)) % seq_length); } static uint32_t fhss_ws_get_sf_timeout_callback(fhss_structure_t *fhss_structure)