diff options
author | Keith Packard <keithp@keithp.com> | 2013-09-19 00:26:24 -0500 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-09-19 00:26:24 -0500 |
commit | be7f56b86478ef4a23a2af77338c580b9c9e5e3b (patch) | |
tree | bcea098c8b47d1f324de17e3f73f836f4290d47c | |
parent | 56b577e55c264c8e3152bb2b2cca02fa8836ac1e (diff) |
altoslib: Prefer averaged ground pres for ground alt computation
If ground pressure is recorded (as from an eeprom file), then prefer
that value to the average of the pre-boost ground pressures when
computing the ground altitude.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altoslib/AltosState.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index 5a805fc6..a9bb1e70 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -301,7 +301,8 @@ public class AltosState implements Cloneable { class AltosGroundPressure extends AltosCValue { void set_filtered(double p, double time) { computed.set_filtered(p, time); - ground_altitude.set_computed(pressure_to_altitude(computed.value()), time); + if (!is_measured()) + ground_altitude.set_computed(pressure_to_altitude(computed.value()), time); } void set_measured(double p, double time) { @@ -657,6 +658,7 @@ public class AltosState implements Cloneable { set = 0; + ground_pressure.copy(old.ground_pressure); ground_altitude.copy(old.ground_altitude); altitude.copy(old.altitude); pressure.copy(old.pressure); |