summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-04-06 17:08:16 -0700
committerGary E. Miller <gem@rellim.com>2016-04-06 17:08:16 -0700
commit75d069ef30094daa6a5bd97350cda4fbb09d4686 (patch)
tree76e39de4e57ce8086af5c1a11d72db3abf42a9ee /libgpsd_core.c
parent85a64bc0f64d66b4bb8f8b2de24829747e48a485 (diff)
downloadgpsd-75d069ef30094daa6a5bd97350cda4fbb09d4686.tar.gz
Add another gross sanity check for climb/speed
I would rather find where the bad data is coming from...
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index c3aad99d..9370db6d 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -871,6 +871,19 @@ static void gpsd_error_model(struct gps_device_t *session,
(session->gpsdata.status ==
STATUS_DGPS_FIX ? P_UERE_WITH_DGPS : P_UERE_NO_DGPS);
+ /* sanity check the speed, 10,000 m/s should be a nice max */
+ if ( 9999.9 < fix->speed )
+ fix->speed = NAN;
+ else if ( -9999.9 > fix->speed )
+ fix->speed = NAN;
+
+ /* sanity check the climb, 10,000 m/s should be a nice max */
+ if ( 9999.9 < fix->climb )
+ fix->climb = NAN;
+ else if ( -9999.9 > fix->climb )
+ fix->climb = NAN;
+
+
/*
* OK, this is not an error computation, but we're at the right
* place in the architecture for it. Compute speed over ground