@@ -811,16 +811,22 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
811811 return -1 ;
812812 }
813813 if (!bc_timing_info -> broadcast_interval || !bc_timing_info -> broadcast_dwell_interval ) {
814+ //IOTTHD-3571 temporary debug traces
815+ tr_debug ("No bc info to synch" );
814816 return -1 ;
815817 }
816818 if (((uint32_t )S_TO_US (fhss_structure -> ws -> min_synch_interval ) > (fhss_structure -> callbacks .read_timestamp (fhss_structure -> fhss_api ) - fhss_structure -> ws -> synchronization_time )) && !force_synch ) {
819+ //IOTTHD-3571 temporary debug traces
820+ tr_debug ("Do not synch, min_synch_interval: %u, timestamp: %" PRIu32 ", synchronization_time: %" PRIu32 "" , fhss_structure -> ws -> min_synch_interval , fhss_structure -> callbacks .read_timestamp (fhss_structure -> fhss_api ), fhss_structure -> ws -> synchronization_time );
817821 return 0 ;
818822 }
819823 platform_enter_critical ();
820824 uint16_t own_bc_slot = fhss_structure -> ws -> bc_slot ;
821825 uint32_t prev_synchronization_time = fhss_structure -> ws -> synchronization_time ;
822826 fhss_structure -> ws -> synchronization_time = fhss_structure -> callbacks .read_timestamp (fhss_structure -> fhss_api );
823827 uint32_t time_since_last_synch_us = fhss_structure -> ws -> synchronization_time - prev_synchronization_time ;
828+ //IOTTHD-3571 temporary debug traces
829+ tr_debug ("time_since_last_synch_us: %" PRIu32 ", synchronization_time: %" PRIu32 ", prev_synchronization_time: %" PRIu32 "" , time_since_last_synch_us , fhss_structure -> ws -> synchronization_time , prev_synchronization_time );
824830 uint32_t own_bc_interval_offset = fhss_ws_calculate_broadcast_interval_offset (fhss_structure , fhss_structure -> ws -> synchronization_time );
825831 fhss_stop_timer (fhss_structure , fhss_broadcast_handler );
826832 uint32_t time_from_reception_ms = US_TO_MS (fhss_structure -> callbacks .read_timestamp (fhss_structure -> fhss_api ) - bc_timing_info -> bt_rx_timestamp );
@@ -864,6 +870,9 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
864870 fhss_stats_update (fhss_structure , STATS_FHSS_DRIFT_COMP , NS_TO_US (fhss_structure -> ws -> drift_per_millisecond_ns * bc_timing_info -> broadcast_dwell_interval ));
865871 }
866872 tr_debug ("synch to parent: %s, drift: %" PRIi32 "ms in %" PRIu32 " seconds, compensation: %" PRIi32 "ns per ms" , trace_array (eui64 , 8 ), true_bc_interval_offset - own_bc_interval_offset + ((int32_t )(fhss_structure -> ws -> bc_slot - own_bc_slot ) * bc_timing_info -> broadcast_interval ), US_TO_S (time_since_last_synch_us ), fhss_structure -> ws -> drift_per_millisecond_ns );
873+ } else {
874+ //IOTTHD-3571 temporary debug traces
875+ tr_debug ("Do not compensate" );
867876 }
868877 fhss_stats_update (fhss_structure , STATS_FHSS_SYNCH_INTERVAL , US_TO_S (time_since_last_synch_us ));
869878 return 0 ;
0 commit comments