Skip to content

Commit 359c7b9

Browse files
author
Jarkko Paso
authored
Merge pull request #2017 from ARMmbed/IOTTHD-3065
FHSS WS: Fixed large broadcast interval issue
2 parents 570123d + b33e0c1 commit 359c7b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void fhss_event_timer_cb(int8_t timer_id, uint16_t slots);
8282
static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure);
8383
static void fhss_unicast_handler(const fhss_api_t *fhss_api, uint16_t delay);
8484
static bool fhss_ws_check_tx_allowed(fhss_structure_t *fhss_structure);
85-
static uint8_t fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure);
85+
static uint32_t fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure);
8686

8787
// This function supports rounding up
8888
static int32_t divide_integer(int32_t dividend, int32_t divisor)
@@ -169,9 +169,9 @@ static int fhss_ws_manage_channel_table_allocation(fhss_structure_t *fhss_struct
169169
return 0;
170170
}
171171

172-
static uint8_t fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
172+
static uint32_t fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
173173
{
174-
uint8_t number_of_tx_slots = ((fhss_structure->ws->fhss_configuration.fhss_broadcast_interval - fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) / WS_MAX_TXRX_SLOT_LEN_MS) / 2;
174+
uint32_t number_of_tx_slots = ((fhss_structure->ws->fhss_configuration.fhss_broadcast_interval - fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) / WS_MAX_TXRX_SLOT_LEN_MS) / 2;
175175
if (!number_of_tx_slots) {
176176
return 0;
177177
}
@@ -519,7 +519,7 @@ static bool fhss_ws_check_tx_allowed(fhss_structure_t *fhss_structure)
519519
if (fhss_structure->ws->is_on_bc_channel == true) {
520520
return true;
521521
}
522-
uint8_t number_of_tx_slots = fhss_set_txrx_slot_length(fhss_structure);
522+
uint32_t number_of_tx_slots = fhss_set_txrx_slot_length(fhss_structure);
523523
// Allow transmission when broadcast interval is very short comparing to MAX slot length
524524
if (!number_of_tx_slots) {
525525
return true;
@@ -528,7 +528,7 @@ static bool fhss_ws_check_tx_allowed(fhss_structure_t *fhss_structure)
528528
uint32_t remaining_time_ms = get_remaining_slots_us(fhss_structure, fhss_broadcast_handler, MS_TO_US(fhss_structure->ws->fhss_configuration.fhss_broadcast_interval)) / 1000;
529529
uint32_t tx_slot_begin = (fhss_structure->ws->fhss_configuration.fhss_broadcast_interval - fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) - (fhss_structure->ws->txrx_slot_length_ms * (fhss_structure->own_hop & 1));
530530
uint32_t rx_slot_begin = tx_slot_begin - fhss_structure->ws->txrx_slot_length_ms;
531-
uint8_t n_o_tx_slots = number_of_tx_slots;
531+
uint32_t n_o_tx_slots = number_of_tx_slots;
532532

533533
while (n_o_tx_slots--) {
534534
if ((remaining_time_ms <= tx_slot_begin) && (remaining_time_ms > rx_slot_begin)) {

0 commit comments

Comments
 (0)