Skip to content

Commit 4b224f8

Browse files
author
Federico Fissore
committed
Merge remote-tracking branch 'arduino/master' into ide-1.5.x
2 parents 483a798 + b1b83c0 commit 4b224f8

File tree

14 files changed

+82
-22
lines changed

14 files changed

+82
-22
lines changed

app/src/processing/app/Base.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,7 @@ public void actionPerformed(ActionEvent actionevent) {
11871187
Action subAction = new AbstractAction(_(boardCustomMenu.get(customMenuOption))) {
11881188
public void actionPerformed(ActionEvent e) {
11891189
Preferences.set("custom_" + menuId, ((TargetBoard)getValue("board")).getId() + "_" + getValue("custom_menu_option"));
1190+
onBoardOrPortChange();
11901191
}
11911192
};
11921193
subAction.putValue("board", board);

app/src/processing/app/Editor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import com.jcraft.jsch.JSchException;
2828

29+
import jssc.SerialPortException;
2930
import processing.app.debug.*;
3031
import processing.app.forms.PasswordAuthorizationDialog;
3132
import processing.app.helpers.OSUtils;
@@ -2572,6 +2573,12 @@ public void handleSerial() {
25722573
statusError(_("Unable to connect: is the sketch using the bridge?"));
25732574
} catch (JSchException e) {
25742575
statusError(_("Unable to connect: wrong password?"));
2576+
} catch (SerialException e) {
2577+
String errorMessage = e.getMessage();
2578+
if (e.getCause() != null && e.getCause() instanceof SerialPortException) {
2579+
errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")";
2580+
}
2581+
statusError(errorMessage);
25752582
} catch (Exception e) {
25762583
statusError(e);
25772584
} finally {

arduino-core/src/cc/arduino/packages/discoverers/NetworkDiscovery.java

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,32 @@ public NetworkDiscovery() {
5858

5959
@Override
6060
public List<BoardPort> discovery() {
61-
List<BoardPort> ports = clonePortsList();
62-
Iterator<BoardPort> iterator = ports.iterator();
63-
while (iterator.hasNext()) {
61+
List<BoardPort> boardPorts = clonePortsList();
62+
Iterator<BoardPort> boardPortIterator = boardPorts.iterator();
63+
while (boardPortIterator.hasNext()) {
6464
try {
65-
BoardPort board = iterator.next();
66-
if (!NetUtils.isReachable(InetAddress.getByName(board.getAddress()), Integer.parseInt(board.getPrefs().get("port")))) {
67-
iterator.remove();
65+
BoardPort board = boardPortIterator.next();
66+
67+
InetAddress inetAddress = InetAddress.getByName(board.getAddress());
68+
int broadcastedPort = Integer.valueOf(board.getPrefs().get("port"));
69+
70+
List<Integer> ports = new LinkedList<Integer>();
71+
ports.add(broadcastedPort);
72+
73+
//dirty code: allows non up to date yuns to be discovered. Newer yuns will broadcast port 22
74+
if (broadcastedPort == 80) {
75+
ports.add(0, 22);
76+
}
77+
78+
boolean reachable = NetUtils.isReachable(inetAddress, ports);
79+
if (!reachable) {
80+
boardPortIterator.remove();
6881
}
6982
} catch (UnknownHostException e) {
70-
iterator.remove();
83+
boardPortIterator.remove();
7184
}
7285
}
73-
return ports;
86+
return boardPorts;
7487
}
7588

7689
private List<BoardPort> clonePortsList() {

arduino-core/src/processing/app/BaseNoGui.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
public class BaseNoGui {
3838

3939
/** Version string to be used for build */
40-
public static final int REVISION = 10600;
40+
public static final int REVISION = 10601;
4141
/** Extended version string displayed on GUI */
42-
static String VERSION_NAME = "1.6.0";
42+
static String VERSION_NAME = "1.6.1";
4343

4444
static File buildFolder;
4545

arduino-core/src/processing/app/helpers/NetUtils.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,41 @@
44
import java.net.InetAddress;
55
import java.net.InetSocketAddress;
66
import java.net.Socket;
7+
import java.util.Arrays;
8+
import java.util.List;
79

810
public abstract class NetUtils {
911

12+
private static boolean isReachableByEcho(InetAddress address) {
13+
try {
14+
return address.isReachable(100);
15+
} catch (IOException e) {
16+
return false;
17+
}
18+
}
19+
1020
public static boolean isReachable(InetAddress address, int port) {
21+
return isReachable(address, Arrays.asList(port));
22+
}
23+
24+
public static boolean isReachable(InetAddress address, List<Integer> ports) {
25+
if (isReachableByEcho(address)) {
26+
return true;
27+
}
28+
29+
boolean reachable = false;
30+
for (Integer port : ports) {
31+
reachable = reachable || isPortOpen(address, port);
32+
}
33+
34+
return reachable;
35+
}
36+
37+
private static boolean isPortOpen(InetAddress address, int port) {
1138
Socket socket = null;
1239
try {
1340
socket = new Socket();
14-
socket.connect(new InetSocketAddress(address, port), 100);
41+
socket.connect(new InetSocketAddress(address, port), 300);
1542
return true;
1643
} catch (IOException e) {
1744
return false;

build/shared/revisions.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11

2+
ARDUINO 1.6.1
3+
4+
[ide]
5+
* Improved Yun detection for upload via network (Ron Guest)
6+
* In platforms.txt "objcopy" recipe is no more tied to the "hex" format (Arnav Gupta)
7+
* /dev/cu.* serial ports are now filtered from the port list on MacOSX
8+
* Ports in ports list are now grouped by type
9+
* Upgraded avr-gcc toolchains to 3.4.5
10+
* Fixed wrong parsing of boards.txt when using submenu and boards id with underscores
11+
212
ARDUINO 1.6.0 - 2015.02.09
313

414
[ide]

hardware/arduino/avr/platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
77

88
name=Arduino AVR Boards
9-
version=1.6.0
9+
version=1.6.1
1010

1111
# AVR compile variables
1212
# ---------------------

hardware/arduino/sam/platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
66

77
name=Arduino ARM (32-bits) Boards
8-
version=1.6.0
8+
version=1.6.1
99

1010
# SAM3 compile variables
1111
# ----------------------

libraries/Bridge/examples/Bridge/Bridge.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include <YunServer.h>
2727
#include <YunClient.h>
2828

29-
// Listen on default port 5555, the webserver on the Yún
30-
// will forward there all the HTTP requests for us.
29+
// Listen to the default port 5555, the Yún webserver
30+
// will forward there all the HTTP requests you send
3131
YunServer server;
3232

3333
void setup() {

libraries/Ethernet/src/EthernetClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class EthernetClient : public Client {
2424
virtual void stop();
2525
virtual uint8_t connected();
2626
virtual operator bool();
27+
virtual bool operator==(const bool value) { return bool() == value; }
28+
virtual bool operator!=(const bool value) { return bool() != value; }
2729
virtual bool operator==(const EthernetClient&);
2830
virtual bool operator!=(const EthernetClient& rhs) { return !this->operator==(rhs); };
2931

0 commit comments

Comments
 (0)