X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosTelemetryReader.java;h=405c555b35b460c27448ca73fae8bb23a12b6c20;hb=eb659fb0ee80c25312be36b3d8adb686813db125;hp=dfbad5fb21c7b431b85cdc9e91990afcf2ffb60e;hpb=5b976a6651f4eb05d30afc08b9e1f27c7e52ae00;p=fw%2Faltos diff --git a/altoslib/AltosTelemetryReader.java b/altoslib/AltosTelemetryReader.java index dfbad5fb..405c555b 100644 --- a/altoslib/AltosTelemetryReader.java +++ b/altoslib/AltosTelemetryReader.java @@ -34,7 +34,7 @@ public class AltosTelemetryReader extends AltosFlightReader { AltosLine l = telem.take(); if (l.line == null) throw new IOException("IO error"); - AltosTelemetry telem = AltosTelemetryLegacy.parse(l.line); + AltosTelemetry telem = AltosTelemetry.parse(l.line); if (state == null) state = new AltosState(); else @@ -54,7 +54,10 @@ public class AltosTelemetryReader extends AltosFlightReader { public void close(boolean interrupted) { link.remove_monitor(telem); log.close(); - link.close(); + try { + link.close(); + } catch (InterruptedException ie) { + } } public void set_frequency(double in_frequency) throws InterruptedException, TimeoutException { @@ -83,7 +86,7 @@ public class AltosTelemetryReader extends AltosFlightReader { else return false; } catch (InterruptedException ie) { - return true; + return false; } catch (TimeoutException te) { return true; } @@ -114,7 +117,7 @@ public class AltosTelemetryReader extends AltosFlightReader { return link.has_monitor_battery(); } - public double monitor_battery() { + public double monitor_battery() throws InterruptedException { return link.monitor_battery(); } @@ -130,12 +133,8 @@ public class AltosTelemetryReader extends AltosFlightReader { telemetry = AltosPreferences.telemetry(link.serial); set_telemetry(telemetry); link.add_monitor(telem); - } catch (TimeoutException e) { - close(true); - throw(e); - } catch (InterruptedException e) { + } finally { close(true); - throw(e); } } }