-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Submenu and Tile menu support and updated Documentation.
- Loading branch information
1 parent
61d07c1
commit e291919
Showing
7 changed files
with
455 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include <OpenMenuOS.h> // Include the OpenMenuOS library | ||
#include <Fonts/FreeMonoBold9pt7b.h> // Include the required fonts | ||
#include <Fonts/FreeMono9pt7b.h> | ||
|
||
// Create an instance of the OpenMenuOS class with button and display pins, along with menu item names | ||
OpenMenuOS menu(10, 5, 12, 4, 21, 22); //btn_up, btn_sel, tft_bl, cs, dc, rst | ||
|
||
void setup() { | ||
Serial.begin(921600); // Initialize serial communication | ||
menu.begin(); // Initialize the menu | ||
} | ||
|
||
void loop() { | ||
menu.loop(); // Handle menu logic | ||
menu.checkSerial(); // Check for serial input | ||
menu.connectToWiFi(); // Attempt to connect to WiFi if enabled | ||
|
||
// Display the menu if the current screen is the main menu (screen 0) | ||
if (menu.getCurrentScreen() == 0) { | ||
delay(100); // Small delay for stability | ||
menu.drawMenu(true, "Tile Menu", "Submenu", "Settings", NULL); // Draw the main menu on the screen. Set to "true" to display the 16x16 images for the items, else, set to "false" | ||
} | ||
// If the current screen is a submenu (screen 1) | ||
else if (menu.getCurrentScreen() == 1) { | ||
// Handle actions based on the selected menu item | ||
switch (menu.getSelectedItem()) { | ||
case 0: // Tile Menu | ||
menu.drawTileMenu(2, 2, ST7735_GREEN); | ||
break; | ||
case 1: // Submenu | ||
if (menu.getCurrentScreen() == 1) { | ||
delay(100); // Small delay for stability | ||
menu.drawSubmenu(true, "1", "2", "3", "4", NULL); // Draw the submenu on the screen. Set to "true" to display the 16x16 images for the items, else, set to "false" | ||
} else if (menu.getCurrentScreen() == 2) { | ||
// Handle actions based on the selected submenu item | ||
switch (menu.getSelectedItem()) { | ||
case 0: | ||
menu.canvas.fillScreen(ST7735_BLACK); | ||
break; | ||
case 1: | ||
menu.canvas.fillScreen(ST7735_BLACK); | ||
break; | ||
case 2: | ||
menu.canvas.fillScreen(ST7735_BLACK); | ||
break; | ||
case 3: | ||
menu.canvas.fillScreen(ST7735_BLACK); | ||
break; | ||
} | ||
} | ||
break; | ||
case 2: // Settings | ||
// Draw the setting menu on the screen | ||
menu.drawSettingMenu("Setting_6", "Setting_7", "Setting_8", NULL); // 5 items are by default in the settings. The one defined in this function are added after the one there by default | ||
break; | ||
} | ||
} | ||
// Additional functionality based on menu settings | ||
if (menu.menu_items_settings_bool[5]) { | ||
// Execute code if a specific menu item setting is enabled | ||
Serial.println("Menu item bool 5 is true"); | ||
} | ||
menu.drawCanvasOnTFT(); // Draw the updated canvas on the screen. You need to call it at the END of your code (in the "loop()") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
name=OpenMenuOS | ||
version=1.0.2-beta | ||
version=1.1.0 | ||
author=Loic Daigle <loicdaigle31@gmail.com> | ||
maintainer=Loic Daigle <loicdaigle31@gmail.com> | ||
sentence=ESP32 library to easily build menu on ST7735 0.96" display | ||
paragraph=This library was made to easily draw menu on ST7735R 0.96" 160x80 display with ESP32. | ||
category=Display | ||
url=https://github.com/The-Young-Maker/OpenMenuOS | ||
architectures=esp32 | ||
architectures=* | ||
includes=OpenMenuOS.h | ||
depends=ArduinoOTA, Preferences, WiFi | ||
depends=ArduinoOTA, Preferences, WiFi |
Oops, something went wrong.