summaryrefslogtreecommitdiff
path: root/driver_ubx.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-04-22 19:35:26 -0700
committerGary E. Miller <gem@rellim.com>2019-04-22 19:35:26 -0700
commitae6edc83e7dc8ed36d85d1a05b8ea373ce801b48 (patch)
tree6fcbf6ee05f58b3e86257347e0b8deec417e6435 /driver_ubx.c
parentf53cfac2e083f9ea559feef2af66288c70a72e3a (diff)
downloadgpsd-ae6edc83e7dc8ed36d85d1a05b8ea373ce801b48.tar.gz
driver_ubx: Change cycle ender to use iTOW.
This cleaned up some regressions.
Diffstat (limited to 'driver_ubx.c')
-rw-r--r--driver_ubx.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/driver_ubx.c b/driver_ubx.c
index 6ac96ff3..49c193c4 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -363,7 +363,6 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf,
#define DATE_VALID (UBX_SOL_VALID_WEEK | UBX_SOL_VALID_TIME)
if ((flags & DATE_VALID) == DATE_VALID) {
unsigned short week;
- uint32_t iTOW; /* integer part of TOW in ms */
int32_t fTOW; /* fractional part of TOW in ns */
double TOW; /* complete TOW in seconds */
@@ -1267,6 +1266,7 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
return 0;
session->cycle_end_reliable = true;
+ session->driver.ubx.iTOW = -1; /* set by decoder */
/* extract message id and length */
msgid = (buf[2] << 8) | buf[3];
@@ -1582,8 +1582,7 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
mask |= REPORT_IS;
}
/* start of cycle ? */
- if (TIME_SET & mask) {
- timestamp_t difftime;
+ if ( -1 < session->driver.ubx.iTOW) {
/* this sentence has a good time */
/* debug
gpsd_log(&session->context->errout, LOG_ERROR,
@@ -1594,17 +1593,17 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
session->driver.ubx.last_time,
session->driver.ubx.last_msgid);
*/
- /* no more than 100Hz */
- difftime = session->newdata.time - session->driver.ubx.last_time;
- if ((0.01 < difftime) &&
+ /* iTOW is to ms, can go forward or backwards */
+ if ((session->driver.ubx.last_iTOW != session->driver.ubx.iTOW) &&
(session->driver.ubx.end_msgid !=
session->driver.ubx.last_msgid)) {
- /* time advanced, new cycle ender */
+ /* time changed, new cycle ender */
session->driver.ubx.end_msgid = session->driver.ubx.last_msgid;
+ session->driver.ubx.last_iTOW = session->driver.ubx.iTOW;
/* debug
gpsd_log(&session->context->errout, LOG_ERROR,
- "UBX: new ender %x, difftime %.2f\n",
- session->driver.ubx.end_msgid, difftime);
+ "UBX: new ender %x, iTOW %.2f\n",
+ session->driver.ubx.end_msgid, iTOW);
*/
}
session->driver.ubx.last_msgid = msgid;