diff options
author | Keith Packard <keithp@keithp.com> | 2011-07-05 23:38:42 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-07-05 23:38:42 -0700 |
commit | 481577a29380afe6750ef7c4e928daff837cbc49 (patch) | |
tree | b8d9982e76c423831f6531d5ad41d39f1c63af21 | |
parent | 7cfd43663cde5ebdf04e4face076d79ff6329ac3 (diff) |
altosui: Compress telemetry records marked with the same time
Split telemetry transmits multiple packets with the same
timestamp. Merge those into a single record when read from a file.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altosui/AltosTelemetryIterable.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/altosui/AltosTelemetryIterable.java b/altosui/AltosTelemetryIterable.java index 90a08485..1a31b365 100644 --- a/altosui/AltosTelemetryIterable.java +++ b/altosui/AltosTelemetryIterable.java @@ -53,7 +53,6 @@ public class AltosTelemetryIterable extends AltosRecordIterable { AltosRecord record = AltosTelemetry.parse(line, previous); if (record == null) break; - previous = record; if (records.isEmpty()) { current_tick = record.tick; } else { @@ -74,7 +73,9 @@ public class AltosTelemetryIterable extends AltosRecordIterable { has_gps = true; if (record.main != AltosRecord.MISSING) has_ignite = true; - records.add(record); + if (previous != null && previous.tick != record.tick) + records.add(previous); + previous = record; } catch (ParseException pe) { System.out.printf("parse exception %s\n", pe.getMessage()); } catch (AltosCRCException ce) { @@ -84,6 +85,9 @@ public class AltosTelemetryIterable extends AltosRecordIterable { System.out.printf("io exception\n"); } + if (previous != null) + records.add(previous); + /* adjust all tick counts to be relative to boost time */ for (AltosRecord r : this) r.time = (r.tick - boost_tick) / 100.0; |