altoslib: Keep old GPS values when updating data
authorKeith Packard <keithp@keithp.com>
Mon, 11 Dec 2017 22:42:45 +0000 (14:42 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 11 Dec 2017 22:42:45 +0000 (14:42 -0800)
This way, updating satellite information doesn't drop all of the
regular GPS data on the floor.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosCalData.java

index fdea5e214948da1bdad80f60ad43cc8c9fde0475..03e2cbd72e17793aabf277fbc408188940b73fae 100644 (file)
@@ -241,6 +241,8 @@ public class AltosCalData {
 
        public AltosGPS         gps_pad = null;
 
+       public AltosGPS         prev_gps = null;
+
        public double           gps_pad_altitude = AltosLib.MISSING;
 
        public void set_cal_gps(AltosGPS gps) {
@@ -251,6 +253,7 @@ public class AltosCalData {
                                gps_pad_altitude = gps.alt;
                }
                temp_gps = null;
+               prev_gps = gps;
        }
 
        /*
@@ -275,7 +278,7 @@ public class AltosCalData {
 
        public AltosGPS make_temp_cal_gps(int tick, boolean sats) {
                if (temp_gps == null)
-                       temp_gps = new AltosGPS();
+                       temp_gps = new AltosGPS(prev_gps);
                if (sats) {
                        if (tick != temp_gps_sat_tick)
                                temp_gps.cc_gps_sat = null;