altosui: Show GPS max height in flight stats window of graph
[fw/altos] / altosui / AltosFlightStats.java
index 552210c36adac61f13cc1c4c617903a208b9d8ba..0be49c2fb82167890ab9da39f363fc2f8c2f0fca 100644 (file)
 package altosui;
 
 import java.io.*;
-import org.altusmetrum.altoslib_2.*;
+import org.altusmetrum.altoslib_3.*;
 
 public class AltosFlightStats {
        double          max_height;
+       double          max_gps_height;
        double          max_speed;
        double          max_acceleration;
        double[]        state_speed = new double[Altos.ao_flight_invalid + 1];
@@ -38,6 +39,9 @@ public class AltosFlightStats {
        boolean         has_gps;
        boolean         has_other_adc;
        boolean         has_rssi;
+       boolean         has_imu;
+       boolean         has_mag;
+       boolean         has_orient;
 
        double landed_time(AltosStateIterable states) {
                AltosState state = null;
@@ -108,6 +112,9 @@ public class AltosFlightStats {
                has_gps = false;
                has_other_adc = false;
                has_rssi = false;
+               has_imu = false;
+               has_mag = false;
+               has_orient = false;
                for (AltosState state : states) {
                        if (serial == AltosLib.MISSING && state.serial != AltosLib.MISSING)
                                serial = state.serial;
@@ -147,6 +154,7 @@ public class AltosFlightStats {
                                max_height = state.max_height();
                                max_speed = state.max_speed();
                                max_acceleration = state.max_acceleration();
+                               max_gps_height = state.max_gps_height();
                        }
                        if (state.gps != null && state.gps.locked && state.gps.nsat >= 4) {
                                if (state_id <= Altos.ao_flight_pad) {
@@ -157,6 +165,12 @@ public class AltosFlightStats {
                                lon = state.gps.lon;
                                has_gps = true;
                        }
+                       if (state.imu != null)
+                               has_imu = true;
+                       if (state.mag != null)
+                               has_mag = true;
+                       if (state.orient() != AltosLib.MISSING)
+                               has_orient = true;
                }
                for (int s = Altos.ao_flight_startup; s <= Altos.ao_flight_landed; s++) {
                        if (state_count[s] > 0) {