altos: Write current flight state to GPS data from GPS drivers
authorKeith Packard <keithp@keithp.com>
Sat, 7 Jun 2014 18:39:10 +0000 (11:39 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 7 Jun 2014 18:39:10 +0000 (11:39 -0700)
This will be useful with TeleGPS which has no other packet containing
flight state.

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

index d89435b9c635f46891ae62ca948a5378e4a7238a..344b7121446cc410dce3fc5a1e59f04a92fa4fa5 100644 (file)
@@ -413,6 +413,9 @@ ao_gps(void) __reentrant
                        ao_gps_data.hdop = ao_sirf_data.hdop;
                        ao_gps_data.climb_rate = ao_sirf_data.climb_rate;
                        ao_gps_data.flags |= AO_GPS_COURSE_VALID;
+#if HAS_FLIGHT || HAS_TRACKER
+                       ao_gps_data.state = ao_flight_state;
+#endif
 #if 0
                        if (ao_sirf_data.h_error > 6553500)
                                ao_gps_data.h_error = 65535;
index 944a37f9b38400a05ccc3d2a437f332141af8a79..d789974d1c8bd3adf722307bdfe517c942d4792b 100644 (file)
@@ -259,6 +259,9 @@ ao_nmea_gga(void)
        ao_gps_next.minute = ao_gps_decimal(2);
        ao_gps_next.second = ao_gps_decimal(2);
        ao_gps_skip_field();    /* skip seconds fraction */
+#if HAS_FLIGHT || HAS_TRACKER
+                               ao_gps_data.state = ao_flight_state;
+#endif
 
        ao_gps_next.latitude = ao_gps_parse_pos(2);
        if (ao_gps_parse_flag('N', 'S'))
index 077698a90d514a24672b3d990d867118a1c67a9c..6c42c1ba70a8c1fdbabc53817f09fe8a87be3ff3 100644 (file)
@@ -749,7 +749,9 @@ ao_gps(void) __reentrant
                                ao_gps_data.ground_speed = nav_velned.g_speed;
                                ao_gps_data.climb_rate = -nav_velned.vel_d;
                                ao_gps_data.course = nav_velned.heading / 200000;
-
+#if HAS_FLIGHT || HAS_TRACKER
+                               ao_gps_data.state = ao_flight_state;
+#endif
                                ao_gps_tracking_data.channels = 0;
 
                                struct ao_telemetry_satellite_info *dst = &ao_gps_tracking_data.sats[0];