diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 451a5bed939..350ceeeb0b1 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1187,6 +1187,7 @@ public void actionPerformed(ActionEvent actionevent) { Action subAction = new AbstractAction(_(boardCustomMenu.get(customMenuOption))) { public void actionPerformed(ActionEvent e) { Preferences.set("custom_" + menuId, ((TargetBoard)getValue("board")).getId() + "_" + getValue("custom_menu_option")); + onBoardOrPortChange(); } }; subAction.putValue("board", board); diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 7d3b9b0ded4..af95a8fccf5 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -26,6 +26,7 @@ import com.jcraft.jsch.JSchException; +import jssc.SerialPortException; import processing.app.debug.*; import processing.app.forms.PasswordAuthorizationDialog; import processing.app.helpers.OSUtils; @@ -2572,6 +2573,12 @@ public void handleSerial() { statusError(_("Unable to connect: is the sketch using the bridge?")); } catch (JSchException e) { statusError(_("Unable to connect: wrong password?")); + } catch (SerialException e) { + String errorMessage = e.getMessage(); + if (e.getCause() != null && e.getCause() instanceof SerialPortException) { + errorMessage += " (" + ((SerialPortException) e.getCause()).getExceptionType() + ")"; + } + statusError(errorMessage); } catch (Exception e) { statusError(e); } finally { diff --git a/arduino-core/src/cc/arduino/packages/discoverers/NetworkDiscovery.java b/arduino-core/src/cc/arduino/packages/discoverers/NetworkDiscovery.java index 85cd05c6681..6f593571ad3 100644 --- a/arduino-core/src/cc/arduino/packages/discoverers/NetworkDiscovery.java +++ b/arduino-core/src/cc/arduino/packages/discoverers/NetworkDiscovery.java @@ -58,19 +58,32 @@ public NetworkDiscovery() { @Override public List discovery() { - List ports = clonePortsList(); - Iterator iterator = ports.iterator(); - while (iterator.hasNext()) { + List boardPorts = clonePortsList(); + Iterator boardPortIterator = boardPorts.iterator(); + while (boardPortIterator.hasNext()) { try { - BoardPort board = iterator.next(); - if (!NetUtils.isReachable(InetAddress.getByName(board.getAddress()), Integer.parseInt(board.getPrefs().get("port")))) { - iterator.remove(); + BoardPort board = boardPortIterator.next(); + + InetAddress inetAddress = InetAddress.getByName(board.getAddress()); + int broadcastedPort = Integer.valueOf(board.getPrefs().get("port")); + + List ports = new LinkedList(); + ports.add(broadcastedPort); + + //dirty code: allows non up to date yuns to be discovered. Newer yuns will broadcast port 22 + if (broadcastedPort == 80) { + ports.add(0, 22); + } + + boolean reachable = NetUtils.isReachable(inetAddress, ports); + if (!reachable) { + boardPortIterator.remove(); } } catch (UnknownHostException e) { - iterator.remove(); + boardPortIterator.remove(); } } - return ports; + return boardPorts; } private List clonePortsList() { diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index d9cf887f95e..de51e50be9c 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -37,9 +37,9 @@ public class BaseNoGui { /** Version string to be used for build */ - public static final int REVISION = 10600; + public static final int REVISION = 10601; /** Extended version string displayed on GUI */ - static String VERSION_NAME = "1.6.0"; + static String VERSION_NAME = "1.6.1"; static File buildFolder; diff --git a/arduino-core/src/processing/app/debug/Compiler.java b/arduino-core/src/processing/app/debug/Compiler.java index a23836a0e88..e84ba4eda37 100644 --- a/arduino-core/src/processing/app/debug/Compiler.java +++ b/arduino-core/src/processing/app/debug/Compiler.java @@ -34,6 +34,7 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -399,13 +400,17 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE progressListener.progress(60); compileLink(); - // 5. extract EEPROM data (from EEMEM directive) to .eep file. - progressListener.progress(70); - runRecipe("recipe.objcopy.eep.pattern"); - - // 6. build the .hex file - progressListener.progress(80); - runRecipe("recipe.objcopy.output.pattern"); + // 5. run objcopy to generate output files + progressListener.progress(75); + List objcopyPatterns = new ArrayList(); + for (String key : prefs.keySet()) { + if (key.startsWith("recipe.objcopy.") && key.endsWith(".pattern")) + objcopyPatterns.add(key); + } + Collections.sort(objcopyPatterns); + for (String recipe : objcopyPatterns) { + runRecipe(recipe); + } progressListener.progress(90); return true; diff --git a/arduino-core/src/processing/app/helpers/NetUtils.java b/arduino-core/src/processing/app/helpers/NetUtils.java index c67245801cd..67201bf3d9f 100644 --- a/arduino-core/src/processing/app/helpers/NetUtils.java +++ b/arduino-core/src/processing/app/helpers/NetUtils.java @@ -4,14 +4,41 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; +import java.util.Arrays; +import java.util.List; public abstract class NetUtils { + private static boolean isReachableByEcho(InetAddress address) { + try { + return address.isReachable(100); + } catch (IOException e) { + return false; + } + } + public static boolean isReachable(InetAddress address, int port) { + return isReachable(address, Arrays.asList(port)); + } + + public static boolean isReachable(InetAddress address, List ports) { + if (isReachableByEcho(address)) { + return true; + } + + boolean reachable = false; + for (Integer port : ports) { + reachable = reachable || isPortOpen(address, port); + } + + return reachable; + } + + private static boolean isPortOpen(InetAddress address, int port) { Socket socket = null; try { socket = new Socket(); - socket.connect(new InetSocketAddress(address, port), 100); + socket.connect(new InetSocketAddress(address, port), 300); return true; } catch (IOException e) { return false; diff --git a/build/build.xml b/build/build.xml index b77ffa7b5fb..49b73b483db 100644 --- a/build/build.xml +++ b/build/build.xml @@ -5,13 +5,13 @@ - + diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 73a84f27577..ba7557fd2fd 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -1,4 +1,14 @@ +ARDUINO 1.6.1 + +[ide] +* Improved Yun detection for upload via network (Ron Guest) +* In platforms.txt "objcopy" recipe is no more tied to the "hex" format (Arnav Gupta) +* /dev/cu.* serial ports are now filtered from the port list on MacOSX +* Ports in ports list are now grouped by type +* Upgraded avr-gcc toolchains to 3.4.5 +* Fixed wrong parsing of boards.txt when using submenu and boards id with underscores + ARDUINO 1.6.0 - 2015.02.09 [ide] diff --git a/hardware/arduino/avr/platform.txt b/hardware/arduino/avr/platform.txt index 04499b097d0..797e7e3bf43 100644 --- a/hardware/arduino/avr/platform.txt +++ b/hardware/arduino/avr/platform.txt @@ -6,7 +6,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=Arduino AVR Boards -version=1.6.0 +version=1.6.1 # AVR compile variables # --------------------- @@ -61,11 +61,9 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil ## Combine gc-sections, archives, and objects recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm -## Create eeprom +## Create output files (.eep and .hex) recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" - -## Create hex -recipe.objcopy.output.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" diff --git a/hardware/arduino/sam/platform.txt b/hardware/arduino/sam/platform.txt index ce95c886abb..27a562b8b6f 100644 --- a/hardware/arduino/sam/platform.txt +++ b/hardware/arduino/sam/platform.txt @@ -5,7 +5,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=Arduino ARM (32-bits) Boards -version=1.6.0 +version=1.6.1 # SAM3 compile variables # ---------------------- @@ -65,11 +65,8 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil ## Combine gc-sections, archives, and objects recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc -## Create eeprom -recipe.objcopy.eep.pattern= - -## Create hex -recipe.objcopy.output.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" +## Create output (.bin file) +recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" diff --git a/libraries/Bridge/examples/Bridge/Bridge.ino b/libraries/Bridge/examples/Bridge/Bridge.ino index 78343f01c9d..74c912d4c02 100644 --- a/libraries/Bridge/examples/Bridge/Bridge.ino +++ b/libraries/Bridge/examples/Bridge/Bridge.ino @@ -26,8 +26,8 @@ #include #include -// Listen on default port 5555, the webserver on the Yún -// will forward there all the HTTP requests for us. +// Listen to the default port 5555, the Yún webserver +// will forward there all the HTTP requests you send YunServer server; void setup() { diff --git a/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino b/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino index f6ccf69f8ab..53b9eead433 100644 --- a/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino +++ b/libraries/Bridge/examples/YunSerialTerminal/YunSerialTerminal.ino @@ -15,7 +15,7 @@ '~' followed by '1' -> Set the UART speed to 115200 baud '~' followed by '2' -> Set the UART speed to 250000 baud '~' followed by '3' -> Set the UART speed to 500000 baud - '~' followeb by '~' -> Sends the bridge's shutdown command to + '~' followed by '~' -> Sends the bridge's shutdown command to obtain the console. The circuit: diff --git a/libraries/Bridge/src/YunClient.cpp b/libraries/Bridge/src/YunClient.cpp index 82965894ad2..0c5dc479f8b 100644 --- a/libraries/Bridge/src/YunClient.cpp +++ b/libraries/Bridge/src/YunClient.cpp @@ -160,7 +160,7 @@ int YunClient::connect(const char *host, uint16_t port) { if (connected()) return 1; - opened = false; + stop(); handle = 0; return 0; } diff --git a/libraries/Ethernet/src/EthernetClient.h b/libraries/Ethernet/src/EthernetClient.h index 1992db05240..16e2500bc37 100644 --- a/libraries/Ethernet/src/EthernetClient.h +++ b/libraries/Ethernet/src/EthernetClient.h @@ -24,6 +24,8 @@ class EthernetClient : public Client { virtual void stop(); virtual uint8_t connected(); virtual operator bool(); + virtual bool operator==(const bool value) { return bool() == value; } + virtual bool operator!=(const bool value) { return bool() != value; } virtual bool operator==(const EthernetClient&); virtual bool operator!=(const EthernetClient& rhs) { return !this->operator==(rhs); }; diff --git a/libraries/LiquidCrystal/library.properties b/libraries/LiquidCrystal/library.properties index 05d2c9faa39..4786c58c5cc 100644 --- a/libraries/LiquidCrystal/library.properties +++ b/libraries/LiquidCrystal/library.properties @@ -1,6 +1,6 @@ name=LiquidCrystal version=1.0 -author= +author=Arduino, Adafruit maintainer=Arduino sentence=Allows communication with alphanumerical liquid crystal displays (LCDs). For all Arduino boards. paragraph=This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4 or 8 bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines). diff --git a/libraries/SD/library.properties b/libraries/SD/library.properties index 088d7c60f29..ad4a6d68603 100644 --- a/libraries/SD/library.properties +++ b/libraries/SD/library.properties @@ -1,7 +1,7 @@ name=SD version=1.0 -author= -maintainer= +author=Arduino, SparkFun +maintainer=Arduino sentence=Enables reading and writing on SD cards. For all Arduino boards. paragraph=Once an SD memory card is connected to the SPI interfare of the Arduino board you are enabled to create files and read/write on them. You can also move through directories on the SD card. category=Data Storage diff --git a/libraries/Stepper/library.properties b/libraries/Stepper/library.properties index 7e2ab969829..30b7cea4406 100644 --- a/libraries/Stepper/library.properties +++ b/libraries/Stepper/library.properties @@ -1,7 +1,7 @@ name=Stepper version=1.0 -author= -maintainer= +author=Arduino +maintainer=Arduino sentence=Allows Arduino boards to control a variety of stepper motors. For all Arduino boards. paragraph=This library allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it. category=Device Control diff --git a/libraries/TFT/library.properties b/libraries/TFT/library.properties index 46e9d26ed20..68ea4b6e452 100644 --- a/libraries/TFT/library.properties +++ b/libraries/TFT/library.properties @@ -1,7 +1,7 @@ name=TFT version=1.0 -author= -maintainer= +author=Arduino, Adafruit +maintainer=Arduino sentence=Allows drawing text, images, and shapes on the Arduino TFT graphical display. For all Arduino boards. paragraph=This library is compatible with most of the TFT display based on the ST7735 chipset category=Display