From a3ead50933d40ef0040bc35983f5cc777935b4ee Mon Sep 17 00:00:00 2001 From: Haakan Johansson Date: Mon, 14 Mar 2016 15:05:17 +0100 Subject: [PATCH 4/4] Introduce the flag GOODTIME_IS to mark that the device has a good time even if it does not report a position fix. Used by the OnCore driver, e.g. when in position hold mode. scons check pass --- driver_oncore.c | 4 ++-- gpsd.c | 3 ++- gpsd.h-tail | 1 + timehint.c | 3 ++- 4 filer ändrade, 7 tillägg(+), 4 borttagningar(-) diff --git a/driver_oncore.c b/driver_oncore.c index f4338b7..43f65f0 100644 --- a/driver_oncore.c +++ b/driver_oncore.c @@ -176,9 +176,9 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf, } /* bit 2 of the status word: using for time solution */ if (status & 0x02) - mask |= PPSTIME_IS; + mask |= PPSTIME_IS | GOODTIME_IS; /* - * The PPSTIME_IS mask bit exists distinctly from TIME_SET exactly + * The GOODTIME_IS mask bit exists distinctly from TIME_SET exactly * so an OnCore running in time-service mode (and other GPS clocks) * can signal that it's returning time even though no position fixes * have been available. diff --git a/gpsd.c b/gpsd.c index 555495b..9d2853d 100644 --- a/gpsd.c +++ b/gpsd.c @@ -1517,7 +1517,8 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) */ if ((changed & TIME_SET) == 0) { //gpsd_log(&context.errout, LOG_PROG, "NTP: No time this packet\n"); - } else if ( 0 >= device->fixcnt ) { + } else if ( 0 >= device->fixcnt && + (changed & GOODTIME_IS) == 0) { /* many GPS spew random times until a valid GPS fix */ //gpsd_log(&context.errout, LOG_PROG, "NTP: no fix\n"); } else if (isnan(device->newdata.time)) { diff --git a/gpsd.h-tail b/gpsd.h-tail index 6af997a..a308de0 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -304,6 +304,7 @@ typedef enum { #define PERR_IS INTERNAL_SET(8) /* PDOP set */ #define PASSTHROUGH_IS INTERNAL_SET(9) /* passthrough mode */ #define EOF_IS INTERNAL_SET(10) /* synthetic EOF */ +#define GOODTIME_IS INTERNAL_SET(11) /* time good even if no pos fix */ #define DATA_IS ~(ONLINE_SET|PACKET_SET|CLEAR_IS|REPORT_IS) typedef unsigned int driver_mask_t; diff --git a/timehint.c b/timehint.c index da828f4..e057339 100644 --- a/timehint.c +++ b/timehint.c @@ -374,7 +374,8 @@ static char *report_hook(volatile struct pps_thread_t *pps_thread, * * Not sure yet how to handle u-blox UBX_MODE_TMONLY */ - if (session->fixcnt <= PPS_MIN_FIXES) + if (session->fixcnt <= PPS_MIN_FIXES && + (session->gpsdata.set & GOODTIME_IS) == 0) return "no fix"; } -- 1.7.10.4