|
|
@ -27,7 +27,7 @@ |
|
|
|
#define _UI_HPP_ |
|
|
|
#define _UI_HPP_ |
|
|
|
|
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
#include "config.h" |
|
|
|
#include "LiquidCrystalPlus_I2C.h" |
|
|
|
#include "Disp_Plus.h" |
|
|
|
#include "SoftenValue.hpp" |
|
|
|
#include "SoftenValue.hpp" |
|
|
|
#include "effect_modulated_delay.h" |
|
|
|
#include "effect_modulated_delay.h" |
|
|
|
#include "effect_stereo_mono.h" |
|
|
|
#include "effect_stereo_mono.h" |
|
|
@ -39,7 +39,11 @@ |
|
|
|
#define _LCDML_DISP_cols LCD_cols |
|
|
|
#define _LCDML_DISP_cols LCD_cols |
|
|
|
#define _LCDML_DISP_rows LCD_rows |
|
|
|
#define _LCDML_DISP_rows LCD_rows |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
#define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol
|
|
|
|
#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
|
|
|
|
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
|
|
|
|
|
|
|
|
|
|
|
|
extern config_t configuration; |
|
|
|
extern config_t configuration; |
|
|
@ -52,6 +56,9 @@ extern void strip_extension(char* s, char *target); |
|
|
|
extern void eeprom_write(void); |
|
|
|
extern void eeprom_write(void); |
|
|
|
extern bool get_voice_names_from_bank(uint8_t b); |
|
|
|
extern bool get_voice_names_from_bank(uint8_t b); |
|
|
|
extern bool load_sysex(uint8_t b, uint8_t v); |
|
|
|
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_volume; |
|
|
|
extern SoftenValue <uint8_t> soften_filter_res[NUM_DEXED]; |
|
|
|
extern SoftenValue <uint8_t> soften_filter_res[NUM_DEXED]; |
|
|
|
extern SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED]; |
|
|
|
extern SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED]; |
|
|
@ -74,7 +81,22 @@ extern Dexed* MicroDexed[NUM_DEXED]; |
|
|
|
************************************************************************/ |
|
|
|
************************************************************************/ |
|
|
|
elapsedMillis back_from_volume; |
|
|
|
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] = { |
|
|
|
const uint8_t scroll_bar[5][8] = { |
|
|
|
{B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top
|
|
|
|
{B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top
|
|
|
@ -89,7 +111,6 @@ enum { MENU_START, MENU_VOICE, MENU_EDIT, MENU_VOLUME }; |
|
|
|
enum {MENU_VOICE_BANK, MENU_VOICE_SOUND}; |
|
|
|
enum {MENU_VOICE_BANK, MENU_VOICE_SOUND}; |
|
|
|
uint8_t menu_state = MENU_START; |
|
|
|
uint8_t menu_state = MENU_START; |
|
|
|
uint8_t menu_voice = MENU_VOICE_SOUND; |
|
|
|
uint8_t menu_voice = MENU_VOICE_SOUND; |
|
|
|
|
|
|
|
|
|
|
|
void lcdml_menu_display(void); |
|
|
|
void lcdml_menu_display(void); |
|
|
|
void lcdml_voice_menu_display(void); |
|
|
|
void lcdml_voice_menu_display(void); |
|
|
|
void lcdml_menu_clear(void); |
|
|
|
void lcdml_menu_clear(void); |
|
|
@ -130,6 +151,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_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); |
|
|
|
void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// normal menu
|
|
|
|
// normal menu
|
|
|
|
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
|
|
|
|
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); |
|
|
|
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); |
|
|
@ -180,6 +202,63 @@ long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = {0, 0}; |
|
|
|
bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH}; |
|
|
|
bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH}; |
|
|
|
uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0}; |
|
|
|
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) |
|
|
|
void lcdml_menu_control(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// If something must init, put in in the setup condition
|
|
|
|
// If something must init, put in in the setup condition
|
|
|
@ -348,8 +427,15 @@ void encoder_right_up(void) |
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
configuration.bank++; |
|
|
|
configuration.bank++; |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(false); |
|
|
|
|
|
|
|
#endif |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(true); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
case MENU_VOICE_SOUND: |
|
|
@ -363,9 +449,16 @@ void encoder_right_up(void) |
|
|
|
configuration.voice = 0; |
|
|
|
configuration.voice = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(false); |
|
|
|
|
|
|
|
#endif |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(true); |
|
|
|
|
|
|
|
#endif |
|
|
|
eeprom_write(); |
|
|
|
eeprom_write(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
UI_func_voice_selection(0); |
|
|
|
UI_func_voice_selection(0); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -391,8 +484,16 @@ void encoder_right_down(void) |
|
|
|
if (configuration.bank > 0) |
|
|
|
if (configuration.bank > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
configuration.bank--; |
|
|
|
configuration.bank--; |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(false); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(true); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
case MENU_VOICE_SOUND: |
|
|
@ -406,8 +507,15 @@ void encoder_right_down(void) |
|
|
|
configuration.voice = 31; |
|
|
|
configuration.voice = 31; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(false); |
|
|
|
|
|
|
|
#endif |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
|
|
|
change_disp_sd(true); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
eeprom_write(); |
|
|
|
eeprom_write(); |
|
|
|
} |
|
|
|
} |
|
|
|
UI_func_voice_selection(0); |
|
|
|
UI_func_voice_selection(0); |
|
|
@ -587,8 +695,13 @@ void lcdml_menu_display(void) |
|
|
|
// delete or reset scrollbar
|
|
|
|
// delete or reset scrollbar
|
|
|
|
if (_LCDML_DISP_cfg_scrollbar == 1) { |
|
|
|
if (_LCDML_DISP_cfg_scrollbar == 1) { |
|
|
|
if (scrollbar_max > n_max) { |
|
|
|
if (scrollbar_max > n_max) { |
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
lcd.write((uint8_t)0); |
|
|
|
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 { |
|
|
|
else { |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
@ -603,16 +716,31 @@ void lcdml_menu_display(void) |
|
|
|
//set scroll position
|
|
|
|
//set scroll position
|
|
|
|
if (scrollbar_cur_pos == scrollbar_min) { |
|
|
|
if (scrollbar_cur_pos == scrollbar_min) { |
|
|
|
// min pos
|
|
|
|
// min pos
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), 0); |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), 0); |
|
|
|
lcd.write((uint8_t)1); |
|
|
|
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)) { |
|
|
|
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) { |
|
|
|
// max pos
|
|
|
|
// max pos
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1)); |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1)); |
|
|
|
lcd.write((uint8_t)4); |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
// between
|
|
|
|
// between
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max); |
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max); |
|
|
|
lcd.write((uint8_t)(scroll_pos % n_max) + 1); |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1548,6 +1676,9 @@ void UI_func_voice_selection(uint8_t param) |
|
|
|
lcd.show(1, 14, 2, "] "); |
|
|
|
lcd.show(1, 14, 2, "] "); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int x = 2; x < LCD_rows; x++) { |
|
|
|
|
|
|
|
lcd.show(x, 0, LCD_cols+1, " "); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UI_func_volume(uint8_t param) |
|
|
|
void UI_func_volume(uint8_t param) |
|
|
|