diff options
author | Keith Packard <keithp@keithp.com> | 2013-05-14 00:24:53 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-14 00:24:53 -0700 |
commit | 43f94e923a6a87520edcbb8fb4829e6ddf708908 (patch) | |
tree | 418a5faf0b502845450f092961aa78235d5d22ea /altoslib/AltosTelemetryRecordLegacy.java | |
parent | c88aa32b979f379e3cf316dcb651e264c32a5283 (diff) |
altoslib: Use sequence numbers to track GPS updates to AltosRecord
State objects now record what GPS sequence ID they have to know when
the GPS data has been updated. Record objects bump the GPS sequence
each time new GPS data is recorded. This way, record objects aren't
modified as they're iterated over to generate the list of state
objects which makes it possible to iterate multiple times and get the
same resulting set of states.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosTelemetryRecordLegacy.java')
-rw-r--r-- | altoslib/AltosTelemetryRecordLegacy.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/altoslib/AltosTelemetryRecordLegacy.java b/altoslib/AltosTelemetryRecordLegacy.java index a734b188..f2d3f868 100644 --- a/altoslib/AltosTelemetryRecordLegacy.java +++ b/altoslib/AltosTelemetryRecordLegacy.java @@ -267,7 +267,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { if (map.has(AO_TELEM_GPS_STATE)) { record.gps = new AltosGPS(map); - record.new_gps = true; + record.gps_sequence++; } else record.gps = null; @@ -357,7 +357,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { } record.gps = new AltosGPS(words, i, record.version); - record.new_gps = true; + record.gps_sequence++; } public AltosTelemetryRecordLegacy(String line) throws ParseException, AltosCRCException { @@ -476,7 +476,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { if ((gps_flags & (AO_GPS_VALID|AO_GPS_RUNNING)) != 0) { record.gps = new AltosGPS(); - record.new_gps = true; + record.gps_sequence++; record.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon; record.gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK); |