altoslib: Reset telem tracking state when switching altimeters
authorKeith Packard <keithp@keithp.com>
Sun, 18 Nov 2012 18:13:49 +0000 (10:13 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 18 Nov 2012 18:13:49 +0000 (10:13 -0800)
This discards any local state when the new telem packet has a
different serial number

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosTelemetryRecordRaw.java

index c21da6fc1cbe26f87eb480f0ecf6fce9477cc6f0..51dd704dc81c319477af3b4416ca4238829f97ca 100644 (file)
@@ -62,7 +62,8 @@ public class AltosTelemetryRecordRaw extends AltosTelemetryRecord {
 
        public AltosRecord update_state(AltosRecord previous) {
                AltosRecord     next;
-               if (previous != null)
+
+               if (previous != null && previous.serial == serial)
                        next = previous.clone();
                else
                        next = new AltosRecordNone();