From 4318f37d4cd73693a051a5b7e15c5f678075c3f1 Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Wed, 19 Aug 2020 14:01:48 +0300 Subject: [PATCH] Calculate drift in critical state (#2419) --- source/Service_Libs/fhss/fhss_ws.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 111e8c6c24c..143e0bef22e 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -980,7 +980,6 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8], if (fhss_structure->ws->fhss_configuration.ws_bc_channel_function == WS_TR51CF) { fhss_structure->ws->bc_slot %= fhss_structure->number_of_channels; } - platform_exit_critical(); //TODO: support multiple parents fhss_structure->ws->parent_bc_info = bc_timing_info; if (prev_synchronization_time && fhss_structure->ws->fhss_configuration.ws_bc_channel_function != WS_FIXED_CHANNEL) { @@ -1001,6 +1000,7 @@ int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8], } tr_debug("synch to parent: %s, drift: %"PRIi32"ms in %"PRIu64" 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); } + platform_exit_critical(); fhss_stats_update(fhss_structure, STATS_FHSS_SYNCH_INTERVAL, US_TO_S(time_since_last_synch_us)); return 0; }