1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00
Commit Graph

7215 Commits

Author SHA1 Message Date
Matthijs Kooijman
7c4205b412 Handle nested submenus of the Tools menu
There is some code that, for each submenu under Tools, shows the
selected item in the label of the submenu itself (e.g. before opening
the submenu). This was done whenever the Tools menu is opened and
iterated over all the items in the submenu to identify the s

Previously, this code only looked at direct children of the submenu.
Now, this code also looks through submenus recursively, to keep the code
working even when items are divided over sub-submenus.

This makes a small behaviour change: previously, the first selected item
with a non-zero label was used. Now, the first selected item is used,
which makes the code a bit cleaner. I cannot quickly see any case where
the first selected item would have an empty text (and even more that
there is *another* selected item), so this check seems unnecessary. If
this case would occur nonetheless, it would only mean the selected item
is not displayed in the tools menu, nothing would otherwise break.
2020-03-25 15:26:53 +01:00
Martino Facchin
6c7d1042a9
Merge pull request #9912 from matthijskooijman/no-empty-programmers-menu
Never leave programmers menu empty
2020-03-25 09:10:40 +01:00
Matthijs Kooijman
e803061709 Never leave programmers menu empty
When there are no programmers available for the current board, the
programmers menu would remain empty, which would prevent it from
unfolding and could make users think there was something wrong with the
menu.

Now, a disabled item with a message is added if no programmers are
available, which should make it more clear what is going on.

This is a followup for #9373.
2020-03-24 20:37:12 +01:00
Matthijs Kooijman
a1d6da9dfe Prevent bytes from lingering in the serial buffer
This fixes a problem with the Serial UTF-8 decoder. This decoding moves
data from char[] buf, into a ByteBuffer inFromSerial, then decodes them
into a CharBuffer outToMessage and converts to a char[] to pass on.

When the buf read contained just over a full buffer worth of bytes and
contained some multi-byte characters, a situation could arise where two
decodes were needed to fill up outToMessage, leaving some data in
inFromSerial. If in this case no data would be left in buf, decoding
would stop until more data came in from serial.

This commit fixes this problem by:
 - Changing the outer loop to continue running when buf is empty, but
   inFromSerial is not.
 - Changing the inner loop to run at least once (so it runs when buf is
   empty, but inFromSerial is no).
 - Breaking out of the outer loop when no characters were produced (this
   handles the case where only an incomplete UTF-8 character remains in
   inFromSerial, which would otherwise prevent the loop from
   terminating.
 - Removes a `if (outToMessage.hasRemaining()` check that is now
   necessarily true if the break was not done.

This fixes #9808.
2020-03-24 15:24:50 +01:00
Matthijs Kooijman
d244a45c4a Use Math.min instead of ternary if in Serial data copy
This makes the code slightly more compact and easier to read.
2020-03-24 15:24:50 +01:00
Cristian Maglie
d6667dd4ca Added unit testing for UTF8 decoder in Serial 2020-03-24 15:24:50 +01:00
Cristian Maglie
a82f9a0e74 Silenced function deprecated warning 2020-03-23 18:42:35 +01:00
Cristian Maglie
bc54dd8ef5 SerialDiscovery: reorder a bit the discovery phases to make it clearer 2020-03-23 18:37:59 +01:00
Cristian Maglie
8208376507 SerialDiscovery: refactor search loop 2020-03-23 18:37:59 +01:00
Martino Facchin
bb629d1ba0 Wait a bit before resuming serial monitor
Helps in case the bootloader port has not yet disappeared when upload completes successfully.
2020-03-23 17:37:01 +01:00
Martino Facchin
d154120f0e Fix bogus port disconnection during serial event
Fixes https://github.com/arduino/Arduino/issues/9785 and probably many others

This commit strongly simplyfies the serial list code

Pluggable discovery introduced a bug since BoardPort.toString() started reporting only the name of the port, not the complete name_vid_pid needed to match liblistserial output.
Adding .toCompleteString() almost solves the bogus disconnection part alone, but resolveDeviceByVendorIdProductId() uses "0x" prefixes VID/PID, breaking it again.

In addition, all the logic used to match a board with its bootloader (to obtain a serial number on 32u4 boards) has been completely removed since it is currently useless (and unused).
2020-03-23 17:37:01 +01:00
Cristian Maglie
a0cd3eade8 Updated changelog 2020-03-23 12:48:22 +01:00
Martino Facchin
85a3b385eb
Merge pull request #9873 from matthijskooijman/allow-serial-change-when-disabled
Allow config changes and clear in disabled serial monitor and plotter
2020-03-23 12:12:56 +01:00
Martino Facchin
558ddd3d91 Don't restore sketch if last.sketch.location is out of display
`if ((screen.width != screenW) || (screen.height != screenH))` was making sure to reset every preference in case the display geometry changed.
Unfortunately, on Windows 10, `Toolkit.getDefaultToolkit().getScreenSize()` reports only the primary monitor either if external display is connected or not.

Fixes #9781
2020-03-23 12:07:40 +01:00
Martino Facchin
6f943ea4a8
Merge pull request #9843 from cmaglie/fix-proxy-prefs
Fixed user/pass preferences save for "manual" proxy settings.
2020-03-23 12:06:16 +01:00
Matthijs Kooijman
84e017fc36 Only show programmers for current board
Previously, the programmers menu always showed *all* programmers of
*all* platforms. This made it hard to find the programmer you need.

When selecting a programmer from another platform, it would typically
not work, since the tool definitions rely on specific variables to be
defined by the board, or files available in the variant directory, which
are typically platform-dependent. Also, some programmers might be
defined in multiple platforms, but there is currently no way to tell
which one is for the current platform an will work, and which is for
another platform and will break.

This commit changes the programmer menu to only show programmers from
the platforms that define the board and the core used. The latter is
only used when boar definition refers a core in another platform, in
which case the core and variant already have a strong coupling (the
variant must offer the right variables for the core to work), so that
would also apply to the programmer, so programmers from the referenced
core's platform can be expected to work.

When a board is selected, the menu of available programmers is
refreshed, but the currently selected programmer preference is
untouched. This might mean that a programmer is selected that is invalid
for the current board and will not actually work. This could be fixed by
clearing the current programmer when it becomes invalid, but that would
mean that changing to another platform and back would always require
reselecting the programmer to use, which seems counter-productive. An
alternative fix would be to check the programmer against the board and
throw an error, but that would require duplicating some code, which did
not seem worthwile (ideally, all this code will be moved to arduino-cli
anyway in the future).

This fixes #9373.
2020-03-23 12:05:38 +01:00
Martino Facchin
2e53557465
Merge pull request #9875 from matthijskooijman/manager-title-colors
Set foreground color on board/library titles in managers
2020-03-16 09:05:14 +01:00
Matthijs Kooijman
2659875078 Set foreground color on board/library titles in managers
In commit 93581b03d (Set foreground color in library/board manager), the
foreground color was set in addition to the background color, to make
sure that the library and board manager would remain readable even with
a non-standard color scheme (e.g. a dark theme).

When that commit was created, this worked properly. However, between
creating that commit and merging it as part of #9272, the title
rendering was changed from being part of the description (which had its
color set up properly) to being part of the title border (which used
default colors) in #9262.

This commit fixes this again by applying the foreground color also to
the TitledBorder component.

In ContributedPlatformTableCellJPanel this also moves the creation of
the TitledBorder into the constructor, and for
ContributedLibraryTableCellJPanel upwards in the constructor (where it
is run unconditionally), so the property can be final.
2020-03-14 13:07:46 +01:00
Matthijs Kooijman
ffa8720114 Allow config changes and clear in disabled serial monitor and plotter
When the serial device disconnects, the serial monitor and plotter are
disabled. Previously, the window would be completely disabled. Now, the
configuration controls (autoscroll, add timestamp, baudrate, line
endings) can still be changed while the window is disconnected. These
settings will not take effect immediately, but will be used when the
port is next opened.

Also, the clear output button can now also be used when the port is
disconnected, which makes it easy to get a clean start when reconnecting
the serial port.
2020-03-13 21:03:05 +01:00
Sebastian Hunkeler
42336ace32 Add new app icon 2020-03-09 11:31:55 +01:00
Cristian Maglie
fcb53ba6e1 Fixed user/pass preferences save for "manual" proxy settings.
There was an error in the following constants:

  PREF_PROXY_AUTO_USERNAME = "proxy.manual.username"
  PREF_PROXY_AUTO_PASSWORD = "proxy.manual.password"

they should be set to "auto" and not "manual":

  PREF_PROXY_AUTO_USERNAME = "proxy.auto.username"
  PREF_PROXY_AUTO_PASSWORD = "proxy.auto.password"

Changing the constants to the correct value now will fix the problem for
future installations of the IDE but will produce an annoying side-effect
for users upgrading from previous version of the IDE: they will lose
their saved user and pass (because it was saved as "proxy.manual.*")
and the IDE will suddenly stop working without any clear reason.

To avoid this I've left the value to "proxy.manual.*" and removed
the distinction from AUTO and MANUAL, so now we have only:

  PREF_PROXY_USERNAME = "proxy.manual.username"
  PREF_PROXY_PASSWORD = "proxy.manual.password"

The corresponding textbox in the preference dialog will be filled based on
the PROXY_TYPE selection.
2020-03-06 18:55:50 +01:00
Thomas L. Kjeldsen
b40f54af06 Declare fields at the top of the class
Improve Codacy PR quality requirements:
Fields should be declared at the top of the class, before any method
declarations, constructors, initializers or inner classes.
2020-02-19 15:13:47 +01:00
Thomas L. Kjeldsen
488388050e Remove "MrBean" dependency
Sacrifice abstract classes and interfaces to reduce the amount of magic
performed by MrBean.

Refs https://github.com/HuayraLinux/pkg-arduino/issues/4
2020-02-19 15:13:47 +01:00
Cristian Maglie
15133a0720 Starting Arduino IDE 1.8.13 2020-02-14 15:29:26 +01:00
Cristian Maglie
4bbd63a2ed Update revision log 2020-02-13 10:30:39 +01:00
Cristian Maglie
d8cd264a2d Fixed shasum of arduino-builder for macosx 2020-02-12 13:00:38 +01:00
Cristian Maglie
4cc3e72fa2 Removed some debugging leftovers... 2020-02-12 12:47:21 +01:00
Cristian Maglie
7ae377d3e9 Do not clear serial monitor when disabled for upload (@PaulStoffregen)
Fix #9234
2020-02-12 12:47:21 +01:00
Cristian Maglie
00641691b6 fixed some warnings 2020-02-12 12:47:21 +01:00
jenkins
d19ee30be8 update arduino-builder to 1.5.2 2020-02-12 12:24:00 +01:00
Cristian Maglie
8793a6d351 Fix libraries comparator logic
Previously it could lead to contract violations for example consider
this:

A = Library{ Name:"A", Types: ["Sensors"] }
B = Library{ Name:"B", Types: null        }
C = Library{ Name:"C", Types: ["Arduino"] }

it results in:

A<B (because B has Types==null and compare("A","B")<0)
B<C (because B has Types==null and compare("B","C")<0)
C<A (becuase C has Types=="Arduino" and the comparator returns -1)

This commit fix this behavior
2020-02-12 09:54:38 +01:00
Cristian Maglie
678420cd47 Revert "Replaced JFileChooser with FileDialog in 'Add .zip library'"
This reverts commit 7cb1440006.
2020-02-11 14:50:44 +01:00
per1234
33ff49566c Start Arduino IDE 1.8.12 2020-02-07 23:16:20 +01:00
Thomas
f62b5db908
Print log4j store directory only when operating in GUI mode (#9695)
This fixes CommandLineTest.testCommandLineVersion()

Looks like the test was broken by the System.out.println statement in Base.java
824567d763
2020-02-07 18:57:15 +01:00
Cristian Maglie
b59c91ebe2 Fixed failures in download tests 2020-02-06 16:04:39 +01:00
Cristian Maglie
efdd341e0e Run github actions on pull request 2020-02-06 16:04:39 +01:00
Cristian Maglie
3c7c0e46e9 Merge branch 'tlk/fail-on-test-errors' of https://github.com/tlk/Arduino into tlk-tlk/build-on-github-hosted-runners 2020-02-06 12:45:31 +01:00
Cristian Maglie
7dfcc7310c Merge branch 'tlk/build-on-github-hosted-runners' of https://github.com/tlk/Arduino into tlk-tlk/build-on-github-hosted-runners 2020-02-06 12:32:58 +01:00
Cristian Maglie
768c659f9d
Merge pull request #9722 from cmaglie/msstore-hotfix
Replaced JFileChooser with FileDialog in 'Add .zip library'
2020-02-05 18:29:14 +01:00
Cristian Maglie
7cb1440006 Replaced JFileChooser with FileDialog in 'Add .zip library'
For some reason the combination of the AdoptJDKJre 8 and Microsoft store
do not like JFileChooser.

This commit replace JFileChooser with a FileDialog that seems to work
without issues.
2020-02-05 15:56:37 +01:00
Cristian Maglie
2ed953ad5b Updated arudino-builder build with Apple SDK 10.9+
Fix https://github.com/arduino/arduino-builder/issues/349
2020-02-03 18:31:33 +01:00
Thomas L. Kjeldsen
ac6688de59 Treat JUnit errors as failures to increase visibility
Before this change `cd app; ant test` would return "BUILD SUCCESS"
even when unit tests were returning errors.
2020-01-31 16:00:04 +01:00
Thomas L. Kjeldsen
b4e5a8f7de Run tests with an X virtual framebuffer (1024x768)
The GitHub-hosted runner is a virtual machine hosted by GitHub.

Xvfb on that setup defaults to a virtual screen size of 640x480
(XVFBARGS='-screen 0 640x480x16') which in turn makes the Arduino user
interface tests fail with exceptions like this:

    [junit] org.fest.swing.exception.ActionFailedException: The component to click is out of the boundaries of the screen
    [junit] 	at org.fest.swing.exception.ActionFailedException.actionFailure(ActionFailedException.java:33)
    [junit] 	at org.fest.swing.core.RobotEventGenerator.pressMouse(RobotEventGenerator.java:74)

Setting the xvfb screen size to 1024x768 solves this error.
2020-01-31 12:52:27 +01:00
Thomas L. Kjeldsen
ab8471d562 Don't require user interaction when building the dist target 2020-01-31 12:52:19 +01:00
Thomas L. Kjeldsen
c630dc0b92 Build and run tests on GitHub-hosted runners
A GitHub-hosted runner is a virtual machine hosted by GitHub with the GitHub
Actions runner application installed.
2020-01-31 12:52:10 +01:00
Martino Facchin
67f35cedd5
Merge pull request #9692 from arduino/appdata-1.8.11
Update linux/appdata.xml to 1.8.11
2020-01-31 09:27:18 +01:00
Gianluca Varisco
063c518830 Update linux/appdata.xml to 1.8.11 2020-01-31 08:34:17 +01:00
Martino Facchin
88fa134d07
Merge pull request #9683 from matthijskooijman/compiler-errors-without-column
Compiler errors without column
2020-01-30 09:28:04 +01:00
Matthijs Kooijman
3d4b026b50 Preserve "fatal" in compiler errors
When transforming compiler errors (to make filenames more friendly), it
would match "fatal error" or "error" but then always reconstruct as
"error", modifying the compiler error in a way that is not intended.

This commit fixes that, as well as the previous hardcoding of the
"error: " prefix when rebuilding the error message, by capturing this
entire prefix and simply reproducing it in the resulting error message.
2020-01-29 19:38:03 +01:00
Matthijs Kooijman
e387c23b60 Slightly simplify error message rebuilding
This removes some duplicate code for with and without column number by
building the column number string separately first.
2020-01-29 19:04:43 +01:00