X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosGraph.java;h=a73e3fd8ee2837e67df4e23e02ba86543afb6386;hb=04d7d0f829ba953ffeca8ad9887a4b6b2b5d5087;hp=9383824a15b59e37bff93428acba2a0b258c9d85;hpb=2efd3ad80d4fefa8ccc1b80a2e657dbf9ba0c60f;p=fw%2Faltos diff --git a/altosui/AltosGraph.java b/altosui/AltosGraph.java index 9383824a..a73e3fd8 100644 --- a/altosui/AltosGraph.java +++ b/altosui/AltosGraph.java @@ -50,7 +50,7 @@ class AltosVoltage extends AltosUnits { } public int show_fraction(int width) { - return width / 9; + return width / 2; } } @@ -73,10 +73,29 @@ class AltosNsat extends AltosUnits { } } +class AltosPressure extends AltosUnits { + + public double value(double p) { + return p; + } + + public String show_units() { + return "Pa"; + } + + public String say_units() { + return "pascals"; + } + + public int show_fraction(int width) { + return 0; + } +} + class AltosDbm extends AltosUnits { - public double value(double v) { - return v; + public double value(double d) { + return d; } public String show_units() { @@ -84,7 +103,7 @@ class AltosDbm extends AltosUnits { } public String say_units() { - return "d b m"; + return "D B M"; } public int show_fraction(int width) { @@ -96,6 +115,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 +132,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) { + 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 +160,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, @@ -150,65 +178,72 @@ public class AltosGraph extends AltosUIGraph { accel_color, true, accel_axis); - addSeries("Range", - AltosGraphDataPoint.data_range, - AltosConvert.distance, - range_color, - false, - distance_axis); - addSeries("Distance", - AltosGraphDataPoint.data_distance, - AltosConvert.distance, - distance_color, - false, - distance_axis); - addSeries("GPS Height", - AltosGraphDataPoint.data_gps_height, - AltosConvert.height, - gps_height_color, - false, - height_axis); - addSeries("GPS Satellites in Solution", - AltosGraphDataPoint.data_gps_nsat_solution, - nsat_units, - gps_nsat_solution_color, - false, + if (stats.has_gps) { + addSeries("Range", + AltosGraphDataPoint.data_range, + AltosConvert.distance, + range_color, + false, + distance_axis); + addSeries("Distance", + AltosGraphDataPoint.data_distance, + AltosConvert.distance, + distance_color, + false, + distance_axis); + addSeries("GPS Height", + AltosGraphDataPoint.data_gps_height, + AltosConvert.height, + gps_height_color, + false, + height_axis); + addSeries("GPS Satellites in Solution", + AltosGraphDataPoint.data_gps_nsat_solution, + nsat_units, + gps_nsat_solution_color, + false, + nsat_axis); + addSeries("GPS Satellites in View", + AltosGraphDataPoint.data_gps_nsat_view, + nsat_units, + gps_nsat_view_color, + false, nsat_axis); - addSeries("GPS Satellites in View", - AltosGraphDataPoint.data_gps_nsat_view, - nsat_units, - gps_nsat_view_color, - false, - nsat_axis); - addSeries("Received Signal Strength", - AltosGraphDataPoint.data_rssi, - dbm_units, - dbm_color, - false, - dbm_axis); - addSeries("Temperature", - AltosGraphDataPoint.data_temperature, - AltosConvert.temperature, - temperature_color, - false, - temperature_axis); - addSeries("Battery Voltage", - AltosGraphDataPoint.data_battery_voltage, - voltage_units, - battery_voltage_color, - false, - voltage_axis); - addSeries("Drogue Voltage", - AltosGraphDataPoint.data_drogue_voltage, - voltage_units, - drogue_voltage_color, - false, - voltage_axis); - addSeries("Main Voltage", - AltosGraphDataPoint.data_main_voltage, - voltage_units, - main_voltage_color, - false, - voltage_axis); + } + if (stats.has_rssi) + addSeries("Received Signal Strength", + AltosGraphDataPoint.data_rssi, + dbm_units, + dbm_color, + false, + dbm_axis); + if (stats.has_other_adc) { + addSeries("Temperature", + AltosGraphDataPoint.data_temperature, + AltosConvert.temperature, + temperature_color, + false, + temperature_axis); + addSeries("Battery Voltage", + AltosGraphDataPoint.data_battery_voltage, + voltage_units, + battery_voltage_color, + false, + voltage_axis); + addSeries("Drogue Voltage", + AltosGraphDataPoint.data_drogue_voltage, + voltage_units, + drogue_voltage_color, + false, + voltage_axis); + addSeries("Main Voltage", + AltosGraphDataPoint.data_main_voltage, + voltage_units, + main_voltage_color, + false, + voltage_axis); + } + + setDataSet(dataSet); } } \ No newline at end of file