diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-08-31 20:50:59 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-08-31 20:50:59 +0000 |
commit | 84115883abcc6e083b367c5b1e59215784f87f3e (patch) | |
tree | abdc4d1892290bedd2cddcdad1538b5b10849482 | |
parent | c61e42306cf42981e34d1dae844bb90861e5aced (diff) | |
download | gpsd-84115883abcc6e083b367c5b1e59215784f87f3e.tar.gz |
Design decision: Trie North data gets mapped into existing fields (track, etc)
...rather than new ones like heading. This gets rid of the HEADING_FIX code
contributed but not compiled in by default.
Also, fix a place in the zodiac driver that sets a fix rather than newdata
member.
-rw-r--r-- | gps.h | 8 | ||||
-rw-r--r-- | gpsd.c | 8 | ||||
-rw-r--r-- | gpsutils.c | 6 | ||||
-rw-r--r-- | libgps.c | 6 | ||||
-rw-r--r-- | nmea_parse.c | 54 | ||||
-rw-r--r-- | zodiac.c | 2 |
6 files changed, 16 insertions, 68 deletions
@@ -66,12 +66,6 @@ struct gps_fix_t { double eps; /* Speed uncertainty, meters/sec */ double climb; /* Vertical speed, meters/sec */ double epc; /* Vertical speed uncertainty */ -#ifdef HEADING_FIX - double heading; /* Heading (relative to true north) - only available from True North or comparable digital compass devices */ -#endif /* HEADING_FIX */ - double pitch; /* Pitch angle in degrees */ - double roll; /* Roll angle in degrees */ - double dip; /* Dip angle in degrees */ }; /* @@ -255,7 +249,7 @@ struct gps_data_t { #define SAT_FIX_USED 0x40 /* used for position fix */ #endif - /* compass status */ + /* compass status -- TrueNorth (and any similar) devices only */ char headingStatus; char pitchStatus; char rollStatus; @@ -742,14 +742,6 @@ static int handle_gpsd_request(int cfd, char *buf, int buflen) else (void)snprintf(phrase, sizeof(phrase), ",G=GPS"); break; -#ifdef HEADING_FIX - case 'H': - if (assign_channel(whoami) && have_fix(whoami->device) && isnan(whoami->fixbuffer.heading)==0) - (void)snprintf(phrase, sizeof(phrase), ",H=%.4f", whoami->fixbuffer.heading); - else - (void)strlcpy(phrase, ",H=?", BUFSIZ); - break; -#endif /* HEADING_FIX */ case 'I': if (assign_channel(whoami) && whoami->device->device_type!=NULL) (void)snprintf(phrase, sizeof(phrase), ",I=%s", @@ -27,12 +27,6 @@ void gps_clear_fix(/*@out@*/struct gps_fix_t *fixp) fixp->epd = NAN; fixp->eps = NAN; fixp->epc = NAN; -#ifdef HEADING_FIX - fixp->heading = NAN; -#endif /* HEADING_FIX */ - fixp->pitch = NAN; - fixp->roll = NAN; - fixp->dip = NAN; } unsigned int gps_valid_fields(/*@in@*/struct gps_fix_t *fixp) @@ -351,12 +351,6 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata) gpsdata->set |= SPEEDERR_SET; if (isnan(nf.epc)==0) gpsdata->set |= CLIMBERR_SET; -#ifndef HEADING_FIX - nf.pitch = nf.roll = nf.dip = NAN; -#else /* HEADING_FIX */ - /* there is no support for a TrueNorth source in the O command at this stage, so libgps-based clients that wish to use the heading provided by such a source must send the sequence "OH\n". N.B. the order is important - "HO\n" will result in heading=NAN. More work is needed to provide any support for pitch, roll and dip. */ - nf.pitch = nf.roll = nf.dip = nf.heading = NAN; -#endif /* HEADING_FIX */ gpsdata->fix = nf; (void)strlcpy(gpsdata->tag, tag, MAXTAGLEN+1); gpsdata->set |= TIME_SET|TIMERR_SET|LATLON_SET|MODE_SET; diff --git a/nmea_parse.c b/nmea_parse.c index e5a131a0..07630be7 100644 --- a/nmea_parse.c +++ b/nmea_parse.c @@ -512,53 +512,27 @@ static gps_mask_t processTNTHTM(int c UNUSED, char *field[], struct gps_device_t //gpsd_zero_satellites(&session->gpsdata); -#ifdef HEADING_FIX - // these fields are not handled by gps_merge_fix(), so must be written directly to the current fix structure -#endif /* HEADING_FIX */ - session->gpsdata.fix.time = timestamp(); -#ifndef HEADING_FIX + /* + * Heading maps to track. + * Pitch maps to climb. + * Roll maps to speed. + * Dip maps to altitude. + */ + session->gpsdata.newdata.time = timestamp(); session->gpsdata.newdata.track = atof(field[1]); -#else /* HEADING_FIX */ - session->gpsdata.fix.heading = atof(field[1]); -#endif /* HEADING_FIX */ session->gpsdata.headingStatus = *field[2]; -#ifndef HEADING_FIX - mask |= (TRACK_SET | MODE_SET); - session->gpsdata.status = STATUS_FIX; /* could be DGPS_FIX, we can't tell */ - //session->gpsdata.newdata.mode = MODE_2D; - session->gpsdata.newdata.mode = MODE_2D; - //session->gpsdata.newdata.mode = MODE_NO_FIX; - - session->gpsdata.newdata.pitch = atof(field[3]); -#else /* HEADING_FIX */ - // this device does not provide track, mode, or status - we have to rely on other devices for that! -// mask |= (TRACK_SET | MODE_SET); -// session->gpsdata.status = STATUS_FIX; /* could be DGPS_FIX, we can't tell */ -// session->gpsdata.newdata.mode = MODE_2D; - - session->gpsdata.fix.pitch = atof(field[3]); -#endif /* HEADING_FIX */ + session->gpsdata.newdata.climb = atof(field[3]); session->gpsdata.pitchStatus = *field[4]; - -#ifndef HEADING_FIX - session->gpsdata.newdata.roll = atof(field[5]); -#else /* HEADING_FIX */ - session->gpsdata.fix.roll = atof(field[5]); -#endif /* HEADING_FIX */ + session->gpsdata.newdata.speed = atof(field[5]); session->gpsdata.rollStatus = *field[6]; - -#ifndef HEADING_FIX session->gpsdata.newdata.dip = atof(field[7]); -#else /* HEADING_FIX */ - session->gpsdata.fix.dip = atof(field[7]); -#endif /* HEADING_FIX */ + session->gpsdata.fix.altitude = atof(field[7]); session->gpsdata.horzField = atof(field[8]); + session->gpsdata.newdata.mode = MODE_2D; + mask |= (TRACK_SET | MODE_SET | TRACK_SET | SPEED_SET | CLIMB_SET | ALTITUDE_SET); + session->gpsdata.status = STATUS_FIX; /* could be DGPS_FIX */ -#ifndef HEADING_FIX - //gpsd_report(5, "Heading %lf %c.\n", session->gpsdata.fix.track, session->gpsdata.fix.headingStatus); -#else /* HEADING_FIX */ - //gpsd_report(5, "Heading %lf %c.\n", session->gpsdata.fix.heading, session->gpsdata.fix.headingStatus); -#endif /* HEADING_FIX */ + gpsd_report(5, "Heading %lf %c.\n", session->gpsdata.fix.track, session->gpsdata.fix.headingStatus); return mask; } #endif /* TNT_ENABLE */ @@ -320,7 +320,7 @@ static void handle1005(struct gps_device_t *session UNUSED) gpsd_report(1, "iode mismatch:%d\n", (getword(13+i) & 4096) ? 1 : 0); } #endif - if (session->gpsdata.fix.mode == MODE_NO_FIX) + if (session->gpsdata.newdata.mode == MODE_NO_FIX) session->gpsdata.status = STATUS_NO_FIX; else if (numcorrections == 0) session->gpsdata.status = STATUS_FIX; |