@@ -811,16 +811,22 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8],
811
811
return -1 ;
812
812
}
813
813
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" );
814
816
return -1 ;
815
817
}
816
818
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 );
817
821
return 0 ;
818
822
}
819
823
platform_enter_critical ();
820
824
uint16_t own_bc_slot = fhss_structure -> ws -> bc_slot ;
821
825
uint32_t prev_synchronization_time = fhss_structure -> ws -> synchronization_time ;
822
826
fhss_structure -> ws -> synchronization_time = fhss_structure -> callbacks .read_timestamp (fhss_structure -> fhss_api );
823
827
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 );
824
830
uint32_t own_bc_interval_offset = fhss_ws_calculate_broadcast_interval_offset (fhss_structure , fhss_structure -> ws -> synchronization_time );
825
831
fhss_stop_timer (fhss_structure , fhss_broadcast_handler );
826
832
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],
864
870
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 ));
865
871
}
866
872
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" );
867
876
}
868
877
fhss_stats_update (fhss_structure , STATS_FHSS_SYNCH_INTERVAL , US_TO_S (time_since_last_synch_us ));
869
878
return 0 ;
0 commit comments