Skip to content

Indicate board compatibility in **File > Examples** menu #817

Open
@per1234

Description

@per1234

Describe the current behavior

Some Arduino libraries are compatible only with specific architectures. The library author can indicate this in the library's metadata.

By comparing that metadata against the architecture of the currently selected board, the IDE can determine whether the library is intended to be compatible with the board and communicate that information to the user.

One of the ways Arduino IDE 1.x communicates this information to the user is by putting the examples of incompatible libraries under the File > Examples > INCOMPATIBLE menu:

image

🙁 Arduino IDE 2.x does not do this. Instead, it presents examples of incompatible libraries directly under the File > Examples menu, with nothing to differentiate them from the compatible library examples.

To reproduce

  1. Install the "USBHost" library via Library Manager.
    This library is compatible only with the sam architecture.
  2. Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
    This is a board of the avr architecture.
  3. Select File > Examples from the Arduino IDE menus.

🙁 The menu contains a "USBHost" item at the first level:

image

Describe the request

Put examples of incompatible libraries under the File > Examples > INCOMPATIBLE menu.

Desktop

  • OS: Windows 10, Ubuntu 20.04
  • Version: 2.0.0-rc3-snapshot.a20899f
    Date: 2022-02-01T13:36:29.975Z
    CLI Version: nightly-20220205 [10107d2]

Additional context

The IDE does have another method of communicating library compatibility to the user, which is a warning shown in the compilation output:

library X claims to run on Y architecture(s) and may be incompatible with your current board which runs on Z architecture(s)

However, that warning is not always shown and not always noticed by users even when it is shown in the midst of some more cryptic errors.

The File > Examples > INCOMPATIBLE mechanism is much more visible to the user and also gives them the advance warning that they are doing something inadvisable rather than having to discover that after something breaks.


The question might be posed: "if the library is incompatible, why show the examples at all?".

It is possible that a library is compatible with a board even though its architecture is not specified in the library metadata. The "allow list" approach used to specify architecture compatibility in library metadata means that it is not always possible for the library author to completely specify compatibility with the ever growing number of possible architectures (e.g., mbed -> mbed_nano).

Even when truly incompatible, hiding them might only lead to the user attempting to use the library directly.


It looks like Arduino CLI does provide this information:

https://arduino.github.io/arduino-cli/dev/rpc/commands/#:~:text=source%20root%20directory.-,compatible_with,-Library.CompatibleWithEntry

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions