From 428d09294ba0395fedd71346ad00fd90a4cdde97 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 7 Jun 2014 21:12:44 -0700 Subject: [PATCH] ao-tools: Parse TeleGPS state value from gps location packet TeleGPS encodes state in a spare gps location packet byte, masking in 0x80 to signify that the state value is valid Signed-off-by: Keith Packard --- ao-tools/ao-telem/ao-telem.c | 2 ++ ao-tools/lib/cc-telemetry.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ao-tools/ao-telem/ao-telem.c b/ao-tools/ao-telem/ao-telem.c index da873838..75f94ec1 100644 --- a/ao-tools/ao-telem/ao-telem.c +++ b/ao-tools/ao-telem/ao-telem.c @@ -145,6 +145,8 @@ main (int argc, char **argv) telem.location.ground_speed / 100.0, telem.location.climb_rate / 100.0, telem.location.course * 2); + if ((telem.location.state & AO_GPS_STATE_VALID)) + printf (" state %1d", telem.location.state & ~(AO_GPS_STATE_VALID)); printf ("\n"); break; case AO_TELEMETRY_SATELLITE: diff --git a/ao-tools/lib/cc-telemetry.h b/ao-tools/lib/cc-telemetry.h index d64c4b30..35cca13b 100644 --- a/ao-tools/lib/cc-telemetry.h +++ b/ao-tools/lib/cc-telemetry.h @@ -90,6 +90,8 @@ struct ao_telemetry_configuration { #define AO_GPS_MODE_MANUAL 'M' #define AO_GPS_MODE_SIMULATED 'S' +#define AO_GPS_STATE_VALID 0x80 + struct ao_telemetry_location { uint16_t serial; /* 0 */ uint16_t tick; /* 2 */ @@ -112,7 +114,7 @@ struct ao_telemetry_location { uint16_t ground_speed; /* 26 cm/s */ int16_t climb_rate; /* 28 cm/s */ uint8_t course; /* 30 degrees / 2 */ - uint8_t unused[1]; /* 31 */ + uint8_t state; /* 31 */ /* 32 */ }; -- 2.30.2