summaryrefslogtreecommitdiff
path: root/altoslib/AltosState.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-09-03 17:42:00 -0600
committerKeith Packard <keithp@keithp.com>2013-09-03 17:42:00 -0600
commit96a651cc1b81b30f4cbde454e34cf80ed8825945 (patch)
tree5080697fcc19eae2c0213eabba7a8370b915be46 /altoslib/AltosState.java
parent4de934c283a839fcbb246b36aa15362f3cf8629c (diff)
altoslib: Clear sat data when tick changes
Sat data comes in multiple records, but the tick is always the same, so use that to tell when the set of sats is new Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosState.java')
-rw-r--r--altoslib/AltosState.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java
index e874a498..e32a1fe5 100644
--- a/altoslib/AltosState.java
+++ b/altoslib/AltosState.java
@@ -464,7 +464,7 @@ public class AltosState implements Cloneable {
public AltosGPS gps;
public AltosGPS temp_gps;
- public boolean temp_gps_clear_sats_pending;
+ public int temp_gps_sat_tick;
public boolean gps_pending;
public int gps_sequence;
@@ -558,7 +558,7 @@ public class AltosState implements Cloneable {
gps = null;
temp_gps = null;
- temp_gps_clear_sats_pending = false;
+ temp_gps_sat_tick = 0;
gps_sequence = 0;
gps_pending = false;
@@ -653,7 +653,7 @@ public class AltosState implements Cloneable {
temp_gps = old.temp_gps.clone();
else
temp_gps = null;
- temp_gps_clear_sats_pending = old.temp_gps_clear_sats_pending;
+ temp_gps_sat_tick = old.temp_gps_sat_tick;
gps_sequence = old.gps_sequence;
gps_pending = old.gps_pending;
@@ -973,11 +973,10 @@ public class AltosState implements Cloneable {
temp_gps = new AltosGPS(gps);
}
gps_pending = true;
- if (!sats)
- temp_gps_clear_sats_pending = true;
- else if (temp_gps_clear_sats_pending) {
- temp_gps.cc_gps_sat = null;
- temp_gps_clear_sats_pending = false;
+ if (sats) {
+ if (tick != temp_gps_sat_tick)
+ temp_gps.cc_gps_sat = null;
+ temp_gps_sat_tick = tick;
}
return temp_gps;
}