summaryrefslogtreecommitdiff
path: root/driver_ubx.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-04-12 20:06:43 -0700
committerGary E. Miller <gem@rellim.com>2019-04-12 20:06:43 -0700
commit393a3a02c84146b39a76ceaf48ed112625f87ff7 (patch)
tree9da879ad6a76721752ed2870f66bcac5a01d2672 /driver_ubx.c
parent59d0330b70e0364b7ffb1bc37df8b341cdda75e5 (diff)
downloadgpsd-393a3a02c84146b39a76ceaf48ed112625f87ff7.tar.gz
ubxtool: Add end of cycle detection.
This made the ublox-neo-m8n.log regression finally look good. Needed for u-blox 9.
Diffstat (limited to 'driver_ubx.c')
-rw-r--r--driver_ubx.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/driver_ubx.c b/driver_ubx.c
index b9f424d4..e6e695e1 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -1553,7 +1553,20 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
"UBX: unknown packet id 0x%04hx (length %zd)\n",
msgid, len);
}
- /* FIXME: need cycle detection here... */
+ /* end of cycle ? */
+ if (session->driver.ubx.end_msgid == msgid) {
+ /* end of cycle, report it */
+ mask |= REPORT_IS;
+ }
+ /* start of cycle ? */
+ if (TIME_SET & mask) {
+ /* this sentence has a good time */
+ if (session->newdata.time > session->lastfix.time) {
+ /* time advanced, save cycle ender */
+ session->driver.ubx.end_msgid = session->driver.ubx.last_msgid;
+ }
+ session->driver.ubx.last_msgid = msgid;
+ }
return mask | ONLINE_SET;
}