mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Merge branch 'ide-1.5.x' into dev-ide-1.5.x-discovery
Conflicts: app/src/cc/arduino/packages/uploaders/SerialUploader.java app/src/processing/app/Editor.java app/src/processing/app/Sketch.java app/src/processing/app/debug/Uploader.java
This commit is contained in:
@ -72,9 +72,9 @@ public abstract class Uploader implements MessageConsumer {
|
|||||||
this.notFoundError = false;
|
this.notFoundError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws RunnerException;
|
public abstract boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws Exception;
|
||||||
|
|
||||||
public abstract boolean burnBootloader() throws RunnerException;
|
public abstract boolean burnBootloader() throws Exception;
|
||||||
|
|
||||||
public boolean requiresAuthorization() {
|
public boolean requiresAuthorization() {
|
||||||
return false;
|
return false;
|
||||||
@ -84,11 +84,11 @@ public abstract class Uploader implements MessageConsumer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean executeUploadCommand(Collection<String> command) throws RunnerException {
|
protected boolean executeUploadCommand(Collection<String> command) throws Exception {
|
||||||
return executeUploadCommand(command.toArray(new String[command.size()]));
|
return executeUploadCommand(command.toArray(new String[command.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean executeUploadCommand(String command[]) throws RunnerException {
|
protected boolean executeUploadCommand(String command[]) throws Exception {
|
||||||
notFoundError = false;
|
notFoundError = false;
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import processing.app.*;
|
|||||||
import processing.app.debug.RunnerException;
|
import processing.app.debug.RunnerException;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
|
import processing.app.helpers.PreferencesMapException;
|
||||||
import processing.app.helpers.StringReplacer;
|
import processing.app.helpers.StringReplacer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -43,12 +44,12 @@ import static processing.app.I18n._;
|
|||||||
|
|
||||||
public class SerialUploader extends Uploader {
|
public class SerialUploader extends Uploader {
|
||||||
|
|
||||||
public boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws RunnerException {
|
public boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws Exception {
|
||||||
// FIXME: Preferences should be reorganized
|
// FIXME: Preferences should be reorganized
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
||||||
PreferencesMap prefs = Preferences.getMap();
|
PreferencesMap prefs = Preferences.getMap();
|
||||||
prefs.putAll(Base.getBoardPreferences());
|
prefs.putAll(Base.getBoardPreferences());
|
||||||
prefs.putAll(targetPlatform.getTool(prefs.get("upload.tool")));
|
prefs.putAll(targetPlatform.getTool(prefs.getOrExcept("upload.tool")));
|
||||||
|
|
||||||
// if no protocol is specified for this board, assume it lacks a
|
// if no protocol is specified for this board, assume it lacks a
|
||||||
// bootloader and upload using the selected programmer.
|
// bootloader and upload using the selected programmer.
|
||||||
@ -69,7 +70,7 @@ public class SerialUploader extends Uploader {
|
|||||||
boolean waitForUploadPort = (t != null) && t.equals("true");
|
boolean waitForUploadPort = (t != null) && t.equals("true");
|
||||||
|
|
||||||
if (doTouch) {
|
if (doTouch) {
|
||||||
String uploadPort = prefs.get("serial.port");
|
String uploadPort = prefs.getOrExcept("serial.port");
|
||||||
try {
|
try {
|
||||||
// Toggle 1200 bps on selected serial port to force board reset.
|
// Toggle 1200 bps on selected serial port to force board reset.
|
||||||
List<String> before = Serial.list();
|
List<String> before = Serial.list();
|
||||||
@ -105,9 +106,9 @@ public class SerialUploader extends Uploader {
|
|||||||
prefs.put("build.path", buildPath);
|
prefs.put("build.path", buildPath);
|
||||||
prefs.put("build.project_name", className);
|
prefs.put("build.project_name", className);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
prefs.put("upload.verbose", prefs.get("upload.params.verbose"));
|
prefs.put("upload.verbose", prefs.getOrExcept("upload.params.verbose"));
|
||||||
else
|
else
|
||||||
prefs.put("upload.verbose", prefs.get("upload.params.quiet"));
|
prefs.put("upload.verbose", prefs.getOrExcept("upload.params.quiet"));
|
||||||
|
|
||||||
boolean uploadResult;
|
boolean uploadResult;
|
||||||
try {
|
try {
|
||||||
@ -116,7 +117,7 @@ public class SerialUploader extends Uploader {
|
|||||||
// flushSerialBuffer();
|
// flushSerialBuffer();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
String pattern = prefs.get("upload.pattern");
|
String pattern = prefs.getOrExcept("upload.pattern");
|
||||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||||
uploadResult = executeUploadCommand(cmd);
|
uploadResult = executeUploadCommand(cmd);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -207,7 +208,7 @@ public class SerialUploader extends Uploader {
|
|||||||
throw new RunnerException(_("Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload."));
|
throw new RunnerException(_("Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload."));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean uploadUsingProgrammer(String buildPath, String className) throws RunnerException {
|
public boolean uploadUsingProgrammer(String buildPath, String className) throws Exception {
|
||||||
|
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
||||||
String programmer = Preferences.get("programmer");
|
String programmer = Preferences.get("programmer");
|
||||||
@ -220,15 +221,15 @@ public class SerialUploader extends Uploader {
|
|||||||
PreferencesMap prefs = Preferences.getMap();
|
PreferencesMap prefs = Preferences.getMap();
|
||||||
prefs.putAll(Base.getBoardPreferences());
|
prefs.putAll(Base.getBoardPreferences());
|
||||||
prefs.putAll(targetPlatform.getProgrammer(programmer));
|
prefs.putAll(targetPlatform.getProgrammer(programmer));
|
||||||
prefs.putAll(targetPlatform.getTool(prefs.get("program.tool")));
|
prefs.putAll(targetPlatform.getTool(prefs.getOrExcept("program.tool")));
|
||||||
|
|
||||||
prefs.put("build.path", buildPath);
|
prefs.put("build.path", buildPath);
|
||||||
prefs.put("build.project_name", className);
|
prefs.put("build.project_name", className);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
prefs.put("program.verbose", prefs.get("program.params.verbose"));
|
prefs.put("program.verbose", prefs.getOrExcept("program.params.verbose"));
|
||||||
else
|
else
|
||||||
prefs.put("program.verbose", prefs.get("program.params.quiet"));
|
prefs.put("program.verbose", prefs.getOrExcept("program.params.quiet"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// if (prefs.get("program.disable_flushing") == null
|
// if (prefs.get("program.disable_flushing") == null
|
||||||
@ -237,7 +238,7 @@ public class SerialUploader extends Uploader {
|
|||||||
// flushSerialBuffer();
|
// flushSerialBuffer();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
String pattern = prefs.get("program.pattern");
|
String pattern = prefs.getOrExcept("program.pattern");
|
||||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||||
return executeUploadCommand(cmd);
|
return executeUploadCommand(cmd);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -245,7 +246,7 @@ public class SerialUploader extends Uploader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean burnBootloader() throws RunnerException {
|
public boolean burnBootloader() throws Exception {
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
||||||
|
|
||||||
// Find preferences for the selected programmer
|
// Find preferences for the selected programmer
|
||||||
@ -267,7 +268,7 @@ public class SerialUploader extends Uploader {
|
|||||||
|
|
||||||
// Create configuration for bootloader tool
|
// Create configuration for bootloader tool
|
||||||
PreferencesMap toolPrefs = new PreferencesMap();
|
PreferencesMap toolPrefs = new PreferencesMap();
|
||||||
String tool = prefs.get("bootloader.tool");
|
String tool = prefs.getOrExcept("bootloader.tool");
|
||||||
if (tool.contains(":")) {
|
if (tool.contains(":")) {
|
||||||
String[] split = tool.split(":", 2);
|
String[] split = tool.split(":", 2);
|
||||||
TargetPlatform platform = Base.getCurrentTargetPlatformFromPackage(split[0]);
|
TargetPlatform platform = Base.getCurrentTargetPlatformFromPackage(split[0]);
|
||||||
@ -283,20 +284,20 @@ public class SerialUploader extends Uploader {
|
|||||||
// Merge tool with global configuration
|
// Merge tool with global configuration
|
||||||
prefs.putAll(toolPrefs);
|
prefs.putAll(toolPrefs);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
prefs.put("erase.verbose", prefs.get("erase.params.verbose"));
|
prefs.put("erase.verbose", prefs.getOrExcept("erase.params.verbose"));
|
||||||
prefs.put("bootloader.verbose", prefs.get("bootloader.params.verbose"));
|
prefs.put("bootloader.verbose", prefs.getOrExcept("bootloader.params.verbose"));
|
||||||
} else {
|
} else {
|
||||||
prefs.put("erase.verbose", prefs.get("erase.params.quiet"));
|
prefs.put("erase.verbose", prefs.getOrExcept("erase.params.quiet"));
|
||||||
prefs.put("bootloader.verbose", prefs.get("bootloader.params.quiet"));
|
prefs.put("bootloader.verbose", prefs.getOrExcept("bootloader.params.quiet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String pattern = prefs.get("erase.pattern");
|
String pattern = prefs.getOrExcept("erase.pattern");
|
||||||
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||||
if (!executeUploadCommand(cmd))
|
if (!executeUploadCommand(cmd))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pattern = prefs.get("bootloader.pattern");
|
pattern = prefs.getOrExcept("bootloader.pattern");
|
||||||
cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
|
||||||
return executeUploadCommand(cmd);
|
return executeUploadCommand(cmd);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1195,10 +1195,15 @@ public class Base {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Library lib = Library.create(subfolder);
|
try {
|
||||||
// (also replace previously found libs with the same name)
|
Library lib = Library.create(subfolder);
|
||||||
if (lib != null)
|
// (also replace previously found libs with the same name)
|
||||||
res.addOrReplace(lib);
|
if (lib != null)
|
||||||
|
res.addOrReplace(lib);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println(I18n.format(_("Invalid library found in {0}: {1}"),
|
||||||
|
subfolder, e.getMessage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import cc.arduino.packages.UploaderAndMonitorFactory;
|
|||||||
import com.jcraft.jsch.JSchException;
|
import com.jcraft.jsch.JSchException;
|
||||||
import processing.app.debug.*;
|
import processing.app.debug.*;
|
||||||
import processing.app.forms.PasswordAuthorizationDialog;
|
import processing.app.forms.PasswordAuthorizationDialog;
|
||||||
|
import processing.app.helpers.PreferencesMapException;
|
||||||
import processing.app.syntax.*;
|
import processing.app.syntax.*;
|
||||||
import processing.app.tools.*;
|
import processing.app.tools.*;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
@ -2403,6 +2404,10 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
if (serialMenu.getItemCount() == 0) statusError(e);
|
if (serialMenu.getItemCount() == 0) statusError(e);
|
||||||
else if (serialPrompt()) run();
|
else if (serialPrompt()) run();
|
||||||
else statusNotice(_("Upload canceled."));
|
else statusNotice(_("Upload canceled."));
|
||||||
|
} catch (PreferencesMapException e) {
|
||||||
|
statusError(I18n.format(
|
||||||
|
_("Error while uploading: missing '{0}' configuration parameter"),
|
||||||
|
e.getMessage()));
|
||||||
} catch (RunnerException e) {
|
} catch (RunnerException e) {
|
||||||
//statusError("Error during upload.");
|
//statusError("Error during upload.");
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
@ -2439,6 +2444,10 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
if (serialMenu.getItemCount() == 0) statusError(e);
|
if (serialMenu.getItemCount() == 0) statusError(e);
|
||||||
else if (serialPrompt()) run();
|
else if (serialPrompt()) run();
|
||||||
else statusNotice(_("Upload canceled."));
|
else statusNotice(_("Upload canceled."));
|
||||||
|
} catch (PreferencesMapException e) {
|
||||||
|
statusError(I18n.format(
|
||||||
|
_("Error while uploading: missing '{0}' configuration parameter"),
|
||||||
|
e.getMessage()));
|
||||||
} catch (RunnerException e) {
|
} catch (RunnerException e) {
|
||||||
//statusError("Error during upload.");
|
//statusError("Error during upload.");
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
@ -2541,9 +2550,10 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
statusError(_("Error while burning bootloader."));
|
statusError(_("Error while burning bootloader."));
|
||||||
// error message will already be visible
|
// error message will already be visible
|
||||||
}
|
}
|
||||||
} catch (RunnerException e) {
|
} catch (PreferencesMapException e) {
|
||||||
statusError(_("Error while burning bootloader."));
|
statusError(I18n.format(
|
||||||
e.printStackTrace();
|
_("Error while burning bootloader: missing '{0}' configuration parameter"),
|
||||||
|
e.getMessage()));
|
||||||
//statusError(e);
|
//statusError(e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusError(_("Error while burning bootloader."));
|
statusError(_("Error while burning bootloader."));
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
package processing.app;
|
package processing.app;
|
||||||
|
|
||||||
import cc.arduino.packages.UploaderAndMonitorFactory;
|
import cc.arduino.packages.UploaderAndMonitorFactory;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
|
||||||
|
|
||||||
import cc.arduino.packages.Uploader;
|
import cc.arduino.packages.Uploader;
|
||||||
import processing.app.debug.*;
|
import processing.app.debug.*;
|
||||||
@ -1583,7 +1582,7 @@ public class Sketch {
|
|||||||
* Handle export to applet.
|
* Handle export to applet.
|
||||||
*/
|
*/
|
||||||
public boolean exportApplet(String appletPath, boolean usingProgrammer)
|
public boolean exportApplet(String appletPath, boolean usingProgrammer)
|
||||||
throws RunnerException, IOException {
|
throws Exception {
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
|
|
||||||
@ -1661,7 +1660,7 @@ public class Sketch {
|
|||||||
System.out.println(_("Low memory available, stability problems may occur"));
|
System.out.println(_("Low memory available, stability problems may occur"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean upload(String buildPath, String suggestedClassName, boolean usingProgrammer) throws RunnerException {
|
protected boolean upload(String buildPath, String suggestedClassName, boolean usingProgrammer) throws Exception {
|
||||||
|
|
||||||
TargetPlatform target = Base.getTargetPlatform();
|
TargetPlatform target = Base.getTargetPlatform();
|
||||||
String board = Preferences.get("board");
|
String board = Preferences.get("board");
|
||||||
|
@ -245,6 +245,22 @@ public class PreferencesMap extends LinkedHashMap<String, String> {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value to which the specified key is mapped, or throws a
|
||||||
|
* PreferencesMapException if not found
|
||||||
|
*
|
||||||
|
* @param k
|
||||||
|
* the key whose associated value is to be returned
|
||||||
|
* @return the value to which the specified key is mapped
|
||||||
|
* @throws PreferencesMapException
|
||||||
|
*/
|
||||||
|
public String getOrExcept(String k) throws PreferencesMapException {
|
||||||
|
String r = get(k);
|
||||||
|
if (r == null)
|
||||||
|
throw new PreferencesMapException(k);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toString("");
|
return toString("");
|
||||||
|
10
app/src/processing/app/helpers/PreferencesMapException.java
Normal file
10
app/src/processing/app/helpers/PreferencesMapException.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package processing.app.helpers;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class PreferencesMapException extends Exception {
|
||||||
|
|
||||||
|
public PreferencesMapException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
Plays a pitch that changes based on a changing analog input
|
Plays a pitch that changes based on a changing analog input
|
||||||
|
|
||||||
circuit:
|
circuit:
|
||||||
* 8-ohm speaker on digital pin 8
|
* 8-ohm speaker on digital pin 9
|
||||||
* photoresistor on analog 0 to 5V
|
* photoresistor on analog 0 to 5V
|
||||||
* 4.7K resistor on analog 0 to ground
|
* 4.7K resistor on analog 0 to ground
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ ARDUINO 1.5.3 BETA
|
|||||||
* avr: Added support for Flash strings on String class (Jantje)
|
* avr: Added support for Flash strings on String class (Jantje)
|
||||||
* Added support for floating point numbers in String class (Tevin Zhang, SebiTimeWaster)
|
* Added support for floating point numbers in String class (Tevin Zhang, SebiTimeWaster)
|
||||||
* sam: Fixed String buffer overflows (Paul Stoffregen)
|
* sam: Fixed String buffer overflows (Paul Stoffregen)
|
||||||
|
* avr: Added recipe for assembly files (C. A. Church)
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
* sam: Added CAN library (still in early stage of development) (Palliser)
|
* sam: Added CAN library (still in early stage of development) (Palliser)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#######################################
|
#######################################
|
||||||
# Syntax Coloring Map for SoftwareSerial
|
# Syntax Coloring Map for SoftwareSerial
|
||||||
# (formely NewSoftSerial)
|
# (formerly NewSoftSerial)
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
@ -40,6 +40,9 @@ recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={b
|
|||||||
## Compile c++ files
|
## Compile c++ files
|
||||||
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||||
|
|
||||||
|
## Compile S files
|
||||||
|
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||||
|
|
||||||
## Create archives
|
## Create archives
|
||||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user