arduino-ide icon indicating copy to clipboard operation
arduino-ide copied to clipboard

Boards list widget search must be deterministic

Open kittaakos opened this issue 3 years ago • 6 comments

Describe the problem

The Boards included in this package content is generated by the IDE2 from the result from the CLI. It's not deterministic.

To reproduce

  • Open IDE2,
  • Open Boards Manager,
  • Search for esp,
  • Delete p and add p so that search runs again with the esp term. Now the result is different.

https://user-images.githubusercontent.com/1405703/175551342-270fd4a7-fb85-48c8-a93d-4cdea0c5deba.mp4

Expected behavior

It's the same.

Arduino IDE version

rc8

Operating system

macOS

Operating system version

12.3.1

Additional context

~Let's order the list of boards alphabetically in the IDE2.~ (See https://github.com/arduino/arduino-ide/issues/1110#issuecomment-1165624455)

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] I verified the problem still occurs when using the latest nightly build
  • [X] My report contains all necessary details

kittaakos avatar Jun 24 '22 14:06 kittaakos

The ideal would be to respect the order specified by the platform author in the packages[*].platforms[*].boards[*] field of the package index (which I see the data provided by Arduino CLI does not do currently).

The list may have a specific order that groups related boards or provides the primary targets first. For example:

https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json

"boards": [
  {
    "name": "ATmega1284/P"
  },
  {
    "name": "ATmega644/P/PA/A"
  },
  {
    "name": "ATmega324P/PA/A/PB"
  },
  {
    "name": "ATmega164P/PA/A"
  },
  {
    "name": "ATmega32"
  },
  {
    "name": "ATmega16"
  },
  {
    "name": "ATmega8535"
  }
],

The primary target of the "MightyCore" boards platform is the ATmega1284 series, so that is listed first. After that, the other members of the ATmega1284's family are listed descending order by specs/interest (most casual users give preference to the higher spec parts since the price difference is really only significant for product manufacturing).

The second most interesting targets ATmega32 and ATmega16 come next, again in descending specs/interest.

Finally is the more obscure ATmega8535, which is included mostly for the sake of making the platform fully comprehensive.


This ordering is the established behavior from Arduino IDE 1.x:

image

per1234 avatar Jun 24 '22 14:06 per1234

@per1234 it appears to me that the order of the boards defined in the boards.txt configuration file is the same as the order defined in the package index. Can you confirm it?

Because issue https://github.com/arduino/arduino-ide/issues/802 says we want to use the order defined in boards.txt, while here it looks like we want to follow the one defined in the package index, so I would like to make sure we're doing the right thing before taking action.

AlbyIanna avatar Aug 11 '22 08:08 AlbyIanna

that the order of the boards defined in the boards.txt configuration file is the same as the order defined in the package index. Can you confirm it?

I can deny it. The package author can put any arbitrary content in the packages[*].platforms[*].boards[] field. They may happen match if the package author chose to do so, but there is no requirement, and in fact you will often find that the two have different contents.

per1234 avatar Aug 11 '22 09:08 per1234

Ok. Can I ask you why in the Board list widget we want to order the boards as defined in the package index, while in the Tools > Board menu we want to use the boards.txt one?

AlbyIanna avatar Aug 11 '22 09:08 AlbyIanna

In Boards Manager, we don't necessarily have a boards.txt file to get the order from because the boards.txt file is only available once the platform is installed, while Boards Manager must list all the available platforms. For non-installed platforms, the only data it has is that provided by the package index.

There really would be no way to use the boards list from package index for the Tools > Board menu because that list is not linked to the board definitions other than in an unreliable way by hoping the two human readable strings happen to match (which as I explained they are not required to, and often do not even in the Arduino's primary package index).

per1234 avatar Aug 11 '22 15:08 per1234

Understood, thank you for the reply!

AlbyIanna avatar Aug 12 '22 06:08 AlbyIanna