From 87e135eb507333c704c74bf8f51b44800bcd4fa0 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 13 May 2020 13:48:42 +0200 Subject: [PATCH] Functions per instance can now change directly between them. --- MicroDexed.ino | 3 +- UI.hpp | 1093 ++++++++++++++++++++++++++++++++++++++---------- config.h | 6 +- 3 files changed, 870 insertions(+), 232 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index d376685..388e0ab 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1383,7 +1383,8 @@ void initial_values_from_eeprom(bool init) MicroDexed[instance_id]->doRefreshVoice(); MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); MicroDexed[instance_id]->setMaxNotes(configuration.dexed[instance_id].polyphony); - + MicroDexed[instance_id]->setMonoMode(configuration.sys.mono); + #if defined(USE_FX) //chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true)); //chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true)); diff --git a/UI.hpp b/UI.hpp index f0d55cf..6732e67 100644 --- a/UI.hpp +++ b/UI.hpp @@ -124,20 +124,38 @@ const uint8_t scroll_bar[5][8] = { {B10001, B10001, B10001, B10001, B10001, B10001, B11111, B11111} // scrollbar bottom }; -const uint8_t block_bar[5][8] = { +/* + const uint8_t block_bar[5][8] = { {B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000}, {B11000, B11000, B11000, B11000, B11000, B11000, B11000, B11000}, {B11100, B11100, B11100, B11100, B11100, B11100, B11100, B11100}, {B11110, B11110, B11110, B11110, B11110, B11110, B11110, B11110}, {B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111} -}; + }; -const uint8_t meter_bar[5][8] = { + const uint8_t meter_bar[5][8] = { {B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000}, {B01000, B01000, B01000, B01000, B01000, B01000, B01000, B01000}, {B00100, B00100, B00100, B00100, B00100, B00100, B00100, B00100}, {B00010, B00010, B00010, B00010, B00010, B00010, B00010, B00010}, {B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001} + }; +*/ + +const uint8_t block_bar[5][8] = { + {B00000, B10000, B10000, B10000, B10000, B10000, B10000, B00000}, + {B00000, B11000, B11000, B11000, B11000, B11000, B11000, B00000}, + {B00000, B11100, B11100, B11100, B11100, B11100, B11100, B00000}, + {B00000, B11110, B11110, B11110, B11110, B11110, B11110, B00000}, + {B00000, B11111, B11111, B11111, B11111, B11111, B11111, B00000} +}; + +const uint8_t meter_bar[5][8] = { + {B00000, B10000, B10000, B10000, B10000, B10000, B10000, B00000}, + {B00000, B01000, B01000, B01000, B01000, B01000, B01000, B00000}, + {B00000, B00100, B00100, B00100, B00100, B00100, B00100, B00000}, + {B00000, B00010, B00010, B00010, B00010, B00010, B00010, B00000}, + {B00000, B00001, B00001, B00001, B00001, B00001, B00001, B00000} }; const uint8_t inverse_num[2][8] = { @@ -1004,16 +1022,36 @@ void UI_func_chorus_frequency(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_float("Chorus Frq.", configuration.fx.chorus_frequency[instance_id], 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif + } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.chorus_frequency[instance_id] = constrain(configuration.fx.chorus_frequency[instance_id] + ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX); else if (LCDML.BT_checkUp()) configuration.fx.chorus_frequency[instance_id] = constrain(configuration.fx.chorus_frequency[instance_id] - ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_float("Chorus Frq.", configuration.fx.chorus_frequency[instance_id], 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, false); @@ -1024,11 +1062,9 @@ void UI_func_chorus_frequency(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_frequency[0]), configuration.fx.chorus_frequency[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_frequency[0]), configuration.fx.chorus_frequency[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_frequency[1]), configuration.fx.chorus_frequency[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_frequency[1]), configuration.fx.chorus_frequency[1]); #endif } } @@ -1048,6 +1084,14 @@ void UI_func_chorus_waveform(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Chorus Waveform")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1056,6 +1100,17 @@ void UI_func_chorus_waveform(uint8_t param) configuration.fx.chorus_waveform[instance_id] = constrain(configuration.fx.chorus_waveform[instance_id] + 1, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX); else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) configuration.fx.chorus_waveform[instance_id] = constrain(configuration.fx.chorus_waveform[instance_id] - 1, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif lcd.setCursor(0, 1); switch (configuration.fx.chorus_waveform[instance_id]) @@ -1078,11 +1133,9 @@ void UI_func_chorus_waveform(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_waveform[0]), configuration.fx.chorus_waveform[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_waveform[0]), configuration.fx.chorus_waveform[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_waveform[1]), configuration.fx.chorus_waveform[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_waveform[1]), configuration.fx.chorus_waveform[1]); #endif } } @@ -1102,16 +1155,35 @@ void UI_func_chorus_depth(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Dpt.", configuration.fx.chorus_depth[instance_id], 1.0, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.chorus_depth[instance_id] = constrain(configuration.fx.chorus_depth[instance_id] + ENCODER[ENC_R].speed(), CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX); else if (LCDML.BT_checkUp()) configuration.fx.chorus_depth[instance_id] = constrain(configuration.fx.chorus_depth[instance_id] - ENCODER[ENC_R].speed(), CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Chorus Dpt.", configuration.fx.chorus_depth[instance_id], 1.0, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 3, false, false, false, false); @@ -1123,12 +1195,9 @@ void UI_func_chorus_depth(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_depth[0]), configuration.fx.chorus_depth[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_depth[0]), configuration.fx.chorus_depth[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_depth[1]), configuration.fx.chorus_depth[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_depth[1]), configuration.fx.chorus_depth[1]); #endif } } @@ -1148,16 +1217,35 @@ void UI_func_chorus_level(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Lvl.", configuration.fx.chorus_level[instance_id], 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.chorus_level[instance_id] = constrain(configuration.fx.chorus_level[instance_id] + ENCODER[ENC_R].speed(), CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); else if (LCDML.BT_checkUp()) configuration.fx.chorus_level[instance_id] = constrain(configuration.fx.chorus_level[instance_id] - ENCODER[ENC_R].speed(), CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Chorus Lvl.", configuration.fx.chorus_level[instance_id], 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, false); @@ -1172,11 +1260,9 @@ void UI_func_chorus_level(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_level[0]), configuration.fx.chorus_level[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_level[0]), configuration.fx.chorus_level[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_level[1]), configuration.fx.chorus_level[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_level[1]), configuration.fx.chorus_level[1]); #endif } } @@ -1185,7 +1271,6 @@ void UI_func_delay_time(uint8_t param) { static uint8_t instance_id; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1197,16 +1282,35 @@ void UI_func_delay_time(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Time", configuration.fx.delay_time[instance_id], 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.delay_time[instance_id] = constrain(configuration.fx.delay_time[instance_id] + ENCODER[ENC_R].speed(), DELAY_TIME_MIN, DELAY_TIME_MAX); else if (LCDML.BT_checkUp()) configuration.fx.delay_time[instance_id] = constrain(configuration.fx.delay_time[instance_id] - ENCODER[ENC_R].speed(), DELAY_TIME_MIN, DELAY_TIME_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Delay Time", configuration.fx.delay_time[instance_id], 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, false, true); @@ -1218,11 +1322,9 @@ void UI_func_delay_time(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_time[0]), configuration.fx.delay_time[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_time[0]), configuration.fx.delay_time[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_time[1]), configuration.fx.delay_time[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_time[1]), configuration.fx.delay_time[1]); #endif } } @@ -1239,18 +1341,38 @@ void UI_func_delay_feedback(uint8_t param) instance_id = 1; else instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.delay_feedback[instance_id] = constrain(configuration.fx.delay_feedback[instance_id] + ENCODER[ENC_R].speed(), DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX); else if (LCDML.BT_checkUp()) configuration.fx.delay_feedback[instance_id] = constrain(configuration.fx.delay_feedback[instance_id] - ENCODER[ENC_R].speed(), DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false, false); @@ -1262,11 +1384,9 @@ void UI_func_delay_feedback(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_feedback[0]), configuration.fx.delay_feedback[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_feedback[0]), configuration.fx.delay_feedback[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_feedback[1]), configuration.fx.delay_feedback[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_feedback[1]), configuration.fx.delay_feedback[1]); #endif } } @@ -1275,9 +1395,6 @@ void UI_func_delay_level(uint8_t param) { static uint8_t instance_id; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1289,16 +1406,35 @@ void UI_func_delay_level(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Lvl.", configuration.fx.delay_level[instance_id], 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.delay_level[instance_id] = constrain(configuration.fx.delay_level[instance_id] + ENCODER[ENC_R].speed(), DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); else if (LCDML.BT_checkUp()) configuration.fx.delay_level[instance_id] = constrain(configuration.fx.delay_level[instance_id] - ENCODER[ENC_R].speed(), DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Delay Lvl.", configuration.fx.delay_level[instance_id], 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false, false); @@ -1310,11 +1446,9 @@ void UI_func_delay_level(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_level[0]), configuration.fx.delay_level[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_level[0]), configuration.fx.delay_level[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_level[1]), configuration.fx.delay_level[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_level[1]), configuration.fx.delay_level[1]); #endif } } @@ -1334,16 +1468,35 @@ void UI_func_reverb_send(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Reverb Send", configuration.fx.reverb_send[instance_id], 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_send[instance_id] = constrain(configuration.fx.reverb_send[instance_id] + ENCODER[ENC_R].speed(), REVERB_SEND_MIN, REVERB_SEND_MAX); else if (LCDML.BT_checkUp()) configuration.fx.reverb_send[instance_id] = constrain(configuration.fx.reverb_send[instance_id] - ENCODER[ENC_R].speed(), REVERB_SEND_MIN, REVERB_SEND_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Reverb Send", configuration.fx.reverb_send[instance_id], 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false, false); @@ -1356,11 +1509,9 @@ void UI_func_reverb_send(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_send[0]), configuration.fx.reverb_send[0]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_send[0]), configuration.fx.reverb_send[0]); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_send[1]), configuration.fx.reverb_send[1]); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_send[1]), configuration.fx.reverb_send[1]); #endif } } @@ -1380,16 +1531,35 @@ void UI_func_filter_cutoff(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Filter Cut", configuration.dexed[instance_id].filter_cutoff, 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].filter_cutoff = constrain(configuration.dexed[instance_id].filter_cutoff + ENCODER[ENC_R].speed(), FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].filter_cutoff = constrain(configuration.dexed[instance_id].filter_cutoff - ENCODER[ENC_R].speed(), FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Filter Cut", configuration.dexed[instance_id].filter_cutoff, 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false, false); @@ -1401,11 +1571,9 @@ void UI_func_filter_cutoff(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].filter_cutoff), configuration.dexed[0].filter_cutoff); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].filter_cutoff), configuration.dexed[0].filter_cutoff); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].filter_cutoff), configuration.dexed[1].filter_cutoff); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].filter_cutoff), configuration.dexed[1].filter_cutoff); #endif } } @@ -1425,16 +1593,35 @@ void UI_func_filter_resonance(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Filter Res", configuration.dexed[instance_id].filter_resonance, 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].filter_resonance = constrain(configuration.dexed[instance_id].filter_resonance + ENCODER[ENC_R].speed(), FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].filter_resonance = constrain(configuration.dexed[instance_id].filter_resonance - ENCODER[ENC_R].speed(), FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Filter Res", configuration.dexed[instance_id].filter_resonance, 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false, false); @@ -1446,11 +1633,9 @@ void UI_func_filter_resonance(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].filter_resonance), configuration.dexed[0].filter_resonance); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].filter_resonance), configuration.dexed[0].filter_resonance); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].filter_resonance), configuration.dexed[1].filter_resonance); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].filter_resonance), configuration.dexed[1].filter_resonance); #endif } } @@ -1471,33 +1656,50 @@ void UI_func_transpose(uint8_t param) lcd_special_chars(METERBAR); lcd_display_meter_int("Transpose", configuration.dexed[instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 3, false, false, true, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose + ENCODER[ENC_R].speed(), TRANSPOSE_MIN, TRANSPOSE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose - ENCODER[ENC_R].speed(), TRANSPOSE_MIN, TRANSPOSE_MAX); - } - - lcd_display_meter_int("Transpose", configuration.dexed[instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 3, false, false, true, true); - - MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE] = configuration.dexed[instance_id].transpose; - MicroDexed[instance_id]->notesOff(); - } - +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif + } + + lcd_display_meter_int("Transpose", configuration.dexed[instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 3, false, false, true, true); + + MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE] = configuration.dexed[instance_id].transpose; + MicroDexed[instance_id]->notesOff(); + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].transpose), configuration.dexed[0].transpose); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].transpose), configuration.dexed[0].transpose); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].transpose), configuration.dexed[1].transpose); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].transpose), configuration.dexed[1].transpose); #endif } } @@ -1517,16 +1719,35 @@ void UI_func_tune(uint8_t param) lcd_special_chars(METERBAR); lcd_display_meter_int("Fine Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune + ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune - ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_meter_int("Fine Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, false); @@ -1539,11 +1760,9 @@ void UI_func_tune(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].tune), configuration.dexed[0].tune); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].tune), configuration.dexed[0].tune); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].tune), configuration.dexed[1].tune); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].tune), configuration.dexed[1].tune); #endif } } @@ -1563,14 +1782,33 @@ void UI_func_midi_channel(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("MIDI Channel")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (LCDML.BT_checkDown()) + if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); - else if (LCDML.BT_checkUp()) + else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif lcd.setCursor(0, 1); if (configuration.dexed[instance_id].midi_channel == 0) @@ -1587,11 +1825,9 @@ void UI_func_midi_channel(uint8_t param) { // you can here reset some global vars or do nothing encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].midi_channel), configuration.dexed[0].midi_channel); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].midi_channel), configuration.dexed[0].midi_channel); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].midi_channel), configuration.dexed[1].midi_channel); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].midi_channel), configuration.dexed[1].midi_channel); #endif } } @@ -1626,16 +1862,35 @@ void UI_func_lowest_note(uint8_t param) lcd.print(F("[")); lcd.print(note_name); lcd.print(F("]")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].lowest_note = constrain(configuration.dexed[instance_id].lowest_note + ENCODER[ENC_R].speed(), INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].lowest_note = constrain(configuration.dexed[instance_id].lowest_note - ENCODER[ENC_R].speed(), INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } getNoteName(note_name, configuration.dexed[instance_id].lowest_note); @@ -1646,11 +1901,9 @@ void UI_func_lowest_note(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].lowest_note), configuration.dexed[0].lowest_note); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].lowest_note), configuration.dexed[0].lowest_note); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].lowest_note), configuration.dexed[1].lowest_note); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].lowest_note), configuration.dexed[1].lowest_note); #endif } } @@ -1676,16 +1929,35 @@ void UI_func_highest_note(uint8_t param) lcd.print(F("[")); lcd.print(note_name); lcd.print(F("]")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].highest_note = constrain(configuration.dexed[instance_id].highest_note + ENCODER[ENC_R].speed(), INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].highest_note = constrain(configuration.dexed[instance_id].highest_note - ENCODER[ENC_R].speed(), INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } getNoteName(note_name, configuration.dexed[instance_id].highest_note); @@ -1696,11 +1968,9 @@ void UI_func_highest_note(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].highest_note), configuration.dexed[0].highest_note); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].highest_note), configuration.dexed[0].highest_note); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].highest_note), configuration.dexed[1].highest_note); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].highest_note), configuration.dexed[1].highest_note); #endif } } @@ -1719,13 +1989,10 @@ void UI_func_sound_intensity(uint8_t param) instance_id = 0; lcd_special_chars(BLOCKBAR); - - lcd_active_instance_number(instance_id); - lcd_display_bar_int("Voice Level", configuration.dexed[instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, true); #if NUM_DEXED > 1 - lcd_display_bar_int("Voice Level", configuration.dexed[instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, true); + lcd_active_instance_number(instance_id); lcd.setCursor(15, 0); lcd.write(5); lcd.setCursor(15, 1); @@ -1744,7 +2011,7 @@ void UI_func_sound_intensity(uint8_t param) else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity - ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); #if NUM_DEXED > 1 - if (LCDML.BT_checkEnter()) + else if (LCDML.BT_checkEnter()) { instance_id = !instance_id; lcd_active_instance_number(instance_id); @@ -1764,11 +2031,9 @@ void UI_func_sound_intensity(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].sound_intensity), configuration.dexed[0].sound_intensity); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].sound_intensity), configuration.dexed[0].sound_intensity); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].sound_intensity), configuration.dexed[1].sound_intensity); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].sound_intensity), configuration.dexed[1].sound_intensity); #endif } } @@ -1777,8 +2042,6 @@ void UI_func_panorama(uint8_t param) { static uint8_t instance_id; - - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1802,10 +2065,21 @@ void UI_func_panorama(uint8_t param) if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (LCDML.BT_checkDown() && configuration.sys.mono == 0) + if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down() && configuration.sys.mono == 0) configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan + ENCODER[ENC_R].speed(), PANORAMA_MIN, PANORAMA_MAX); - else if (LCDML.BT_checkUp() && configuration.sys.mono == 0) + else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up() && configuration.sys.mono == 0) configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan - ENCODER[ENC_R].speed(), PANORAMA_MIN, PANORAMA_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif if (configuration.sys.mono == 0) { @@ -1818,11 +2092,9 @@ void UI_func_panorama(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pan), configuration.dexed[0].pan); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pan), configuration.dexed[0].pan); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pan), configuration.dexed[1].pan); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pan), configuration.dexed[1].pan); #endif } } @@ -1894,30 +2166,52 @@ void UI_func_stereo_mono(uint8_t param) } } -#if NUM_DEXED == 1 +//#if NUM_DEXED == 1 void UI_func_polyphony(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Polyphony", configuration.dexed[instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 3, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony + ENCODER[ENC_R].speed(), POLYPHONY_MIN, POLYPHONY_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony - ENCODER[ENC_R].speed(), POLYPHONY_MIN, POLYPHONY_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Polyphony", configuration.dexed[instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 3, false, false, false, false); @@ -1929,17 +2223,16 @@ void UI_func_polyphony(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].polyphony), configuration.dexed[0].polyphony); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].polyphony), configuration.dexed[0].polyphony); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].polyphony), configuration.dexed[1].polyphony); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].polyphony), configuration.dexed[1].polyphony); #endif } } -#else -void UI_func_polyphony(uint8_t param) -{ +/* + #else + void UI_func_polyphony(uint8_t param) + { char poly_value_string[3]; static uint8_t poly_instance_id; @@ -2014,8 +2307,9 @@ void UI_func_polyphony(uint8_t param) EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].polyphony), configuration.dexed[0].polyphony); EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].polyphony), configuration.dexed[1].polyphony); } -} -#endif + } + #endif +*/ void UI_func_engine(uint8_t param) { @@ -2032,16 +2326,35 @@ void UI_func_engine(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Engine")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine + 1, ENGINE_MIN, ENGINE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine - 1, ENGINE_MIN, ENGINE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setEngineType(configuration.dexed[instance_id].engine); @@ -2064,11 +2377,9 @@ void UI_func_engine(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].engine), configuration.dexed[0].engine); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].engine), configuration.dexed[0].engine); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].engine), configuration.dexed[1].engine); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].engine), configuration.dexed[1].engine); #endif } } @@ -2088,16 +2399,35 @@ void UI_func_mono_poly(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Mono/Polyphonic")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly + 1, MONOPOLY_MIN, MONOPOLY_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly - 1, MONOPOLY_MIN, MONOPOLY_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setMonoMode(!configuration.dexed[instance_id].monopoly); @@ -2117,11 +2447,9 @@ void UI_func_mono_poly(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].monopoly), configuration.dexed[0].monopoly); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].monopoly), configuration.dexed[0].monopoly); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].monopoly), configuration.dexed[1].monopoly); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].monopoly), configuration.dexed[1].monopoly); #endif } } @@ -2130,28 +2458,46 @@ void UI_func_note_refresh(uint8_t param) { static uint8_t instance_id; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; + else + instance_id = 0; lcd.setCursor(0, 0); lcd.print(F("Note Refresh")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].note_refresh = constrain(configuration.dexed[instance_id].note_refresh + 1, NOTE_REFRESH_MIN, NOTE_REFRESH_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].note_refresh = constrain(configuration.dexed[instance_id].note_refresh - 1, NOTE_REFRESH_MIN, NOTE_REFRESH_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setRefreshMode(configuration.dexed[instance_id].note_refresh); @@ -2171,18 +2517,16 @@ void UI_func_note_refresh(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].note_refresh), configuration.dexed[0].note_refresh); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].note_refresh), configuration.dexed[0].note_refresh); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].note_refresh), configuration.dexed[1].note_refresh); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].note_refresh), configuration.dexed[1].note_refresh); #endif } } void UI_func_pb_range(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { @@ -2195,16 +2539,35 @@ void UI_func_pb_range(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, 1.0, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].pb_range = constrain(configuration.dexed[instance_id].pb_range + ENCODER[ENC_R].speed(), PB_RANGE_MIN, PB_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].pb_range = constrain(configuration.dexed[instance_id].pb_range - ENCODER[ENC_R].speed(), PB_RANGE_MIN, PB_RANGE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, 1.0, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, false); @@ -2216,11 +2579,9 @@ void UI_func_pb_range(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pb_range), configuration.dexed[0].pb_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pb_range), configuration.dexed[0].pb_range); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pb_range), configuration.dexed[1].pb_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pb_range), configuration.dexed[1].pb_range); #endif } } @@ -2240,16 +2601,35 @@ void UI_func_pb_step(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, 1.0, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].pb_step = constrain(configuration.dexed[instance_id].pb_step + ENCODER[ENC_R].speed(), PB_STEP_MIN, PB_STEP_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].pb_step = constrain(configuration.dexed[instance_id].pb_step - ENCODER[ENC_R].speed(), PB_STEP_MIN, PB_STEP_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, 1.0, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, false); @@ -2261,11 +2641,9 @@ void UI_func_pb_step(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pb_step), configuration.dexed[0].pb_step); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pb_step), configuration.dexed[0].pb_step); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pb_step), configuration.dexed[1].pb_step); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pb_step), configuration.dexed[1].pb_step); #endif } } @@ -2285,16 +2663,35 @@ void UI_func_mw_range(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, 1.0, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].mw_range = constrain(configuration.dexed[instance_id].mw_range + ENCODER[ENC_R].speed(), MW_RANGE_MIN, MW_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].mw_range = constrain(configuration.dexed[instance_id].mw_range - ENCODER[ENC_R].speed(), MW_RANGE_MIN, MW_RANGE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, 1.0, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, false); @@ -2306,11 +2703,9 @@ void UI_func_mw_range(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_range), configuration.dexed[0].mw_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_range), configuration.dexed[0].mw_range); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_range), configuration.dexed[1].mw_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_range), configuration.dexed[1].mw_range); #endif } } @@ -2330,16 +2725,35 @@ void UI_func_mw_assign(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("MW Assign")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].mw_assign = constrain(configuration.dexed[instance_id].mw_assign + 1, MW_ASSIGN_MIN, MW_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].mw_assign = constrain(configuration.dexed[instance_id].mw_assign - 1, MW_ASSIGN_MIN, MW_ASSIGN_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode); @@ -2377,11 +2791,9 @@ void UI_func_mw_assign(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_assign), configuration.dexed[0].mw_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_assign), configuration.dexed[0].mw_assign); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_assign), configuration.dexed[1].mw_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_assign), configuration.dexed[1].mw_assign); #endif } } @@ -2401,16 +2813,35 @@ void UI_func_mw_mode(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("MW Mode")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].mw_mode = constrain(configuration.dexed[instance_id].mw_mode + 1, MW_MODE_MIN, MW_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].mw_mode = constrain(configuration.dexed[instance_id].mw_mode - 1, MW_MODE_MIN, MW_MODE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode); @@ -2434,11 +2865,9 @@ void UI_func_mw_mode(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_mode), configuration.dexed[0].mw_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_mode), configuration.dexed[0].mw_mode); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_mode), configuration.dexed[1].mw_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_mode), configuration.dexed[1].mw_mode); #endif } } @@ -2458,16 +2887,36 @@ void UI_func_fc_range(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, 1.0, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif + } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].fc_range = constrain(configuration.dexed[instance_id].fc_range + ENCODER[ENC_R].speed(), FC_RANGE_MIN, FC_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].fc_range = constrain(configuration.dexed[instance_id].fc_range - ENCODER[ENC_R].speed(), FC_RANGE_MIN, FC_RANGE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, 1.0, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, false); @@ -2479,11 +2928,9 @@ void UI_func_fc_range(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_range), configuration.dexed[0].fc_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_range), configuration.dexed[0].fc_range); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_range), configuration.dexed[1].fc_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_range), configuration.dexed[1].fc_range); #endif } } @@ -2503,16 +2950,35 @@ void UI_func_fc_assign(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("FC Assign")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].fc_assign = constrain(configuration.dexed[instance_id].fc_assign + 1, FC_ASSIGN_MIN, FC_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].fc_assign = constrain(configuration.dexed[instance_id].fc_assign - 1, FC_ASSIGN_MIN, FC_ASSIGN_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode); @@ -2550,11 +3016,9 @@ void UI_func_fc_assign(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_assign), configuration.dexed[0].fc_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_assign), configuration.dexed[0].fc_assign); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_assign), configuration.dexed[1].fc_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_assign), configuration.dexed[1].fc_assign); #endif } } @@ -2574,16 +3038,35 @@ void UI_func_fc_mode(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("FC Mode")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].fc_mode = constrain(configuration.dexed[instance_id].fc_mode + 1, FC_MODE_MIN, FC_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].fc_mode = constrain(configuration.dexed[instance_id].fc_mode - 1, FC_MODE_MIN, FC_MODE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode); @@ -2607,11 +3090,9 @@ void UI_func_fc_mode(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_mode), configuration.dexed[0].fc_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_mode), configuration.dexed[0].fc_mode); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_mode), configuration.dexed[1].fc_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_mode), configuration.dexed[1].fc_mode); #endif } } @@ -2631,16 +3112,35 @@ void UI_func_bc_range(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, 1.0, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].bc_range = constrain(configuration.dexed[instance_id].bc_range + ENCODER[ENC_R].speed(), BC_RANGE_MIN, BC_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].bc_range = constrain(configuration.dexed[instance_id].bc_range - ENCODER[ENC_R].speed(), BC_RANGE_MIN, BC_RANGE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, 1.0, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, false); @@ -2652,11 +3152,9 @@ void UI_func_bc_range(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_range), configuration.dexed[0].bc_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_range), configuration.dexed[0].bc_range); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_range), configuration.dexed[1].bc_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_range), configuration.dexed[1].bc_range); #endif } } @@ -2676,16 +3174,35 @@ void UI_func_bc_assign(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("BC Assign")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].bc_assign = constrain(configuration.dexed[instance_id].bc_assign + 1, BC_ASSIGN_MIN, BC_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].bc_assign = constrain(configuration.dexed[instance_id].bc_assign - 1, BC_ASSIGN_MIN, BC_ASSIGN_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode); @@ -2723,11 +3240,9 @@ void UI_func_bc_assign(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_assign), configuration.dexed[0].bc_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_assign), configuration.dexed[0].bc_assign); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_assign), configuration.dexed[1].bc_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_assign), configuration.dexed[1].bc_assign); #endif } } @@ -2747,16 +3262,35 @@ void UI_func_bc_mode(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("BC Mode")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].bc_mode = constrain(configuration.dexed[instance_id].bc_mode + 1, BC_MODE_MIN, BC_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].bc_mode = constrain(configuration.dexed[instance_id].bc_mode - 1, BC_MODE_MIN, BC_MODE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode); @@ -2780,11 +3314,9 @@ void UI_func_bc_mode(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_mode), configuration.dexed[0].bc_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_mode), configuration.dexed[0].bc_mode); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_mode), configuration.dexed[1].bc_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_mode), configuration.dexed[1].bc_mode); #endif } } @@ -2804,16 +3336,35 @@ void UI_func_at_range(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, 1.0, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].at_range = constrain(configuration.dexed[instance_id].at_range + ENCODER[ENC_R].speed(), AT_RANGE_MIN, AT_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].at_range = constrain(configuration.dexed[instance_id].at_range - ENCODER[ENC_R].speed(), AT_RANGE_MIN, AT_RANGE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, 1.0, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, false); @@ -2825,11 +3376,9 @@ void UI_func_at_range(uint8_t param) { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_range), configuration.dexed[0].at_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_range), configuration.dexed[0].at_range); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_range), configuration.dexed[1].at_range); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_range), configuration.dexed[1].at_range); #endif } } @@ -2849,16 +3398,35 @@ void UI_func_at_assign(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("AT Assign")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].at_assign = constrain(configuration.dexed[instance_id].at_assign + 1, AT_ASSIGN_MIN, AT_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].at_assign = constrain(configuration.dexed[instance_id].at_assign - 1, AT_ASSIGN_MIN, AT_ASSIGN_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode); @@ -2896,11 +3464,9 @@ void UI_func_at_assign(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_assign), configuration.dexed[0].at_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_assign), configuration.dexed[0].at_assign); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_assign), configuration.dexed[1].at_assign); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_assign), configuration.dexed[1].at_assign); #endif } } @@ -2920,16 +3486,35 @@ void UI_func_at_mode(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("AT Mode")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].at_mode = constrain(configuration.dexed[instance_id].at_mode + 1, AT_MODE_MIN, AT_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].at_mode = constrain(configuration.dexed[instance_id].at_mode - 1, AT_MODE_MIN, AT_MODE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode); @@ -2953,11 +3538,9 @@ void UI_func_at_mode(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_mode), configuration.dexed[0].at_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_mode), configuration.dexed[0].at_mode); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_mode), configuration.dexed[1].at_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_mode), configuration.dexed[1].at_mode); #endif } } @@ -2977,16 +3560,35 @@ void UI_func_portamento_mode(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Portamento Mode")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].portamento_mode = constrain(configuration.dexed[instance_id].portamento_mode + 1, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].portamento_mode = constrain(configuration.dexed[instance_id].portamento_mode - 1, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); @@ -3012,11 +3614,9 @@ void UI_func_portamento_mode(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_mode), configuration.dexed[0].portamento_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_mode), configuration.dexed[0].portamento_mode); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_mode), configuration.dexed[1].portamento_mode); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_mode), configuration.dexed[1].portamento_mode); #endif } } @@ -3036,16 +3636,35 @@ void UI_func_portamento_glissando(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Portam. Gliss.")); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando + 1, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando - 1, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); @@ -3065,11 +3684,9 @@ void UI_func_portamento_glissando(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_glissando), configuration.dexed[0].portamento_glissando); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_glissando), configuration.dexed[0].portamento_glissando); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_glissando), configuration.dexed[1].portamento_glissando); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_glissando), configuration.dexed[1].portamento_glissando); #endif } } @@ -3089,33 +3706,49 @@ void UI_func_portamento_time(uint8_t param) lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, 1.0, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, true); + +#if NUM_DEXED > 1 + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time + ENCODER[ENC_R].speed(), PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time - ENCODER[ENC_R].speed(), PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, 1.0, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, false); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); - } if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); - if (instance_id == 0) - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_time), configuration.dexed[0].portamento_time); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_time), configuration.dexed[0].portamento_time); #if NUM_DEXED > 1 - else - EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_time), configuration.dexed[1].portamento_time); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_time), configuration.dexed[1].portamento_time); #endif } } @@ -4848,7 +5481,7 @@ void lcd_display_meter_float(const char* title, float value, float factor, float if (vi == 0) { - lcd.write((uint8_t)(vf / 2.0 + 0.5)); + lcd.write((uint8_t)(vf / 2.0)); for (uint8_t i = 1; i < cols; i++) lcd.print(F(" ")); // empty block } @@ -4863,7 +5496,7 @@ void lcd_display_meter_float(const char* title, float value, float factor, float for (uint8_t i = 0; i < cols; i++) lcd.print(F(" ")); // empty block lcd.setCursor(vi, 1); - lcd.write((uint8_t)(vf / 2.0 + 0.5)); + lcd.write((uint8_t)(vf / 2.0)); for (uint8_t i = vi + 1; i < cols; i++) lcd.print(F(" ")); // empty block } diff --git a/config.h b/config.h index 36a0a7a..5068a00 100644 --- a/config.h +++ b/config.h @@ -42,8 +42,12 @@ // // Tools for testing MIDI: https://github.com/gbevin/SendMIDI // https://github.com/gbevin/ReceiveMIDI +// +// Receiving and storing MIDI SYSEX with Linux: +// amidi -p hw:2,0,0 -d -r /tmp/bkup1.syx +// -#define VERSION "0.9.9d" +#define VERSION "0.9.9e" //************************************************************************************************* //* DEVICE SETTINGS