altosui: Add raw pressure to the AltosUI graph
authorKeith Packard <keithp@keithp.com>
Mon, 17 Jun 2013 21:00:43 +0000 (14:00 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 17 Jun 2013 21:00:43 +0000 (14:00 -0700)
A nice addition, and useful when diagnosing baro sensor issues

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

index 825306be998559373141bba449553019605fa18c..e0d9bb1fc394dc1cb42b495bc03e755d135968bb 100644 (file)
@@ -40,6 +40,7 @@ public class AltosState {
        public double   ground_altitude;
        public double   altitude;
        public double   height;
        public double   ground_altitude;
        public double   altitude;
        public double   height;
+       public double   pressure;
        public double   acceleration;
        public double   battery;
        public double   temperature;
        public double   acceleration;
        public double   battery;
        public double   temperature;
@@ -125,6 +126,7 @@ public class AltosState {
                drogue_sense = data.drogue_voltage();
                main_sense = data.main_voltage();
                battery = data.battery_voltage();
                drogue_sense = data.drogue_voltage();
                main_sense = data.main_voltage();
                battery = data.battery_voltage();
+               pressure = data.pressure();
                tick = data.tick;
                state = data.state;
 
                tick = data.tick;
                state = data.state;
 
index defe69a0082cdca7a061331cd5086bf3404e772a..40604ce3574060a3a20d09f62244ac6a32f6d3c0 100644 (file)
@@ -73,18 +73,18 @@ class AltosNsat extends AltosUnits {
        }
 }
 
        }
 }
 
-class AltosDbm extends AltosUnits {
+class AltosPressure extends AltosUnits {
 
 
-       public double value(double v) {
-               return v;
+       public double value(double p) {
+               return p;
        }
 
        public String show_units() {
        }
 
        public String show_units() {
-               return "dBm";
+               return "Pa";
        }
 
        public String say_units() {
        }
 
        public String say_units() {
-               return "d b m";
+               return "pascals";
        }
 
        public int show_fraction(int width) {
        }
 
        public int show_fraction(int width) {
@@ -96,6 +96,7 @@ public class AltosGraph extends AltosUIGraph {
 
        static final private Color height_color = new Color(194,31,31);
        static final private Color gps_height_color = new Color(150,31,31);
 
        static final private Color height_color = new Color(194,31,31);
        static final private Color gps_height_color = new Color(150,31,31);
+       static final private Color pressure_color = new Color (225,31,31);
        static final private Color range_color = new Color(100, 31, 31);
        static final private Color distance_color = new Color(100, 31, 194);
        static final private Color speed_color = new Color(31,194,31);
        static final private Color range_color = new Color(100, 31, 31);
        static final private Color distance_color = new Color(100, 31, 194);
        static final private Color speed_color = new Color(31,194,31);
@@ -112,16 +113,18 @@ public class AltosGraph extends AltosUIGraph {
        static final private Color state_color = new Color(0,0,0);
 
        static AltosVoltage voltage_units = new AltosVoltage();
        static final private Color state_color = new Color(0,0,0);
 
        static AltosVoltage voltage_units = new AltosVoltage();
+       static AltosPressure pressure_units = new AltosPressure();
        static AltosNsat nsat_units = new AltosNsat();
        static AltosDbm dbm_units = new AltosDbm();
 
        AltosUIAxis     height_axis, speed_axis, accel_axis, voltage_axis, temperature_axis, nsat_axis, dbm_axis;
        static AltosNsat nsat_units = new AltosNsat();
        static AltosDbm dbm_units = new AltosDbm();
 
        AltosUIAxis     height_axis, speed_axis, accel_axis, voltage_axis, temperature_axis, nsat_axis, dbm_axis;
-       AltosUIAxis     distance_axis;
+       AltosUIAxis     distance_axis, pressure_axis;
 
        public AltosGraph(AltosUIEnable enable, AltosFlightStats stats, AltosGraphDataSet dataSet) {
                super(enable);
 
                height_axis = newAxis("Height", AltosConvert.height, height_color);
 
        public AltosGraph(AltosUIEnable enable, AltosFlightStats stats, AltosGraphDataSet dataSet) {
                super(enable);
 
                height_axis = newAxis("Height", AltosConvert.height, height_color);
+               pressure_axis = newAxis("Pressure", pressure_units, pressure_color, 0);
                speed_axis = newAxis("Speed", AltosConvert.speed, speed_color);
                accel_axis = newAxis("Acceleration", AltosConvert.accel, accel_color);
                voltage_axis = newAxis("Voltage", voltage_units, voltage_color);
                speed_axis = newAxis("Speed", AltosConvert.speed, speed_color);
                accel_axis = newAxis("Acceleration", AltosConvert.accel, accel_color);
                voltage_axis = newAxis("Voltage", voltage_units, voltage_color);
@@ -138,6 +141,12 @@ public class AltosGraph extends AltosUIGraph {
                          height_color,
                          true,
                          height_axis);
                          height_color,
                          true,
                          height_axis);
+               addSeries("Pressure",
+                         AltosGraphDataPoint.data_pressure,
+                         pressure_units,
+                         pressure_color,
+                         false,
+                         pressure_axis);
                addSeries("Speed",
                          AltosGraphDataPoint.data_speed,
                          AltosConvert.speed,
                addSeries("Speed",
                          AltosGraphDataPoint.data_speed,
                          AltosConvert.speed,
index 8e6d6923327feb670f339a9bd0f8af3b19cfc4fd..7454f447948e897b2a468af31820f0ee42df8593 100644 (file)
@@ -39,6 +39,7 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
        public static final int data_temperature = 12;
        public static final int data_range = 13;
        public static final int data_distance = 14;
        public static final int data_temperature = 12;
        public static final int data_range = 13;
        public static final int data_distance = 14;
+       public static final int data_pressure = 15;
 
        public double x() throws AltosUIDataMissing {
                if (state.data.time < -2)
 
        public double x() throws AltosUIDataMissing {
                if (state.data.time < -2)
@@ -94,6 +95,9 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
                        if (state.from_pad != null)
                                y = state.from_pad.distance;
                        break;
                        if (state.from_pad != null)
                                y = state.from_pad.distance;
                        break;
+               case data_pressure:
+                       y = state.pressure;
+                       break;
                }
                if (y == AltosRecord.MISSING)
                        throw new AltosUIDataMissing(index);
                }
                if (y == AltosRecord.MISSING)
                        throw new AltosUIDataMissing(index);