diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-04-05 14:06:07 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-04-05 14:06:07 -0400 |
commit | b8547586aa0a9a5b330ad21de845d885f93cc10a (patch) | |
tree | 0249515558fc0d800ff2b9f3d75db54367496c99 | |
parent | f1d0dea4ce72f8e49eefcec94c2daf325358d809 (diff) | |
download | gpsd-b8547586aa0a9a5b330ad21de845d885f93cc10a.tar.gz |
Refactoring step. Change the signature of ecef_to_wgs84fix().
All regression tests pass.
-rw-r--r-- | driver_evermore.c | 2 | ||||
-rw-r--r-- | driver_italk.c | 3 | ||||
-rw-r--r-- | driver_proto.c | 3 | ||||
-rw-r--r-- | driver_sirf.c | 2 | ||||
-rw-r--r-- | driver_superstar2.c | 2 | ||||
-rw-r--r-- | driver_ubx.c | 3 | ||||
-rw-r--r-- | geoid.c | 16 | ||||
-rw-r--r-- | gpsd.h-tail | 3 | ||||
-rw-r--r-- | monitor_ubx.c | 4 |
9 files changed, 22 insertions, 16 deletions
diff --git a/driver_evermore.c b/driver_evermore.c index 4d9c9b30..ba176473 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -185,7 +185,7 @@ gps_mask_t evermore_parse(struct gps_device_t *session, unsigned char *buf, size session->gpsdata.fix.time = gpstime_to_unix((int)getleuw(buf2, 2), getleul(buf2, 4)*0.01) - session->context->leap_seconds; /*@ end @*/ - ecef_to_wgs84fix(&session->gpsdata, + ecef_to_wgs84fix(&session->gpsdata.fix, &session->gpsdata.separation, getlesl(buf2, 8)*1.0, getlesl(buf2, 12)*1.0, getlesl(buf2, 16)*1.0, getlesw(buf2, 20)/10.0, getlesw(buf2, 22)/10.0, getlesw(buf2, 24)/10.0); used = (unsigned char)getub(buf2, 26) & 0x0f; diff --git a/driver_italk.c b/driver_italk.c index c73603ff..a33c30b8 100644 --- a/driver_italk.c +++ b/driver_italk.c @@ -66,7 +66,8 @@ static gps_mask_t decode_itk_navfix(struct gps_device_t *session, unsigned char evx = (double)(getlesl(buf, 7 + 186)/1000.0); evy = (double)(getlesl(buf, 7 + 190)/1000.0); evz = (double)(getlesl(buf, 7 + 194)/1000.0); - ecef_to_wgs84fix(&session->gpsdata, epx, epy, epz, evx, evy, evz); + ecef_to_wgs84fix(&session->gpsdata.fix, &session->gpsdata.separation, + epx, epy, epz, evx, evy, evz); mask |= LATLON_SET | ALTITUDE_SET | SPEED_SET | TRACK_SET | CLIMB_SET ; eph = (double)(getlesl(buf, 7 + 252)/100.0); /* eph is a circular error, sqrt(epx**2 + epy**2) */ diff --git a/driver_proto.c b/driver_proto.c index e9e34518..405cdfe7 100644 --- a/driver_proto.c +++ b/driver_proto.c @@ -94,7 +94,8 @@ _proto__msg_navsol(struct gps_device_t *session, unsigned char *buf, size_t data /* extract ECEF navigation solution here */ /* or extract the local tangential plane (ENU) solution */ [Px, Py, Pz, Vx, Vy, Vz] = GET_ECEF_FIX(); - ecef_to_wgs84fix(&session->gpsdata, Px, Py, Pz, Vx, Vy, Vz); + ecef_to_wgs84fix(&session->gpsdata.fix, &session->separation, + Px, Py, Pz, Vx, Vy, Vz); mask |= LATLON_SET | ALTITUDE_SET | SPEED_SET | TRACK_SET | CLIMB_SET ; session->gpsdata.fix.epx = GET_LONGITUDE_ERROR(); diff --git a/driver_sirf.c b/driver_sirf.c index e50e269c..b23f5cb0 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -531,7 +531,7 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, unsigned char *b for (i = 0; i < SIRF_CHANNELS; i++) session->gpsdata.used[i] = (int)getub(buf, 29+i); /* position/velocity is bytes 1-18 */ - ecef_to_wgs84fix(&session->gpsdata, + ecef_to_wgs84fix(&session->gpsdata.fix, &session->gpsdata.separation, getbesl(buf, 1)*1.0, getbesl(buf, 5)*1.0, getbesl(buf, 9)*1.0, getbesw(buf, 13)/8.0, getbesw(buf, 15)/8.0, getbesw(buf, 17)/8.0); /* fix status is byte 19 */ diff --git a/driver_superstar2.c b/driver_superstar2.c index 1c78aaf3..6c5b26dd 100644 --- a/driver_superstar2.c +++ b/driver_superstar2.c @@ -206,7 +206,7 @@ superstar2_msg_navsol_ecef(struct gps_device_t *session, /* extract the earth-centered, earth-fixed (ECEF) solution */ /*@ -evalorder @*/ - ecef_to_wgs84fix(&session->gpsdata, + ecef_to_wgs84fix(&session->gpsdata.fix, &session->separation, getled(buf, 14), getled(buf, 22), getled(buf, 30), getlef(buf, 38), getlef(buf, 42), getlef(buf, 46)); /*@ +evalorder @*/ diff --git a/driver_ubx.c b/driver_ubx.c index 5444b89f..339afa07 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -87,7 +87,8 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf, size_t data_le evx = (double)(getlesl(buf, 28)/100.0); evy = (double)(getlesl(buf, 32)/100.0); evz = (double)(getlesl(buf, 36)/100.0); - ecef_to_wgs84fix(&session->gpsdata, epx, epy, epz, evx, evy, evz); + ecef_to_wgs84fix(&session->gpsdata.fix, &session->gpsdata.separation, + epx, epy, epz, evx, evy, evz); mask |= LATLON_SET | ALTITUDE_SET | SPEED_SET | TRACK_SET | CLIMB_SET; session->gpsdata.fix.epx = session->gpsdata.fix.epy = (double)(getlesl(buf, 24)/100.0)/sqrt(2); session->gpsdata.fix.eps = (double)(getlesl(buf, 40)/100.0); @@ -86,7 +86,7 @@ double wgs84_separation(double lat, double lon) } -void ecef_to_wgs84fix(struct gps_data_t *gpsdata, +void ecef_to_wgs84fix(struct gps_fix_t *fix, double *separation, double x, double y, double z, double vx, double vy, double vz) /* fill in WGS84 position/velocity fields from ECEF coordinates */ @@ -105,20 +105,20 @@ void ecef_to_wgs84fix(struct gps_data_t *gpsdata, phi = atan2(z + e_2*b*pow(sin(theta),3),p - e2*a*pow(cos(theta),3)); n = a / sqrt(1.0 - e2*pow(sin(phi),2)); h = p / cos(phi) - n; - gpsdata->fix.latitude = phi * RAD_2_DEG; - gpsdata->fix.longitude = lambda * RAD_2_DEG; - gpsdata->separation = wgs84_separation(gpsdata->fix.latitude, gpsdata->fix.longitude); - gpsdata->fix.altitude = h - gpsdata->separation; + fix->latitude = phi * RAD_2_DEG; + fix->longitude = lambda * RAD_2_DEG; + *separation = wgs84_separation(fix->latitude, fix->longitude); + fix->altitude = h - *separation; /* velocity computation */ vnorth = -vx*sin(phi)*cos(lambda)-vy*sin(phi)*sin(lambda)+vz*cos(phi); veast = -vx*sin(lambda)+vy*cos(lambda); - gpsdata->fix.climb = vx*cos(phi)*cos(lambda)+vy*cos(phi)*sin(lambda)+vz*sin(phi); - gpsdata->fix.speed = sqrt(pow(vnorth,2) + pow(veast,2)); + fix->climb = vx*cos(phi)*cos(lambda)+vy*cos(phi)*sin(lambda)+vz*sin(phi); + fix->speed = sqrt(pow(vnorth,2) + pow(veast,2)); heading = atan2(fix_minuz(veast), fix_minuz(vnorth)); /*@ +evalorder @*/ if (heading < 0) heading += 2 * GPS_PI; - gpsdata->fix.track = heading * RAD_2_DEG; + fix->track = heading * RAD_2_DEG; } /* diff --git a/gpsd.h-tail b/gpsd.h-tail index 0b46fbb1..cd362941 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -502,7 +502,8 @@ extern bool ntpshm_free(struct gps_context_t *, int); extern int ntpshm_put(struct gps_device_t *, double, double); extern int ntpshm_pps(struct gps_device_t *,struct timeval *); -extern void ecef_to_wgs84fix(/*@out@*/struct gps_data_t *, +extern void ecef_to_wgs84fix(/*@out@*/struct gps_fix_t *, + /*@out@*/double *, double, double, double, double, double, double); extern void clear_dop(/*@out@*/struct dop_t *); diff --git a/monitor_ubx.c b/monitor_ubx.c index 68e7b979..88fa7430 100644 --- a/monitor_ubx.c +++ b/monitor_ubx.c @@ -132,6 +132,7 @@ static void display_nav_sol(unsigned char *buf, size_t data_len) double t; time_t tt; struct gps_data_t g; + double separation; if (data_len != 52) return; @@ -152,7 +153,8 @@ static void display_nav_sol(unsigned char *buf, size_t data_len) evx = (double)(getlesl(buf, 28)/100.0); evy = (double)(getlesl(buf, 32)/100.0); evz = (double)(getlesl(buf, 36)/100.0); - ecef_to_wgs84fix(&g, epx, epy, epz, evx, evy, evz); + ecef_to_wgs84fix(&g.fix, &separation, + epx, epy, epz, evx, evy, evz); g.fix.epx = g.fix.epy = (double)(getlesl(buf, 24)/100.0); g.fix.eps = (double)(getlesl(buf, 40)/100.0); g.dop.pdop = (double)(getleuw(buf, 44)/100.0); |