summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-11-18 10:13:49 -0800
committerKeith Packard <keithp@keithp.com>2012-11-18 10:13:49 -0800
commitc4737c81ee2da826b38cc52efbfb09017e6825ca (patch)
treeede1c8b0cc02a33117f600fd58c2889d5bafedf9
parentfcb801b145e1ae6f1c0b3418a99245d34dbf5aa4 (diff)
altoslib: Reset telem tracking state when switching altimeters
This discards any local state when the new telem packet has a different serial number Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosTelemetryRecordRaw.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/altoslib/AltosTelemetryRecordRaw.java b/altoslib/AltosTelemetryRecordRaw.java
index c21da6fc..51dd704d 100644
--- a/altoslib/AltosTelemetryRecordRaw.java
+++ b/altoslib/AltosTelemetryRecordRaw.java
@@ -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();