From 36b8b6f9ee33d4644f5901d57976cef7cf7aa88b Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 5 May 2019 10:17:38 +0200 Subject: [PATCH] Added first steps for LiquidMenu system menu. --- MicroMDAEPiano.ino | 7 ++++--- UI.hpp | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index e23eb2a..c2e93d8 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -230,9 +230,10 @@ void setup() Serial.println(F("")); - menu.next_screen(); - menu.update(); - + menu_system.next_screen(); + menu_system.update(); + menu_system.switch_focus(); + #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) show_cpu_and_mem_usage(); cpu_mem_millis = 0; diff --git a/UI.hpp b/UI.hpp index c0e9094..b6f7e80 100644 --- a/UI.hpp +++ b/UI.hpp @@ -29,18 +29,42 @@ extern LiquidCrystal_I2C lcd; -LiquidMenu menu(lcd); - -const char text1[] PROGMEM = "MicroMDAEPiano"; -const char text2[] PROGMEM = "(c)parasiTstudio"; - -//const char text1[] PROGMEM = ""; // Welcome screen -LiquidLine welcome_line1(1, 0, text1); -LiquidLine welcome_line2(0, 1, text2); +const char text00[] PROGMEM = "MicroMDAEPiano"; +const char text01[] PROGMEM = "(c)parasiTstudio"; +LiquidLine welcome_line1(1, 0, text00); +LiquidLine welcome_line2(0, 1, text01); LiquidScreen welcome_screen(welcome_line1, welcome_line2); +// Main menu +const char text10[] PROGMEM = "Favorites "; +const char text11[] PROGMEM = "Sound "; +const char text12[] PROGMEM = "Store "; +const char text13[] PROGMEM = "Info "; +LiquidLine main_line1(0, 0, text10); +LiquidLine main_line2(0, 1, text11); +LiquidScreen main_screen(main_line1, main_line2); +LiquidMenu main_menu(lcd,welcome_screen,main_screen,1); + +// Sound menu +const char text20[] PROGMEM = "Decay "; +const char text21[] PROGMEM = "Release "; +const char text22[] PROGMEM = "Hardness "; +const char text23[] PROGMEM = "Treble "; +LiquidLine sound_line1(0, 0, text20); +LiquidLine sound_line2(0, 1, text21); +LiquidLine sound_line3(0, 1, text22); +LiquidLine sound_line4(0, 1, text23); +LiquidScreen sound_screen(sound_line1, sound_line2, sound_line3, sound_line4); +LiquidMenu sound_menu(lcd,sound_screen); + +// System menu +LiquidSystem menu_system(main_menu, sound_menu); + +void callback_main_function() { + Serial.println(F("You called the main callback function.")); +} void menu_init(void) { @@ -51,7 +75,9 @@ void menu_init(void) lcd.backlight(); lcd.noAutoscroll(); - menu.add_screen(welcome_screen); - menu.update(); + main_line1.attach_function(1, callback_main_function); + + menu_system.update(); } + #endif