altosui: Try to make telem tick counts match eeprom
authorKeith Packard <keithp@keithp.com>
Tue, 8 May 2012 04:53:53 +0000 (21:53 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 8 May 2012 04:53:53 +0000 (21:53 -0700)
telem files can have an extra wrap or two of tick count if they start
recording a long time before the flight. Account for this so that the
CSV file output from each have matching tick values.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosTelemetryIterable.java

index 278cbfb75b9e2e28ebceff7aa5f0621f84c60cb2..a1b253321fde593eb2f11238b1f7e420ca7f6f41 100644 (file)
@@ -88,6 +88,15 @@ public class AltosTelemetryIterable extends AltosRecordIterable {
                if (previous != null)
                        records.add(previous);
 
+               /* Adjust all tick counts to match expected eeprom values,
+                * which starts with a 16-bit tick count 16 samples before boost
+                */
+
+               int tick_adjust = (boost_tick - 16) & 0xffff0000;
+               for (AltosRecord r : this)
+                       r.tick -= tick_adjust;
+               boost_tick -= tick_adjust;
+
                /* adjust all tick counts to be relative to boost time */
                for (AltosRecord r : this)
                        r.time = (r.tick - boost_tick) / 100.0;