It seems this script was used to extract libraries, along with their
history, from the libraries directory of this repository. Since then,
all libraries have been extracted and then deleted in commit 067d7e925
(Delete builtin libraries sources), so no need to keep this script
around.
This keeps the repository root a bit cleaner. Since these files are used
automatically and are not intended to be directly read by users, there
is no point in keeping them in the root (github will pick up these
templates from the root, .github directory or docs directory equally).
According to JEP223, Java versions do not include trailing zero
elements. This means that e.g. Java 14.0.0 reports its version just as
"14". The changed code part expected at least three characters, so it
failed to start on such "zero-zero" Java releases. The evaluated java
version was not used anywhere, so the code block was removed.
Otherwise it may happen some weird sorting when untraslated and
translated labels are sorted together:
Arduino megaAVR Boards
Arduino nRF52 Board
ESP32 Arduino
ESP8266 Modules
Schede Arduino AVR <-- the localized string falls to the bottom
Also there is no way for 3rd party boards developers to actually provide
a translation, so let's just remove them.
This sorts the board submenus themselves, based on the displayed name.
This does not change the ordering of board items within these submenus
(which uses the order from boards.txt).
Previously, the Tools->Boards menu was one long list, divided into
different platforms by (unselectable) headers. When more than one or two
platforms were installed, this quickly results in a very long list of
boards that is hard to navigate.
This commit changes the board menu to have a submenu for each platform,
where each submenu contains just the boards for that platform.
Note that this first keeps a list of board items and then adds those to
the boards menu later. This could have been done directly, but the
intermediate list makes it easier to special-case single platform
installations, as well as sort the list in subsequent commits.
This fixes part of #8858.
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.
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.
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.
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).
`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
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.
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.
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.
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.
Improve Codacy PR quality requirements:
Fields should be declared at the top of the class, before any method
declarations, constructors, initializers or inner classes.
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