From ed15dc3b5a3a3655525a161c885631d74396d1b5 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sat, 20 Oct 2012 17:21:46 +0200 Subject: [PATCH 1/3] Remove 1200 automagic baud rate every time the IDE use the serial port touch --- .../processing/app/debug/BasicUploader.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/src/processing/app/debug/BasicUploader.java b/app/src/processing/app/debug/BasicUploader.java index e92ae60c2..f88a38104 100644 --- a/app/src/processing/app/debug/BasicUploader.java +++ b/app/src/processing/app/debug/BasicUploader.java @@ -126,24 +126,28 @@ public class BasicUploader extends Uploader { throw new RunnerException(e); } - // For Leonardo wait until the bootloader serial port disconnects and the - // sketch serial port reconnects (or timeout after a few seconds if the - // sketch port never comes back). Doing this saves users from accidentally - // opening Serial Monitor on the soon-to-be-orphaned bootloader port. + // Remove the magic baud rate (1200bps) to avoid + // future unwanted board resets try { - if (uploadResult && waitForUploadPort) { - Thread.sleep(500); - long timeout = System.currentTimeMillis() + 2000; - while (timeout > System.currentTimeMillis()) { - List portList = Serial.list(); - String uploadPort = Preferences.get("serial.port"); - if (portList.contains(Preferences.get("serial.port"))) { - // Remove the magic baud rate (1200bps) to avoid - // future unwanted board resets - Serial.touchPort(uploadPort, 9600); - break; + if (uploadResult && doTouch) { + String uploadPort = Preferences.get("serial.port"); + if (waitForUploadPort) { + // For Due/Leonardo wait until the bootloader serial port disconnects and the + // sketch serial port reconnects (or timeout after a few seconds if the + // sketch port never comes back). Doing this saves users from accidentally + // opening Serial Monitor on the soon-to-be-orphaned bootloader port. + Thread.sleep(500); + long timeout = System.currentTimeMillis() + 2000; + while (timeout > System.currentTimeMillis()) { + List portList = Serial.list(); + if (portList.contains(uploadPort)) { + Serial.touchPort(uploadPort, 9600); + break; + } + Thread.sleep(100); } - Thread.sleep(100); + } else { + Serial.touchPort(uploadPort, 9600); } } } catch (InterruptedException ex) { From 61389303bbe732113d62a9aab576da0c24770ae5 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sun, 21 Oct 2012 22:14:01 +0200 Subject: [PATCH 2/3] Serial port can take a while to close (especially on latest MacOSX) take this fact in account. --- app/src/processing/app/SerialMonitor.java | 3 +++ app/src/processing/app/debug/BasicUploader.java | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/processing/app/SerialMonitor.java b/app/src/processing/app/SerialMonitor.java index 1f34e8f7e..58adff44e 100644 --- a/app/src/processing/app/SerialMonitor.java +++ b/app/src/processing/app/SerialMonitor.java @@ -139,9 +139,12 @@ public class SerialMonitor extends JFrame implements MessageConsumer { Preferences.set("serial.debug_rate", rateString); closeSerialPort(); try { + Thread.sleep(100); // Wait for serial port to properly close openSerialPort(); } catch (SerialException e) { System.err.println(e); + } catch (InterruptedException e) { + e.printStackTrace(); } }}); diff --git a/app/src/processing/app/debug/BasicUploader.java b/app/src/processing/app/debug/BasicUploader.java index f88a38104..4328cc1a6 100644 --- a/app/src/processing/app/debug/BasicUploader.java +++ b/app/src/processing/app/debug/BasicUploader.java @@ -141,10 +141,14 @@ public class BasicUploader extends Uploader { while (timeout > System.currentTimeMillis()) { List portList = Serial.list(); if (portList.contains(uploadPort)) { - Serial.touchPort(uploadPort, 9600); - break; + try { + Serial.touchPort(uploadPort, 9600); + break; + } catch (SerialException e) { + // Port already in use + } } - Thread.sleep(100); + Thread.sleep(250); } } else { Serial.touchPort(uploadPort, 9600); From ab63860778e386bd566decf289e3361abd58b9d6 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sun, 21 Oct 2012 22:36:22 +0200 Subject: [PATCH 3/3] Set arudino version to 150 (1.5.0-beta) --- app/src/processing/app/Base.java | 4 ++-- todo.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 19429e2c7..042bf0cbe 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -49,9 +49,9 @@ import static processing.app.I18n._; * files and images, etc) that comes from that. */ public class Base { - public static final int REVISION = 101; + public static final int REVISION = 150; /** This might be replaced by main() if there's a lib/version.txt file. */ - static String VERSION_NAME = "0101"; + static String VERSION_NAME = "0150"; /** Set true if this a proper release rather than a numbered revision. */ static public boolean RELEASE = false; diff --git a/todo.txt b/todo.txt index 3a248a7ea..b757486d5 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,4 @@ -0101 arduino +0150 arduino Fix Linux make.sh, etc. scripts Test on Linux.