From: Keith Packard Date: Mon, 17 Jun 2013 21:00:43 +0000 (-0700) Subject: altosui: Add raw pressure to the AltosUI graph X-Git-Tag: 1.2.9.4~158 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=10f3d0084ff1c0b3dbf28c5d44727b514caeee20 altosui: Add raw pressure to the AltosUI graph A nice addition, and useful when diagnosing baro sensor issues Signed-off-by: Keith Packard --- diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index 825306be..e0d9bb1f 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -40,6 +40,7 @@ public class AltosState { public double ground_altitude; public double altitude; public double height; + public double pressure; 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(); + pressure = data.pressure(); tick = data.tick; state = data.state; diff --git a/altosui/AltosGraph.java b/altosui/AltosGraph.java index defe69a0..40604ce3 100644 --- a/altosui/AltosGraph.java +++ b/altosui/AltosGraph.java @@ -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() { - return "dBm"; + return "Pa"; } public String say_units() { - return "d b m"; + return "pascals"; } 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 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); @@ -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 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; - 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); + 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); @@ -138,6 +141,12 @@ public class AltosGraph extends AltosUIGraph { height_color, true, height_axis); + addSeries("Pressure", + AltosGraphDataPoint.data_pressure, + pressure_units, + pressure_color, + false, + pressure_axis); addSeries("Speed", AltosGraphDataPoint.data_speed, AltosConvert.speed, diff --git a/altosui/AltosGraphDataPoint.java b/altosui/AltosGraphDataPoint.java index 8e6d6923..7454f447 100644 --- a/altosui/AltosGraphDataPoint.java +++ b/altosui/AltosGraphDataPoint.java @@ -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_pressure = 15; 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; + case data_pressure: + y = state.pressure; + break; } if (y == AltosRecord.MISSING) throw new AltosUIDataMissing(index);