1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Adding upload using programmer options (instead of verbose).

This commit is contained in:
David A. Mellis 2010-12-20 14:50:18 -05:00
parent 8523ab1ac7
commit f1146d80a5
5 changed files with 24 additions and 21 deletions

View File

@ -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();

View File

@ -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:

View File

@ -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;
}

View File

@ -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<String, String> 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();

View File

@ -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;