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_superstar2.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_superstar2.c')
-rw-r--r-- | driver_superstar2.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/driver_superstar2.c b/driver_superstar2.c index bd602804..c5893afc 100644 --- a/driver_superstar2.c +++ b/driver_superstar2.c @@ -183,19 +183,20 @@ superstar2_msg_svinfo(struct gps_device_t *session, unsigned int porn; if ((porn = (unsigned int)getub(buf, off) & 0x1f) == 0) porn = (unsigned int)(getub(buf, off + 3) >> 1) + 87; + bool used = (getub(buf, off) & 0x60) == 0x60; - session->gpsdata.PRN[i] = (int)porn; - session->gpsdata.ss[i] = (float)getub(buf, off + 4); - session->gpsdata.elevation[i] = (int)getsb(buf, off + 1); - session->gpsdata.azimuth[i] = (unsigned short)getub(buf, off + 2) + + session->gpsdata.skyview[i].PRN = (int)porn; + session->gpsdata.skyview[i].ss = (float)getub(buf, off + 4); + session->gpsdata.skyview[i].elevation = (int)getsb(buf, off + 1); + session->gpsdata.skyview[i].azimuth = (unsigned short)getub(buf, off + 2) + ((unsigned short)(getub(buf, off + 3) & 0x1) << 1); - + session->gpsdata.skyview[i].used = used; /*@ +charint @*/ - if ((getub(buf, off) & 0x60) == 0x60) - session->gpsdata.used[nsv++] = session->gpsdata.PRN[i]; + if (used) + session->sats_used[nsv++] = session->gpsdata.skyview[i].PRN; /*@ -charint @*/ - if (session->gpsdata.PRN[i]) + if (session->gpsdata.skyview[i].PRN) st++; } session->gpsdata.skyview_time = NAN; @@ -302,8 +303,8 @@ superstar2_msg_measurement(struct gps_device_t *session, unsigned char *buf, for (i = 0; i < n; i++) { unsigned long ul; session->gpsdata.raw.mtime[i] = t; - session->gpsdata.PRN[i] = (int)getub(buf, 11 * i + 15) & 0x1f; - session->gpsdata.ss[i] = (double)getub(buf, 11 * i * 15 + 1) / 4.0; + session->gpsdata.skyview[i].PRN = (int)getub(buf, 11 * i + 15) & 0x1f; + session->gpsdata.skyview[i].ss = (double)getub(buf, 11 * i * 15 + 1) / 4.0; session->gpsdata.raw.codephase[i] = (double)getleu32(buf, 11 * i * 15 + 2); ul = (unsigned long)getleu32(buf, 11 * i * 15 + 6); |