Fixing DEBUG option (renaming to avoid conflict with LiquidMenu).

Small fixes.
master
Holger Wirtz 5 years ago
parent fd409c2be3
commit ea2f8fbbd9
  1. 28
      MicroMDAEPiano.ino
  2. 259
      UI.hpp
  3. 4
      config.h
  4. 456
      midi_devices.hpp

@ -21,14 +21,12 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "config.h"
#include <Audio.h> #include <Audio.h>
#include <Wire.h> #include <Wire.h>
#include <SPI.h> #include <SPI.h>
#include <MIDI.h> #include <MIDI.h>
#include <EEPROM.h> #include <EEPROM.h>
#include "EEPROMAnything.h" #include "EEPROMAnything.h"
#include <limits.h>
#include "mdaEPiano.h" #include "mdaEPiano.h"
#include "effect_modulated_chorus.h" #include "effect_modulated_chorus.h"
#ifdef USE_XFADE_DATA #ifdef USE_XFADE_DATA
@ -38,6 +36,7 @@
#endif #endif
#include "UI.hpp" #include "UI.hpp"
#include "midi_devices.hpp" #include "midi_devices.hpp"
#include "config.h"
//************************************************************************************************* //*************************************************************************************************
//* GLOBAL VARIABLES //* GLOBAL VARIABLES
@ -213,7 +212,7 @@ void setup()
Serial.println(F("PT8211 enabled.")); Serial.println(F("PT8211 enabled."));
#endif #endif
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (SHOW_DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
// Initialize processor and memory measurements // Initialize processor and memory measurements
AudioProcessorUsageMaxReset(); AudioProcessorUsageMaxReset();
AudioMemoryUsageMaxReset(); AudioMemoryUsageMaxReset();
@ -242,10 +241,12 @@ void setup()
modulator.frequency(1.0); modulator.frequency(1.0);
modulator.phase(0); modulator.phase(0);
modulator.offset(0.0); modulator.offset(0.0);
// internal mixing of original signal(0), reverb(1) and chorus(2) // internal mixing of original signal(0), reverb(1) and chorus(2)
mixer_r.gain(0, 1.0); mixer_r.gain(0, 1.0);
mixer_l.gain(0, 1.0); mixer_l.gain(0, 1.0);
mixer_r.gain(1, 0.5);
mixer_l.gain(1, 0.5);
mixer_r.gain(2, 0.5); mixer_r.gain(2, 0.5);
mixer_l.gain(2, 0.5); mixer_l.gain(2, 0.5);
@ -254,7 +255,7 @@ void setup()
Serial.println(F("<setup end>")); Serial.println(F("<setup end>"));
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (SHOW_DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
Serial.println(); Serial.println();
show_cpu_and_mem_usage(); show_cpu_and_mem_usage();
cpu_mem_millis = 0; cpu_mem_millis = 0;
@ -275,7 +276,7 @@ void loop()
{ {
fill_audio_buffer = 0; fill_audio_buffer = 0;
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (SHOW_DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
if (cpu_mem_millis > SHOW_CPU_LOAD_MSEC) if (cpu_mem_millis > SHOW_CPU_LOAD_MSEC)
{ {
show_cpu_and_mem_usage(); show_cpu_and_mem_usage();
@ -474,7 +475,7 @@ bool checkMidiChannel(byte inChannel)
} }
else if (inChannel != configuration.midi_channel) else if (inChannel != configuration.midi_channel)
{ {
#ifdef DEBUG #ifdef SHOW_DEBUG
Serial.print(F("Ignoring MIDI data on channel ")); Serial.print(F("Ignoring MIDI data on channel "));
Serial.print(inChannel); Serial.print(inChannel);
Serial.print(F("(listening on ")); Serial.print(F("(listening on "));
@ -492,7 +493,7 @@ void set_master_volume(uint8_t value)
uint16_t tmp = map(value, ENC_MASTER_VOLUME_MIN, ENC_MASTER_VOLUME_MAX, 0, 0x3ff); uint16_t tmp = map(value, ENC_MASTER_VOLUME_MIN, ENC_MASTER_VOLUME_MAX, 0, 0x3ff);
float tmp2 = mapfloat(configuration.pan, ENC_MASTER_PAN_MIN, ENC_MASTER_PAN_MAX, 0.0, 1.0); float tmp2 = mapfloat(configuration.pan, ENC_MASTER_PAN_MIN, ENC_MASTER_PAN_MAX, 0.0, 1.0);
float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20);
#ifdef DEBUG #ifdef SHOW_DEBUG
Serial.print(F("Setting volume: VOL=")); Serial.print(F("Setting volume: VOL="));
Serial.print(value, DEC); Serial.print(value, DEC);
Serial.print(F("[")); Serial.print(F("["));
@ -531,7 +532,7 @@ void config_from_eeprom(void)
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), tmp_conf); EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), tmp_conf);
checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4); checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4);
#ifdef DEBUG #ifdef SHOW_DEBUG
Serial.print(F("Reading sound ")); Serial.print(F("Reading sound "));
Serial.print(sound, DEC); Serial.print(sound, DEC);
Serial.print(F(" from 0x")); Serial.print(F(" from 0x"));
@ -545,17 +546,22 @@ void config_from_eeprom(void)
if (checksum == tmp_conf.checksum) if (checksum == tmp_conf.checksum)
{ {
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration);
#ifdef SHOW_DEBUG
Serial.print(F(" - OK")); Serial.print(F(" - OK"));
#endif
} }
else else
{ {
#ifdef DEBUG #ifdef SHOW_DEBUG
Serial.println(F(" - mismatch -> loading initial configuration.")); Serial.println(F(" - mismatch -> loading initial configuration."));
#endif #endif
set_complete_configuration(); set_complete_configuration();
EEPROM.update(EEPROM_SOUND, sound); EEPROM.update(EEPROM_SOUND, sound);
} }
#ifdef SHOW_DEBUG
show_sound(); show_sound();
#endif
} }
void initial_values_from_eeprom(void) void initial_values_from_eeprom(void)
@ -621,7 +627,7 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/
//* DEBUG FUNCTIONS //* DEBUG FUNCTIONS
//************************************************************************************************* //*************************************************************************************************
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (SHOW_DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
void show_cpu_and_mem_usage(void) void show_cpu_and_mem_usage(void)
{ {
Serial.print(F("CPU: ")); Serial.print(F("CPU: "));

259
UI.hpp

File diff suppressed because it is too large Load Diff

@ -70,7 +70,7 @@
//* DEBUG OUTPUT SETTINGS //* DEBUG OUTPUT SETTINGS
//************************************************************************************************* //*************************************************************************************************
//#define DEBUG 1 #define SHOW_DEBUG 1
#define SERIAL_SPEED 38400 #define SERIAL_SPEED 38400
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000
@ -139,7 +139,7 @@
//* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!!
//************************************************************************************************* //*************************************************************************************************
#define MICRO_MDAEPIANO_VERSION "0.9.3" #define MICRO_MDAEPIANO_VERSION "0.9.4"
#define MAX_SOUNDS min(99,int((4096-EEPROM_CONFIGURATIONS)/sizeof(config_t))) #define MAX_SOUNDS min(99,int((4096-EEPROM_CONFIGURATIONS)/sizeof(config_t)))

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save