AP_Common: use EXCLUDECORE macro to hack some debug messages away

This commit is contained in:
Pat Hickey 2012-08-22 17:31:03 -07:00 committed by Andrew Tridgell
parent 7854c54880
commit 0d342a3293
2 changed files with 13 additions and 0 deletions

View File

@ -15,6 +15,10 @@
#ifndef _AP_COMMON_H
#define _AP_COMMON_H
#include <string.h>
#include <avr/pgmspace.h>
#ifndef EXCLUDECORE
// Get the common arduino functions
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
@ -24,6 +28,7 @@
// ... and remove some of their stupid macros
#undef round
#undef abs
#endif
// prog_char_t is used as a wrapper type for prog_char, which is
// a character stored in flash. By using this wrapper type we can

View File

@ -8,12 +8,16 @@
//
#include <stdlib.h>
#include <stdint.h>
#include "c++.h"
#ifndef EXCLUDECORE
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#endif
void * operator new(size_t size)
{
@ -32,8 +36,10 @@ extern "C" void __cxa_pure_virtual()
{
while (1)
{
#ifndef EXCLUDECORE
Serial.println("Error: pure virtual call");
delay(1000);
#endif
}
}
@ -74,8 +80,10 @@ void displayMemory()
static int minMemFree=0;
if (minMemFree<=0 || freeMemory()<minMemFree) {
minMemFree = freeMemory();
#ifndef EXCLUDECORE
Serial.print("bytes free: ");
Serial.println(minMemFree);
#endif
}
}