X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosTelemetryReader.java;h=23524b2cb349c4a99a2d11878a5a2f879842f5a3;hp=6c5a93978c69a4156e0e44fe3b94b3ea7a9c92c0;hb=3cad81b0ebb52352c66643a2587e94a2b693a2d2;hpb=51c7741040d95c5deece939dae5e4136cc04afc4 diff --git a/altosui/AltosTelemetryReader.java b/altosui/AltosTelemetryReader.java index 6c5a9397..23524b2c 100644 --- a/altosui/AltosTelemetryReader.java +++ b/altosui/AltosTelemetryReader.java @@ -26,6 +26,7 @@ class AltosTelemetryReader extends AltosFlightReader { AltosDevice device; AltosSerial serial; AltosLog log; + AltosRecord previous; LinkedBlockingQueue telem; @@ -33,7 +34,13 @@ class AltosTelemetryReader extends AltosFlightReader { AltosLine l = telem.take(); if (l.line == null) throw new IOException("IO error"); - return new AltosTelemetry(l.line); + AltosRecord next = AltosTelemetry.parse(l.line, previous); + previous = next; + return next; + } + + void flush() { + telem.clear(); } void close(boolean interrupted) { @@ -47,12 +54,18 @@ class AltosTelemetryReader extends AltosFlightReader { AltosPreferences.set_channel(device.getSerial(), channel); } + void set_telemetry(int telemetry) { + serial.set_telemetry(telemetry); + AltosPreferences.set_telemetry(device.getSerial(), telemetry); + } + public AltosTelemetryReader (AltosDevice in_device) throws FileNotFoundException, AltosSerialInUseException, IOException { device = in_device; serial = new AltosSerial(device); log = new AltosLog(serial); name = device.toShortString(); + previous = null; telem = new LinkedBlockingQueue(); serial.set_radio();