summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-02-18 13:51:35 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-02-18 13:51:35 +0000
commit8ce187ffcfb394eeae8c166eb6fc2abb254262b3 (patch)
tree38f6f4613f0e748ecf5b45673692abdcb29d6c1b
parent6504f1f29e830537d2df1f4014416508e455b84a (diff)
downloadgpsd-8ce187ffcfb394eeae8c166eb6fc2abb254262b3.tar.gz
Jason von Nieda's TSIP patch.
-rw-r--r--TODO19
-rw-r--r--gpsd.h1
-rw-r--r--gpsd.spec.in3
-rw-r--r--tsip.c30
4 files changed, 32 insertions, 21 deletions
diff --git a/TODO b/TODO
index 0709a5e5..3665b1b9 100644
--- a/TODO
+++ b/TODO
@@ -4,16 +4,6 @@ will unfold them again.
** Bugs in gpsd and its clients:
-*** EPH and EPV reports are zeroed too often in the TSIP driver
-
-There is some bad interaction between the policy code in
-libgpsd_core.c and the TSIP driver that we haven't figured out.
-
-This may be a symptom of more general problems in data management
-on devices that ship several sentences of fix and related data
-per cycle. It does not affect devices speaking SiRF or Zodiac or
-Garmin-binary protocol.
-
*** PPS code is flaky, possibly due to a pthreads bug
Some code attempting to terminate the PPS-monitoring thread when there
@@ -27,8 +17,8 @@ The default build has ENABLE_PPS off until we figure this one out.
There's a report that RoyalTek support broke between 2.25 and 2.28 by
David Mandala <davidm@them.com>. His workaround is to condition out
-SiRF-II support; it works OK in NMEA mode. He has undertaken to
-pin down the SVN revision that broke things after OLS.
+SiRF-II support; it works OK in NMEA mode. The Royaltek died in an
+accident, so we're stuck until someone else can test this.
*** Axiom Sandpiper II OEM NMEA GPS Module gets mistaken for an FV-18
@@ -168,7 +158,7 @@ an elevation test.
gpsd relies on the GPS to periodically send PVT reports to it.
-Most GPSes send PVT reports once a second. No GPS I am aware of
+Most GPSes send PVT reports once a second. No NMEA GPS I've ever seen
allows you to set a cycle time of less than a second. This is because
at 4800bps, a full PVT report takes just under one second in NMEA.
@@ -184,6 +174,9 @@ a second, and a SiRF one maybe 18 times a second.
Is this worth doing? Maybe. It would reduce fix latency, possibly
to good effect if your GPS is in motion. Opinions? Calculations?
+Gary Miller reports that the Garmin GPS 18 LVC-5m and the GPS 18-5Hz
+both report 5 times a second, but he doesn't have either to test.
+
*** Set the system time zone from latitude/longitude
If we're going to give gpsd the capability to set system time via
diff --git a/gpsd.h b/gpsd.h
index f0be8104..59232be6 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -187,6 +187,7 @@ struct gps_device_t {
time_t last_41; /* Timestamps for packet requests */
time_t last_5c;
time_t last_6d;
+ time_t last_46;
unsigned int parity, stopbits; /* saved RS232 link parameters */
} tsip;
#endif /* TSIP_ENABLE */
diff --git a/gpsd.spec.in b/gpsd.spec.in
index b736a114..58c829d5 100644
--- a/gpsd.spec.in
+++ b/gpsd.spec.in
@@ -146,7 +146,8 @@ cp gps.py gpsfake.py "$RPM_BUILD_ROOT"%{_libdir}/python${PYVERSION}/site-package
NMEA. Slightly better time handling under NMEA. Daemon now builds with
all but NMEA disabled. Update the leap-second offset. Fix bad unit
conversion in V output. cgpxlogger introduced. Upgrade gpxlogger
- to DBUS 0.60 conformance.
+ to DBUS 0.60 conformance. Jason von Nieda's patch may fix the chronic TSIP
+ driver problems.
* Wed Sep 14 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.30-1
- Prevent core dump on -d option. The .log option is no longer required for
diff --git a/tsip.c b/tsip.c
index e440d734..09c8e335 100644
--- a/tsip.c
+++ b/tsip.c
@@ -3,7 +3,6 @@
* by Rob Janssen, PE1CHL.
*/
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
@@ -221,8 +220,19 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
case 0x46: /* Health of Receiver */
if (len != 2)
break;
+ session->driver.tsip.last_46 = now;
u1 = getub(buf,0); /* Status code */
u2 = getub(buf,1); /* Antenna/Battery */
+ if (u1) {
+ session->gpsdata.status = STATUS_NO_FIX;
+ mask |= STATUS_SET;
+ }
+ else {
+ if (session->gpsdata.status < STATUS_FIX) {
+ session->gpsdata.status = STATUS_FIX;
+ mask |= STATUS_SET;
+ }
+ }
gpsd_report(4, "Receiver health %02x %02x\n",u1,u2);
break;
case 0x47: /* Signal Levels for all Satellites */
@@ -318,7 +328,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
f5 = getf(buf,16); /* time-of-fix */
session->gpsdata.newdata.climb = f3;
/*@ -evalorder @*/
- session->gpsdata.newdata.speed = sqrt(pow(f2,2) + pow(f1,2));
+ session->gpsdata.newdata.speed = sqrt(pow(f2,2) + pow(f1,2)) * MPS_TO_KNOTS;
/*@ +evalorder @*/
if ((session->gpsdata.newdata.track = atan2(f1,f2) * RAD_2_DEG) < 0)
session->gpsdata.newdata.track += 360.0;
@@ -390,15 +400,15 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
switch (u1 & 7) /* dimension */
{
case 3:
- session->gpsdata.status = STATUS_FIX;
+ //session->gpsdata.status = STATUS_FIX;
session->gpsdata.newdata.mode = MODE_2D;
break;
case 4:
- session->gpsdata.status = STATUS_FIX;
+ //session->gpsdata.status = STATUS_FIX;
session->gpsdata.newdata.mode = MODE_3D;
break;
default:
- session->gpsdata.status = STATUS_NO_FIX;
+ //session->gpsdata.status = STATUS_NO_FIX;
session->gpsdata.newdata.mode = MODE_NO_FIX;
break;
}
@@ -524,7 +534,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
d2 = s2 * d5; /* north velocity m/s */
session->gpsdata.newdata.climb = s3 * d5; /* up velocity m/s */
/*@ -evalorder @*/
- session->gpsdata.newdata.speed = sqrt(pow(d2,2) + pow(d1,2));
+ session->gpsdata.newdata.speed = sqrt(pow(d2,2) + pow(d1,2)) * MPS_TO_KNOTS;
/*@ +evalorder @*/
if ((session->gpsdata.newdata.track = atan2(d1,d2) * RAD_2_DEG) < 0)
session->gpsdata.newdata.track += 360.0;
@@ -599,7 +609,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
d2 = s3 * d5; /* north velocity m/s */
session->gpsdata.newdata.climb = s4 * d5; /* up velocity m/s */
/*@ -evalorder @*/
- session->gpsdata.newdata.speed = sqrt(pow(d2,2) + pow(d1,2));
+ session->gpsdata.newdata.speed = sqrt(pow(d2,2) + pow(d1,2)) * MPS_TO_KNOTS;
/*@ +evalorder @*/
if ((session->gpsdata.newdata.track = atan2(d1,d2) * RAD_2_DEG) < 0)
session->gpsdata.newdata.track += 360.0;
@@ -650,6 +660,12 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
session->driver.tsip.last_5c = now;
}
+ if ((now - session->driver.tsip.last_46) > 5) {
+ /* Request Health of Receiver */
+ (void)tsip_write(session->gpsdata.gps_fd, 0x26, buf, 0);
+ session->driver.tsip.last_46 = now;
+ }
+
return mask;
}