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_geostar.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'driver_geostar.c') diff --git a/driver_geostar.c b/driver_geostar.c index 4fc9ebb5..9a778d90 100644 --- a/driver_geostar.c +++ b/driver_geostar.c @@ -123,7 +123,7 @@ static bool geostar_detect(struct gps_device_t *session) static gps_mask_t geostar_analyze(struct gps_device_t *session) { - int i, j, len; + int i, len; gps_mask_t mask = 0; unsigned int id; int16_t s1, s2, s3; @@ -259,20 +259,18 @@ static gps_mask_t geostar_analyze(struct gps_device_t *session) gpsd_report(&session->context->errout, LOG_INF, "SVs in view %d\n", ul1); session->gpsdata.satellites_visible = (int)ul1; if(ul1 > GEOSTAR_CHANNELS) ul1 = GEOSTAR_CHANNELS; - for(i = 0, j = 0; (uint32_t)i < ul1; i++) { + for(i = 0; (uint32_t)i < ul1; i++) { ul2 = getleu32(buf, OFFSET(2) + i * 3 * 4); s1 = getles16(buf, OFFSET(3) + i * 3 * 4); s2 = getles16(buf, OFFSET(3) + 2 + i * 3 * 4); s3 = getles16(buf, OFFSET(4) + 2 + i * 3 * 4); gpsd_report(&session->context->errout, LOG_INF, "ID %d Az %g El %g SNR %g\n", decode_channel_id(ul2), s1*0.001*RAD_2_DEG, s2*0.001*RAD_2_DEG, s3*0.1); - session->gpsdata.PRN[i] = decode_channel_id(ul2); - session->gpsdata.azimuth[i] = (int)round((double)s1*0.001 * RAD_2_DEG); - session->gpsdata.elevation[i] = (int)round((double)s2*0.001 * RAD_2_DEG); - session->gpsdata.ss[i] = (double)s3*0.1; - if(ul2 & (1<<27)) { - session->gpsdata.used[j++] = decode_channel_id(ul2); - } + session->gpsdata.skyview[i].PRN = decode_channel_id(ul2); + session->gpsdata.skyview[i].azimuth = (int)round((double)s1*0.001 * RAD_2_DEG); + session->gpsdata.skyview[i].elevation = (int)round((double)s2*0.001 * RAD_2_DEG); + session->gpsdata.skyview[i].ss = (double)s3*0.1; + session->gpsdata.skyview[i].used = (bool)(ul2 & (1<<27)); } session->gpsdata.skyview_time = NAN; mask |= SATELLITE_SET | USED_IS; -- cgit v1.2.1