From c93861c733ced9c6659241cea69c7feed56afcce Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Wed, 20 Feb 2019 02:39:38 +0000 Subject: use OCXO, and auto fail-over between different clock sources --- app/dcf77.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/dcf77.c') diff --git a/app/dcf77.c b/app/dcf77.c index 2e9a9a4..909188b 100644 --- a/app/dcf77.c +++ b/app/dcf77.c @@ -10,7 +10,8 @@ static Event_ring dcf77_ring; -uint64_t dcf77_last_second; +static uint64_t dcf77_last_second; +uint64_t dcf77_last_happy; void exti15_10_isr (void) { @@ -71,8 +72,12 @@ static void process_bits (uint64_t abs) if (bits[17]) dcf77_time.s -= 3600; /*CEST*/ + dcf77_last_happy = abs - (int64_t) 60 * (int64_t) HZ; + pll_set_offset (dcf77_time, abs); + + printf ("DCF77: Next minute is: %02d-%02d-%02d %02d:%02d\r\n", u.year, u.month, u.mday, u.hour, u.minute); time_print_epoch ("DCF77: ", dcf77_time); @@ -161,7 +166,7 @@ void dcf77_dispatch (void) abs = abs_extend (now); dcf77_last_second = abs; - //pll_dispatch (abs); + pll_dispatch (dcf77_last_happy, abs, "DCF77"); if (time_known) report_time (abs); -- cgit v1.2.3