From f1146d80a5443399a9c9693e5e181126edbe3321 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Mon, 20 Dec 2010 14:50:18 -0500 Subject: [PATCH] Adding upload using programmer options (instead of verbose). --- app/src/processing/app/Editor.java | 23 +++++++++++-------- app/src/processing/app/EditorToolbar.java | 4 ++-- app/src/processing/app/Sketch.java | 12 +++++----- .../processing/app/debug/AvrdudeUploader.java | 4 ++-- app/src/processing/app/debug/Uploader.java | 2 +- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index cd45ce3d2..7e2d3e378 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -538,7 +538,7 @@ public class Editor extends JFrame implements RunnerListener { }); fileMenu.add(saveAsMenuItem); - item = newJMenuItem("Upload to I/O Board", 'U'); + item = newJMenuItem("Upload", 'U'); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleExport(false); @@ -546,13 +546,13 @@ public class Editor extends JFrame implements RunnerListener { }); fileMenu.add(item); -// item = newJMenuItemShift("Upload to I/O Board (verbose)", 'U'); -// item.addActionListener(new ActionListener() { -// public void actionPerformed(ActionEvent e) { -// handleExport(true); -// } -// }); -// fileMenu.add(item); + item = newJMenuItemShift("Upload Using Programmer", 'U'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleExport(true); + } + }); + fileMenu.add(item); fileMenu.addSeparator(); @@ -2331,13 +2331,13 @@ public class Editor extends JFrame implements RunnerListener { * Made synchronized to (hopefully) avoid problems of people * hitting export twice, quickly, and horking things up. */ - synchronized public void handleExport(final boolean verbose) { + synchronized public void handleExport(final boolean usingProgrammer) { //if (!handleExportCheckModified()) return; toolbar.activate(EditorToolbar.EXPORT); console.clear(); statusNotice("Uploading to I/O Board..."); - new Thread(verbose ? exportAppHandler : exportHandler).start(); + new Thread(usingProgrammer ? exportAppHandler : exportHandler).start(); } // DAM: in Arduino, this is upload @@ -2388,6 +2388,9 @@ public class Editor extends JFrame implements RunnerListener { } else { // error message will already be visible } + } catch (SerialNotFoundException e) { + if (serialPrompt()) run(); + else statusNotice("Upload canceled."); } catch (RunnerException e) { //statusError("Error during upload."); //e.printStackTrace(); diff --git a/app/src/processing/app/EditorToolbar.java b/app/src/processing/app/EditorToolbar.java index f86fb17c5..9d7a5fc13 100644 --- a/app/src/processing/app/EditorToolbar.java +++ b/app/src/processing/app/EditorToolbar.java @@ -42,7 +42,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key /** Titles for each button when the shift key is pressed. */ static final String titleShift[] = { - "Verify (w/ Verbose Output)", "Upload (w/ Verbose Output)", "New Editor Window", "Open in Another Window", "Save", "Serial Monitor" + "Verify", "Upload Using Programmer", "New Editor Window", "Open in Another Window", "Save", "Serial Monitor" }; static final int BUTTON_COUNT = title.length; @@ -310,7 +310,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key switch (sel) { case RUN: - editor.handleRun(e.isShiftDown()); + editor.handleRun(false); break; // case STOP: diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index b09055779..22e2aa591 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -1520,15 +1520,15 @@ public class Sketch { } - protected boolean exportApplet(boolean verbose) throws Exception { - return exportApplet(tempBuildFolder.getAbsolutePath(), verbose); + protected boolean exportApplet(boolean usingProgrammer) throws Exception { + return exportApplet(tempBuildFolder.getAbsolutePath(), usingProgrammer); } /** * Handle export to applet. */ - public boolean exportApplet(String appletPath, boolean verbose) + public boolean exportApplet(String appletPath, boolean usingProgrammer) throws RunnerException, IOException, SerialException { // Make sure the user didn't hide the sketch folder @@ -1565,7 +1565,7 @@ public class Sketch { // return false; // } - upload(appletFolder.getPath(), foundName, verbose); + upload(appletFolder.getPath(), foundName, usingProgrammer); return true; } @@ -1592,7 +1592,7 @@ public class Sketch { } - protected String upload(String buildPath, String suggestedClassName, boolean verbose) + protected String upload(String buildPath, String suggestedClassName, boolean usingProgrammer) throws RunnerException, SerialException { Uploader uploader; @@ -1602,7 +1602,7 @@ public class Sketch { uploader = new AvrdudeUploader(); boolean success = uploader.uploadUsingPreferences(buildPath, suggestedClassName, - verbose); + usingProgrammer); return success ? suggestedClassName : null; } diff --git a/app/src/processing/app/debug/AvrdudeUploader.java b/app/src/processing/app/debug/AvrdudeUploader.java index 7273346ed..a30f56614 100755 --- a/app/src/processing/app/debug/AvrdudeUploader.java +++ b/app/src/processing/app/debug/AvrdudeUploader.java @@ -42,14 +42,14 @@ public class AvrdudeUploader extends Uploader { public AvrdudeUploader() { } - public boolean uploadUsingPreferences(String buildPath, String className, boolean verbose) + public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer) throws RunnerException, SerialException { this.verbose = verbose; Map boardPreferences = Base.getBoardPreferences(); // if no protocol is specified for this board, assume it lacks a // bootloader and upload using the selected programmer. - if (boardPreferences.get("upload.protocol") == null) { + if (usingProgrammer || boardPreferences.get("upload.protocol") == null) { String programmer = Preferences.get("programmer"); Target target = Base.getTarget(); diff --git a/app/src/processing/app/debug/Uploader.java b/app/src/processing/app/debug/Uploader.java index b79509179..03d8f2f30 100755 --- a/app/src/processing/app/debug/Uploader.java +++ b/app/src/processing/app/debug/Uploader.java @@ -64,7 +64,7 @@ public abstract class Uploader implements MessageConsumer { public Uploader() { } - public abstract boolean uploadUsingPreferences(String buildPath, String className, boolean verbose) + public abstract boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer) throws RunnerException, SerialException; public abstract boolean burnBootloader() throws RunnerException;