altoslib/altosui: Get legacy telem working with new AltosState structure
[fw/altos] / altoslib / AltosTelemetryReader.java
index 3915927c5df0666714af79a3a90700eb15f02f69..b1cc009c12814f336bf56b9b3d86be1a460fc4ef 100644 (file)
@@ -35,9 +35,12 @@ public class AltosTelemetryReader extends AltosFlightReader {
                AltosLine l = telem.take();
                if (l.line == null)
                        throw new IOException("IO error");
-               AltosRecord     next = AltosTelemetry.parse(l.line, previous);
-               previous = next;
-               state = new AltosState (next, state);
+               AltosTelemetry  telem = AltosTelemetryLegacy.parse(l.line);
+               if (state == null)
+                       state = new AltosState();
+               else
+                       state = state.clone();
+               telem.update_state(state);
                return state;
        }