@@ -421,7 +421,7 @@ static int8_t ws_fhss_initialize(protocol_interface_info_entry_t *cur)
421
421
{
422
422
fhss_api_t * fhss_api = ns_sw_mac_get_fhss_api (cur -> mac_api );
423
423
424
- if (!fhss_api ) {
424
+ if (!fhss_api || ( fhss_api && cur -> ws_info -> fhss_owner ) ) {
425
425
// When FHSS doesn't exist yet, create one
426
426
fhss_ws_configuration_t fhss_configuration ;
427
427
memset (& fhss_configuration , 0 , sizeof (fhss_ws_configuration_t ));
@@ -438,12 +438,25 @@ static int8_t ws_fhss_initialize(protocol_interface_info_entry_t *cur)
438
438
fhss_configuration .fhss_bc_dwell_interval = cur -> ws_info -> fhss_bc_dwell_interval ;
439
439
fhss_configuration .fhss_broadcast_interval = cur -> ws_info -> fhss_bc_interval ;
440
440
441
- fhss_api = ns_fhss_ws_create (& fhss_configuration , cur -> ws_info -> fhss_timer_ptr );
442
441
if (!fhss_api ) {
443
- tr_error ("fhss create failed" );
444
- return -1 ;
442
+ fhss_api = ns_fhss_ws_create (& fhss_configuration , cur -> ws_info -> fhss_timer_ptr );
443
+ if (!fhss_api ) {
444
+ tr_error ("fhss create failed" );
445
+ return -1 ;
446
+ }
447
+ ns_sw_mac_fhss_register (cur -> mac_api , fhss_api );
448
+ cur -> ws_info -> fhss_owner = true;
449
+ } else {
450
+ //Configuration set
451
+ ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
452
+
453
+ if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
454
+ ns_fhss_ws_set_hop_count (cur -> ws_info -> fhss_api , 0 );
455
+ } else {
456
+ //Clear OWN HOP
457
+ ns_fhss_ws_set_hop_count (cur -> ws_info -> fhss_api , 0xff );
458
+ }
445
459
}
446
- ns_sw_mac_fhss_register (cur -> mac_api , fhss_api );
447
460
} else {
448
461
// Read defaults from the configuration to help FHSS testing
449
462
const fhss_ws_configuration_t * fhss_configuration = ns_fhss_ws_configuration_get (fhss_api );
@@ -524,6 +537,7 @@ static int8_t ws_fhss_discovery_configure(protocol_interface_info_entry_t *cur)
524
537
fhss_configuration .unicast_fixed_channel = tmp_uc_fixed_channel ;
525
538
fhss_configuration .broadcast_fixed_channel = tmp_bc_fixed_channel ;
526
539
ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
540
+ ns_fhss_ws_set_hop_count (cur -> ws_info -> fhss_api , 0xff );
527
541
ws_bootstrap_llc_hopping_update (cur , & fhss_configuration );
528
542
529
543
return 0 ;
0 commit comments