From 0b4aa78f4c70ed90b09aae7677ea5f5664cb2c8f Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Mon, 1 Oct 2018 11:26:12 +0300 Subject: [PATCH] Parent Broadcast synch fix and TR51CF slot define fix Fixed Broadcast slot calculation if we keep timing info over 1 second at queue Fixed Parent synch after receiving BT-IE info. Change-Id: Ia493380778ea20f5121d374a8afada7bcf9a7874 --- source/6LoWPAN/ws/ws_llc_data_service.c | 9 +++++---- source/Service_Libs/fhss/fhss_ws.c | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/6LoWPAN/ws/ws_llc_data_service.c b/source/6LoWPAN/ws/ws_llc_data_service.c index 646fbfc2dcf..1d274b85c5c 100644 --- a/source/6LoWPAN/ws/ws_llc_data_service.c +++ b/source/6LoWPAN/ws/ws_llc_data_service.c @@ -521,15 +521,16 @@ static void ws_llc_mac_indication_cb(const mac_api_t* api, const mcps_data_ind_t if (us_ie_inline) { ws_neighbor_class_neighbor_unicast_schedule_set(neighbor_info.ws_neighbor, &us_ie); - if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) { - // We have broadcast schedule set up set the broadcast parent schedule - ns_fhss_ws_set_parent(interface->ws_info->fhss_api, neighbor_info.neighbor->mac64, &neighbor_info.ws_neighbor->fhss_data.bc_timing_info); - } + } //Update BT if it is part of message ws_bt_ie_t ws_bt; if (ws_wh_bt_read(ie_ext->headerIeList, ie_ext->headerIeListLength, &ws_bt)) { ws_neighbor_class_neighbor_broadcast_time_info_update(neighbor_info.ws_neighbor, &ws_bt, data->timestamp); + if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) { + // We have broadcast schedule set up set the broadcast parent schedule + ns_fhss_ws_set_parent(interface->ws_info->fhss_api, neighbor_info.neighbor->mac64, &neighbor_info.ws_neighbor->fhss_data.bc_timing_info); + } } //Refresh Neighbor if unicast diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index f245ebb4dfc..66b17c20b6e 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -682,6 +682,9 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8], fhss_structure->ws->fhss_configuration.fhss_broadcast_interval = bc_timing_info->broadcast_interval; fhss_set_txrx_slot_length(fhss_structure); fhss_structure->ws->bc_slot = bc_timing_info->broadcast_slot + slots_since_reception; + if (fhss_structure->ws->fhss_configuration.ws_bc_channel_function == WS_TR51CF) { + fhss_structure->ws->bc_slot %= fhss_structure->number_of_channels; + } platform_exit_critical(); //TODO: support multiple parents fhss_structure->ws->parent_bc_info = bc_timing_info;