@@ -468,7 +468,7 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
468
468
/* Sets the parent and broadcast schedule we are following
469
469
*
470
470
*/
471
- static void ws_bootstrap_primary_parent_set (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info )
471
+ static void ws_bootstrap_primary_parent_set (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info , bool force_synch )
472
472
{
473
473
474
474
fhss_ws_configuration_t fhss_configuration ;
@@ -498,7 +498,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
498
498
ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
499
499
500
500
// We have broadcast schedule set up set the broadcast parent schedule
501
- ns_fhss_ws_set_parent (cur -> ws_info -> fhss_api , neighbor_info -> neighbor -> mac64 , & neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info , true );
501
+ ns_fhss_ws_set_parent (cur -> ws_info -> fhss_api , neighbor_info -> neighbor -> mac64 , & neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info , force_synch );
502
502
503
503
// Update LLC to follow updated fhss settings
504
504
ws_bootstrap_llc_hopping_update (cur ,& fhss_configuration );
@@ -930,16 +930,18 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
930
930
return ;
931
931
}
932
932
933
- //Update synch to primary parent allways to update broadcast shedule and timing
934
- if (neighbor_info .neighbor -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
935
- // RPL priority parent configuration we must update FHSS data
936
- ws_bootstrap_primary_parent_set (cur , & neighbor_info );
937
- }
933
+ if (cur -> ws_info -> configuration_learned ) {
934
+ bool old_version = cur -> ws_info -> pan_information .pan_version == pan_version ;
935
+ if (neighbor_info .neighbor -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
936
+ // RPL priority parent configuration we must update FHSS data
937
+ //Update synch to primary parent allways to update broadcast shedule and timing
938
+ ws_bootstrap_primary_parent_set (cur , & neighbor_info , !old_version );
939
+ }
938
940
939
- if (cur -> ws_info -> configuration_learned &&
940
- cur -> ws_info -> pan_information . pan_version == pan_version ) {
941
- // No new information
942
- return ;
941
+ if (old_version ) {
942
+ // No new information
943
+ return ;
944
+ }
943
945
}
944
946
945
947
/*
@@ -958,13 +960,10 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
958
960
// return to state machine after 1-2 s
959
961
cur -> bootsrap_state_machine_cnt = randLIB_get_random_in_range (10 ,20 );
960
962
// enable frequency hopping for unicast channel and start listening first neighbour
961
- ws_bootstrap_primary_parent_set (cur , & neighbor_info );
963
+ ws_bootstrap_primary_parent_set (cur , & neighbor_info , true );
962
964
// set neighbor as priority parent clear if there is others
963
965
protocol_6lowpan_neighbor_priority_clear_all (cur -> id , PRIORITY_1ST );
964
966
neighbor_info .neighbor -> link_role = PRIORITY_PARENT_NEIGHBOUR ;
965
- } else if (neighbor_info .neighbor -> link_role != PRIORITY_PARENT_NEIGHBOUR ) {
966
- //This cuold affect serious problem if BC parameters are changed
967
- ws_bootstrap_primary_parent_set (cur , & neighbor_info );
968
967
}
969
968
}
970
969
@@ -2138,7 +2137,7 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne
2138
2137
llc_neighbour_req_t neighbor_info ;
2139
2138
neighbor_info .neighbor = neighbor ;
2140
2139
neighbor_info .ws_neighbor = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , neighbor -> index );
2141
- ws_bootstrap_primary_parent_set (interface , & neighbor_info );
2140
+ ws_bootstrap_primary_parent_set (interface , & neighbor_info , true );
2142
2141
2143
2142
ws_secondary_parent_update (interface );
2144
2143
}
0 commit comments