[Gpsbabel-code] garmin fix committed
Brought to you by:
robertl
From: Robert L. <rob...@us...> - 2002-12-13 18:57:54
|
I confirmed this fixed the problem on the GPS12 and have committed it. Thanx to B?rre Ludvigsen for the checkout. RJL Index: garmin.c =================================================================== RCS file: /cvsroot/gpsbabel/gpsbabel/garmin.c,v retrieving revision 1.15 diff -p -u -r1.15 garmin.c --- garmin.c 25 Nov 2002 01:01:36 -0000 1.15 +++ garmin.c 13 Dec 2002 14:49:07 -0000 @@ -20,6 +20,7 @@ */ #include <ctype.h> +#include <limits.h> #include "defs.h" #include "jeeps/gps.h" @@ -67,7 +68,19 @@ waypt_read(void) wpt_tmp->description = way[i]->cmnt; wpt_tmp->position.longitude.degrees = way[i]->lon; wpt_tmp->position.latitude.degrees = way[i]->lat; - if (way[i]->alt == (float) (1<<31)) { + /* + * If a unit doesn't store altitude info (i.e. a D103) + * gpsmem will default the alt to INT_MAX. Other units + * (I can't recall if it was the V (D109) hor the Vista (D108) + * return INT_MAX+1, contrary to the Garmin protocol doc which + * says they should report 1.0e25. So we'll try to trap + * all the cases here. Yes, libjeeps should probably + * do this and not us... + */ + if ((way[i]->alt == (float) (1<<31)) || + (way[i]->alt == INT_MAX) || + (way[i]->alt == 1.0e25) + ) { wpt_tmp->position.altitude.altitude_meters = unknown_alt; } else { wpt_tmp->position.altitude.altitude_meters = way[i]->alt; |