diff options
| author | Anthony Towns <aj@erisian.com.au> | 2010-11-25 08:47:36 +1000 |
|---|---|---|
| committer | Anthony Towns <aj@erisian.com.au> | 2010-11-25 08:47:36 +1000 |
| commit | 7811e6dfa6caf10251da7df7c24b98cdc3787892 (patch) | |
| tree | 43e9447faf4d5a7e73f71ae4f516f8e830f86758 /ao-tools/altosui/AltosIgnite.java | |
| parent | 71b1949e50f4533bcf44537da65b19bc67863c8e (diff) | |
| parent | 7a50837ea0d92db3f469f197ec8210aee22aa143 (diff) | |
Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
Diffstat (limited to 'ao-tools/altosui/AltosIgnite.java')
| -rw-r--r-- | ao-tools/altosui/AltosIgnite.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ao-tools/altosui/AltosIgnite.java b/ao-tools/altosui/AltosIgnite.java index 8e92ec1b..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,15 +35,18 @@ public class AltosIgnite { final static int Open = 3; private void start_serial() throws InterruptedException { + serial_started = true; if (remote) { - serial.set_channel(AltosPreferences.channel(device.getSerial())); - serial.set_callsign(AltosPreferences.callsign()); - serial.printf("~\np\n"); + serial.set_radio(); + serial.printf("p\nE 0\n"); serial.flush_input(); } } private void stop_serial() throws InterruptedException { + if (!serial_started) + return; + serial_started = false; if (serial == null) return; if (remote) { @@ -100,7 +104,7 @@ public class AltosIgnite { start_serial(); serial.printf("t\n"); for (;;) { - String line = serial.get_reply(1000); + String line = serial.get_reply(5000); if (line == null) throw new TimeoutException(); if (get_string(line, "Igniter: drogue Status: ", status_name)) @@ -149,6 +153,10 @@ public class AltosIgnite { } public void close() { + try { + stop_serial(); + } catch (InterruptedException ie) { + } serial.close(); serial = null; } |
