Added LED blinking for showing that the system is not blocking.

Added UI for drum midinote - but there's still work to do.
dev
Holger Wirtz 2 years ago
parent 7c8a806ec5
commit 40c124db0b
  1. 11
      MicroDexed.ino
  2. 78
      UI.hpp
  3. 1
      config.h

@ -354,7 +354,9 @@ int16_t _midi_bpm = -1;
elapsedMillis midi_bpm_timer; elapsedMillis midi_bpm_timer;
elapsedMillis long_button_pressed; elapsedMillis long_button_pressed;
elapsedMillis control_rate; elapsedMillis control_rate;
elapsedMillis led_blink;
elapsedMillis save_sys; elapsedMillis save_sys;
bool led_status = false;
bool save_sys_flag = false; bool save_sys_flag = false;
uint8_t active_voices[NUM_DEXED]; uint8_t active_voices[NUM_DEXED];
uint8_t midi_voices[NUM_DEXED]; uint8_t midi_voices[NUM_DEXED];
@ -444,6 +446,8 @@ void setup() {
setup_debug_message(); setup_debug_message();
#endif #endif
pinMode(LED_BUILTIN, OUTPUT);
generate_version_string(version_string, sizeof(version_string)); generate_version_string(version_string, sizeof(version_string));
#ifdef DEBUG #ifdef DEBUG
@ -853,6 +857,13 @@ void loop() {
show_cpu_and_mem_usage(); show_cpu_and_mem_usage();
} }
#endif #endif
// LED blink
if (led_blink > LED_BLINK_MS) {
digitalWrite(LED_BUILTIN, led_status);
led_status = !led_status;
led_blink = 0;
}
} }
/****************************************************************************** /******************************************************************************

@ -4295,20 +4295,80 @@ void UI_func_drum_reverb_send(uint8_t param) {
} }
} }
bool _get_midi_note(uint8_t note) { void UI_func_drum_midi_note(uint8_t param) {
for (uint8_t i = DRUMS_MIDI_NOTE_MIN; i <= DRUMS_MIDI_NOTE_MAX; i++) { static bool display_name;
if (drum_config[activesample].midinote == i) char tmp_val[4];
return (true); char tmp_name[9];
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
midi_learn_mode = true;
memset(tmp_name, ' ', 8);
strncpy(tmp_name, drum_config[active_sample].name, strlen(drum_config[active_sample].name));
tmp_name[8] = '\0';
display.setCursor(0, 0);
display.print(F("MIDI Note"));
display.setCursor(1, 1);
display.print(tmp_name);
display.setCursor(LCD_cols - 4, 1);
getNoteName(tmp_val, configuration.drums.midinote[active_sample]);
display.print(tmp_val);
_check_display_name(display_name, 3);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
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()) {
if (display_name == true) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) {
active_sample++;
display.setCursor(LCD_cols - 4, 1);
getNoteName(tmp_val, configuration.drums.midinote[active_sample]);
display.print(tmp_val);
}
} else {
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
}
} else if (LCDML.BT_checkUp()) {
if (display_name == true) {
if (active_sample > 0) {
active_sample--;
display.setCursor(LCD_cols - 4, 1);
getNoteName(tmp_val, configuration.drums.midinote[active_sample]);
display.print(tmp_val);
}
} else {
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
}
} else if (LCDML.BT_checkEnter()) {
display_name = !display_name;
} }
return (false);
} }
void _UI_func_drum_midi_note_display(bool mode) { getNoteName(tmp_val, configuration.drums.midinote[active_sample]);
; #ifdef DEBUG
Serial.printf("Drum midinote for active_sample=%d [%s]=%d (%s)\n", active_sample, drum_config[active_sample].name, configuration.drums.midinote[active_sample], tmp_val);
#endif
memset(tmp_name, ' ', 8);
strncpy(tmp_name, drum_config[active_sample].name, strlen(drum_config[active_sample].name));
tmp_name[8] = '\0';
display.setCursor(1, 1);
display.print(tmp_name);
display.setCursor(LCD_cols - 4, 1);
display.print(tmp_val);
_check_display_name(display_name, 3);
} }
void UI_func_drum_midi_note(uint8_t param) { if (LCDML.FUNC_close()) // ****** STABLE END *********
; {
encoderDir[ENC_L].reset();
midi_learn_mode = false;
}
} }
void UI_func_save_performance(uint8_t param) { void UI_func_save_performance(uint8_t param) {

@ -345,6 +345,7 @@
//************************************************************************************************* //*************************************************************************************************
#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS! #define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS!
#define CONTROL_RATE_MS 50 #define CONTROL_RATE_MS 50
#define LED_BLINK_MS 1000
#define SAVE_SYS_MS 5000 #define SAVE_SYS_MS 5000
#define VOL_MAX_FLOAT 0.95 #define VOL_MAX_FLOAT 0.95

Loading…
Cancel
Save