From 562831b815b65fff79e72180b5a2daa8348542fe Mon Sep 17 00:00:00 2001 From: Haakan Johansson Date: Sat, 13 Nov 2010 15:12:40 +0100 Subject: Allow oncore devices in postion hold mode to deliver PPS data to ntpshm. Signed-off-by: Jon Schlueter --- driver_oncore.c | 4 ++++ gpsd.h-tail | 1 + libgpsd_core.c | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/driver_oncore.c b/driver_oncore.c index a72820d1..b9921756 100644 --- a/driver_oncore.c +++ b/driver_oncore.c @@ -143,6 +143,8 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf, mask |= LATLON_IS | ALTITUDE_IS | SPEED_IS | TRACK_IS; + session->driver.oncore.good_time = 0; + gpsd_zero_satellites(&session->gpsdata); /* Merge the satellite information from the Bb message. */ Bbused = 0; @@ -174,6 +176,8 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf, st++; if (status & 0x80) session->gpsdata.used[nsv++] = sv; + if (status & 0x02) + session->driver.oncore.good_time = 1; } } for (j = 0; (int)j < session->driver.oncore.visible; j++) diff --git a/gpsd.h-tail b/gpsd.h-tail index 758a02f7..4084512f 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -448,6 +448,7 @@ struct gps_device_t { int PRN[ONCORE_VISIBLE_CH]; /* PRNs of satellite */ int elevation[ONCORE_VISIBLE_CH]; /* elevation of satellite */ int azimuth[ONCORE_VISIBLE_CH]; /* azimuth */ + int good_time; double pps_delay; } oncore; #endif /* ONCORE_ENABLE */ diff --git a/libgpsd_core.c b/libgpsd_core.c index b85fde6e..91400e25 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -52,6 +52,10 @@ #include #endif +#if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE) +extern const struct gps_type_t oncore_binary; +#endif + int gpsd_switch_driver(struct gps_device_t *session, char *type_name) { const struct gps_type_t **dp; @@ -423,7 +427,12 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) (unsigned long)tv.tv_sec, (unsigned long)tv.tv_usec); /*@ +boolint @*/ - if (3 < session->context->fixcnt) { + if (3 < session->context->fixcnt +#if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE) + || (session->device_type == &oncore_binary && + session->driver.oncore.good_time) +#endif + ) { /* Garmin doc says PPS is valid after four good fixes. */ /* * The PPS pulse is normally a short pulse with a frequency of @@ -1006,7 +1015,12 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) //gpsd_report(LOG_PROG, "NTP: bad new time\n"); } else if (session->newdata.time == session->last_fixtime) { //gpsd_report(LOG_PROG, "NTP: Not a new time\n"); - } else if (session->newdata.mode == MODE_NO_FIX) { + } else if (session->newdata.mode == MODE_NO_FIX +#if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE) + && !(session->device_type == &oncore_binary && + session->driver.oncore.good_time) +#endif + ) { //gpsd_report(LOG_PROG, "NTP: No fix\n"); } else { double offset; -- cgit v1.2.1