X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosConfigTD.java;h=13eced99dea325a40b366911f8bb05115095783a;hp=397ed3db05b5e38a343353528e5a43dc8e784a85;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hpb=efb86669b5a74f244e2218f3385db633c36208af diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 397ed3db..13eced99 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,8 +22,8 @@ import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_5.*; -import org.altusmetrum.altosuilib_3.*; +import org.altusmetrum.altoslib_11.*; +import org.altusmetrum.altosuilib_11.*; public class AltosConfigTD implements ActionListener { @@ -183,14 +184,12 @@ public class AltosConfigTD implements ActionListener { } synchronized int telemetry_rate() { - System.out.printf("telemetry_rate: %d\n", telemetry_rate.get()); return telemetry_rate.get(); } synchronized void set_telemetry_rate(int new_telemetry_rate){ int rate = telemetry_rate.get(); - System.out.printf("set_telemetry_rate %d\n", new_telemetry_rate); if (rate >= 0) telemetry_rate.set(new_telemetry_rate); } @@ -225,8 +224,10 @@ public class AltosConfigTD implements ActionListener { if (!config_version.get().equals("0.0")) break; been_there = true; - config.serial_line.printf("C\n "); - config.serial_line.flush_input(); + if (config != null && config.serial_line != null) { + config.serial_line.printf("C\n "); + config.serial_line.flush_input(); + } } } catch (InterruptedException ie) { } @@ -279,8 +280,10 @@ public class AltosConfigTD implements ActionListener { } void abort() { - serial_line.close(); - serial_line = null; + if (serial_line != null) { + serial_line.close(); + serial_line = null; + } JOptionPane.showMessageDialog(owner, String.format("Connection to \"%s\" failed", device.toShortString()),