1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-23 19:21:59 +03:00

updated code to reflect upstream API changes

This commit is contained in:
Federico Fissore
2013-04-18 17:33:33 +02:00
parent 0c03dc8db9
commit 2f5d71fb59
3 changed files with 14 additions and 9 deletions

View File

@ -32,6 +32,7 @@ import javax.swing.UIManager;
import com.sun.jna.Library;
import com.sun.jna.Native;
import processing.app.debug.TargetBoard;
import processing.app.debug.TargetPackage;
import processing.app.debug.TargetPlatform;
import processing.app.helpers.PreferencesMap;
@ -147,14 +148,14 @@ public class Platform {
protected String resolveDeviceByVendorIdProductId(Map<String, TargetPackage> packages, String readVIDPID) {
for (TargetPackage targetPackage : packages.values()) {
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {
for (PreferencesMap board : targetPlatform.getBoards().values()) {
List<String> vids = new LinkedList<String>(board.createSubTree("vid").values());
for (TargetBoard board : targetPlatform.getBoards().values()) {
List<String> vids = new LinkedList<String>(board.getPreferences().subTree("vid").values());
if (!vids.isEmpty()) {
List<String> pids = new LinkedList<String>(board.createSubTree("pid").values());
List<String> pids = new LinkedList<String>(board.getPreferences().subTree("pid").values());
for (int i = 0; i< vids.size(); i++) {
String vidPid = vids.get(i) + "_" + pids.get(i);
if (vidPid.toUpperCase().equals(readVIDPID)) {
return board.get("name");
return board.getName();
}
}
}

View File

@ -7,8 +7,8 @@ public class UploaderFactory {
private static final Pattern IPV4_ADDRESS = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
public Uploader newUploader(Map<String, String> preferences, String port) {
if ("true".equals(preferences.get("upload.via_http")) && IPV4_ADDRESS.matcher(port).find()) {
public Uploader newUploader(TargetBoard board, String port) {
if ("true".equals(board.getPreferences().get("upload.via_http")) && IPV4_ADDRESS.matcher(port).find()) {
return new HttpUploader(port);
}