File tree Expand file tree Collapse file tree 14 files changed +82
-22
lines changed
cc/arduino/packages/discoverers Expand file tree Collapse file tree 14 files changed +82
-22
lines changed Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff line change 2626
2727import com .jcraft .jsch .JSchException ;
2828
29+ import jssc .SerialPortException ;
2930import processing .app .debug .*;
3031import processing .app .forms .PasswordAuthorizationDialog ;
3132import 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 {
Original file line number Diff line number Diff 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 () {
Original file line number Diff line number Diff line change 3737public 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
Original file line number Diff line number Diff line change 44import java .net .InetAddress ;
55import java .net .InetSocketAddress ;
66import java .net .Socket ;
7+ import java .util .Arrays ;
8+ import java .util .List ;
79
810public 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 ;
Original file line number Diff line number Diff line change 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+
212ARDUINO 1.6.0 - 2015.02.09
313
414[ide]
Original file line number Diff line number Diff line change 66# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
77
88name=Arduino AVR Boards
9- version=1.6.0
9+ version=1.6.1
1010
1111# AVR compile variables
1212# ---------------------
Original file line number Diff line number Diff line change 55# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
66
77name=Arduino ARM (32-bits) Boards
8- version=1.6.0
8+ version=1.6.1
99
1010# SAM3 compile variables
1111# ----------------------
Original file line number Diff line number Diff line change 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
3131YunServer server;
3232
3333void setup () {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments