When the packet connection times out, turn packet mode off when
closing the serial port.
Signed-off-by: Keith Packard <keithp@keithp.com>
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)) {
}
void start_serial() throws InterruptedException {
+ serial_started = true;
if (remote) {
serial_line.set_radio();
serial_line.printf("p\nE 0\n");
}
void stop_serial() throws InterruptedException {
+ if (!serial_started)
+ return;
+ serial_started = false;
if (remote) {
serial_line.printf("~");
serial_line.flush_output();
device.toShortString()),
"Connection Failed",
JOptionPane.ERROR_MESSAGE);
+ try {
+ stop_serial();
+ } catch (InterruptedException ie) {
+ }
serial_line.close();
serial_line = null;
}
AltosDevice device;
AltosSerial serial;
boolean remote;
+ boolean serial_started;
final static int None = 0;
final static int Apogee = 1;
final static int Main = 2;
final static int Open = 3;
private void start_serial() throws InterruptedException {
+ serial_started = true;
if (remote) {
serial.set_radio();
serial.printf("p\nE 0\n");
}
private void stop_serial() throws InterruptedException {
+ if (!serial_started)
+ return;
+ serial_started = false;
if (serial == null)
return;
if (remote) {
}
public void close() {
+ try {
+ stop_serial();
+ } catch (InterruptedException ie) {
+ }
serial.close();
serial = null;
}