|
|
|
@ -27,7 +27,7 @@ |
|
|
|
|
#define _UI_HPP_ |
|
|
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
|
#include "LiquidCrystalPlus_I2C.h" |
|
|
|
|
#include "Disp_Plus.h" |
|
|
|
|
#include "SoftenValue.hpp" |
|
|
|
|
#include "effect_modulated_delay.h" |
|
|
|
|
#include "dexed.h" |
|
|
|
@ -38,7 +38,11 @@ |
|
|
|
|
#define _LCDML_DISP_cols LCD_cols |
|
|
|
|
#define _LCDML_DISP_rows LCD_rows |
|
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
#define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol
|
|
|
|
|
#else |
|
|
|
|
#define _LCDML_DISP_cfg_cursor 0x8d // cursor Symbol
|
|
|
|
|
#endif |
|
|
|
|
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
|
|
|
|
|
|
|
|
|
|
extern config_t configuration; |
|
|
|
@ -51,6 +55,9 @@ extern void strip_extension(char* s, char *target); |
|
|
|
|
extern void eeprom_write(void); |
|
|
|
|
extern bool get_voice_names_from_bank(uint8_t b); |
|
|
|
|
extern bool load_sysex(uint8_t b, uint8_t v); |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
extern void change_disp_sd(bool d); |
|
|
|
|
#endif |
|
|
|
|
extern SoftenValue <uint8_t> soften_volume; |
|
|
|
|
extern SoftenValue <uint8_t> soften_filter_res[NUM_DEXED]; |
|
|
|
|
extern SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED]; |
|
|
|
@ -73,7 +80,22 @@ extern void set_volume(uint8_t v, int8_t p); |
|
|
|
|
************************************************************************/ |
|
|
|
|
elapsedMillis back_from_volume; |
|
|
|
|
|
|
|
|
|
LiquidCrystalPlus_I2C lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows); |
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
#include <LiquidCrystal_I2C.h> |
|
|
|
|
Disp_Plus<LiquidCrystal_I2C> lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef U8X8_DISPLAY |
|
|
|
|
#include <U8x8lib.h> |
|
|
|
|
#ifdef U8X8_HAVE_HW_SPI |
|
|
|
|
#include <SPI.h> |
|
|
|
|
#endif |
|
|
|
|
#ifdef U8X8_HAVE_HW_I2C |
|
|
|
|
#include <Wire.h> |
|
|
|
|
#endif |
|
|
|
|
Disp_Plus<U8X8_DISPLAY_CLASS> lcd(/* cs=*/ U8X8_CS_PIN, /* dc=*/ U8X8_DC_PIN, /* reset=*/ U8X8_RESET_PIN); |
|
|
|
|
//Disp_Plus<U8X8_DISPLAY_CLASS> lcd(U8X8_PIN_NONE);
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
const uint8_t scroll_bar[5][8] = { |
|
|
|
|
{B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top
|
|
|
|
@ -88,7 +110,6 @@ enum { MENU_START, MENU_VOICE, MENU_EDIT, MENU_VOLUME }; |
|
|
|
|
enum {MENU_VOICE_BANK, MENU_VOICE_SOUND}; |
|
|
|
|
uint8_t menu_state = MENU_START; |
|
|
|
|
uint8_t menu_voice = MENU_VOICE_SOUND; |
|
|
|
|
|
|
|
|
|
void lcdml_menu_display(void); |
|
|
|
|
void lcdml_voice_menu_display(void); |
|
|
|
|
void lcdml_menu_clear(void); |
|
|
|
@ -129,6 +150,7 @@ void UI_func_goToRootMenu(uint8_t param); |
|
|
|
|
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign); |
|
|
|
|
void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// normal menu
|
|
|
|
|
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
|
|
|
|
|
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); |
|
|
|
@ -179,6 +201,63 @@ long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = {0, 0}; |
|
|
|
|
bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH}; |
|
|
|
|
uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0}; |
|
|
|
|
|
|
|
|
|
#ifdef U8X8_DISPLAY |
|
|
|
|
const uint8_t * flipped_scroll_bar[5]; |
|
|
|
|
|
|
|
|
|
uint8_t * rotTile(const uint8_t * tile) { |
|
|
|
|
uint8_t * newt = new uint8_t[8]; |
|
|
|
|
for (int x = 0; x < 8; x++) { |
|
|
|
|
uint8_t newb = 0; |
|
|
|
|
for (int y = 0 ; y < 8; y++){ |
|
|
|
|
newb |= (tile[y] << x) & 0x80; |
|
|
|
|
newb >>= 1; |
|
|
|
|
} |
|
|
|
|
newt[x] = newb; |
|
|
|
|
} |
|
|
|
|
return newt; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
void setup_ui(void){ |
|
|
|
|
// LCD Begin
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
lcd.init(); |
|
|
|
|
lcd.backlight(); |
|
|
|
|
lcd.clear(); |
|
|
|
|
lcd.blink_off(); |
|
|
|
|
lcd.cursor_off(); |
|
|
|
|
lcd.backlight(); |
|
|
|
|
#else |
|
|
|
|
lcd.begin(); |
|
|
|
|
lcd.clear(); |
|
|
|
|
lcd.setFont(u8x8_font_amstrad_cpc_extended_f); |
|
|
|
|
#endif |
|
|
|
|
lcd.setCursor(1, 0); |
|
|
|
|
lcd.print("MicroDexed"); |
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
lcd.print("(c)parasiTstudio"); |
|
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
// set special chars for scrollbar
|
|
|
|
|
lcd.createChar(0, (uint8_t*)scroll_bar[0]); |
|
|
|
|
lcd.createChar(1, (uint8_t*)scroll_bar[1]); |
|
|
|
|
lcd.createChar(2, (uint8_t*)scroll_bar[2]); |
|
|
|
|
lcd.createChar(3, (uint8_t*)scroll_bar[3]); |
|
|
|
|
lcd.createChar(4, (uint8_t*)scroll_bar[4]); |
|
|
|
|
#else |
|
|
|
|
for (int x=0; x < 5; x++) { |
|
|
|
|
flipped_scroll_bar[x] = rotTile(scroll_bar[x]); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// LCDMenuLib Setup
|
|
|
|
|
LCDML_setup(_LCDML_DISP_cnt); |
|
|
|
|
// Enable Menu Rollover
|
|
|
|
|
//LCDML.MENU_enRollover();
|
|
|
|
|
// Enable Screensaver (screensaver menu function, time to activate in ms)
|
|
|
|
|
//LCDML.SCREEN_enable(UI_func_voice_selection, VOICE_SELECTION_MS); // set to 10 seconds
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void lcdml_menu_control(void) |
|
|
|
|
{ |
|
|
|
|
// If something must init, put in in the setup condition
|
|
|
|
@ -347,8 +426,15 @@ void encoder_right_up(void) |
|
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
|
{ |
|
|
|
|
configuration.bank++; |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(false); |
|
|
|
|
#endif |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(true); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
@ -362,9 +448,16 @@ void encoder_right_up(void) |
|
|
|
|
configuration.voice = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(false); |
|
|
|
|
#endif |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(true); |
|
|
|
|
#endif |
|
|
|
|
eeprom_write(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
break; |
|
|
|
@ -390,8 +483,16 @@ void encoder_right_down(void) |
|
|
|
|
if (configuration.bank > 0) |
|
|
|
|
{ |
|
|
|
|
configuration.bank--; |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(false); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(true); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
@ -405,8 +506,15 @@ void encoder_right_down(void) |
|
|
|
|
configuration.voice = 31; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(false); |
|
|
|
|
#endif |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(true); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
@ -586,8 +694,13 @@ void lcdml_menu_display(void) |
|
|
|
|
// delete or reset scrollbar
|
|
|
|
|
if (_LCDML_DISP_cfg_scrollbar == 1) { |
|
|
|
|
if (scrollbar_max > n_max) { |
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
|
lcd.write((uint8_t)0); |
|
|
|
|
#else |
|
|
|
|
lcd.drawTile((_LCDML_DISP_cols - 1), n, 1, flipped_scroll_bar[0]); |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols), n+1); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
@ -602,16 +715,31 @@ void lcdml_menu_display(void) |
|
|
|
|
//set scroll position
|
|
|
|
|
if (scrollbar_cur_pos == scrollbar_min) { |
|
|
|
|
// min pos
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), 0); |
|
|
|
|
lcd.write((uint8_t)1); |
|
|
|
|
#else |
|
|
|
|
lcd.drawTile((_LCDML_DISP_cols - 1), 0, 1, flipped_scroll_bar[1]); |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols), 1); |
|
|
|
|
#endif |
|
|
|
|
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) { |
|
|
|
|
// max pos
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1)); |
|
|
|
|
lcd.write((uint8_t)4); |
|
|
|
|
#else |
|
|
|
|
lcd.drawTile((_LCDML_DISP_cols - 1), (n_max - 1), 1, flipped_scroll_bar[4]); |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols), (n_max)); |
|
|
|
|
#endif |
|
|
|
|
} else { |
|
|
|
|
// between
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max); |
|
|
|
|
lcd.write((uint8_t)(scroll_pos % n_max) + 1); |
|
|
|
|
#else |
|
|
|
|
lcd.drawTile((_LCDML_DISP_cols - 1), scroll_pos / n_max, 1, flipped_scroll_bar[(scroll_pos % n_max) + 1]); |
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols), (scroll_pos / n_max)+1); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1421,6 +1549,9 @@ void UI_func_voice_selection(uint8_t param) |
|
|
|
|
lcd.show(1, 14, 2, "] "); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
for (int x = 2; x < LCD_rows; x++) { |
|
|
|
|
lcd.show(x, 0, LCD_cols+1, " "); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UI_func_volume(uint8_t param) |
|
|
|
|