summaryrefslogtreecommitdiff
path: root/driver_ubx.c
diff options
context:
space:
mode:
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;
}