From a0870ae23bc1d91c9f4851dc66bb2c157b486d17 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 15 Mar 2020 17:21:50 +0100 Subject: [PATCH] SMall fixes. Version string generated from config.h data. --- MicroDexed.ino | 32 ++++++++++++++++++++++++++++---- UI.hpp | 12 ++++++++---- config.h | 14 +++++++------- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index bfd2d36..6f2dcc4 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -268,11 +268,14 @@ void setup() #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")); Serial.println(F("(c)2018-2020 H. Wirtz ")); Serial.println(F("https://codeberg.org/dcoredump/MicroDexed")); Serial.print(F("Version: ")); - Serial.println(VERSION); + Serial.println(version_string); Serial.print(F("CPU-Speed: ")); Serial.print(F_CPU / 1000000.0, 1); Serial.println(F(" MHz")); @@ -329,6 +332,7 @@ void setup() #if defined(TEENSY_AUDIO_BOARD) sgtl5000_1.enable(); + sgtl5000_1.lineOutLevel(sgtl5000_level); sgtl5000_1.dacVolumeRamp(); sgtl5000_1.dacVolume(1.0); //sgtl5000_1.dacVolumeRampLinear(); @@ -337,7 +341,6 @@ void setup() sgtl5000_1.unmuteLineout(); sgtl5000_1.autoVolumeDisable(); // turn off AGC sgtl5000_1.volume(0.5, 0.5); // Headphone volume - sgtl5000_1.lineOutLevel(sgtl5000_level); sgtl5000_1.audioPostProcessorEnable(); sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05); //sgtl5000_1.autoVolumeEnable(); @@ -1384,7 +1387,7 @@ void initial_values_from_eeprom(bool init) #if defined(TEENSY_AUDIO_BOARD) EEPROM.get(EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS, sgtl5000_level); - //sgtl5000_1.lineOutLevel(sgtl5000_level); + sgtl5000_1.lineOutLevel(sgtl5000_level); #endif } #ifdef DEBUG @@ -1570,11 +1573,32 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/ return (crc); } +void generate_version_string(char* buffer, uint8_t len) +{ + char tmp[3]; + strncat(&buffer[0], VERSION, len); +#if defined(TEENSY3_5) + strncat(buffer, "-3.5", 4); +#elif defined(TEENSY3_6) + strncat(buffer, "-3.6", 4); +#elif defined(TEENSY4) + strncat(buffer, "-4.0", 4); +#endif +#if defined(USE_FX) + strncat(buffer, "FX", 2); +#endif +#if defined(MAX_NOTES) + strncat(buffer, "-", 1); + itoa (MAX_NOTES, tmp, 10); + strncat(buffer, tmp, 2); +#endif +} + /****************************************************************************** DEBUG HELPER ******************************************************************************/ -#if defined (SHOW_CPU_LOAD_MSEC) +#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) void show_cpu_and_mem_usage(void) { uint32_t sum_xrun = 0; diff --git a/UI.hpp b/UI.hpp index 786bedf..f8acc8d 100644 --- a/UI.hpp +++ b/UI.hpp @@ -32,8 +32,6 @@ #include "effect_stereo_mono.h" #include "dexed.h" -#define ENCODER_USE_INTERRUPTS - #include #include @@ -58,6 +56,8 @@ extern void strip_extension(char* s, char *target); extern void eeprom_write(void); extern bool get_voice_names_from_bank(uint8_t b, uint8_t instance_id); extern bool load_sysex(uint8_t b, uint8_t v); +extern void generate_version_string(char* buffer, uint8_t len); + #ifdef DISPLAY_LCD_SPI extern void change_disp_sd(bool d); #endif @@ -2914,11 +2914,15 @@ void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char version_string[LCD_cols+1]; + + generate_version_string(version_string,sizeof(version_string)); + // setup function lcd.setCursor(0, 0); lcd.print(F("MicroDexed")); lcd.setCursor(0, 1); - lcd.print(VERSION); + lcd.print(version_string); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -3023,8 +3027,8 @@ void UI_func_output_level(uint8_t param) } } } - sgtl5000_1.lineOutLevel(sgtl5000_level); + lcd_display_bar_int("Output Level", sgtl5000_level, SGTL5000_LINEOUT_LEVEL_MIN, SGTL5000_LINEOUT_LEVEL_MAX, 2, false, false, false, false); } diff --git a/config.h b/config.h index 1bcf45a..2b26da2 100644 --- a/config.h +++ b/config.h @@ -59,10 +59,10 @@ //************************************************************************************************* // If nothing is defined Teensy internal DAC is used as audio output device! // Left and right channel audio signal is presented on pins A21 and A22. +#define TEENSY_AUDIO_BOARD #define AUDIO_DEVICE_USB //#define TEENSY_DAC //#define TEENSY_DAC_SYMMETRIC -#define TEENSY_AUDIO_BOARD //#define I2S_AUDIO_ONLY //#define TGA_AUDIO_BOARD //#define PT8211_AUDIO @@ -85,7 +85,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 @@ -120,7 +120,7 @@ 30: 1.22 Volts p-p 31: 1.16 Volts p-p */ -#define SGTL5000_LINEOUT_LEVEL 21 +#define SGTL5000_LINEOUT_LEVEL 29 #if AUDIO_BLOCK_SAMPLES == 64 #define AUDIO_MEM 512 #else @@ -179,9 +179,6 @@ //************************************************************************************************* //* HARDWARE SETTINGS //************************************************************************************************* -#if defined(__IMXRT1062__) //Teensy-4.0 -#define TEENSY4 -#endif // Teensy Audio Shield (not used) //#define SDCARD_CS_PIN 10 @@ -248,16 +245,18 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #if defined(__IMXRT1062__) //Teensy-4.0 #undef MIDI_DEVICE_USB #define MAX_NOTES 16 +#define TEENSY4 #endif #if defined(__MK66FX1M0__) // Teensy-3.6 // Teensy-3.6 settings #define MIDI_DEVICE_USB_HOST 1 #if defined(USE_FX) -#define MAX_NOTES 11 +#define MAX_NOTES 13 #else #define MAX_NOTES 16 #endif +#define TEENSY3_6 #endif #if defined (__MK64FX512__) @@ -265,6 +264,7 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #undef MIDI_DEVICE_USB_HOST #define MAX_NOTES 11 #undef USE_FX +#define TEENSY3_5 #endif #define TRANSPOSE_FIX 24