summaryrefslogtreecommitdiff
path: root/altoslib
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-04-05 16:41:20 -0700
committerKeith Packard <keithp@keithp.com>2018-04-26 19:24:21 -0700
commit110e4818b85781c33d683b7b7e7f2864a1223c5c (patch)
tree0670fde673158d40ed8dfc7cdb88e5b6e899c1a8 /altoslib
parent20dc0e6c8e365c1f4188189d506163d589c3bade (diff)
micropeak: Make reported 'max height' value show filtered max height
MicroPeak tries to filter out bogus pressure data so that the value reported on the LED is reasonable. We want to report that same value in the UI, which means replacing the normal mechanism for computing max height from the time series of height data with the value computed from the saved minimum pressure value recorded in the device. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib')
-rw-r--r--altoslib/AltosFlightSeries.java9
-rw-r--r--altoslib/AltosFlightStats.java4
2 files changed, 11 insertions, 2 deletions
diff --git a/altoslib/AltosFlightSeries.java b/altoslib/AltosFlightSeries.java
index d130d3ad..182bdd19 100644
--- a/altoslib/AltosFlightSeries.java
+++ b/altoslib/AltosFlightSeries.java
@@ -257,6 +257,15 @@ public class AltosFlightSeries extends AltosDataListener {
public AltosTimeSeries height_series;
+ public double max_height = AltosLib.MISSING;
+
+ public void set_min_pressure(double pa) {
+ double ground_altitude = cal_data().ground_altitude;
+ if (ground_altitude != AltosLib.MISSING)
+ max_height = AltosConvert.pressure_to_altitude(pa) -
+ ground_altitude;
+ }
+
public static final String height_name = "Height";
public void set_pressure(double pa) {
diff --git a/altoslib/AltosFlightStats.java b/altoslib/AltosFlightStats.java
index 6bb83581..2760321d 100644
--- a/altoslib/AltosFlightStats.java
+++ b/altoslib/AltosFlightStats.java
@@ -266,8 +266,8 @@ public class AltosFlightStats {
}
}
- max_height = AltosLib.MISSING;
- if (series.height_series != null)
+ max_height = series.max_height;
+ if (max_height == AltosLib.MISSING && series.height_series != null)
max_height = series.height_series.max().value;
max_gps_height = AltosLib.MISSING;
if (series.gps_height != null) {