summaryrefslogtreecommitdiff
path: root/geoid.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-03-31 19:38:11 -0700
committerGary E. Miller <gem@rellim.com>2016-03-31 19:38:11 -0700
commiteaf16294c49f63db42b657ae57ac2f2d410e4b5f (patch)
tree4eff0a94b93a3fda8f59cecb1951012e84115ad4 /geoid.c
parent20fe9920129a8f8090badd5eebf12b22d13de846 (diff)
downloadgpsd-eaf16294c49f63db42b657ae57ac2f2d410e4b5f.tar.gz
Use NAN to signal overrange climb/speed.
I see that is what libgpsd_json.c expects.
Diffstat (limited to 'geoid.c')
-rw-r--r--geoid.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/geoid.c b/geoid.c
index e2a5df53..5d708af2 100644
--- a/geoid.c
+++ b/geoid.c
@@ -126,22 +126,18 @@ void ecef_to_wgs84fix(struct gps_fix_t *fix, double *separation,
fix->climb =
vx * cos(phi) * cos(lambda) + vy * cos(phi) * sin(lambda) +
vz * sin(phi);
- /* sanity check the climb, 10,000 m/s max will do */
- if ( isnan(fix->climb) )
- fix->climb = 0;
- else if ( 9999.9 < fix->climb )
- fix->climb = 9999.9;
+ /* 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->speed )
- fix->climb = -9999.9;
+ fix->climb = NAN;
fix->speed = sqrt(pow(vnorth, 2) + pow(veast, 2));
- /* sanity check the speed, 10,000 m/s max will do */
- if ( isnan(fix->speed) )
- fix->speed = 0;
- else if ( 9999.9 < fix->speed )
- fix->speed = 9999.9;
+ /* 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 = -9999.9;
+ fix->speed = NAN;
heading = atan2(fix_minuz(veast), fix_minuz(vnorth));
if (heading < 0)