|
|
@ -152,7 +152,7 @@ const uint8_t meter_bar[5][8] = { |
|
|
|
{B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001} |
|
|
|
{B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const uint8_t special_chars[18][8] = { |
|
|
|
const uint8_t special_chars[19][8] = { |
|
|
|
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [0] 1 small invers
|
|
|
|
{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, B10101, B11101, B11011, B10111, B10001, B11111}, // [1] 2 small invers
|
|
|
|
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [2] 1 OP invers
|
|
|
|
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [2] 1 OP invers
|
|
|
@ -171,7 +171,8 @@ const uint8_t special_chars[18][8] = { |
|
|
|
{B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [15] Level 8
|
|
|
|
{B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [15] Level 8
|
|
|
|
{B00100, B00110, B00101, B00101, B01101, B11101, B11100, B11000}, // [16] Note
|
|
|
|
{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, B11111, B11011, B11011, B11111, B00000} // [17] Disabled 2nd instance symbol
|
|
|
|
{B01110, B10001, B10001, B01110, B00100, B00100, B00110, B00110} // [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
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
enum { SCROLLBAR, BLOCKBAR, METERBAR }; |
|
|
|
enum { SCROLLBAR, BLOCKBAR, METERBAR }; |
|
|
@ -246,6 +247,7 @@ void UI_func_eq_bass(uint8_t param); |
|
|
|
void UI_func_eq_treble(uint8_t param); |
|
|
|
void UI_func_eq_treble(uint8_t param); |
|
|
|
void UI_function_not_enabled(void); |
|
|
|
void UI_function_not_enabled(void); |
|
|
|
void UI_function_not_implemented(uint8_t param); |
|
|
|
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); |
|
|
|
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); |
|
|
|
uint8_t search_accepted_char(uint8_t c); |
|
|
|
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); |
|
|
@ -259,6 +261,10 @@ void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op); |
|
|
|
void lcd_special_chars(uint8_t mode); |
|
|
|
void lcd_special_chars(uint8_t mode); |
|
|
|
void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string); |
|
|
|
void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string); |
|
|
|
void string_trim(char *s); |
|
|
|
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
|
|
|
|
// 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)
|
|
|
@ -270,6 +276,8 @@ LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_displa |
|
|
|
#include "UI_NO_FX.h" |
|
|
|
#include "UI_NO_FX.h" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int favsearcher = 0; |
|
|
|
|
|
|
|
|
|
|
|
// create menu
|
|
|
|
// create menu
|
|
|
|
LCDML_createMenu(_LCDML_DISP_cnt); |
|
|
|
LCDML_createMenu(_LCDML_DISP_cnt); |
|
|
|
|
|
|
|
|
|
|
@ -745,8 +753,11 @@ void lcdml_menu_control(void) |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.println(F("ENC-L long recognized")); |
|
|
|
Serial.println(F("ENC-L long recognized")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
|
|
|
|
MicroDexed[i]->panic(); |
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
encoderDir[ENC_L].reset(); |
|
|
|
encoderDir[ENC_L].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
@ -2036,6 +2047,70 @@ 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) |
|
|
|
void UI_func_stereo_mono(uint8_t param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
@ -3726,6 +3801,161 @@ 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) |
|
|
|
void UI_func_voice_select(uint8_t param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
static uint8_t menu_voice_select = MENU_VOICE_SOUND; |
|
|
|
static uint8_t menu_voice_select = MENU_VOICE_SOUND; |
|
|
@ -3749,6 +3979,8 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
lcd.setCursor(15, 0); |
|
|
|
lcd.setCursor(15, 0); |
|
|
|
lcd.write(1); |
|
|
|
lcd.write(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lcd.createChar(2, (uint8_t*)special_chars[18]); // favorites symbol
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef TEENSY3_6 |
|
|
|
#ifdef TEENSY3_6 |
|
|
|
lcd.createChar(6, (uint8_t*)special_chars[16]); // MIDI activity note symbol
|
|
|
|
lcd.createChar(6, (uint8_t*)special_chars[16]); // MIDI activity note symbol
|
|
|
|
lcd.createChar(7, (uint8_t*)special_chars[16]); // MIDI activity note symbol
|
|
|
|
lcd.createChar(7, (uint8_t*)special_chars[16]); // MIDI activity note symbol
|
|
|
@ -3767,12 +3999,55 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.BT_checkUp()) |
|
|
|
if (LCDML.BT_checkUp()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (menu_voice_select) |
|
|
|
//start : show all presets
|
|
|
|
|
|
|
|
if (configuration.sys.favorites == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case MENU_VOICE_BANK: |
|
|
|
switch (menu_voice_select) |
|
|
|
memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN); |
|
|
|
{ |
|
|
|
bank_tmp = constrain(configuration.performance.bank[selected_instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); |
|
|
|
case MENU_VOICE_BANK: |
|
|
|
configuration.performance.bank[selected_instance_id] = bank_tmp; |
|
|
|
memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN); |
|
|
|
|
|
|
|
bank_tmp = constrain(configuration.performance.bank[selected_instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); |
|
|
|
|
|
|
|
configuration.performance.bank[selected_instance_id] = bank_tmp; |
|
|
|
|
|
|
|
#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; |
|
|
|
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
|
|
|
|
memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN); |
|
|
|
|
|
|
|
voice_tmp = configuration.performance.voice[selected_instance_id] - ENCODER[ENC_R].speed(); |
|
|
|
|
|
|
|
if (voice_tmp < 0 && configuration.performance.bank[selected_instance_id] - 1 >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
configuration.performance.bank[selected_instance_id]--; |
|
|
|
|
|
|
|
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id], 0, MAX_BANKS - 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (voice_tmp < 0 && configuration.performance.bank[selected_instance_id] - 1 <= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
voice_tmp = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (voice_tmp < 0) |
|
|
|
|
|
|
|
voice_tmp = MAX_VOICES + voice_tmp; |
|
|
|
|
|
|
|
configuration.performance.voice[selected_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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 Favs
|
|
|
|
|
|
|
|
if (configuration.sys.favorites == 1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locate_previous_favorite(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(false); |
|
|
|
change_disp_sd(false); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -3780,22 +4055,23 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(true); |
|
|
|
change_disp_sd(true); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
break; |
|
|
|
} else //only non-Favs
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
if (configuration.sys.favorites == 2) |
|
|
|
memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN); |
|
|
|
|
|
|
|
voice_tmp = configuration.performance.voice[selected_instance_id] - ENCODER[ENC_R].speed(); |
|
|
|
|
|
|
|
if (voice_tmp < 0 && configuration.performance.bank[selected_instance_id] - 1 >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
configuration.performance.bank[selected_instance_id]--; |
|
|
|
locate_previous_non_favorite(); |
|
|
|
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id], 0, MAX_BANKS - 1); |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
} |
|
|
|
change_disp_sd(false); |
|
|
|
else if (voice_tmp < 0 && configuration.performance.bank[selected_instance_id] - 1 <= 0) |
|
|
|
#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) |
|
|
|
{ |
|
|
|
{ |
|
|
|
voice_tmp = 0; |
|
|
|
locate_random_non_favorite(); |
|
|
|
} |
|
|
|
|
|
|
|
if (voice_tmp < 0) |
|
|
|
|
|
|
|
voice_tmp = MAX_VOICES + voice_tmp; |
|
|
|
|
|
|
|
configuration.performance.voice[selected_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(false); |
|
|
|
change_disp_sd(false); |
|
|
@ -3804,17 +4080,19 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(true); |
|
|
|
change_disp_sd(true); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
break; |
|
|
|
}
|
|
|
|
} |
|
|
|
} //end UP
|
|
|
|
} |
|
|
|
|
|
|
|
else if (LCDML.BT_checkDown()) |
|
|
|
else if (LCDML.BT_checkDown()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (menu_voice_select) |
|
|
|
//start : show all presets
|
|
|
|
|
|
|
|
if (configuration.sys.favorites == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case MENU_VOICE_BANK: |
|
|
|
switch (menu_voice_select) |
|
|
|
memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN); |
|
|
|
{ |
|
|
|
bank_tmp = constrain(configuration.performance.bank[selected_instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); |
|
|
|
case MENU_VOICE_BANK: |
|
|
|
configuration.performance.bank[selected_instance_id] = bank_tmp; |
|
|
|
memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN); |
|
|
|
|
|
|
|
bank_tmp = constrain(configuration.performance.bank[selected_instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); |
|
|
|
|
|
|
|
configuration.performance.bank[selected_instance_id] = bank_tmp; |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(false); |
|
|
|
change_disp_sd(false); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -3823,20 +4101,20 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
change_disp_sd(true); |
|
|
|
change_disp_sd(true); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN); |
|
|
|
memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN); |
|
|
|
voice_tmp = configuration.performance.voice[selected_instance_id] + ENCODER[ENC_R].speed(); |
|
|
|
voice_tmp = configuration.performance.voice[selected_instance_id] + ENCODER[ENC_R].speed(); |
|
|
|
if (voice_tmp >= MAX_VOICES && configuration.performance.bank[selected_instance_id] + 1 < MAX_BANKS) |
|
|
|
if (voice_tmp >= MAX_VOICES && configuration.performance.bank[selected_instance_id] + 1 < MAX_BANKS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
voice_tmp %= MAX_VOICES; |
|
|
|
voice_tmp %= MAX_VOICES; |
|
|
|
configuration.performance.bank[selected_instance_id]++; |
|
|
|
configuration.performance.bank[selected_instance_id]++; |
|
|
|
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id], 0, MAX_BANKS - 1); |
|
|
|
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id], 0, MAX_BANKS - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (voice_tmp >= MAX_VOICES && configuration.performance.bank[selected_instance_id] + 1 >= MAX_BANKS) |
|
|
|
else if (voice_tmp >= MAX_VOICES && configuration.performance.bank[selected_instance_id] + 1 >= MAX_BANKS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
voice_tmp = MAX_VOICES - 1; |
|
|
|
voice_tmp = MAX_VOICES - 1; |
|
|
|
} |
|
|
|
} |
|
|
|
configuration.performance.voice[selected_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1); |
|
|
|
configuration.performance.voice[selected_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(false); |
|
|
|
change_disp_sd(false); |
|
|
@ -3847,6 +4125,46 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
break; |
|
|
|
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()) |
|
|
|
else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonPressed()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -3890,24 +4208,28 @@ void UI_func_voice_select(uint8_t param) |
|
|
|
|
|
|
|
|
|
|
|
lcd.show(0, 0, 2, configuration.performance.bank[selected_instance_id]); |
|
|
|
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(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1); |
|
|
|
lcd.show(0, 3, 10, bank_name); |
|
|
|
lcd.show(0, 3, 8, bank_name); |
|
|
|
lcd.show(1, 3, 10, voice_name); |
|
|
|
lcd.show(1, 3, 10, voice_name); |
|
|
|
|
|
|
|
//lcd.show(0, 3, 10, bank_name);
|
|
|
|
|
|
|
|
|
|
|
|
switch (menu_voice_select) |
|
|
|
switch (menu_voice_select) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case MENU_VOICE_BANK: |
|
|
|
case MENU_VOICE_BANK: |
|
|
|
lcd.show(0, 2, 1, "["); |
|
|
|
lcd.show(0, 2, 1, "["); |
|
|
|
lcd.show(0, 13, 1, "]"); |
|
|
|
lcd.show(0, 11, 1, "]"); |
|
|
|
lcd.show(1, 2, 1, " "); |
|
|
|
lcd.show(1, 2, 1, " "); |
|
|
|
lcd.show(1, 13, 1, " "); |
|
|
|
lcd.show(1, 13, 1, " "); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
lcd.show(0, 2, 1, " "); |
|
|
|
lcd.show(0, 2, 1, " "); |
|
|
|
lcd.show(0, 13, 1, " "); |
|
|
|
lcd.show(0, 11, 1, " "); |
|
|
|
lcd.show(1, 2, 1, "["); |
|
|
|
lcd.show(1, 2, 1, "["); |
|
|
|
lcd.show(1, 13, 1, "]"); |
|
|
|
lcd.show(1, 13, 1, "]"); |
|
|
|
break; |
|
|
|
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 *********
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
@ -5844,4 +6166,192 @@ void string_trim(char *s) |
|
|
|
s[i + 1] = '\0'; |
|
|
|
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 |
|
|
|
#endif |
|
|
|