diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-09-22 14:50:03 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-09-22 14:50:03 -0400 |
commit | 282691da60ec526772f713a63fa0b8f43aea7acb (patch) | |
tree | 622f4d55c882f63475b84691d41108dd17326cca /driver_tsip.c | |
parent | f63bdafc18991624b872e9efa858c024834a540e (diff) | |
download | gpsd-282691da60ec526772f713a63fa0b8f43aea7acb.tar.gz |
Refactor representation of satellite data into an array of structs...
...from a set of parallel arrays. This change flushed out a
longstanding bug in the computation of DOPs for estimated error bars.
Some test-load rebuilds were required:
geostar-geos1m-binary.log.chk: With this change error
estimates are computed and reported.
trimble-lassen_iq-3dfix.log, trimble-lassen_iq-3dfix.log: the
change revealed a bug in the computation of satellite-seen bits.
Error estimates did not change.
navcom.log: Error estimates changed.
With these rebuilds, all regression tests pass.
Diffstat (limited to 'driver_tsip.c')
-rw-r--r-- | driver_tsip.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/driver_tsip.c b/driver_tsip.c index 74c1c4ec..6b909c56 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -342,8 +342,8 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) if ((f1 = getbef32((char *)buf, 5 * i + 2)) < 0) f1 = 0.0; for (j = 0; j < TSIP_CHANNELS; j++) - if (session->gpsdata.PRN[j] == (int)u1) { - session->gpsdata.ss[j] = f1; + if (session->gpsdata.skyview[j].PRN == (int)u1) { + session->gpsdata.skyview[j].ss = f1; break; } (void)snprintf(buf2 + strlen(buf2), sizeof(buf2) - strlen(buf2), @@ -507,14 +507,20 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) i, u1, u2 & 7, u3, u4, f1, f2, d1, d2); if (i < TSIP_CHANNELS) { if (d1 >= 0.0) { - session->gpsdata.PRN[i] = (int)u1; - session->gpsdata.ss[i] = f1; - session->gpsdata.elevation[i] = (int)round(d1); - session->gpsdata.azimuth[i] = (int)round(d2); + session->gpsdata.skyview[i].PRN = (int)u1; + session->gpsdata.skyview[i].ss = f1; + session->gpsdata.skyview[i].elevation = (int)round(d1); + session->gpsdata.skyview[i].azimuth = (int)round(d2); + session->gpsdata.skyview[i].used = false; + for (j = 0; j < session->gpsdata.satellites_used; j++) + if (session->gpsdata.skyview[i].PRN && session->sats_used[j]) + session->gpsdata.skyview[i].used = true; } else { - session->gpsdata.PRN[i] = session->gpsdata.elevation[i] - = session->gpsdata.azimuth[i] = 0; - session->gpsdata.ss[i] = 0.0; + session->gpsdata.skyview[i].PRN = + session->gpsdata.skyview[i].elevation = + session->gpsdata.skyview[i].azimuth = 0; + session->gpsdata.skyview[i].ss = 0.0; + session->gpsdata.skyview[i].used = false; } if (++i == session->gpsdata.satellites_visible) { session->gpsdata.skyview_time = NAN; @@ -568,12 +574,12 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) pow(session->gpsdata.dop.tdop, 2)); /*@ +evalorder @*/ - memset(session->gpsdata.used, 0, sizeof(session->gpsdata.used)); + memset(session->sats_used, 0, sizeof(session->sats_used)); buf2[0] = '\0'; /*@ +charint @*/ for (i = 0; i < count; i++) (void)snprintf(buf2 + strlen(buf2), sizeof(buf2) - strlen(buf2), - " %d", session->gpsdata.used[i] = + " %d", session->sats_used[i] = (int)getub(buf, 17 + i)); /*@ -charint @*/ gpsd_report(&session->context->errout, LOG_DATA, |