summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosFlash.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-13 16:07:04 -0800
committerKeith Packard <keithp@keithp.com>2010-11-13 16:07:04 -0800
commitdcfa56498d1b65a213b8aba9cbd6c4806532383c (patch)
tree196742b9dea168b18f6fbadaa54573a15fefd2b3 /ao-tools/altosui/AltosFlash.java
parent8463ffcaca6bcd31e645aba71c171f548dce96d8 (diff)
altosui: Open serial device at 'new' time. Prohibit duplicate opens.
With the per-serial UI, there's never a reason to create a serial device without opening it right away. This eliminates the bug caused by not opening the serial device for telemetry reception. Serial devices can now be opened only once; this eliminates errors when trying to reflash or configure devices while receiving telemetry. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosFlash.java')
-rw-r--r--ao-tools/altosui/AltosFlash.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/ao-tools/altosui/AltosFlash.java b/ao-tools/altosui/AltosFlash.java
index 25b4a06e..fa2465d3 100644
--- a/ao-tools/altosui/AltosFlash.java
+++ b/ao-tools/altosui/AltosFlash.java
@@ -329,17 +329,14 @@ public class AltosFlash {
return rom_config;
}
- public void open() throws IOException, FileNotFoundException, InterruptedException {
+ public AltosFlash(File in_file, AltosDevice in_debug_dongle)
+ throws IOException, FileNotFoundException, AltosSerialInUseException, InterruptedException {
+ file = in_file;
+ debug_dongle = in_debug_dongle;
+ debug = new AltosDebug(in_debug_dongle);
input = new FileInputStream(file);
image = new AltosHexfile(input);
- debug.open(debug_dongle);
if (!debug.check_connection())
throw new IOException("Debug port not connected");
}
-
- public AltosFlash(File in_file, AltosDevice in_debug_dongle) {
- file = in_file;
- debug_dongle = in_debug_dongle;
- debug = new AltosDebug();
- }
} \ No newline at end of file