altoslib: Don't smash existing GPS pad alt after boost
authorKeith Packard <keithp@keithp.com>
Wed, 9 Jan 2013 23:23:46 +0000 (15:23 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 11 Jan 2013 05:44:05 +0000 (21:44 -0800)
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>
altoslib/AltosState.java

index 218c598..4f59c84 100644 (file)
@@ -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)