@@ -109,15 +109,15 @@ static int32_t fhss_ws_calc_bc_channel(fhss_structure_t *fhss_structure)
109109{
110110 int32_t next_channel = fhss_structure -> rx_channel ;
111111
112- if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_TR51CF ) {
112+ if (fhss_structure -> ws -> fhss_configuration .ws_bc_channel_function == WS_TR51CF ) {
113113 next_channel = tr51_get_bc_channel_index (fhss_structure -> ws -> bc_slot , fhss_structure -> ws -> fhss_configuration .bsi , fhss_structure -> number_of_channels , NULL );
114114 if (++ fhss_structure -> ws -> bc_slot == fhss_structure -> number_of_channels ) {
115115 fhss_structure -> ws -> bc_slot = 0 ;
116116 }
117- } else if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_DH1CF ) {
117+ } else if (fhss_structure -> ws -> fhss_configuration .ws_bc_channel_function == WS_DH1CF ) {
118118 next_channel = dh1cf_get_bc_channel_index (fhss_structure -> ws -> bc_slot , fhss_structure -> ws -> fhss_configuration .bsi , fhss_structure -> number_of_channels );
119119 fhss_structure -> ws -> bc_slot ++ ;
120- } else if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_VENDOR_DEF_CF ) {
120+ } else if (fhss_structure -> ws -> fhss_configuration .ws_bc_channel_function == WS_VENDOR_DEF_CF ) {
121121 if (fhss_structure -> ws -> fhss_configuration .vendor_defined_cf ) {
122122 next_channel = fhss_structure -> ws -> fhss_configuration .vendor_defined_cf (fhss_structure -> fhss_api , fhss_structure -> ws -> bc_slot , NULL , fhss_structure -> ws -> fhss_configuration .bsi , fhss_structure -> number_of_channels );
123123 }
@@ -240,7 +240,7 @@ static uint32_t fhss_ws_calculate_ufsi(fhss_structure_t *fhss_structure, uint32_
240240 }
241241 uint64_t ms_since_seq_start = (cur_slot * dwell_time ) + (dwell_time - remaining_time ) + time_to_tx ;
242242 uint32_t seq_length = 0x10000 ;
243- if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_TR51CF ) {
243+ if (fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function == WS_TR51CF ) {
244244 ms_since_seq_start %= (dwell_time * fhss_structure -> number_of_channels );
245245 seq_length = fhss_structure -> number_of_channels ;
246246 }
@@ -289,7 +289,7 @@ static void fhss_ws_synch_state_set_callback(const fhss_api_t *api, fhss_states
289289 if (!fhss_structure ) {
290290 return ;
291291 }
292- if (( fhss_state == FHSS_SYNCHRONIZED ) && ( fhss_structure -> ws -> fhss_configuration . ws_channel_function != WS_FIXED_CHANNEL ) ) {
292+ if (fhss_state == FHSS_SYNCHRONIZED ) {
293293 uint32_t fhss_broadcast_interval = fhss_structure -> ws -> fhss_configuration .fhss_broadcast_interval ;
294294 uint8_t fhss_bc_dwell_interval = fhss_structure -> ws -> fhss_configuration .fhss_bc_dwell_interval ;
295295
@@ -298,8 +298,10 @@ static void fhss_ws_synch_state_set_callback(const fhss_api_t *api, fhss_states
298298 fhss_broadcast_handler (fhss_structure -> fhss_api , 0 );
299299 }
300300 // Start unicast schedule
301- fhss_ws_update_uc_channel_callback (fhss_structure );
302- fhss_start_timer (fhss_structure , fhss_structure -> ws -> fhss_configuration .fhss_uc_dwell_interval * 1000 , fhss_unicast_handler );
301+ if ((fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function != WS_FIXED_CHANNEL )) {
302+ fhss_ws_update_uc_channel_callback (fhss_structure );
303+ fhss_start_timer (fhss_structure , fhss_structure -> ws -> fhss_configuration .fhss_uc_dwell_interval * 1000 , fhss_unicast_handler );
304+ }
303305 }
304306
305307 fhss_structure -> fhss_state = fhss_state ;
@@ -311,17 +313,17 @@ static void fhss_ws_update_uc_channel_callback(fhss_structure_t *fhss_structure)
311313 uint8_t mac_address [8 ];
312314 int32_t next_channel = fhss_structure -> rx_channel ;
313315 fhss_structure -> callbacks .read_mac_address (fhss_structure -> fhss_api , mac_address );
314- if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_FIXED_CHANNEL ) {
316+ if (fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function == WS_FIXED_CHANNEL ) {
315317 return ;
316- } else if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_TR51CF ) {
318+ } else if (fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function == WS_TR51CF ) {
317319 next_channel = fhss_structure -> rx_channel = tr51_get_uc_channel_index (fhss_structure -> ws -> uc_slot , mac_address , fhss_structure -> number_of_channels , NULL );
318320 if (++ fhss_structure -> ws -> uc_slot == fhss_structure -> number_of_channels ) {
319321 fhss_structure -> ws -> uc_slot = 0 ;
320322 }
321- } else if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_DH1CF ) {
323+ } else if (fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function == WS_DH1CF ) {
322324 next_channel = fhss_structure -> rx_channel = dh1cf_get_uc_channel_index (fhss_structure -> ws -> uc_slot , mac_address , fhss_structure -> number_of_channels );
323325 fhss_structure -> ws -> uc_slot ++ ;
324- } else if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_VENDOR_DEF_CF ) {
326+ } else if (fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function == WS_VENDOR_DEF_CF ) {
325327 if (fhss_structure -> ws -> fhss_configuration .vendor_defined_cf ) {
326328 next_channel = fhss_structure -> rx_channel = fhss_structure -> ws -> fhss_configuration .vendor_defined_cf (fhss_structure -> fhss_api , fhss_structure -> ws -> bc_slot , mac_address , fhss_structure -> ws -> fhss_configuration .bsi , fhss_structure -> number_of_channels );
327329 }
@@ -453,9 +455,6 @@ static bool fhss_ws_check_tx_conditions_callback(const fhss_api_t *api, bool is_
453455 if (!fhss_structure ) {
454456 return true;
455457 }
456- if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_FIXED_CHANNEL ) {
457- return true;
458- }
459458 // Do not allow broadcast destination on unicast channel
460459 if (is_broadcast_addr && (fhss_structure -> ws -> is_on_bc_channel == false)) {
461460 return false;
@@ -535,7 +534,7 @@ static void fhss_ws_data_tx_done_callback(const fhss_api_t *api, bool waiting_ac
535534 if (!fhss_structure ) {
536535 return ;
537536 }
538- if (( fhss_structure -> fhss_state == FHSS_SYNCHRONIZED ) && ( fhss_structure -> ws -> fhss_configuration . ws_channel_function != WS_FIXED_CHANNEL ) ) {
537+ if (fhss_structure -> fhss_state == FHSS_SYNCHRONIZED ) {
539538 if (waiting_ack == false) {
540539 if (fhss_structure -> ws -> is_on_bc_channel == false) {
541540 fhss_structure -> callbacks .change_channel (fhss_structure -> fhss_api , fhss_structure -> rx_channel );
@@ -612,7 +611,7 @@ static bool fhss_ws_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadc
612611 return false;
613612 }
614613 // Do not use broadcast queue when fixed channel
615- if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_FIXED_CHANNEL ) {
614+ if (fhss_structure -> ws -> fhss_configuration .ws_bc_channel_function == WS_FIXED_CHANNEL ) {
616615 return false;
617616 }
618617 // Broadcast packets are stored in broadcast queue
@@ -661,9 +660,6 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
661660 if (!fhss_structure -> ws ) {
662661 return -1 ;
663662 }
664- if (fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_FIXED_CHANNEL ) {
665- return 0 ;
666- }
667663 if (!bc_timing_info -> broadcast_interval || !bc_timing_info -> broadcast_dwell_interval ) {
668664 return -1 ;
669665 }
@@ -701,14 +697,15 @@ int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_co
701697 if (channel_count <= 0 ) {
702698 return -1 ;
703699 }
704- if ((fhss_structure -> ws -> fhss_configuration .ws_channel_function == WS_FIXED_CHANNEL ) && (fhss_configuration -> ws_channel_function != WS_FIXED_CHANNEL )) {
700+ if ((fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function == WS_FIXED_CHANNEL ) && (fhss_configuration -> ws_uc_channel_function != WS_FIXED_CHANNEL )) {
705701 // Start unicast schedule if channel function changed from fixed channel
706702 fhss_start_timer (fhss_structure , fhss_configuration -> fhss_uc_dwell_interval * 1000 , fhss_unicast_handler );
707703 }
708704 fhss_structure -> ws -> fhss_configuration = * fhss_configuration ;
709705 fhss_structure -> number_of_channels = channel_count ;
710- tr_info ("fhss Configuration set function:%d channels: %d, uc dwell: %d, bc dwell: %d, bc interval: %d, bsi:%d" ,
711- fhss_structure -> ws -> fhss_configuration .ws_channel_function ,
706+ tr_info ("fhss Configuration set UC CF: %d, BC CF: %d, channels: %d, uc dwell: %d, bc dwell: %d, bc interval: %d, bsi:%d" ,
707+ fhss_structure -> ws -> fhss_configuration .ws_uc_channel_function ,
708+ fhss_structure -> ws -> fhss_configuration .ws_bc_channel_function ,
712709 fhss_structure -> number_of_channels ,
713710 fhss_structure -> ws -> fhss_configuration .fhss_uc_dwell_interval ,
714711 fhss_structure -> ws -> fhss_configuration .fhss_bc_dwell_interval ,
0 commit comments