summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgpsd_core.c55
-rw-r--r--test/bu303-nofix.log.chk7
-rw-r--r--test/bu303b-nofix.log.chk6
3 files changed, 30 insertions, 38 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 2779c579..b39e2fc1 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -67,6 +67,7 @@ void gpsd_init(struct gps_device_t *session, struct gps_context_t *context, char
session->gpsdata.pdop = NAN;
session->gpsdata.tdop = NAN;
session->gpsdata.gdop = NAN;
+ session->gpsdata.epe = NAN;
/* mark GPS fd closed */
session->gpsdata.gps_fd = -1;
@@ -403,11 +404,6 @@ static void apply_error_model(struct gps_device_t *session)
* modeling stuff goes. Presently we don't know how to derive
* time error.
*
- * Field reports match the theoretical prediction that
- * expected time error should be half the resolution of
- * the GPS clock, so we put the bound of the error
- * in as a constant pending getting it from each driver.
- *
* Some drivers set the position-error fields. Only the Zodiacs
* report speed error. Nobody reports track error or climb error.
*/
@@ -415,29 +411,38 @@ static void apply_error_model(struct gps_device_t *session)
#define UERE_WITH_DGPS 2.0 /* meters, 95% confidence */
double uere = (session->gpsdata.status == STATUS_DGPS_FIX ? UERE_WITH_DGPS : UERE_NO_DGPS);
- session->gpsdata.fix.ept = 0.005;
- session->gpsdata.set |= TIMERR_SET;
- if ((session->gpsdata.set & HERR_SET)==0
- && (session->gpsdata.set & HDOP_SET)!=0) {
- session->gpsdata.fix.eph = session->gpsdata.hdop * uere;
- session->gpsdata.set |= HERR_SET;
- }
- if ((session->gpsdata.set & VERR_SET)==0
- && (session->gpsdata.set & VDOP_SET)!=0) {
- session->gpsdata.fix.epv = session->gpsdata.vdop * uere;
- session->gpsdata.set |= VERR_SET;
- }
- if ((session->gpsdata.set & PERR_SET)==0
- && (session->gpsdata.set & PDOP_SET)!=0) {
- session->gpsdata.epe = session->gpsdata.pdop * uere;
- session->gpsdata.set |= PERR_SET;
- }
/*
- * If we have a current fix and an old fix, and the packet handler
- * didn't set the speed error and climb error members itself,
- * try to compute them now.
+ * Field reports match the theoretical prediction that
+ * expected time error should be half the resolution of
+ * the GPS clock, so we put the bound of the error
+ * in as a constant pending getting it from each driver.
*/
+ if ((session->gpsdata.set & TIMERR_SET)==0) {
+ session->gpsdata.fix.ept = 0.005;
+ session->gpsdata.set |= TIMERR_SET;
+ }
+ /* Other error computations depend on having a valid fix */
if (session->gpsdata.fix.mode >= MODE_2D) {
+ if ((session->gpsdata.set & HERR_SET)==0
+ && (session->gpsdata.set & HDOP_SET)!=0) {
+ session->gpsdata.fix.eph = session->gpsdata.hdop * uere;
+ session->gpsdata.set |= HERR_SET;
+ }
+ if ((session->gpsdata.set & VERR_SET)==0
+ && (session->gpsdata.set & VDOP_SET)!=0) {
+ session->gpsdata.fix.epv = session->gpsdata.vdop * uere;
+ session->gpsdata.set |= VERR_SET;
+ }
+ if ((session->gpsdata.set & PERR_SET)==0
+ && (session->gpsdata.set & PDOP_SET)!=0) {
+ session->gpsdata.epe = session->gpsdata.pdop * uere;
+ session->gpsdata.set |= PERR_SET;
+ }
+ /*
+ * If we have a current fix and an old fix, and the packet handler
+ * didn't set the speed error and climb error members itself,
+ * try to compute them now.
+ */
if ((session->gpsdata.set & SPEEDERR_SET)==0 && session->gpsdata.fix.time > session->lastfix.time) {
session->gpsdata.fix.eps = NAN;
if (session->lastfix.mode > MODE_NO_FIX
diff --git a/test/bu303-nofix.log.chk b/test/bu303-nofix.log.chk
index 03081c6d..af12af77 100644
--- a/test/bu303-nofix.log.chk
+++ b/test/bu303-nofix.log.chk
@@ -2,30 +2,23 @@ GPSD,W=1,R=1
GPSD,Y=?
$GPRMC,143259,V,18000.0000,N,00000.0000,W,0.0000,180.000,141102,,*17
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,143300,V,18000.0000,N,00000.0000,W,0.0000,180.000,141102,,*1A
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,143301,V,18000.0000,N,00000.0000,W,0.0000,180.000,141102,,*1B
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,143302,V,18000.0000,N,00000.0000,W,0.0000,180.000,141102,,*18
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,143303,V,18000.0000,N,00000.0000,W,0.0000,180.000,141102,,*19
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
GPSD,Y=?
$GPRMC,143304,V,18000.0000,N,00000.0000,W,0.0000,180.000,090605,,*13
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,143305,V,18000.0000,N,00000.0000,W,0.0000,180.000,090605,,*12
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
diff --git a/test/bu303b-nofix.log.chk b/test/bu303b-nofix.log.chk
index c805943e..27c4c521 100644
--- a/test/bu303b-nofix.log.chk
+++ b/test/bu303b-nofix.log.chk
@@ -2,26 +2,20 @@ GPSD,W=1,R=1
GPSD,Y=?
$GPRMC,000603,V,4002.1027,N,07531.2013,W,0.0000,0.000,101102,,*2C
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,000604,V,4002.1027,N,07531.2013,W,0.0000,0.000,101102,,*2B
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,000605,V,4002.1027,N,07531.2013,W,0.0000,0.000,101102,,*2A
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,000606,V,4002.1027,N,07531.2013,W,0.0000,0.000,101102,,*29
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
$GPRMC,000607,V,4002.1027,N,07531.2013,W,0.0000,0.000,101102,,*28
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?
GPSD,Y=?
$GPRMC,000608,V,4002.1027,N,07531.2013,W,0.0000,0.000,101102,,*27
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
-$PGRME,400.00,0.00,0.00*7B
GPSD,O=?