mirror of https://github.com/noisymime/Arduino.git
Now allowing uploads using a programmer by setting the upload.using preference ("bootloader" for default behavior, or the name of a programmer prefix from the programmers.txt file).
This commit is contained in:
parent
0b0d07661e
commit
bd56d4ff28
|
@ -38,6 +38,17 @@ public class AvrdudeUploader extends Uploader {
|
||||||
|
|
||||||
// XXX: add support for uploading sketches using a programmer
|
// XXX: add support for uploading sketches using a programmer
|
||||||
public boolean uploadUsingPreferences(String buildPath, String className)
|
public boolean uploadUsingPreferences(String buildPath, String className)
|
||||||
|
throws RunnerException {
|
||||||
|
if (Preferences.get("upload.using").equals("bootloader")) {
|
||||||
|
return uploadViaBootloader(buildPath, className);
|
||||||
|
} else {
|
||||||
|
Collection params = getProgrammerCommands(Preferences.get("upload.using"));
|
||||||
|
params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i");
|
||||||
|
return avrdude(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean uploadViaBootloader(String buildPath, String className)
|
||||||
throws RunnerException {
|
throws RunnerException {
|
||||||
List commandDownloader = new ArrayList();
|
List commandDownloader = new ArrayList();
|
||||||
String protocol = Preferences.get("boards." + Preferences.get("board") + ".upload.protocol");
|
String protocol = Preferences.get("boards." + Preferences.get("board") + ".upload.protocol");
|
||||||
|
@ -58,6 +69,10 @@ public class AvrdudeUploader extends Uploader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean burnBootloader(String programmer) throws RunnerException {
|
public boolean burnBootloader(String programmer) throws RunnerException {
|
||||||
|
return burnBootloader(getProgrammerCommands(programmer));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Collection getProgrammerCommands(String programmer) {
|
||||||
List params = new ArrayList();
|
List params = new ArrayList();
|
||||||
params.add("-c" + Preferences.get("programmers." + programmer + ".protocol"));
|
params.add("-c" + Preferences.get("programmers." + programmer + ".protocol"));
|
||||||
|
|
||||||
|
@ -73,7 +88,7 @@ public class AvrdudeUploader extends Uploader {
|
||||||
if (Preferences.get("programmers." + programmer + ".delay") != null)
|
if (Preferences.get("programmers." + programmer + ".delay") != null)
|
||||||
params.add("-i" + Preferences.get("programmers." + programmer + ".delay"));
|
params.add("-i" + Preferences.get("programmers." + programmer + ".delay"));
|
||||||
|
|
||||||
return burnBootloader(params);
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean burnBootloader(Collection params)
|
protected boolean burnBootloader(Collection params)
|
||||||
|
|
|
@ -747,7 +747,7 @@ public class Editor extends JFrame
|
||||||
});
|
});
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
|
|
||||||
item = new JMenuItem("Copy for Discourse");
|
item = new JMenuItem("Copy for Forum");
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
|
@ -269,8 +269,7 @@ linestatus.height = 20
|
||||||
|
|
||||||
# set the upload defaults
|
# set the upload defaults
|
||||||
upload.verbose=false
|
upload.verbose=false
|
||||||
upload.erase=false
|
upload.using=bootloader
|
||||||
upload.verify=false
|
|
||||||
|
|
||||||
# set the parallel port defaults (used if upload.programmer=dapa)
|
# set the parallel port defaults (used if upload.programmer=dapa)
|
||||||
parallel.port=0x378
|
parallel.port=0x378
|
||||||
|
|
Loading…
Reference in New Issue