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 /libgps_sock.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 'libgps_sock.c')
-rw-r--r-- | libgps_sock.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libgps_sock.c b/libgps_sock.c index e84a1eb2..2cb2d1e8 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -411,10 +411,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata) if (timestamp[0] != '?') { gpsdata->set |= TIME_SET; } - for (j = 0; j < MAXCHANNELS; j++) { - gpsdata->PRN[j] = gpsdata->elevation[j] = gpsdata->azimuth[j] = gpsdata->used[j] = 0; - gpsdata->ss[j] = 0.0; - } + memset(&gpsdata->skyview, '\0', sizeof(gpsdata->skyview)); for (j = 0, gpsdata->satellites_used = 0; j < gpsdata->satellites_visible; j++) { if ((sp != NULL) @@ -423,11 +420,11 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata) // cppcheck-suppress invalidscanf (void)sscanf(sp, "%d %d %d %lf %d", &i1, &i2, &i3, &f4, &i5); - gpsdata->PRN[j] = i1; - gpsdata->elevation[j] = i2; - gpsdata->azimuth[j] = i3; - gpsdata->ss[j] = f4; - gpsdata->used[j] = i5; + gpsdata->skyview[j].PRN = i1; + gpsdata->skyview[j].elevation = i2; + gpsdata->skyview[j].azimuth = i3; + gpsdata->skyview[j].ss = f4; + gpsdata->skyview[j].used = i5; if (i5 == 1) gpsdata->satellites_used++; } |