altosui: Leave new_gps indication until gps value is used
authorKeith Packard <keithp@keithp.com>
Thu, 13 Sep 2012 05:40:57 +0000 (22:40 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 13 Sep 2012 06:54:13 +0000 (23:54 -0700)
During replay, AltosState may not see a new GPS value as soon as it
lands in the state field as additional records with the same timestamp
may come in after the GPS record.

Instead of resetting the new_gps indication when the new record is
created, wait until the new_gps indication is seen by the AltosState
update code and have that clear the new_gps indication.

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

index dd741716a884d2c2d191a3cb530b638886c77a06..8bab1d0cad2ad0c7b2700f809fc8ac09d14a6eff 100644 (file)
@@ -168,7 +168,7 @@ public class AltosRecord implements Comparable <AltosRecord>, Cloneable {
                speed = old.speed;
                height = old.height;
                gps = new AltosGPS(old.gps);
-               new_gps = false;
+               new_gps = old.new_gps;
                companion = old.companion;
        }
 
index 2806812e4fc9f992b2fd7447eb2913eedf6b1670..2e4d8870e12684d5f6aa3ef6764f1338492f9281 100644 (file)
@@ -165,6 +165,8 @@ public class AltosState {
                } else
                        pad_alt = ground_altitude;
 
+               data.new_gps = false;
+
                gps_waiting = MIN_PAD_SAMPLES - npad;
                if (gps_waiting < 0)
                        gps_waiting = 0;