summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-01-09 15:23:46 -0800
committerKeith Packard <keithp@keithp.com>2013-01-10 21:44:05 -0800
commit42733d2823b1ecf54c03881fc120067868c0ff4c (patch)
tree7d7f66997e81f89c57c40a85360a5795b6e68c21
parentd7d259c7b3eedcc1c185d2b7e3c33e829bd7ce96 (diff)
altoslib: Don't smash existing GPS pad alt after boost
Leave the existing GPS pad altitude value in place after boost by checking to see if it was ever computed before resetting it to the barometric pad altitude. This makes GPS height values relative to the pad. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosState.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java
index 218c598a..4f59c840 100644
--- a/altoslib/AltosState.java
+++ b/altoslib/AltosState.java
@@ -200,10 +200,10 @@ public class AltosState {
}
ngps++;
}
- } else
- pad_alt = ground_altitude;
-
- data.new_gps = false;
+ } else {
+ if (ngps == 0)
+ pad_alt = ground_altitude;
+ }
gps_waiting = MIN_PAD_SAMPLES - npad;
if (gps_waiting < 0)