diff options
author | Gary E. Miller <gem@rellim.com> | 2009-12-07 23:23:09 +0000 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2009-12-07 23:23:09 +0000 |
commit | 0c79dc5e9fe7e60ccb09a58764b1bfcab9b926f4 (patch) | |
tree | 64706f7a3d7cddf1138b90d7a459e1c10a2c41b6 | |
parent | 2342d70b1d72e98e58e84f697fffaa0c2b9aadc4 (diff) | |
download | gpsd-0c79dc5e9fe7e60ccb09a58764b1bfcab9b926f4.tar.gz |
Tweaks to improve Oncore GPS PPS performance.
>From Hakan Johansson.
-rw-r--r-- | driver_oncore.c | 25 | ||||
-rw-r--r-- | gpsd.h-tail | 1 | ||||
-rw-r--r-- | monitor_oncore.c | 27 |
3 files changed, 49 insertions, 4 deletions
diff --git a/driver_oncore.c b/driver_oncore.c index c869012f..a7e476e3 100644 --- a/driver_oncore.c +++ b/driver_oncore.c @@ -25,6 +25,7 @@ static char enableEn[] = { 'E', 'n', 1, 0, 100, 100, 1, 0,0,0,0,0,0,0,0,0,0 }; /*static char enableAt2[] = { 'A', 't', 2, };*/ static char pollAs[] = { 'A', 's', 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }; static char pollAt[] = { 'A', 't', 0xff }; +static char pollAy[] = { 'A', 'y', 0xff, 0xff, 0xff, 0xff }; static char pollBo[] = { 'B', 'o', 0x01 }; /*@ -charint @*/ @@ -36,6 +37,7 @@ static gps_mask_t oncore_parse_input(struct gps_device_t *); static gps_mask_t oncore_dispatch(struct gps_device_t *, unsigned char *, size_t ); static gps_mask_t oncore_msg_navsol(struct gps_device_t *, unsigned char *, size_t ); static gps_mask_t oncore_msg_utc_offset(struct gps_device_t *, unsigned char *, size_t ); +static gps_mask_t oncore_msg_pps_delay(struct gps_device_t *, unsigned char *, size_t ); static gps_mask_t oncore_msg_svinfo(struct gps_device_t *, unsigned char *, size_t ); static gps_mask_t oncore_msg_time_raim(struct gps_device_t *, unsigned char *, size_t ); static gps_mask_t oncore_msg_firmware(struct gps_device_t *, unsigned char *, size_t ); @@ -109,7 +111,7 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf, size_t data_ * Else we may be providing GPS time. */ if (session->context->enable_ntpshm) - (void)ntpshm_put(session, session->gpsdata.fix.time, 0.16); + (void)ntpshm_put(session, session->gpsdata.fix.time, 0.175); #endif /* NTPSHM_ENABLE */ gpsd_report(LOG_IO, "oncore NAVSOL - time: %04d-%02d-%02d %02d:%02d:%02d.%09d\n", @@ -196,6 +198,7 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf, size_t data_ */ (void)oncore_control_send(session,pollAs,sizeof(pollAs)); (void)oncore_control_send(session,pollAt,sizeof(pollAt)); + (void)oncore_control_send(session,pollAy,sizeof(pollAy)); (void)oncore_control_send(session,pollBo,sizeof(pollBo)); gpsd_report(LOG_DATA, "NAVSOL: time=%.2f lat=%.2f lon=%.2f alt=%.2f speed=%.2f track=%.2f mode=%d status=%d visible=%d used=%d mask=%s\n", @@ -235,6 +238,24 @@ oncore_msg_utc_offset(struct gps_device_t *session, unsigned char *buf, size_t d } /** + * PPS delay + */ +static gps_mask_t +oncore_msg_pps_delay(struct gps_device_t *session, unsigned char *buf, size_t data_len) +{ + double pps_delay; + + if (data_len != 11) + return 0; + + gpsd_report(LOG_IO, "oncore PPS delay\n"); + pps_delay = getbesl(buf, 4) / 1000000.0; + + session->driver.oncore.pps_delay = pps_delay; + return 0; +} + +/** * GPS Satellite Info */ static gps_mask_t @@ -339,6 +360,8 @@ gps_mask_t oncore_dispatch(struct gps_device_t *session, unsigned char *buf, siz return 0; /* position hold mode */ case ONCTYPE('A','t'): return 0; /* position hold position */ + case ONCTYPE('A','y'): + return oncore_msg_pps_delay(session, buf, len); default: /* XXX This gets noisy in a hurry. Change once your driver works */ diff --git a/gpsd.h-tail b/gpsd.h-tail index 0ed82210..faf941b3 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -378,6 +378,7 @@ struct gps_device_t { int PRN[ONCORE_VISIBLE_CH]; /* PRNs of satellite */ int elevation[ONCORE_VISIBLE_CH]; /* elevation of satellite */ int azimuth[ONCORE_VISIBLE_CH]; /* azimuth */ + double pps_delay; } oncore; #endif /* ONCORE_ENABLE */ diff --git a/monitor_oncore.c b/monitor_oncore.c index 7000864c..776291ee 100644 --- a/monitor_oncore.c +++ b/monitor_oncore.c @@ -29,7 +29,7 @@ #if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE) extern const struct gps_type_t oncore_binary; -static WINDOW *Ea1win, *Eawin, *Bbwin, *Enwin, *Bowin, *Aswin, *Atwin; +static WINDOW *Ea1win, *Eawin, *Bbwin, *Enwin, *Bowin, *Aywin, *Aswin, *Atwin; static unsigned char EaSVlines[8]; static const char *antenna[] = @@ -103,6 +103,7 @@ static bool oncore_initialize(void) Bbwin = subwin(devicewin, MAXVISSATS+3, 22, 6, 28); Enwin = subwin(devicewin, 10, 29, 6, 51); Bowin = subwin(devicewin, 4, 11, 17, 0); + Aywin = subwin(devicewin, 4, 15, 17, 12); Atwin = subwin(devicewin, 5, 9, 16, 51); Aswin = subwin(devicewin, 5, 19, 16, 61); /*@ +onlytrans @*/ @@ -116,6 +117,7 @@ static bool oncore_initialize(void) (void)syncok(Bbwin, true); (void)syncok(Enwin, true); (void)syncok(Bowin, true); + (void)syncok(Aywin, true); (void)syncok(Aswin, true); (void)syncok(Atwin, true); @@ -158,9 +160,15 @@ static bool oncore_initialize(void) (void)wborder(Bowin, 0, 0, 0, 0, 0, 0, 0, 0), (void)wattrset(Bowin, A_BOLD); (void)mvwprintw(Bowin, 1, 1, "UTC:"); - (void)mvwprintw(Bowin, 3, 1, " @@Bo "); + (void)mvwprintw(Bowin, 3, 2, " @@Bo "); (void)wattrset(Bowin, A_NORMAL); + (void)wborder(Aywin, 0, 0, 0, 0, 0, 0, 0, 0), + (void)wattrset(Aywin, A_BOLD); + (void)mvwprintw(Aywin, 1, 1, "PPS delay:"); + (void)mvwprintw(Aywin, 3, 4, " @@Ay "); + (void)wattrset(Aywin, A_NORMAL); + (void)wborder(Atwin, 0, 0, 0, 0, 0, 0, 0, 0), (void)wattrset(Atwin, A_BOLD); (void)mvwprintw(Atwin, 1, 1, "PHold:"); @@ -393,7 +401,7 @@ static void oncore_update(void) utc_offset = (unsigned char)getub(buf, 4); if (utc_offset != (unsigned char) 0) - (void)mvwprintw(Bowin, 2, 2, "GPS%+3d",utc_offset); + (void)mvwprintw(Bowin, 2, 2, "GPS%+4d",utc_offset); else (void)mvwprintw(Bowin, 2, 2, "unknown",utc_offset); } @@ -401,6 +409,18 @@ static void oncore_update(void) monitor_log("Bo ="); break; + case ONCTYPE('A','y'): + { + double pps_delay; + + pps_delay = getbesl(buf, 4) / 1000000.0; + + (void)mvwprintw(Aywin, 2, 2, " %7.3f ms",pps_delay); + } + + monitor_log("Ay ="); + break; + case ONCTYPE('A','t'): { unsigned char mode; @@ -449,6 +469,7 @@ static void oncore_wrap(void) (void)delwin(Bbwin); (void)delwin(Enwin); (void)delwin(Bowin); + (void)delwin(Aywin); (void)delwin(Atwin); (void)delwin(Aswin); } |