From 481577a29380afe6750ef7c4e928daff837cbc49 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 5 Jul 2011 23:38:42 -0700 Subject: [PATCH] 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 --- altosui/AltosTelemetryIterable.java | 8 ++++++-- 1 file 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; -- 2.30.2