Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
per1234 opened this issue Feb 8, 2022 · 0 comments
Open

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

per1234 opened this issue Feb 8, 2022 · 0 comments
Assignees
Labels
criticality: medium Of moderate impact topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Feb 8, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criticality: medium Of moderate impact topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants