Skip to content

Commit

Permalink
Merge pull request ARMmbed#1868 from ARMmbed/IOTTHD-2863
Browse files Browse the repository at this point in the history
Iotthd 2863
  • Loading branch information
Jarkko Paso authored Oct 23, 2018
2 parents 23296c1 + 2188fd2 commit 98be8b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ static void ws_set_fhss_hop(protocol_interface_info_entry_t *cur)
// Calculate own hop count. This method gets inaccurate when hop count increases.
uint8_t own_hop = (own_rank - rank_inc) / rank_inc;
ns_fhss_ws_set_hop_count(cur->ws_info->fhss_api, own_hop);
tr_debug("own hop: %u, own rank: %u, rank inc: %u", own_hop, own_rank, rank_inc);
}

static void ws_address_registration_update(protocol_interface_info_entry_t *interface)
Expand Down
8 changes: 8 additions & 0 deletions source/Service_Libs/fhss/fhss_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ static uint32_t fhss_ws_calculate_ufsi(fhss_structure_t *fhss_structure, uint32_
}
cur_slot--;
uint32_t remaining_time = (fhss_structure->platform_functions.fhss_get_remaining_slots(fhss_unicast_handler, fhss_structure->fhss_api) / 1000);
if (remaining_time > dwell_time) {
remaining_time = 0;
}
uint32_t time_to_tx = 0;
uint32_t cur_time = fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api);
if (cur_time < tx_time) {
Expand Down Expand Up @@ -689,6 +692,9 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
fhss_stop_timer(fhss_structure, fhss_broadcast_handler);
uint32_t time_from_reception_ms = divide_integer(fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api) - bc_timing_info->bt_rx_timestamp, 1000);
uint32_t true_bc_interval_offset = (bc_timing_info->broadcast_interval_offset + time_from_reception_ms) % bc_timing_info->broadcast_interval;
if (true_bc_interval_offset >= bc_timing_info->broadcast_dwell_interval) {
fhss_structure->ws->is_on_bc_channel = false;
}
uint32_t timeout = ((bc_timing_info->broadcast_interval-true_bc_interval_offset)*1000);

if (fhss_structure->ws->is_on_bc_channel) {
Expand Down Expand Up @@ -726,6 +732,7 @@ int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_co
if (channel_count <= 0) {
return -1;
}
platform_enter_critical();
if (fhss_configuration->ws_uc_channel_function == WS_FIXED_CHANNEL || fhss_configuration->fhss_uc_dwell_interval == 0) {
fhss_stop_timer(fhss_structure, fhss_unicast_handler);
fhss_structure->ws->unicast_timer_running = false;
Expand All @@ -739,6 +746,7 @@ int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_co
if (fhss_configuration->ws_uc_channel_function == WS_FIXED_CHANNEL) {
fhss_structure->rx_channel = fhss_configuration->unicast_fixed_channel;
}
platform_exit_critical();
tr_info("fhss Configuration set, UC channel: %d, BC channel: %d, UC CF: %d, BC CF: %d, channels: %d, uc dwell: %d, bc dwell: %d, bc interval: %d, bsi:%d",
fhss_structure->ws->fhss_configuration.unicast_fixed_channel,
fhss_structure->ws->fhss_configuration.broadcast_fixed_channel,
Expand Down

0 comments on commit 98be8b2

Please sign in to comment.