From 282691da60ec526772f713a63fa0b8f43aea7acb Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 22 Sep 2014 14:50:03 -0400 Subject: 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. --- driver_zodiac.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'driver_zodiac.c') diff --git a/driver_zodiac.c b/driver_zodiac.c index 36c97116..6ff24efe 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -229,7 +229,7 @@ static gps_mask_t handle1002(struct gps_device_t *session) /* Note: this week counter is not limited to 10 bits. */ session->context->gps_week = (unsigned short)gps_week; session->gpsdata.satellites_used = 0; - memset(session->gpsdata.used, 0, sizeof(session->gpsdata.used)); + memset(session->sats_used, 0, sizeof(session->sats_used)); for (i = 0; i < ZODIAC_CHANNELS; i++) { int status, prn; /*@ -type @*/ @@ -238,11 +238,11 @@ static gps_mask_t handle1002(struct gps_device_t *session) /*@ +type @*/ if (status & 1) - session->gpsdata.used[session->gpsdata.satellites_used++] = prn; + session->sats_used[session->gpsdata.satellites_used++] = prn; for (j = 0; j < ZODIAC_CHANNELS; j++) { - if (session->gpsdata.PRN[j] != prn) + if (session->gpsdata.skyview[j].PRN != prn) continue; - session->gpsdata.ss[j] = (float)getzword(17 + (3 * i)); + session->gpsdata.skyview[j].ss = (float)getzword(17 + (3 * i)); break; } } @@ -281,17 +281,17 @@ static gps_mask_t handle1003(struct gps_device_t *session) for (i = 0; i < ZODIAC_CHANNELS; i++) { if (i < session->gpsdata.satellites_visible) { - session->gpsdata.PRN[i] = (int)getzword(15 + (3 * i)); - session->gpsdata.azimuth[i] = + session->gpsdata.skyview[i].PRN = (int)getzword(15 + (3 * i)); + session->gpsdata.skyview[i].azimuth = (int)(((short)getzword(16 + (3 * i))) * RAD_2_DEG * 1e-4); - if (session->gpsdata.azimuth[i] < 0) - session->gpsdata.azimuth[i] += 360; - session->gpsdata.elevation[i] = + if (session->gpsdata.skyview[i].azimuth < 0) + session->gpsdata.skyview[i].azimuth += 360; + session->gpsdata.skyview[i].elevation = (int)(((short)getzword(17 + (3 * i))) * RAD_2_DEG * 1e-4); } else { - session->gpsdata.PRN[i] = 0; - session->gpsdata.azimuth[i] = 0; - session->gpsdata.elevation[i] = 0; + session->gpsdata.skyview[i].PRN = 0; + session->gpsdata.skyview[i].azimuth = 0; + session->gpsdata.skyview[i].elevation = 0; } } session->gpsdata.skyview_time = NAN; -- cgit v1.2.1