From 4e90199ff450df4e3b7226b3ed1a3b95448f3033 Mon Sep 17 00:00:00 2001 From: Maximilien Cuony Date: Mon, 6 Jun 2016 19:05:23 +0200 Subject: Internal ts test --- src/common/src/Core/main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/common/src/Core/main.c b/src/common/src/Core/main.c index 75a444a..125671f 100644 --- a/src/common/src/Core/main.c +++ b/src/common/src/Core/main.c @@ -305,6 +305,9 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { leds_turn_on(LED_BLUE); int t_gps_print_latch = 0; + int t_gps_hours_handeled = 0; + uint64_t last_hour_timestamp = 0; + while (1) { struct tm time; @@ -345,6 +348,30 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) { t_gps_print_latch = 0; } + if (time_valid && gps_time.tm_sec == 0 && gps_time.tm_min == 0 && t_gps_hours_handeled == 0) { + + uint64_t current_timestamp = timestamp_now(); + + if (last_hour_timestamp == 0) { + usart_debug("DERIV INIT TS=%i\r\n", current_timestamp); + } else { + + usart_debug("DERIV TS=%lld Excepted=%lld Delta=%lld\r\n", + current_timestamp, + last_hour_timestamp + 3600000, + last_hour_timestamp + 3600000 - current_timestamp + ); + } + + last_hour_timestamp = timestamp_now(); + + t_gps_hours_handeled = 1; + } + + if (gps_time.tm_sec != 0) { + t_gps_hours_handeled = 0; + } + vTaskDelay(100 / portTICK_RATE_MS); // Reload watchdog -- cgit v1.2.3