mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
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
|
||||
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 {
|
||||
List commandDownloader = new ArrayList();
|
||||
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 {
|
||||
return burnBootloader(getProgrammerCommands(programmer));
|
||||
}
|
||||
|
||||
private Collection getProgrammerCommands(String programmer) {
|
||||
List params = new ArrayList();
|
||||
params.add("-c" + Preferences.get("programmers." + programmer + ".protocol"));
|
||||
|
||||
@ -73,7 +88,7 @@ public class AvrdudeUploader extends Uploader {
|
||||
if (Preferences.get("programmers." + programmer + ".delay") != null)
|
||||
params.add("-i" + Preferences.get("programmers." + programmer + ".delay"));
|
||||
|
||||
return burnBootloader(params);
|
||||
return params;
|
||||
}
|
||||
|
||||
protected boolean burnBootloader(Collection params)
|
||||
|
@ -747,7 +747,7 @@ public class Editor extends JFrame
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Copy for Discourse");
|
||||
item = new JMenuItem("Copy for Forum");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
@ -269,8 +269,7 @@ linestatus.height = 20
|
||||
|
||||
# set the upload defaults
|
||||
upload.verbose=false
|
||||
upload.erase=false
|
||||
upload.verify=false
|
||||
upload.using=bootloader
|
||||
|
||||
# set the parallel port defaults (used if upload.programmer=dapa)
|
||||
parallel.port=0x378
|
||||
|
Loading…
x
Reference in New Issue
Block a user