summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-11-21 18:57:45 -0800
committerKeith Packard <keithp@keithp.com>2009-11-21 20:37:53 -0800
commit80b23f3044a654d61212891a61fadb8a3a4e5572 (patch)
tree880c8cf323d7e648abd6752bfd761669b200129a /src
parent8f036ee7cd30ce3ed2e5cc8501914a4c19b73875 (diff)
Decode HDOP data from skytraq GPS
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>
Diffstat (limited to 'src')
-rw-r--r--src/ao_gps_skytraq.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ao_gps_skytraq.c b/src/ao_gps_skytraq.c
index bf192f28..ef581349 100644
--- a/src/ao_gps_skytraq.c
+++ b/src/ao_gps_skytraq.c
@@ -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 */