mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
If no upload protocol is specified for a board, use selected programmer instead.
Eliminates use of the upload.using preferences to specify a particular programmer. Select the programmer from the menu instead.
This commit is contained in:
parent
15d07fa036
commit
8523ab1ac7
@ -42,33 +42,28 @@ public class AvrdudeUploader extends Uploader {
|
||||
public AvrdudeUploader() {
|
||||
}
|
||||
|
||||
// XXX: add support for uploading sketches using a programmer
|
||||
public boolean uploadUsingPreferences(String buildPath, String className, boolean verbose)
|
||||
throws RunnerException, SerialException {
|
||||
this.verbose = verbose;
|
||||
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
||||
String uploadUsing = boardPreferences.get("upload.using");
|
||||
if (uploadUsing == null) {
|
||||
// fall back on global preference
|
||||
uploadUsing = Preferences.get("upload.using");
|
||||
}
|
||||
if (uploadUsing.equals("bootloader")) {
|
||||
return uploadViaBootloader(buildPath, className);
|
||||
} else {
|
||||
Target t;
|
||||
|
||||
if (uploadUsing.indexOf(':') == -1) {
|
||||
t = Base.getTarget(); // the current target (associated with the board)
|
||||
} else {
|
||||
String targetName = uploadUsing.substring(0, uploadUsing.indexOf(':'));
|
||||
t = Base.targetsTable.get(targetName);
|
||||
uploadUsing = uploadUsing.substring(uploadUsing.indexOf(':') + 1);
|
||||
// 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) {
|
||||
String programmer = Preferences.get("programmer");
|
||||
Target target = Base.getTarget();
|
||||
|
||||
if (programmer.indexOf(":") != -1) {
|
||||
target = Base.targetsTable.get(programmer.substring(0, programmer.indexOf(":")));
|
||||
programmer = programmer.substring(programmer.indexOf(":") + 1);
|
||||
}
|
||||
|
||||
Collection params = getProgrammerCommands(t, uploadUsing);
|
||||
|
||||
Collection params = getProgrammerCommands(target, programmer);
|
||||
params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i");
|
||||
return avrdude(params);
|
||||
}
|
||||
|
||||
return uploadViaBootloader(buildPath, className);
|
||||
}
|
||||
|
||||
private boolean uploadViaBootloader(String buildPath, String className)
|
||||
|
Loading…
x
Reference in New Issue
Block a user