From 393a3a02c84146b39a76ceaf48ed112625f87ff7 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Fri, 12 Apr 2019 20:06:43 -0700 Subject: ubxtool: Add end of cycle detection. This made the ublox-neo-m8n.log regression finally look good. Needed for u-blox 9. --- driver_ubx.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'driver_ubx.c') 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; } -- cgit v1.2.1