Use SdFatUtil::FreeRam() for freeMemory() if there

master
Scott Lahteine 10 years ago
parent 2f9ed1777d
commit ae1a698263

@ -402,7 +402,11 @@ void serial_echopair_P(const char *s_P, double v)
void serial_echopair_P(const char *s_P, unsigned long v)
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
extern "C"{
#ifdef SDSUPPORT
#include "SdFatUtil.h"
int freeMemory() { return SdFatUtil::FreeRam(); }
#else
extern "C" {
extern unsigned int __bss_end;
extern unsigned int __heap_start;
extern void *__brkval;
@ -410,14 +414,15 @@ extern "C"{
int freeMemory() {
int free_memory;
if((int)__brkval == 0)
if ((int)__brkval == 0)
free_memory = ((int)&free_memory) - ((int)&__bss_end);
else
free_memory = ((int)&free_memory) - ((int)__brkval);
return free_memory;
}
}
}
#endif //!SDSUPPORT
//adds an command to the main command buffer
//thats really done in a non-safe way.

Loading…
Cancel
Save