Decode HDOP data from skytraq GPS
authorKeith Packard <keithp@keithp.com>
Sun, 22 Nov 2009 02:57:45 +0000 (18:57 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 22 Nov 2009 04:37:53 +0000 (20:37 -0800)
The hdop data was getting dropped on the floor, but is rather useful
when deciding if the GPS position is crazy or not. This reports HDOP *
5 (giving a useful range of .2-50).

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_gps_skytraq.c

index bf192f2..ef58134 100644 (file)
@@ -271,7 +271,15 @@ ao_gps(void) __reentrant
                        ao_gps_next.flags |= i;
 
                        ao_gps_lexchar();
-                       ao_gps_skip_field();    /* Horizontal dilution */
+                       ao_gps_next.hdop = ao_gps_decimal(0xff);
+                       if (ao_gps_next.hdop <= 50) {
+                               ao_gps_next.hdop = (uint8_t) 5 * ao_gps_next.hdop;
+                               if (ao_gps_char == '.')
+                                       ao_gps_next.hdop = (ao_gps_next.hdop +
+                                                           ((uint8_t) ao_gps_decimal(1) >> 1));
+                       } else
+                               ao_gps_next.hdop = 255;
+                       ao_gps_skip_field();
 
                        ao_gps_next.altitude = ao_gps_decimal(0xff);
                        ao_gps_skip_field();    /* skip any fractional portion */