diff options
| author | Keith Packard <keithp@keithp.com> | 2010-11-24 10:55:18 -0800 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2010-11-24 10:55:18 -0800 |
| commit | 7a50837ea0d92db3f469f197ec8210aee22aa143 (patch) | |
| tree | 8f96a8198ebacdcc7beea586863632b6c9b488c5 /ao-tools/altosui/AltosIgnite.java | |
| parent | 7d90e2f6009e060fb59c519f7e564483a7ca6872 (diff) | |
altosui: Make sure packet mode is turned off when the connection fails
When the packet connection times out, turn packet mode off when
closing the serial port.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosIgnite.java')
| -rw-r--r-- | ao-tools/altosui/AltosIgnite.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ao-tools/altosui/AltosIgnite.java b/ao-tools/altosui/AltosIgnite.java index 75c0a17a..3cbd8a75 100644 --- a/ao-tools/altosui/AltosIgnite.java +++ b/ao-tools/altosui/AltosIgnite.java @@ -24,6 +24,7 @@ public class AltosIgnite { AltosDevice device; AltosSerial serial; boolean remote; + boolean serial_started; final static int None = 0; final static int Apogee = 1; final static int Main = 2; @@ -34,6 +35,7 @@ public class AltosIgnite { 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"); @@ -42,6 +44,9 @@ public class AltosIgnite { } private void stop_serial() throws InterruptedException { + if (!serial_started) + return; + serial_started = false; if (serial == null) return; if (remote) { @@ -148,6 +153,10 @@ public class AltosIgnite { } public void close() { + try { + stop_serial(); + } catch (InterruptedException ie) { + } serial.close(); serial = null; } |
