Small fixes.

Reduced control rate to every 30ms.
Fixed "no sound when sd card is on Teensy" by reversing the order of checking for the SD card slot.
pull/32/head
Holger Wirtz 4 years ago
parent cb2ede50ff
commit 784e1b7703
  1. 39
      MicroDexed.ino
  2. 6
      config.h
  3. 10
      dexed_sysex.cpp

@ -28,6 +28,7 @@
#include <Wire.h>
#include <MIDI.h>
#include <EEPROM.h>
#include <SD.h>
#include "midi_devices.hpp"
#include "dexed.h"
#include "dexed_sysex.h"
@ -37,7 +38,6 @@
#include "PluginFx.h"
#include "UI.hpp"
#include "source_microdexed.h"
#include <SD.h>
// Audio engines
AudioSourceMicroDexed* MicroDexed[NUM_DEXED];
@ -217,9 +217,13 @@ uint32_t peak_l = 0;
bool eeprom_update_flag = false;
config_t configuration;
uint8_t selected_dexed_instance = 0;
const uint8_t cs_pins[] = { SDCARD_AUDIO_CS_PIN, SDCARD_TEENSY_CS_PIN };
const uint8_t mosi_pins[] = { SDCARD_AUDIO_MOSI_PIN, SDCARD_TEENSY_MOSI_PIN };
const uint8_t sck_pins[] = { SDCARD_AUDIO_SCK_PIN, SDCARD_TEENSY_SCK_PIN };
/*const uint8_t cs_pins[] = { SDCARD_AUDIO_CS_PIN, SDCARD_TEENSY_CS_PIN };
const uint8_t mosi_pins[] = { SDCARD_AUDIO_MOSI_PIN, SDCARD_TEENSY_MOSI_PIN };
const uint8_t sck_pins[] = { SDCARD_AUDIO_SCK_PIN, SDCARD_TEENSY_SCK_PIN };*/
const uint8_t cs_pins[] = { SDCARD_TEENSY_CS_PIN, SDCARD_AUDIO_CS_PIN };
const uint8_t mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN };
const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN };
char version_string[LCD_cols + 1];
#if defined(USE_FX)
// Allocate the delay lines for chorus
@ -241,11 +245,13 @@ void setup()
AudioNoInterrupts();
AudioMemory(AUDIO_MEM);
#ifdef DEBUG
Serial.begin(SERIAL_SPEED);
while (!Serial)
{
yield();
}
#endif
#ifdef DISPLAY_LCD_SPI
pinMode(SDCARD_CS_PIN, OUTPUT);
@ -256,13 +262,11 @@ void setup()
setup_ui();
#else
#ifdef DEBUG
//delay(320); // necessary, because before no serial output is done :(
Serial.println(F("NO LCD DISPLAY ENABLED!"));
#endif
#endif
#ifdef DEBUG
char version_string[LCD_cols + 1];
generate_version_string(version_string, sizeof(version_string));
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed"));
@ -384,10 +388,11 @@ void setup()
#endif
// start SD card
sd_card = check_sd_cards();
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
sd_card = check_sd_cards();
if (sd_card < 1)
{
#ifdef DEBUG
@ -401,9 +406,6 @@ void setup()
}
else
{
#ifdef DEBUG
Serial.println(F("SD card found."));
#endif
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
// read all bank names
@ -656,6 +658,8 @@ void loop()
#endif
}
}
else
yield();
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC)
@ -1554,6 +1558,8 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/
void generate_version_string(char* buffer, uint8_t len)
{
char tmp[3];
memset(buffer, 0, len);
strncat(buffer, VERSION, len);
#if defined(TEENSY3_5)
strncat(buffer, "-3.5", 4);
@ -1570,15 +1576,16 @@ void generate_version_string(char* buffer, uint8_t len)
itoa (MAX_NOTES, tmp, 10);
strncat(buffer, tmp, 2);
#endif
buffer[len - 1] = '\0';
}
#ifdef DISPLAY_LCD_SPI
void change_disp_sd(bool disp)
{
if (sd_card >= 0)
if (sd_card > 0)
{
digitalWrite(sd_card, disp);
digitalWrite(U8X8_CS_PIN, !disp);
digitalWrite(U8X8_CS_PIN, !disp);
}
}
#endif
@ -1590,7 +1597,7 @@ uint8_t check_sd_cards(void)
{
#ifdef DEBUG
Serial.print(F("Checking CS pin "));
Serial.print(cs_pins[i]);
Serial.print(cs_pins[i], DEC);
Serial.println(F(" for SD card"));
#endif
SPI.setMOSI(mosi_pins[i]);
@ -1598,6 +1605,10 @@ uint8_t check_sd_cards(void)
if (SD.begin(cs_pins[i]) == true)
{
#ifdef DEBUG
Serial.print(F("Found. Using pin "));
Serial.println(cs_pins[i], DEC);
#endif
ret = cs_pins[i];
break;
}

@ -86,7 +86,7 @@
#define MOD_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT
#define MOD_FILTER_CUTOFF_HZ 3000
// FX-CHAIN ENABLE/DISABLE
//#define USE_FX 1
#define USE_FX 1
//*************************************************************************************************
//* AUDIO SOFTWARE SETTINGS
@ -166,7 +166,7 @@
#define U8X8_RESET_PIN 14
#endif
#define CONTROL_RATE_MS 50
#define CONTROL_RATE_MS 30
#define BACK_FROM_VOLUME_MS 2000
//*************************************************************************************************
@ -406,7 +406,7 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#define PB_STEP_MIN 0
#define PB_STEP_MAX 12
#define PB_STEP_DEFAULT 1
#define PB_STEP_DEFAULT 0
#define MW_RANGE_MIN 0
#define MW_RANGE_MAX 99

@ -77,7 +77,7 @@ bool get_voice_names_from_bank(uint8_t b, uint8_t instance_id)
// erase all data for voice names
memset(voice_names[instance_id], 0, MAX_VOICES * VOICE_NAME_LEN);
if (sd_card >= 0)
if (sd_card > 0)
{
char sysex_file_name[4 + VOICE_NAME_LEN];
@ -182,7 +182,7 @@ uint8_t get_bank_names(uint8_t instance_id)
// erase all data for bank names
memset(bank_names[instance_id], 0, MAX_BANKS * BANK_NAME_LEN);
if (sd_card >= 0)
if (sd_card > 0)
{
char bankdir[4];
@ -226,7 +226,7 @@ bool load_sysex(uint8_t b, uint8_t v, uint8_t instance_id)
v = constrain(v, 0, MAX_VOICES - 1);
b = constrain(b, 0, MAX_BANKS - 1);
if (sd_card >= 0)
if (sd_card > 0)
{
File sysex;
char sysex_file_name[10 + VOICE_NAME_LEN];
@ -481,7 +481,7 @@ bool load_sysex_setup(uint8_t b, uint8_t v, uint8_t instance_id)
v = constrain(v, 0, MAX_VOICES - 1);
b = constrain(b, 0, MAX_BANKS - 1);
if (sd_card >= 0)
if (sd_card > 0)
{
File sysex;
char sysex_setup_file_name[SYSEXFILENAME_LEN];
@ -527,7 +527,7 @@ bool save_sysex_setup(uint8_t b, uint8_t v, config_t configuration)
{
const char* sysex_filename = "config.syx";
if (sd_card >= 0)
if (sd_card > 0)
{
File sysex;
char sysex_file_name[20];

Loading…
Cancel
Save