1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Now have uploading working with the Boards menu. Improved serial port error messages.

This commit is contained in:
David A. Mellis
2007-10-06 20:26:45 +00:00
parent 1f35dce6a8
commit c78c1efe18
15 changed files with 218 additions and 139 deletions

View File

@ -62,26 +62,31 @@ public abstract class Uploader implements MessageConsumer {
public abstract boolean burnBootloaderParallel(String target) throws RunnerException;
protected void flushSerialBuffer() {
protected void flushSerialBuffer() throws RunnerException {
// Cleanup the serial buffer
Serial serialPort = new Serial();
byte[] readBuffer;
while(serialPort.available() > 0) {
readBuffer = serialPort.readBytes();
try {
Serial serialPort = new Serial();
byte[] readBuffer;
while(serialPort.available() > 0) {
readBuffer = serialPort.readBytes();
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
}
serialPort.setDTR(false);
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
serialPort.setDTR(true);
serialPort.dispose();
} catch(Exception e) {
e.printStackTrace();
throw new RunnerException(e.getMessage());
}
serialPort.setDTR(false);
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
serialPort.setDTR(true);
serialPort.dispose();
}
protected boolean executeUploadCommand(Collection commandDownloader)