summaryrefslogtreecommitdiffstats
path: root/app/gps.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/gps.c')
-rw-r--r--app/gps.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/app/gps.c b/app/gps.c
index b0bc433..7e2fd1b 100644
--- a/app/gps.c
+++ b/app/gps.c
@@ -185,25 +185,30 @@ ubx_recv_utc (uint8_t *ptr, unsigned len)
ptr += ubx_get_u8 (ptr, &min);
ptr += ubx_get_u8 (ptr, &sec);
-// printf ("gps %02d:%02d:%02d %09d\r\n", (int) hour, (int) min, (int) sec, (int) nano);
+ // printf ("gps %02d:%02d:%02d %09d\r\n", (int) hour, (int) min, (int) sec, (int) nano);
-{
- UTC u;
- EPOCH gps_time;
+ {
+ UTC u;
+ EPOCH gps_time;
+ uint32_t now;
+ uint64_t abs;
- u.jday = 0;
- u.year = year;
- u.month = month;
- u.mday = day;
- u.hour = hour;
- u.minute = min;
- u.second = sec;
- u.nanosecond = 0;
+ u.jday = 0;
+ u.year = year;
+ u.month = month;
+ u.mday = day;
+ u.hour = hour;
+ u.minute = min;
+ u.second = sec;
+ u.nanosecond = 0;
- gps_time = time_utc_to_epoch (u);
+ gps_time = time_utc_to_epoch (u);
- pll_set_offset (gps_time, abs);
-}
+
+ now = SCS_DWT_CYCCNT;
+ abs = abs_extend (now);
+ pll_set_offset (gps_time, abs);
+ }
#if 0
@@ -437,7 +442,7 @@ static void gps_pps_dispatch (void)
if (!v) return;
- abs=abs_extend(now);
+ abs = abs_extend (now);