altosui: Add extra ignitors to graphable objects
authorKeith Packard <keithp@keithp.com>
Wed, 30 Apr 2014 02:04:30 +0000 (19:04 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 30 Apr 2014 02:05:49 +0000 (19:05 -0700)
List all of the available extra ignitors as possible things to graph.

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

index 0be49c2fb82167890ab9da39f363fc2f8c2f0fca..d02a518d593f44fa72c8dce52ccd50293b3eff05 100644 (file)
@@ -42,6 +42,7 @@ public class AltosFlightStats {
        boolean         has_imu;
        boolean         has_mag;
        boolean         has_orient;
+       int             num_ignitor;
 
        double landed_time(AltosStateIterable states) {
                AltosState state = null;
@@ -171,6 +172,8 @@ public class AltosFlightStats {
                                has_mag = true;
                        if (state.orient() != AltosLib.MISSING)
                                has_orient = true;
+                       if (state.ignitor_voltage != null && state.ignitor_voltage.length > num_ignitor)
+                               num_ignitor = state.ignitor_voltage.length;
                }
                for (int s = Altos.ao_flight_startup; s <= Altos.ao_flight_landed; s++) {
                        if (state_count[s] > 0) {
index 42334e319cc435d5d85090c3bb2c169fb6fd4b4c..f14956762bd8752a165752eb2ff42ca9f447e09e 100644 (file)
@@ -389,7 +389,16 @@ public class AltosGraph extends AltosUIGraph {
                                  orient_color,
                                  false,
                                  orient_axis);
+               if (stats.num_ignitor > 0) {
+                       for (int i = 0; i < stats.num_ignitor; i++)
+                               addSeries(AltosIgnitor.ignitor_name(i),
+                                         AltosGraphDataPoint.data_ignitor_0 + i,
+                                         voltage_units,
+                                         main_voltage_color,
+                                         false,
+                                         voltage_axis);
+               }
 
                setDataSet(dataSet);
        }
-}
\ No newline at end of file
+}
index e672d1bf4e074c0175be7ca7d1baa9101e3dcc60..1c11616637c356ac1f67168bbc101f3a51d0db79 100644 (file)
@@ -50,6 +50,9 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
        public static final int data_mag_y = 23;
        public static final int data_mag_z = 24;
        public static final int data_orient = 25;
+       public static final int data_ignitor_0 = 26;
+       public static final int data_ignitor_num = 32;
+       public static final int data_ignitor_max = data_ignitor_0 + data_ignitor_num - 1;
 
        public double x() throws AltosUIDataMissing {
                double  time = state.time_since_boost();
@@ -161,6 +164,13 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
                case data_orient:
                        y = state.orient();
                        break;
+               default:
+                       if (data_ignitor_0 <= index && index <= data_ignitor_max) {
+                               int ignitor = index - data_ignitor_0;
+                               if (state.ignitor_voltage != null && ignitor < state.ignitor_voltage.length)
+                                       y = state.ignitor_voltage[ignitor];
+                       }
+                       break;
                }
                if (y == AltosLib.MISSING)
                        throw new AltosUIDataMissing(index);
@@ -186,4 +196,4 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
        public AltosGraphDataPoint (AltosState state) {
                this.state = state;
        }
-}
\ No newline at end of file
+}