@@ -973,6 +973,19 @@ static void ws_bootstrap_ip_stack_activate(protocol_interface_info_entry_t *cur)
973
973
ws_bootstrap_ip_stack_reset (cur );
974
974
}
975
975
976
+ static void ws_set_fhss_hop (protocol_interface_info_entry_t * cur )
977
+ {
978
+ uint16_t own_rank = ws_bootstrap_route_cost_calculate (cur );
979
+ uint16_t rank_inc = ws_bootstrap_get_min_rank_inc (cur );
980
+ if (own_rank == 0xffff || rank_inc == 0xffff ) {
981
+ return ;
982
+ }
983
+ // Calculate own hop count. This method gets inaccurate when hop count increases.
984
+ uint8_t own_hop = (own_rank - rank_inc ) / rank_inc ;
985
+ ns_fhss_ws_set_hop_count (cur -> ws_info -> fhss_api , own_hop );
986
+ }
987
+
988
+
976
989
static void ws_bootstrap_rpl_callback (rpl_event_t event , void * handle )
977
990
{
978
991
@@ -984,14 +997,7 @@ static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
984
997
if (event == RPL_EVENT_DAO_DONE ) {
985
998
// Trigger statemachine check
986
999
cur -> bootsrap_state_machine_cnt = 1 ;
987
- uint16_t own_rank = ws_bootstrap_route_cost_calculate (cur );
988
- uint16_t rank_inc = ws_bootstrap_get_min_rank_inc (cur );
989
- if (own_rank == 0xffff || rank_inc == 0xffff ) {
990
- return ;
991
- }
992
- // Calculate own hop count. This method gets inaccurate when hop count increases.
993
- uint8_t own_hop = (own_rank - rank_inc ) / rank_inc ;
994
- ns_fhss_ws_set_hop_count (cur -> ws_info -> fhss_api , own_hop );
1000
+ ws_set_fhss_hop (cur );
995
1001
996
1002
} else if (event == RPL_EVENT_LOCAL_REPAIR_NO_MORE_DIS ) {
997
1003
/*
0 commit comments