Added FreeMem() debugging functions.

pull/32/head
Holger Wirtz 4 years ago
parent c3df658ad1
commit 6bb5a024ab
  1. 27
      MicroDexed.ino
  2. 6
      config.h

@ -2162,6 +2162,8 @@ void show_cpu_and_mem_usage(void)
Serial.print(peak_dexed_value, 1);
Serial.print(F("|BLOCKSIZE:"));
Serial.print(AUDIO_BLOCK_SAMPLES, DEC);
Serial.print(F("|RAM:"));
Serial.print(FreeMem(), DEC);
Serial.print(F("|ACTVOICES:"));
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
@ -2367,4 +2369,29 @@ void SerialPrintFormatInt3(uint8_t num)
sprintf(buf, "%3d", num);
Serial.print(buf);
}
/* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */
extern "C" char* sbrk(int incr);
uint32_t FreeMem(void)
{
char top;
return &top - reinterpret_cast<char*>(sbrk(0));
}
/*
uint32_t FreeMem(void) { // for Teensy 3.0
uint32_t stackTop;
uint32_t heapTop;
// current position of the stack.
stackTop = (uint32_t) &stackTop;
// current position of heap.
void* hTop = malloc(1);
heapTop = (uint32_t) hTop;
free(hTop);
// The difference is (approximately) the free, available ram.
return stackTop - heapTop;
}
*/
#endif

@ -56,7 +56,7 @@
// sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy/hardware/teensy/avr/cores/teensy3/usb_midi.h
//#define USB_MIDI_SYSEX_MAX 4104
#define VERSION "1.0.7"
#define VERSION "1.0.8"
//*************************************************************************************************
//* DEVICE SETTINGS
@ -92,7 +92,7 @@
//*************************************************************************************************
//* DEBUG OUTPUT SETTINGS
//*************************************************************************************************
//#define DEBUG 1
#define DEBUG 1
#define SERIAL_SPEED 230400
#define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000
@ -103,7 +103,7 @@
#define DEXED_ENGINE DEXED_ENGINE_MODERN // DEXED_ENGINE_MARKI // DEXED_ENGINE_OPL
// Number of Dexed instances
#define NUM_DEXED 1 // 1 or 2 - nothing else!
#define NUM_DEXED 2 // 1 or 2 - nothing else!
// FX-CHAIN ENABLE/DISABLE
#define USE_FX 1
// CHORUS parameters

Loading…
Cancel
Save