From 1605a486f0f13d1ce8a09b916a945be2bb89cb11 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 1 May 2019 10:57:27 +0200 Subject: [PATCH] Changed to LiquidMenu library. --- MicroMDAEPiano.ino | 55 ++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 4e7d79c..441e041 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -34,10 +34,10 @@ #else #include "mdaEPianoData.h" #endif -//#include -//#include "Encoder4.h" -//#include "LiquidCrystalPlus_I2C.h" -//#include "UI.h" +#include +#include "Encoder4.h" +#include +#include #include "midi_devices.hpp" //************************************************************************************************* @@ -87,6 +87,10 @@ AudioConnection patchCord13(volume_l, 0, pt8211_1, 0); // Objects mdaEPiano* ep; +LiquidCrystal_I2C lcd(LCD_I2C_ADDRESS, LCD_CHARS, LCD_LINES); +Encoder4 enc[2] = {Encoder4(ENC_L_PIN_A, ENC_L_PIN_B), Encoder4(ENC_R_PIN_A, ENC_R_PIN_B)}; +int32_t enc_val[2] = {INITIAL_ENC_L_VALUE, INITIAL_ENC_R_VALUE}; +Bounce but[2] = {Bounce(BUT_L_PIN, BUT_DEBOUNCE_MS), Bounce(BUT_R_PIN, BUT_DEBOUNCE_MS)}; // Variables uint8_t midi_channel = DEFAULT_MIDI_CHANNEL; @@ -105,6 +109,11 @@ elapsedMillis cpu_mem_millis; enum MDA_EP_PARAM { DECAY, RELEASE, HARDNESS, TREBLE, PAN_TREM, LFO_RATE, VELOCITY_SENSE, STEREO, MAX_POLY, TUNE, DETUNE, OVERDRIVE }; +LiquidLine welcome_line1(1, 0, "MicroMDAEPiano"); +LiquidLine welcome_line2(0, 1, "(c)parasiTstudio"); +LiquidScreen welcome_screen(welcome_line1, welcome_line2); +LiquidMenu menu(lcd); + //************************************************************************************************* //* SETUP FUNCTION //************************************************************************************************* @@ -115,26 +124,22 @@ void setup() Serial.begin(SERIAL_SPEED); delay(220); - /* - // LCD display setup - lcd.init(); - lcd.blink_off(); - lcd.cursor_off(); - lcd.backlight(); - lcd.noAutoscroll(); - lcd.clear(); - lcd.display(); - lcd.show(0, 0, 20, " MicroMDAEPiano"); - lcd.show(1, 0, 16, "(c)parasiTstudio"); - - // Encoder setup - enc[0].write(INITIAL_ENC_L_VALUE); - enc_val[0] = enc[0].read(); - enc[1].write(INITIAL_ENC_R_VALUE); - enc_val[1] = enc[1].read(); - but[0].update(); - but[1].update(); - */ + // LCD display setup + lcd.init(); + lcd.blink_off(); + lcd.cursor_off(); + lcd.backlight(); + lcd.noAutoscroll(); + + menu.add_screen(welcome_screen); + + // Encoder setup + enc[0].write(INITIAL_ENC_L_VALUE); + enc_val[0] = enc[0].read(); + enc[1].write(INITIAL_ENC_R_VALUE); + enc_val[1] = enc[1].read(); + but[0].update(); + but[1].update(); // Debug output Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); @@ -208,6 +213,8 @@ void setup() mixer_l.gain(1, 0.3); AudioInterrupts(); + menu.update(); + Serial.println(F("")); #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)