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

Use more appropriate File > Examples menu section for "built-in" libraries #2259

Open
3 tasks done
per1234 opened this issue Oct 13, 2023 · 1 comment
Open
3 tasks done
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Oct 13, 2023

Describe the request

Place the examples of the "built-in" libraries under a more appropriate section of the File > Examples menu section.

Option A: Move to "Examples from Custom Libraries"

Under the current menu structure, the "Examples from Custom Libraries" section is more appropriate for these examples. The reason

alternative of moving the examples of the "built-in" libraries to the "Examples from Custom Libraries" section would also not be appropriate because it is not accurate to call these official libraries, which are automatically installed by Arduino IDE to a location fairly inaccessible to the user and thus unlikely to be subject to modification, "Custom".

Option B: Move to dedicated section

This is the approach taken by Arduino IDE 1.x, places the examples of the "built-in" libraries under a section of the menu named "Examples for any board".

I don't think the "Examples for any board" label is appropriate because the examples of the built-in libraries aren't necessarily for "any board" (though the situation was probably different at the time this label was chosen by the IDE 1.x developers). For example, the built-in "Keyboard" library's example can not be used with boards that don't have a native USB capability (e.g., UNO, Mega, Nano). Something like "Examples from Built-in Libraries" would be more appropriate.

Something that should be noted in relation to this option is that Arduino IDE 1.x had a larger number of "built-in" libraries (we pruned obsolete/less relevant libraries from the "built-in" set used by IDE 2.x), and the initial trend was for the number of "built-in" libraries to grow steadily over time (because this was the primary distribution mechanism for official libraries prior to the creation of Library Manager). So Arduino IDE 1.x had a greater need for a dedicated section in the menu.

Describe the current behavior

There are three1 different categories of locations where Arduino libraries are installed:

  • Platform2 (e.g., C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\)
  • Built-in3 (e.g., C:\Users\<username>\AppData\Local\Arduino15\libraries\)
  • Sketchbook (e.g., C:\Users\<username>\Documents\Arduino\libraries\)


1. There is a fourth category (LIBRARY_LOCATION_UNMANAGED), but it is not relevant to Arduino IDE.

2. At a lower level, these fall into two subcategories (LIBRARY_LOCATION_PLATFORM_BUILTIN, LIBRARY_LOCATION_REFERENCED_PLATFORM_BUILTIN), but this is not significant for the user so they can be combined in the IDE UI.

3. Despite the similar name, this is completely different from the standalone example sketches that are listed under the "Built-in examples" section of the menu.

The libraries under the platform location are typically bundled with the platform due to being very specific to the architecture of the boards of that platform. Only the libraries of the specific platform of the currently selected board are accessible at any given time.

The libraries under the built-in location are the libraries that are automatically installed by Arduino IDE on the first run after a fresh installation. These are fundamental official libraries which are installed by default in order to provide new users with a gentle learning curve by allowing them to make a decent range of projects before introducing the requirement to learn how to use Library Manager.

The libraries under the sketchbook folder are the ones the user has installed or updated (via Library Manager, "Add .ZIP Library...", or manual installation).

The example sketches bundled with the installed libraries are listed in the File > Examples menu. This menu is separated into sections. The section under which a given library is placed in the menu depends on its location category:

Location Menu Section
platform "Examples for <board name>"
built-in "Examples for <board name>"
sketchbook "Examples from Custom Libraries"

🙁 The "Examples for <board name>" label might not be accurate for the examples of the "built-in" libraries:

  • These examples are completely incompatible with some boards
  • The examples are not specifically targeted to a given board in the way the platform-bundled libraries are.

Arduino IDE version

153e34f

Operating system

Windows

Operating system version

11

Additional context

Related

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Oct 13, 2023
@ben-qnimble
Copy link
Contributor

ben-qnimble commented Oct 15, 2023

One more consequence of the current naming system is that example sketches that come from the platform and built-in both get merged together into the "Examples from <board name>" menu. (see #2249 for more details) A fresh install of Aruduino 2.2.1 (no previous installs, no libraries, no platforms installed) installs nine 'built-in' libraries (Ethernet, Firmata, Keyboard, LiquidCrystal, Mouser, SD, Servo, Stepper, TFT). All the various examples for these libraries get listed as "Examples for <board name>" even though the target board may not support Ethernet, or an SD card, etc. If the platform does have examples that are specific to the actual hardware, those examples merged (buried) with these build-in examples.

On a fresh installation, if you select Arduino Uno as your platform, the platform provides libraries such as 'EEPROM', 'Wire', 'Software Serial' and 'SPI', however, these examples show up combined with the 'Ethernet', 'Liquid Crystal' and other build-in libraries that may or may not even be supported by the active hardware, making it unclear which libraries are actually designed for the active hardware and which ones aren't.

I'd suggest naming these build-in examples something that makes it clear that they are not universal examples. Maybe "Examples for Common Hardware". But anything that separates built-in library examples from platform library examples would be a good solution.

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

No branches or pull requests

2 participants