- fixed a nasty bug if the number of menu items = the .h setting for MAX_OPT, now if you have 22 items, set MAX_OPT = 22, (before fix set to 23)
This library will simplify creating and implementing a menu system for TFT displays that use the Adafruit_ILI9341 displays with microcontrollers such as the ESP32. See my other repository for the ILI8341_t3 for Teensy-based projects.
This library does not support Arduino UNO, NANO, however should work with the MEGA.
This library includes two menu objects
- A simple selection menu (ItemMenu) where the user can scroll up/down and select an item and some programmer defined action can be performed such as drawing a screen or activating a sub menu
- A menu with in-line edit capability (EditMenu) where the user can scroll up/down the list and select an item however, the difference is that move/up down on a selected item will then scroll the values stored with that menu item, selecting a selected item will restore control to moving up/down the menu list
Watch this YouTube video to see the library with touch input: https://youtu.be/wfMcTC3_8bI
Watch this YouTube video to see the library with mechanical input: https://youtu.be/KUi9f4hcV6A
To activate touch usage specify true in the menu object creation step
- EditMenu(Adafruit_ILI9341 *YourDisplayObject, true);
- ItemMenu(Adafruit_ILI9341 *YourDisplayObject, true);
To activate mechanical input usage specify false (default) in the menu object creation step
- EditMenu(Adafruit_ILI9341 *YourDisplayObject, false);
- ItemMenu(Adafruit_ILI9341 *YourDisplayObject, false);
Library highlights
- Support for menu selections using touch screens
- Support for menu selections using mechanical input such as rotary encoders or buttons
- Automatic wrapping for menu rows that exceed screen size
- For EditMenu objects, edits can be within a defined range or from an array
- Menus can include no icon, mono icon, or color icons
- Programmer has full control over margins, colors, fonts, etc.
- Menus can have up to 15 items, but expandable to more by editing the #define MAX_OPT 15
- Menu items can be enabled or disabled through code
- Automatic wrapping during editing for items within editable menus
- Menu item text can be changed at any time through code
- Initial data in EditMenu objects can be set based on stored or set values
- Menu selector bars can have round or sharp corners and have a border to accentuate selection
- Automatic up/down arrows on top and bottom screen rows to indicate to the user "there's more"
While this library was created for Adafruit_ILI9341 drivers, the library can be adapted to other display drivers. Note the driver must use the Adafruit_GFX libraries. To allow other display drivers, modify the lines in the .h and .cpp files to allow a different driver to be passed in. For example change call such as SliderH(ILI9341_t3 *disp,... to SliderH(Adafruit_RA8875 *disp,... and in the .cpp files you may have to change how fonts are passed in using either setFont(&SomeFont) or setFont(SomeFont)
I have included an example that shows how to create multi-menu system with both a simple select menu that call editable menus
1.0 1/11/22 initial code
2.0 1/28/22 added touch support