Revert "Dateien hochladen nach „“"

This reverts commit ab0785ab01.
master
Holger Wirtz 4 years ago
parent ab0785ab01
commit efd3d54c72
  1. 6
      MicroDexed.ino
  2. 524
      UI.hpp
  3. 9
      UI_FX.h
  4. 10
      UI_NO_FX.h
  5. 5
      config.h

@ -572,15 +572,13 @@ void loop()
if (midi_voices[instance_id] > 0 && midi_playing[instance_id] == false)
{
midi_playing[instance_id] = true;
//lcd.setCursor(14 + instance_id, 1);
lcd.setCursor(12 + instance_id, 0);
lcd.setCursor(14 + instance_id, 1);
lcd.write(6 + instance_id);
}
else if (midi_voices[instance_id] == 0 && !MicroDexed[instance_id]->getSustain())
{
midi_playing[instance_id] = false;
//lcd.setCursor(14 + instance_id, 1);
lcd.setCursor(12 + instance_id, 0);
lcd.setCursor(14 + instance_id, 1);
lcd.write(20); // blank
}
#endif

524
UI.hpp

@ -152,7 +152,7 @@ const uint8_t meter_bar[5][8] = {
{B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001}
};
const uint8_t special_chars[19][8] = {
const uint8_t special_chars[18][8] = {
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [0] 1 small invers
{B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111}, // [1] 2 small invers
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [2] 1 OP invers
@ -171,8 +171,7 @@ const uint8_t special_chars[19][8] = {
{B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [15] Level 8
{B00100, B00110, B00101, B00101, B01101, B11101, B11100, B11000}, // [16] Note
//{B01110, B10001, B10001, B11111, B11011, B11011, B11111, B00000} // [17] Disabled 2nd instance symbol
{B01110, B10001, B10001, B01110, B00100, B00100, B00110, B00110}, // [17] Disabled 2nd instance symbol
{B11111, B10001, B10111, B10001, B10111, B10111, B10111, B11111} // [18]Favorites Icon
{B01110, B10001, B10001, B01110, B00100, B00100, B00110, B00110} // [17] Disabled 2nd instance symbol
};
enum { SCROLLBAR, BLOCKBAR, METERBAR };
@ -247,7 +246,6 @@ void UI_func_eq_bass(uint8_t param);
void UI_func_eq_treble(uint8_t param);
void UI_function_not_enabled(void);
void UI_function_not_implemented(uint8_t param);
void UI_func_favorites(uint8_t param);
bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool init);
uint8_t search_accepted_char(uint8_t c);
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign);
@ -261,10 +259,6 @@ void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op);
void lcd_special_chars(uint8_t mode);
void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string);
void string_trim(char *s);
void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id);
void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id);
bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id);
bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id);
// normal menu
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
@ -276,8 +270,6 @@ LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_displa
#include "UI_NO_FX.h"
#endif
int favsearcher = 0;
// create menu
LCDML_createMenu(_LCDML_DISP_cnt);
@ -753,11 +745,8 @@ void lcdml_menu_control(void)
#ifdef DEBUG
Serial.println(F("ENC-L long recognized"));
#endif
save_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
//for (uint8_t i = 0; i < NUM_DEXED; i++)
// MicroDexed[i]->panic();
for (uint8_t i = 0; i < NUM_DEXED; i++)
MicroDexed[i]->panic();
encoderDir[ENC_L].reset();
encoderDir[ENC_R].reset();
@ -2047,70 +2036,6 @@ void UI_func_panorama(uint8_t param)
}
}
void UI_func_favorites(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_L].reset();
lcd.setCursor(0, 0);
lcd.print(F("Favorites"));
lcd.setCursor(0, 1);
switch (configuration.sys.favorites)
{
case 0:
lcd.print(F("[ All presets ]"));
break;
case 1:
lcd.print(F("[ FAVs. only ]"));
break;
case 2:
lcd.print(F("[non-FAVs. only]"));
break;
case 3:
lcd.print(F("[random non-FAV]"));
break;
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkDown())
configuration.sys.favorites = constrain(configuration.sys.favorites + 1, 0, 3);
else if (LCDML.BT_checkUp())
configuration.sys.favorites = constrain(configuration.sys.favorites - 1, 0, 3);
lcd.setCursor(0, 1);
switch (configuration.sys.favorites)
{
case 0:
lcd.print(F("[ All presets ]"));
break;
case 1:
lcd.print(F("[ FAVs. only ]"));
break;
case 2:
lcd.print(F("[non-FAVs. only]"));
break;
case 3:
lcd.print(F("[random non-FAV]"));
break;
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_L].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, sys.favorites), configuration.sys.favorites);
}
}
void UI_func_stereo_mono(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -3801,161 +3726,6 @@ void UI_func_eeprom_reset(uint8_t param)
}
}
void locate_previous_non_favorite()
{
//find prev. non fav in current bank
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do {
if (configuration.performance.voice[selected_instance_id] == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
//configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
do { //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
void locate_previous_favorite()
{
//find previous fav in current bank
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do {
if (configuration.performance.voice[selected_instance_id] == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
//configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
do { //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && favsearcher < 170);
favsearcher = 0;
}
void locate_next_favorite()
{
//find next fav in current bank
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && favsearcher < 170);
favsearcher = 0;
}
void locate_next_non_favorite()
{
//find next non-fav in current bank
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
//configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
void locate_random_non_favorite()
{
//find random non-fav
do {
configuration.performance.voice[selected_instance_id]=random(32);
configuration.performance.bank[selected_instance_id]=random(MAX_BANKS - 1);
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 100);
favsearcher = 0;
}
void UI_func_voice_select(uint8_t param)
{
static uint8_t menu_voice_select = MENU_VOICE_SOUND;
@ -3979,8 +3749,6 @@ void UI_func_voice_select(uint8_t param)
lcd.setCursor(15, 0);
lcd.write(1);
lcd.createChar(2, (uint8_t*)special_chars[18]); // favorites symbol
#ifdef TEENSY3_6
lcd.createChar(6, (uint8_t*)special_chars[16]); // MIDI activity note symbol
lcd.createChar(7, (uint8_t*)special_chars[16]); // MIDI activity note symbol
@ -3998,9 +3766,6 @@ void UI_func_voice_select(uint8_t param)
int8_t voice_tmp;
if (LCDML.BT_checkUp())
{
//start : show all presets
if (configuration.sys.favorites == 0)
{
switch (menu_voice_select)
{
@ -4042,50 +3807,7 @@ void UI_func_voice_select(uint8_t param)
break;
}
}
else //only Favs
if (configuration.sys.favorites == 1)
{
locate_previous_favorite();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
} else //only non-Favs
if (configuration.sys.favorites == 2)
{
locate_previous_non_favorite();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
//break;
} else //random non-Favs
if (configuration.sys.favorites == 3)
{
locate_random_non_favorite();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
}
} //end UP
else if (LCDML.BT_checkDown())
{
//start : show all presets
if (configuration.sys.favorites == 0)
{
switch (menu_voice_select)
{
@ -4125,46 +3847,6 @@ void UI_func_voice_select(uint8_t param)
#endif
break;
}
else //only Favs
if (configuration.sys.favorites == 1)
{
locate_next_favorite();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
//break;
}
else //only non-Favs
if (configuration.sys.favorites == 2)
{
locate_next_non_favorite();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
//break;
} else //random non-Favs
if (configuration.sys.favorites == 3)
{
locate_random_non_favorite();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
}
}
else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonPressed())
{
@ -4208,28 +3890,24 @@ void UI_func_voice_select(uint8_t param)
lcd.show(0, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1);
lcd.show(0, 3, 8, bank_name);
lcd.show(0, 3, 10, bank_name);
lcd.show(1, 3, 10, voice_name);
//lcd.show(0, 3, 10, bank_name);
switch (menu_voice_select)
{
case MENU_VOICE_BANK:
lcd.show(0, 2, 1, "[");
lcd.show(0, 11, 1, "]");
lcd.show(0, 13, 1, "]");
lcd.show(1, 2, 1, " ");
lcd.show(1, 13, 1, " ");
break;
case MENU_VOICE_SOUND:
lcd.show(0, 2, 1, " ");
lcd.show(0, 11, 1, " ");
lcd.show(0, 13, 1, " ");
lcd.show(1, 2, 1, "[");
lcd.show(1, 13, 1, "]");
break;
}
draw_favorite_icon(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -6166,192 +5844,4 @@ void string_trim(char *s)
s[i + 1] = '\0';
}
bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
{
b = constrain(b, 0, MAX_BANKS - 1);
v = constrain(v, 0, MAX_VOICES - 1);
char tmp[18];
File myFav;
if (sd_card > 0)
{
sprintf(tmp, "/%s/%d/%d.fav", FAV_CONFIG_PATH, b, v);
#ifdef DEBUG
Serial.print("check if Voice is a Favorite: ");
Serial.print(tmp);
Serial.println();
#endif
if (SD.exists(tmp))
{ //is Favorite
#ifdef DEBUG
Serial.println(" - It is in Favorites.");
#endif
return true;
}
else
{ // it was not a favorite
#ifdef DEBUG
Serial.println(" - It is not in Favorites.");
#endif
return false;
}
} else return false;
}
void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id)
{
b = constrain(b, 0, MAX_BANKS - 1);
v = constrain(v, 0, MAX_VOICES - 1);
char tmp[18];
File myFav;
if (sd_card > 0)
{
sprintf(tmp, "/%s/%d/%d.fav", FAV_CONFIG_PATH, b, v);
if (SD.exists(tmp))
{ //is Favorite
lcd.setCursor(15, 1);
//lcd.print("F");
lcd.write(2); //fav symbol
}
else
{ // it was not a favorite
lcd.setCursor(15, 1);
lcd.print(" ");
}
}
}
bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id)
{
b = constrain(b, 0, MAX_BANKS - 1);
char tmp[18];
if (sd_card > 0)
{
sprintf(tmp, "/%s/%d/hasfav", FAV_CONFIG_PATH, b);
#ifdef DEBUG
Serial.print("check if there is a Favorite in Bank: ");
Serial.print(tmp);
Serial.println();
#endif
if (SD.exists(tmp) )
{ // this bank HAS at least 1 favorite(s)
#ifdef DEBUG
Serial.println("quickcheck found a FAV in bank!");
#endif
return (true);
}
else
{ // no favorites in bank stored
return (false);
#ifdef DEBUG
Serial.println(" - It is no Favorite in current Bank.");
#endif
}
} else return false;
}
void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
{
#ifdef DEBUG
Serial.println("Starting saving Favorite.");
#endif
b = constrain(b, 0, MAX_BANKS - 1);
v = constrain(v, 0, MAX_VOICES - 1);
char tmp[18];
File myFav;
uint8_t i = 0, countfavs = 0;
if (sd_card > 0)
{
sprintf(tmp, "/%s/%d/%d.fav", FAV_CONFIG_PATH, b, v);
#ifdef DEBUG
Serial.println("Save Favorite to SD card...");
Serial.println(tmp);
#endif
if (!SD.exists(tmp))
{ //create Favorite Semaphore
myFav = SD.open(tmp, FILE_WRITE);
myFav.close();
Serial.println("Favorite saved...");
sprintf(tmp, "/%s/%d/hasfav", FAV_CONFIG_PATH, b); //for quick search, bank contains at least 1 favorite
if (!SD.exists(tmp))
{
myFav = SD.open(tmp, FILE_WRITE);
#ifdef DEBUG
Serial.println("write hasfav file to:");
Serial.print(tmp);
#endif
myFav.close();
}
lcd.setCursor(15, 1);
lcd.write(2); //fav symbol
#ifdef DEBUG
Serial.println("Added to Favorites...");
#endif
}
else
{ // delete the file, is no longer a favorite
SD.remove(tmp);
#ifdef DEBUG
Serial.println("Removed from Favorites...");
#endif
for (i = 0; i < 32; i++) { //if no other favs exist in current bank, remove quick search semaphore
sprintf(tmp, "/%s/%d/%d.fav", FAV_CONFIG_PATH, b, i);
if (SD.exists(tmp)) countfavs++;
}
if (countfavs == 0) {
sprintf(tmp, "/%s/%d/hasfav", FAV_CONFIG_PATH, b);
SD.remove(tmp);
#ifdef DEBUG
Serial.println("Fav count in bank:");
Serial.print(countfavs);
Serial.println("Removed hasfav file since no voice in bank flagged as favorite any more");
#endif
}
lcd.setCursor(15, 1);
lcd.print(" "); //remove fav symbol
#ifdef DEBUG
Serial.println("Removed from Favorites...");
#endif
}
}
}
#endif

@ -114,9 +114,8 @@ LCDML_add(80, LCDML_0, 4, "System", NULL);
//LCDML_add(81, LCDML_0_4, 1, "Volume", UI_func_volume);
LCDML_add(81, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(82, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(83, LCDML_0_4, 3, "Favorites", UI_func_favorites);
LCDML_add(84, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(85, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(86, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 86
LCDML_add(83, LCDML_0_4, 3, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(84, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(85, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 85
#endif

@ -89,11 +89,9 @@ LCDML_add(55, LCDML_0_2_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice);
LCDML_add(56, LCDML_0, 3, "System", NULL);
LCDML_add(57, LCDML_0_3, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(58, LCDML_0_3, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(59, LCDML_0_3, 3, "Favorites", UI_func_favorites);
LCDML_add(60, LCDML_0_3, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(61, LCDML_0, 4, "Info", UI_func_information);
LCDML_addAdvanced(62, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 62
LCDML_add(59, LCDML_0_3, 3, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(60, LCDML_0, 4, "Info", UI_func_information);
LCDML_addAdvanced(61, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 61
#endif

@ -287,10 +287,6 @@
#define VOICE_CONFIG_PATH "VCFG"
#define VOICE_CONFIG_NAME "VCFG"
#define FAV_CONFIG_PATH "FAVCFG"
#define FAV_CONFIG_NAME "FAVCFG"
//*************************************************************************************************
//* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!!
//*************************************************************************************************
@ -671,7 +667,6 @@ typedef struct sys_s {
uint8_t mono;
uint8_t soft_midi_thru;
int8_t performance_number;
uint8_t favorites;
} sys_t;
typedef struct configuration_s {

Loading…
Cancel
Save