summaryrefslogtreecommitdiff
path: root/gpsutils.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-02-08 19:09:14 -0800
committerGary E. Miller <gem@rellim.com>2018-02-08 19:09:14 -0800
commitdd18103237b7089114aa6830f2abe85fb3420fde (patch)
tree4d1f5b12a4657c5f186ba57495776306db286dc0 /gpsutils.c
parent9f6d73c779168a6ec276b02a3d08ece8bfc15d51 (diff)
downloadgpsd-dd18103237b7089114aa6830f2abe85fb3420fde.tar.gz
Add ECEF support to u-blocx driver, data comes out in json.
More work to do so cgps, xgps, etc. see the new data.
Diffstat (limited to 'gpsutils.c')
-rw-r--r--gpsutils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gpsutils.c b/gpsutils.c
index 7c6dbd0a..09f0112d 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -237,6 +237,7 @@ done:
void gps_clear_fix(struct gps_fix_t *fixp)
/* stuff a fix structure with recognizable out-of-band values */
{
+ memset(fixp, 0, sizeof(struct gps_fix_t));
fixp->time = NAN;
fixp->mode = MODE_NOT_SEEN;
fixp->latitude = fixp->longitude = NAN;
@@ -251,6 +252,15 @@ void gps_clear_fix(struct gps_fix_t *fixp)
fixp->epd = NAN;
fixp->eps = NAN;
fixp->epc = NAN;
+ /* clear ECEF too */
+ fixp->ecef.x = NAN;
+ fixp->ecef.y = NAN;
+ fixp->ecef.z = NAN;
+ fixp->ecef.vx = NAN;
+ fixp->ecef.vy = NAN;
+ fixp->ecef.vz = NAN;
+ fixp->ecef.pAcc = NAN;
+ fixp->ecef.vAcc = NAN;
}
void gps_clear_dop( struct dop_t *dop)
@@ -292,6 +302,20 @@ void gps_merge_fix(struct gps_fix_t *to,
to->epv = from->epv;
if ((transfer & SPEEDERR_SET) != 0)
to->eps = from->eps;
+ if ((transfer & ECEF_SET) != 0) {
+ to->ecef.valid = true;
+ to->ecef.x = from->ecef.x;
+ to->ecef.y = from->ecef.y;
+ to->ecef.z = from->ecef.z;
+ to->ecef.pAcc = from->ecef.pAcc;
+ }
+ if ((transfer & VECEF_SET) != 0) {
+ to->ecef.valid = true;
+ to->ecef.vx = from->ecef.vx;
+ to->ecef.vy = from->ecef.vy;
+ to->ecef.vz = from->ecef.vz;
+ to->ecef.vAcc = from->ecef.vAcc;
+ }
}
/* NOTE: timestamp_t is a double, so this is only precise to