diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-01 15:30:11 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-01-01 15:30:11 -0800 |
commit | d83587c3c66b730cc54ca153714eee520ee40b2c (patch) | |
tree | f3f77de67c0e918a8681f39a793235be0a66fc50 /micropeak/MicroSerial.java | |
parent | 65b512c890a3ccf487655b79305ab1cfcf49259c (diff) |
micropeak is code complete now.
Added save and download functionality. Removed 'new' from file menu.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroSerial.java')
-rw-r--r-- | micropeak/MicroSerial.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/micropeak/MicroSerial.java b/micropeak/MicroSerial.java index a1a77a1d..15ef8582 100644 --- a/micropeak/MicroSerial.java +++ b/micropeak/MicroSerial.java @@ -27,6 +27,10 @@ public class MicroSerial extends InputStream { public int read() { int c = libaltos.altos_getchar(file, 0); + if (Thread.interrupted()) + return -1; + if (c == -1) + return -1; if (AltosUIPreferences.serial_debug) System.out.printf("%c", c); return c; @@ -39,12 +43,12 @@ public class MicroSerial extends InputStream { } } - public MicroSerial(MicroUSB usb) throws FileNotFoundException { - file = usb.open(); + public MicroSerial(AltosDevice device) throws FileNotFoundException { + file = device.open(); if (file == null) { - final String message = usb.getErrorString(); + final String message = device.getErrorString(); throw new FileNotFoundException(String.format("%s (%s)", - usb.toShortString(), + device.toShortString(), message)); } } |