mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Merge remote-tracking branch 'dog/ide-1.5.x-discovery' into ide-1.5.x-discovery
Conflicts: app/src/processing/app/Base.java app/src/processing/app/Editor.java
This commit is contained in:
commit
b4852f353c
@ -7,6 +7,7 @@ public class BoardPort {
|
||||
private String address;
|
||||
private String protocol;
|
||||
private String boardName;
|
||||
private String label;
|
||||
private PreferencesMap prefs;
|
||||
|
||||
public String getAddress() {
|
||||
@ -41,4 +42,12 @@ public class BoardPort {
|
||||
return prefs;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import javax.jmdns.ServiceInfo;
|
||||
import javax.jmdns.ServiceListener;
|
||||
import javax.jmdns.impl.DNSTaskStarter;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
import processing.app.zeroconf.jmdns.ArduinoDNSTaskStarter;
|
||||
import cc.arduino.packages.BoardPort;
|
||||
@ -76,14 +77,28 @@ public class NetworkDiscovery implements Discovery, ServiceListener {
|
||||
|
||||
@Override
|
||||
public void serviceResolved(ServiceEvent serviceEvent) {
|
||||
ServiceInfo info = serviceEvent.getInfo();
|
||||
String address = serviceEvent.getInfo().getInet4Addresses()[0]
|
||||
.getHostAddress();
|
||||
String name = serviceEvent.getName();
|
||||
|
||||
PreferencesMap prefs = null;
|
||||
if (info.hasData()) {
|
||||
prefs = new PreferencesMap();
|
||||
prefs.put("id", info.getPropertyString("board"));
|
||||
prefs.put("distro_version", info.getPropertyString("distro_version"));
|
||||
}
|
||||
String boardName = Base.getPlatform()
|
||||
.resolveDeviceByBoardID(Base.packages, prefs.get("id"));
|
||||
|
||||
String label = name + " at " + address + " (" + boardName + ")";
|
||||
|
||||
BoardPort port = new BoardPort();
|
||||
port.setAddress(address);
|
||||
port.setBoardName(name);
|
||||
port.setProtocol("network");
|
||||
port.setPrefs(prefs);
|
||||
port.setLabel(label);
|
||||
ports.add(port);
|
||||
}
|
||||
|
||||
|
@ -31,10 +31,15 @@ public class SerialDiscovery implements Discovery {
|
||||
String address = commPort.getName();
|
||||
String boardName = os.resolveDeviceAttachedTo(address, Base.packages,
|
||||
devicesListOutput);
|
||||
String label = address;
|
||||
if (boardName != null)
|
||||
label += " (" + boardName + ")";
|
||||
|
||||
BoardPort port = new BoardPort();
|
||||
port.setAddress(address);
|
||||
port.setProtocol("serial");
|
||||
port.setBoardName(boardName);
|
||||
port.setLabel(label);
|
||||
res.add(port);
|
||||
}
|
||||
return res;
|
||||
|
@ -24,7 +24,6 @@ public abstract class AbstractMonitor extends JFrame implements MessageConsumer
|
||||
protected JCheckBox autoscrollBox;
|
||||
protected JComboBox lineEndings;
|
||||
protected JComboBox serialRates;
|
||||
protected int serialRate;
|
||||
|
||||
public AbstractMonitor(String title) {
|
||||
super(title);
|
||||
@ -110,8 +109,6 @@ public abstract class AbstractMonitor extends JFrame implements MessageConsumer
|
||||
for (int i = 0; i < serialRateStrings.length; i++)
|
||||
serialRates.addItem(serialRateStrings[i] + " " + _("baud"));
|
||||
|
||||
serialRate = Preferences.getInteger("serial.debug_rate");
|
||||
serialRates.setSelectedItem(serialRate + " " + _("baud"));
|
||||
serialRates.setMaximumSize(serialRates.getMinimumSize());
|
||||
|
||||
pane.add(autoscrollBox);
|
||||
|
@ -990,10 +990,8 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
for (BoardPort port : ports) {
|
||||
String address = port.getAddress();
|
||||
String name = port.getBoardName();
|
||||
String label = port.getLabel();
|
||||
|
||||
String label = address;
|
||||
if (name != null)
|
||||
label += " (" + name + ")";
|
||||
JCheckBoxMenuItem item = new JCheckBoxMenuItem(label, address.equals(selectedPort));
|
||||
item.addActionListener(new SerialMenuListener(address));
|
||||
serialMenu.add(item);
|
||||
|
@ -35,7 +35,6 @@ 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;
|
||||
import processing.core.PConstants;
|
||||
|
||||
|
||||
@ -165,6 +164,19 @@ public class Platform {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String resolveDeviceByBoardID(Map<String, TargetPackage> packages, String boardId) {
|
||||
for (TargetPackage targetPackage : packages.values()) {
|
||||
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {
|
||||
for (TargetBoard board : targetPlatform.getBoards().values()) {
|
||||
if (boardId.equals(board.getId())) {
|
||||
return board.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
|
@ -24,6 +24,8 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
public class SerialMonitor extends AbstractMonitor {
|
||||
|
||||
private final String port;
|
||||
@ -35,6 +37,8 @@ public class SerialMonitor extends AbstractMonitor {
|
||||
|
||||
this.port = port;
|
||||
|
||||
serialRate = Preferences.getInteger("serial.debug_rate");
|
||||
serialRates.setSelectedItem(serialRate + " " + _("baud"));
|
||||
onSerialRateChange(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
String wholeString = (String) serialRates.getSelectedItem();
|
||||
|
@ -42,9 +42,7 @@ void BridgeClass::begin() {
|
||||
delay(500);
|
||||
// Wait for OpenWRT message
|
||||
// "Press enter to activate console"
|
||||
print(F("\ncd /usr/lib/python2.7/bridge\n"));
|
||||
delay(100);
|
||||
print(F("python -B bridge.py\n"));
|
||||
print(F("run-bridge\n"));
|
||||
delay(1000);
|
||||
dropAll();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user