altosuilib: Don't offer to graph some GPS details that TM doesn't log
authorKeith Packard <keithp@keithp.com>
Sun, 8 Feb 2015 04:36:10 +0000 (20:36 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 8 Feb 2015 04:36:10 +0000 (20:36 -0800)
When using a TM eeprom file, various minor GPS details are logged
(course, ground speed, climb rate, etc). Make sure these aren't
offered up for graphing.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosFlightStats.java
altosuilib/AltosGraph.java

index 677230e1e057e558ef9f7fc0aa13105994cfda12..555a34b5bf714fc32f40407d1700f8adfcf38b97 100644 (file)
@@ -38,6 +38,7 @@ public class AltosFlightStats {
        public boolean          has_flight_data;
        public boolean          has_gps;
        public boolean          has_gps_sats;
+       public boolean          has_gps_detail;
        public boolean          has_flight_adc;
        public boolean          has_battery;
        public boolean          has_rssi;
@@ -178,6 +179,8 @@ public class AltosFlightStats {
                                has_gps = true;
                                if (state.gps.cc_gps_sat != null)
                                        has_gps_sats = true;
+                               if (state.gps.course != AltosLib.MISSING)
+                                       has_gps_detail = true;
                        }
                        if (state.imu != null)
                                has_imu = true;
index 854c869c7df23d201ae8caed0bb39869348f741c..e2db9e124b96298c9f2d05842cbc4850084979b9 100644 (file)
@@ -337,42 +337,46 @@ public class AltosGraph extends AltosUIGraph {
                                          false,
                                          nsat_axis);
                        }
-                       addSeries("GPS Course",
-                                 AltosGraphDataPoint.data_gps_course,
-                                 orient_units,
-                                 gps_course_color,
-                                 false,
-                                 course_axis);
-                       addSeries("GPS Ground Speed",
-                                 AltosGraphDataPoint.data_gps_ground_speed,
-                                 AltosConvert.speed,
-                                 gps_ground_speed_color,
-                                 enable_gps,
-                                 speed_axis);
-                       addSeries("GPS Climb Rate",
-                                 AltosGraphDataPoint.data_gps_climb_rate,
-                                 AltosConvert.speed,
-                                 gps_climb_rate_color,
-                                 enable_gps,
-                                 speed_axis);
+                       if (stats.has_gps_detail) {
+                               addSeries("GPS Course",
+                                         AltosGraphDataPoint.data_gps_course,
+                                         orient_units,
+                                         gps_course_color,
+                                         false,
+                                         course_axis);
+                               addSeries("GPS Ground Speed",
+                                         AltosGraphDataPoint.data_gps_ground_speed,
+                                         AltosConvert.speed,
+                                         gps_ground_speed_color,
+                                         enable_gps,
+                                         speed_axis);
+                               addSeries("GPS Climb Rate",
+                                         AltosGraphDataPoint.data_gps_climb_rate,
+                                         AltosConvert.speed,
+                                         gps_climb_rate_color,
+                                         enable_gps,
+                                         speed_axis);
+                       }
                        addSeries("GPS Position DOP",
                                  AltosGraphDataPoint.data_gps_pdop,
                                  dop_units,
                                  gps_pdop_color,
                                  false,
                                  dop_axis);
-                       addSeries("GPS Horizontal DOP",
-                                 AltosGraphDataPoint.data_gps_hdop,
-                                 dop_units,
-                                 gps_hdop_color,
-                                 false,
-                                 dop_axis);
-                       addSeries("GPS Vertical DOP",
-                                 AltosGraphDataPoint.data_gps_vdop,
-                                 dop_units,
-                                 gps_vdop_color,
-                                 false,
-                                 dop_axis);
+                       if (stats.has_gps_detail) {
+                               addSeries("GPS Horizontal DOP",
+                                         AltosGraphDataPoint.data_gps_hdop,
+                                         dop_units,
+                                         gps_hdop_color,
+                                         false,
+                                         dop_axis);
+                               addSeries("GPS Vertical DOP",
+                                         AltosGraphDataPoint.data_gps_vdop,
+                                         dop_units,
+                                         gps_vdop_color,
+                                         false,
+                                         dop_axis);
+                       }
                }
                if (stats.has_rssi)
                        addSeries("Received Signal Strength",