altos: Use 0x80 to indicate valid state value in the GPS location packet
authorKeith Packard <keithp@keithp.com>
Sun, 8 Jun 2014 04:02:26 +0000 (21:02 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 8 Jun 2014 04:02:26 +0000 (21:02 -0700)
And only set this for tracker products; other products place state in
separate state packets

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

index 7850f738bd39d42f4ad32ea09908a7ac5b4c8e9a..2292d229d673a02b6b8ef1ebd87d45720f0fc9dc 100644 (file)
@@ -334,7 +334,9 @@ ao_send_location(void)
                ao_xmemcpy(&telemetry.location.flags,
                       &ao_gps_data.flags,
                       26);
                ao_xmemcpy(&telemetry.location.flags,
                       &ao_gps_data.flags,
                       26);
-               telemetry.location.state = ao_flight_state;
+#if HAS_TRACKER
+               telemetry.location.state = ao_flight_state | AO_GPS_STATE_VALID;
+#endif
                telemetry.location.tick = ao_gps_tick;
                ao_mutex_put(&ao_gps_mutex);
                ao_radio_send(&telemetry, sizeof (telemetry));
                telemetry.location.tick = ao_gps_tick;
                ao_mutex_put(&ao_gps_mutex);
                ao_radio_send(&telemetry, sizeof (telemetry));
index 1aeda264389498e0702b8ff37850457379330e28..050bbf726a09c7d338ae2e31306336c26b760204 100644 (file)
@@ -93,6 +93,8 @@ struct ao_telemetry_configuration {
 #define AO_GPS_MODE_MANUAL             'M'
 #define AO_GPS_MODE_SIMULATED          'S'
 
 #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 */
 struct ao_telemetry_location {
        uint16_t        serial;         /*  0 */
        uint16_t        tick;           /*  2 */