summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-09-22 14:50:03 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-09-22 14:50:03 -0400
commit282691da60ec526772f713a63fa0b8f43aea7acb (patch)
tree622f4d55c882f63475b84691d41108dd17326cca /libgpsd_core.c
parentf63bdafc18991624b872e9efa858c024834a540e (diff)
downloadgpsd-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 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index f3ab7f59..315b3841 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -668,22 +668,22 @@ static gps_mask_t fill_dop(const struct gpsd_errout_t *errout,
memset(satpos, 0, sizeof(satpos));
gpsd_report(errout, LOG_INF, "Sats used (%d):\n", gpsdata->satellites_used);
- for (n = i = 0; i < gpsdata->satellites_visible; i++) {
- for (k = 0; k < gpsdata->satellites_used; k++) {
- if (gpsdata->PRN[i] == gpsdata->used[k]) {
- satpos[n][0] = sin(gpsdata->azimuth[i] * DEG_2_RAD)
- * cos(gpsdata->elevation[i] * DEG_2_RAD);
- satpos[n][1] = cos(gpsdata->azimuth[i] * DEG_2_RAD)
- * cos(gpsdata->elevation[i] * DEG_2_RAD);
- satpos[n][2] = sin(gpsdata->elevation[i] * DEG_2_RAD);
- satpos[n][3] = 1;
- gpsd_report(errout, LOG_INF, "PRN=%3d az=%3d el=%2d (%f, %f, %f)\n",
- gpsdata->PRN[i],
- gpsdata->azimuth[i],
- gpsdata->elevation[i],
- satpos[n][0], satpos[n][1], satpos[n][2]);
- n++;
- }
+ for (n = k = 0; k < gpsdata->satellites_visible; k++) {
+ if (gpsdata->skyview[k].used)
+ {
+ const struct satellite_t *sp = &gpsdata->skyview[k];
+ satpos[n][0] = sin(sp->azimuth * DEG_2_RAD)
+ * cos(sp->elevation * DEG_2_RAD);
+ satpos[n][1] = cos(sp->azimuth * DEG_2_RAD)
+ * cos(sp->elevation * DEG_2_RAD);
+ satpos[n][2] = sin(sp->elevation * DEG_2_RAD);
+ satpos[n][3] = 1;
+ gpsd_report(errout, LOG_INF, "PRN=%3d az=%3d el=%2d (%f, %f, %f)\n",
+ gpsdata->skyview[k].PRN,
+ gpsdata->skyview[k].azimuth,
+ gpsdata->skyview[k].elevation,
+ satpos[n][0], satpos[n][1], satpos[n][2]);
+ n++;
}
}
@@ -1590,10 +1590,7 @@ void gpsd_wrap(struct gps_device_t *session)
void gpsd_zero_satellites( /*@out@*/ struct gps_data_t *out)
{
- (void)memset(out->PRN, 0, sizeof(out->PRN));
- (void)memset(out->elevation, 0, sizeof(out->elevation));
- (void)memset(out->azimuth, 0, sizeof(out->azimuth));
- (void)memset(out->ss, 0, sizeof(out->ss));
+ (void)memset(out->skyview, '\0', sizeof(out->skyview));
out->satellites_visible = 0;
#if 0
/*