X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroDownload.java;fp=micropeak%2FMicroDownload.java;h=33c5587b9c2217c45657fae4bc924efaaab93159;hp=be5a8568c0b23947d6aa6f4f28c80a6d160482ac;hb=38db8202a4d6ab90305768410f1a37106cc95794;hpb=0743e7213729df629aea90b3a5dc904fe397b5cb diff --git a/micropeak/MicroDownload.java b/micropeak/MicroDownload.java index be5a8568..33c5587b 100644 --- a/micropeak/MicroDownload.java +++ b/micropeak/MicroDownload.java @@ -158,6 +158,7 @@ public class MicroDownload extends AltosUIDialog implements Runnable, ActionList } catch (MicroData.NonHexcharException nhe) { } } + write_thread.join(); } catch (FileNotFoundException fe) { } catch (IOException ioe) { } catch (InterruptedException ie) { @@ -168,6 +169,25 @@ public class MicroDownload extends AltosUIDialog implements Runnable, ActionList } Thread serial_thread; + Thread write_thread; + + public class SerialWriter implements Runnable { + MicroSerial serial; + + public void run () { + try { + Thread.sleep(100); + serial.write('l'); + serial.write('\n'); + serial.flush(); + } catch (InterruptedException ie) { + } + } + + public SerialWriter(MicroSerial serial) { + this.serial = serial; + } + } public void start() { try { @@ -178,6 +198,10 @@ public class MicroDownload extends AltosUIDialog implements Runnable, ActionList } serial_thread = new Thread(this); serial_thread.start(); + + SerialWriter writer = new SerialWriter(serial); + write_thread = new Thread(writer); + write_thread.start(); } public void actionPerformed(ActionEvent ae) {