diff options
author | Keith Packard <keithp@keithp.com> | 2014-02-03 00:24:38 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-02-03 00:32:47 -0800 |
commit | 9e0bda088c097ac6bcc677d7b6d00683e73a68fb (patch) | |
tree | 1d16346394ee4c26b3e468afeffd3a49c8543dbd /micropeak/MicroSerial.java | |
parent | 0c2f28cbc1cb312d3bcc8951176d79f234a1af04 (diff) |
micropeak: Watch serial data during download
This adds a text area to monitor the incoming serial data in case some
problem occurs.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroSerial.java')
-rw-r--r-- | micropeak/MicroSerial.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/micropeak/MicroSerial.java b/micropeak/MicroSerial.java index 376223f1..39f421ec 100644 --- a/micropeak/MicroSerial.java +++ b/micropeak/MicroSerial.java @@ -24,6 +24,7 @@ import org.altusmetrum.altosuilib_1.*; public class MicroSerial extends InputStream { SWIGTYPE_p_altos_file file; + private MicroSerialLog log; public int read() { int c = libaltos.altos_getchar(file, 0); @@ -33,6 +34,8 @@ public class MicroSerial extends InputStream { return -1; if (AltosUIPreferences.serial_debug) System.out.printf("%c", c); + if (log != null) + log.log_char(c); return c; } @@ -43,8 +46,13 @@ public class MicroSerial extends InputStream { } } + public void set_log(MicroSerialLog log) { + this.log = log; + } + public MicroSerial(AltosDevice device) throws FileNotFoundException { file = device.open(); + log = null; if (file == null) { final String message = device.getErrorString(); throw new FileNotFoundException(String.format("%s (%s)", |