Comment out ram monitoring code with macro

This commit is contained in:
Starbeamrainbowlabs 2019-06-28 14:02:44 +01:00
parent 40f4e9130b
commit 1bbb1fe535
2 changed files with 15 additions and 7 deletions

View file

@ -1,6 +1,11 @@
#include "settings.h" #include "settings.h"
#include <Arduino.h> #include <Arduino.h>
#include <MemoryFree.h> #ifdef ENABLE_MEMORY_DIAGNOSTICS
// #include <MemoryFree.h>
#define DISPLAY_FREE_MEMORY() Serial.println(freeMemory(), DEC);
#else
#define DISPLAY_FREE_MEMORY() // noop
#endif
#include "random.h" #include "random.h"
// BAD PRACTICE: For some extremely strange reason, the Arduino IDE doesn't pick up random.cpp like it does our other source files - so we've got to explicitly include it here. If we had control over the build process (which we don't), we've use a Makefile here that handled this better. // BAD PRACTICE: For some extremely strange reason, the Arduino IDE doesn't pick up random.cpp like it does our other source files - so we've got to explicitly include it here. If we had control over the build process (which we don't), we've use a Makefile here that handled this better.
@ -17,9 +22,9 @@ void setup() {
Serial.println(F("[main] Starting")); Serial.println(F("[main] Starting"));
random_begin(); random_begin();
Serial.println(freeMemory(), DEC); DISPLAY_FREE_MEMORY();
GPSLocation gps_data = gps_fetch(); GPSLocation gps_data = gps_fetch();
Serial.println(freeMemory(), DEC); DISPLAY_FREE_MEMORY();
Serial.print(F("[main] Location ")); Serial.print(gps_data.lat); Serial.print(F(", ")); Serial.println(gps_data.lng); Serial.print(F("[main] Location ")); Serial.print(gps_data.lat); Serial.print(F(", ")); Serial.println(gps_data.lng);
@ -35,12 +40,12 @@ void setup() {
peripheral_unsilence(PIN_SPI_CS_SD); peripheral_unsilence(PIN_SPI_CS_SD);
Serial.println(freeMemory(), DEC); DISPLAY_FREE_MEMORY();
store_reading(id, gps_data); store_reading(id, gps_data);
Serial.println(freeMemory(), DEC); DISPLAY_FREE_MEMORY();
#ifdef SD_DEBUG_ENABLED #ifdef SD_DEBUG_ENABLED
store_debug(gps_data.time, 19 - 1); // Don't print the null byte store_debug(gps_data.time, 19 - 1); // Don't print the null byte
Serial.println(freeMemory(), DEC); DISPLAY_FREE_MEMORY();
#endif #endif
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View file

@ -27,6 +27,9 @@
// The 'done' pin to pulse to signal to the TPL5111 // The 'done' pin to pulse to signal to the TPL5111
#define PIN_TPL_DONE 8 #define PIN_TPL_DONE 8
// Uncomment to print RAM diagnostics at regular intervals.
//#define ENABLE_MEMORY_DIAGNOSTICS
///////////// /////////////
/// RFM95 /// /// RFM95 ///
///////////// /////////////