diff options
author | Keith Packard <keithp@keithp.com> | 2010-09-09 22:30:48 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-09-09 22:31:52 -0700 |
commit | af200f5b84555de0556b52146379f3934774a3f3 (patch) | |
tree | 0b31ffddad5ff8cb54288a37117cf0fcf8893be6 /ao-tools | |
parent | 96ca7051f60ea299e3e05bafbe5717fc83c3afd2 (diff) |
altosui: Fix telemetry file reader to handle tick count wrapping
The telemetry reader was ignoring tick count wrapping, so you'd see
time go backwards in jumps. Not useful.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools')
-rw-r--r-- | ao-tools/altosui/AltosTelemetryReader.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ao-tools/altosui/AltosTelemetryReader.java b/ao-tools/altosui/AltosTelemetryReader.java index fdedbde2..ae9682ab 100644 --- a/ao-tools/altosui/AltosTelemetryReader.java +++ b/ao-tools/altosui/AltosTelemetryReader.java @@ -41,6 +41,7 @@ public class AltosTelemetryReader extends AltosReader { public AltosTelemetryReader (FileInputStream input) { boolean saw_boost = false; + int current_tick = 0; records = new LinkedList<AltosRecord> (); @@ -51,9 +52,20 @@ public class AltosTelemetryReader extends AltosReader { break; } try { + System.out.printf("%s\n", line); AltosTelemetry record = new AltosTelemetry(line); if (record == null) break; + if (records.isEmpty()) { + current_tick = record.tick; + } else { + int tick = record.tick | (current_tick & ~ 0xffff); + if (tick < current_tick - 0x1000) + tick += 0x10000; + current_tick = tick; + record.tick = current_tick; + } + System.out.printf("\tRSSI %d tick %d\n", record.rssi, record.tick); if (!saw_boost && record.state >= Altos.ao_flight_boost) { saw_boost = true; |