Fixed displaying bank and voice on LCD.

pull/4/head
Holger Wirtz 6 years ago
parent 0701e277fe
commit 9a8b56f71f
  1. 38
      MicroDexed.ino
  2. 1
      config.h
  3. 1
      dexed.cpp
  4. 1
      dexed.h
  5. 55
      dexed_sysex.cpp
  6. 1
      dexed_sysex.h

@ -123,9 +123,8 @@ void setup()
{ {
//while (!Serial) ; // wait for Arduino Serial Monitor //while (!Serial) ; // wait for Arduino Serial Monitor
Serial.begin(SERIAL_SPEED); Serial.begin(SERIAL_SPEED);
delay(220);
#ifndef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.init(); lcd.init();
lcd.blink_off(); lcd.blink_off();
lcd.cursor_off(); lcd.cursor_off();
@ -133,17 +132,18 @@ void setup()
lcd.noAutoscroll(); lcd.noAutoscroll();
lcd.clear(); lcd.clear();
lcd.display(); lcd.display();
lcd.show(0, 0, 20, "MicroDexed"); lcd.show(0, 0, 16, " MicroDexed");
lcd.show(1, 0, 16, "(c)parasiTstudio");
enc_l.write(INITIAL_ENC_L_VALUE); enc_l.write(INITIAL_ENC_L_VALUE);
enc_r.write(INITIAL_ENC_R_VALUE); enc_r.write(INITIAL_ENC_R_VALUE);
#endif #endif
delay(220);
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed"));
Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>")); Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>"));
Serial.println(F("https://github.com/dcoredump/MicroDexed")); Serial.println(F("https://github.com/dcoredump/MicroDexed"));
Serial.println(F("<setup start>")); Serial.println(F("<setup start>"));
initial_values_from_eeprom(); initial_values_from_eeprom();
// start up USB host // start up USB host
@ -198,8 +198,6 @@ void setup()
AudioMemoryUsageMaxReset(); AudioMemoryUsageMaxReset();
#endif #endif
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Bank/Voice from EEPROM [")); Serial.print(F("Bank/Voice from EEPROM ["));
Serial.print(EEPROM.read(EEPROM_OFFSET + EEPROM_BANK_ADDR), DEC); Serial.print(EEPROM.read(EEPROM_OFFSET + EEPROM_BANK_ADDR), DEC);
@ -228,9 +226,13 @@ void setup()
cpu_mem_millis = 0; cpu_mem_millis = 0;
#endif #endif
#ifndef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.show(1, 0, 3, data1); lcd.show(0, 0, 2, bank);
lcd.show(1, 4, 3, data2); lcd.show(0, 2, 1, " ");
lcd.show(0, 3, 10, bank_name);
lcd.show(1, 0, 2, voice);
lcd.show(1, 2, 1, " ");
lcd.show(1, 3, 10, voice_name);
#endif #endif
#ifdef TEST_NOTE #ifdef TEST_NOTE
@ -379,6 +381,11 @@ bool handle_master_key(uint8_t data)
#endif #endif
EEPROM.update(EEPROM_OFFSET + EEPROM_VOICE_ADDR, num); EEPROM.update(EEPROM_OFFSET + EEPROM_VOICE_ADDR, num);
update_eeprom_checksum(); update_eeprom_checksum();
#ifdef I2C_DISPLAY
lcd.show(1, 0, 2, voice);
lcd.show(1, 2, 1, " ");
lcd.show(1, 3, 10, voice_name);
#endif
} }
#ifdef DEBUG #ifdef DEBUG
else else
@ -406,6 +413,19 @@ bool handle_master_key(uint8_t data)
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Bank switch to: ")); Serial.print(F("Bank switch to: "));
Serial.println(bank, DEC); Serial.println(bank, DEC);
#endif
#ifdef I2C_DISPLAY
if(get_bank_name(bank))
{
lcd.show(0, 0, 2, bank);
lcd.show(0, 2, 1, " ");
lcd.show(0, 3, 10, bank_name);
}
else
{
lcd.show(0, 0, 2, bank);
lcd.show(0, 2, 10, " *ERROR*");
}
#endif #endif
return (true); return (true);
} }

@ -40,6 +40,7 @@
//#define DEXED_ENGINE DEXED_ENGINE_MODERN //#define DEXED_ENGINE DEXED_ENGINE_MODERN
#define AUDIO_MEM 2 #define AUDIO_MEM 2
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#define MAX_BANKS 99
#if !defined(__MK66FX1M0__) // check for Teensy-3.6 #if !defined(__MK66FX1M0__) // check for Teensy-3.6
#define MAX_NOTES 11 // No? #define MAX_NOTES 11 // No?

@ -683,6 +683,7 @@ bool Dexed::loadSysexVoice(uint8_t* new_data)
char voicename[11]; char voicename[11];
memset(voicename, 0, sizeof(voicename)); memset(voicename, 0, sizeof(voicename));
strncpy(voicename, (char *)&data[145], sizeof(voicename) - 1); strncpy(voicename, (char *)&data[145], sizeof(voicename) - 1);
strncpy(voice_name, (char *)&data[145], sizeof(voicename) - 1);
Serial.print(F("Voice [")); Serial.print(F("Voice ["));
Serial.print(voicename); Serial.print(voicename);
Serial.println(F("] loaded.")); Serial.println(F("] loaded."));

@ -44,6 +44,7 @@ extern float vol;
extern float vol_right; extern float vol_right;
extern float vol_left; extern float vol_left;
extern void set_volume(float master_volume, float volume_right, float volume_left); extern void set_volume(float master_volume, float volume_right, float volume_left);
extern char voice_name[10];
struct ProcessorVoice { struct ProcessorVoice {
uint8_t midi_note; uint8_t midi_note;

@ -31,13 +31,52 @@
#include "dexed_sysex.h" #include "dexed_sysex.h"
#include "config.h" #include "config.h"
bool get_bank_name(uint8_t b)
{
File root;
b %= MAX_BANKS;
if (sd_card_available)
{
char bankdir[3];
bankdir[0] = '/';
bankdir[2] = '\0';
itoa(b, &bankdir[1], 10);
root = SD.open(bankdir);
if (!root)
{
#ifdef DEBUG
Serial.println(F("E: Cannot open main dir from SD."));
#endif
return (false);
}
while (42 == 42)
{
File entry = root.openNextFile();
if (!entry)
{
// No more files
break;
}
else
{
if (!entry.isDirectory())
strncpy(bank_name, entry.name(), strlen(bank_name) - 1);
}
}
}
return (false);
}
bool load_sysex(uint8_t b, uint8_t v) bool load_sysex(uint8_t b, uint8_t v)
{ {
File root; File root;
bool found = false; bool found = false;
v %= 32; v %= 32;
b %= 10; b %= MAX_BANKS;
if (sd_card_available) if (sd_card_available)
{ {
@ -81,9 +120,10 @@ bool load_sysex(uint8_t b, uint8_t v)
Serial.print(F(" [")); Serial.print(F(" ["));
Serial.print(n); Serial.print(n);
Serial.println(F("]")); Serial.println(F("]"));
strcpy(bank_name, bankdir);
strcpy(voice_name, entry.name());
#endif #endif
strncpy(bank_name, entry.name(), strlen(bank_name) - 1);
return (dexed->loadSysexVoice(data)); return (dexed->loadSysexVoice(data));
} }
else else
@ -96,15 +136,6 @@ bool load_sysex(uint8_t b, uint8_t v)
} }
} }
} }
#ifdef I2C_DISPLAY
char tmp[3];
itoa(bank, tmp, 10);
lcd.show(0, 0, 2, tmp);
lcd.show(0, 3, 10, bank_name);
itoa(voice, tmp, 10);
lcd.show(1, 0, 2, tmp);
lcd.show(1, 3, 10, voice_name);
#endif
#ifdef DEBUG #ifdef DEBUG
if (found == false) if (found == false)

@ -37,5 +37,6 @@ extern char bank_name[10];
extern char voice_name[10]; extern char voice_name[10];
extern LiquidCrystalPlus_I2C lcd; extern LiquidCrystalPlus_I2C lcd;
bool get_bank_name(uint8_t b);
bool load_sysex(uint8_t b, uint8_t v); bool load_sysex(uint8_t b, uint8_t v);
bool get_sysex_voice(char* dir, File sysex, uint8_t voice_number, uint8_t* data); bool get_sysex_voice(char* dir, File sysex, uint8_t voice_number, uint8_t* data);

Loading…
Cancel
Save