X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosConfig.java;h=1c42870f8d7ff61519a2df97b9eb88404cfab6cd;hp=b1acd41072e35d138f00c2d47b027ec263165117;hb=7a50837ea0d92db3f469f197ec8210aee22aa143;hpb=7d90e2f6009e060fb59c519f7e564483a7ca6872 diff --git a/ao-tools/altosui/AltosConfig.java b/ao-tools/altosui/AltosConfig.java index b1acd410..1c42870f 100644 --- a/ao-tools/altosui/AltosConfig.java +++ b/ao-tools/altosui/AltosConfig.java @@ -74,7 +74,7 @@ public class AltosConfig implements Runnable, ActionListener { string_ref product; string_ref callsign; AltosConfigUI config_ui; - + boolean serial_started; boolean get_int(String line, String label, int_ref x) { if (line.startsWith(label)) { @@ -108,6 +108,7 @@ public class AltosConfig implements Runnable, ActionListener { } void start_serial() throws InterruptedException { + serial_started = true; if (remote) { serial_line.set_radio(); serial_line.printf("p\nE 0\n"); @@ -116,6 +117,9 @@ public class AltosConfig implements Runnable, ActionListener { } void stop_serial() throws InterruptedException { + if (!serial_started) + return; + serial_started = false; if (remote) { serial_line.printf("~"); serial_line.flush_output(); @@ -160,6 +164,10 @@ public class AltosConfig implements Runnable, ActionListener { device.toShortString()), "Connection Failed", JOptionPane.ERROR_MESSAGE); + try { + stop_serial(); + } catch (InterruptedException ie) { + } serial_line.close(); serial_line = null; }