From 75d069ef30094daa6a5bd97350cda4fbb09d4686 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Wed, 6 Apr 2016 17:08:16 -0700 Subject: Add another gross sanity check for climb/speed I would rather find where the bad data is coming from... --- libgpsd_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libgpsd_core.c') 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 -- cgit v1.2.1