diff options
author | Gary E. Miller <gem@rellim.com> | 2008-01-20 23:26:51 +0000 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2008-01-20 23:26:51 +0000 |
commit | a99dd5ffb6518c45b92099f6fc99ef9bdc254924 (patch) | |
tree | d4db67ada82523d6d73fb2ac63d294f347ad4cda /libgpsd_core.c | |
parent | 2f022bcef95228b3a40bee68f0583a7ad2ab25e1 (diff) | |
download | gpsd-a99dd5ffb6518c45b92099f6fc99ef9bdc254924.tar.gz |
Add Garmin 5Hz support to PPS. Patch from John Arthur <lists@davey.net.au>
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r-- | libgpsd_core.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c index b4c75e45..91ec967a 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -180,6 +180,9 @@ static void *gpsd_ppsmonitor(void *arg) * * A few stupid GPS, like the Furuno GPSClock, output a 1.0 Hz * square wave where the leading edge is the start of a second + * + * 5Hz GPS (Garmin 18-5Hz) pulses at 5Hz. Set the pulse length to + * 40ms which gives a 160ms pulse before going high. * */ #define timediff(x, y) (int)((x.tv_sec-y.tv_sec)*1000000+x.tv_usec-y.tv_usec) @@ -187,30 +190,35 @@ static void *gpsd_ppsmonitor(void *arg) duration = timediff(tv, pulse[state == 0]); #undef timediff - if (800000 > duration - && !session->driver.nmea.ignore_trailing_edge) { - /* less than 800mS, duration too short for anything */ - gpsd_report(LOG_RAW, - "PPS pulse rejected too short. cycle: %d, duration: %d\n", - cycle, duration); + if (cycle > 199000 && cycle < 201000 ) { + /* 5Hz cycle */ + /* looks like 5hz PPS pulse */ + if (duration > 45000) + (void)ntpshm_pps(session, &tv); + gpsd_report(LOG_RAW, "5Hz PPS pulse. cycle: %d, duration: %d\n", + cycle, duration); } else if (cycle > 999000 && cycle < 1001000 ) { /* looks like PPS pulse or square wave */ - if (duration > 499000 && duration < 501000 + if (duration > 499000 && duration < 501000 && session->driver.nmea.ignore_trailing_edge) { /* looks like 1.0 Hz square wave, ignore trailing edge */ if (state == 1) { (void)ntpshm_pps(session, &tv); } - } else { + } else { /* looks like PPS pulse */ (void)ntpshm_pps(session, &tv); - } + } + gpsd_report(LOG_RAW, "PPS pulse. cycle: %d, duration: %d\n", + cycle, duration); } else if (cycle > 1999000 && cycle < 2001000) { /* looks like 0.5 Hz square wave */ (void)ntpshm_pps(session, &tv); + gpsd_report(LOG_RAW, "PPS square wave. cycle: %d, duration: %d\n", + cycle, duration); } else { - gpsd_report(LOG_RAW, "PPS pulse rejected. cycle: %d, duration: %d\n", + gpsd_report(LOG_RAW, "PPS pulse rejected. cycle: %d, duration: %d\n", cycle, duration); } } else { |