add free memory command
add read and write nfc commands fix function sending
This commit is contained in:
15
main.cpp
15
main.cpp
@ -127,6 +127,13 @@ void restore_state()
|
||||
}
|
||||
}
|
||||
|
||||
int freeRAM()
|
||||
{
|
||||
extern int __heap_start, *__brkval;
|
||||
int v;
|
||||
return (int) &v - (__brkval == 0 ? (int) &__heap_start: (int) __brkval);
|
||||
}
|
||||
|
||||
inline static void printHelp(Serial* serial)
|
||||
{
|
||||
serial->write_p(PSTR("Available Commands: \n\
|
||||
@ -157,6 +164,7 @@ inline static void printHelp(Serial* serial)
|
||||
power on : power on the rail\n\
|
||||
power auto : power off the rail when no trains are moveing\n\
|
||||
dump : prints epprom contence\n\
|
||||
free : show amount of free ram\n\
|
||||
erase : Erase epprom.\n"));
|
||||
}
|
||||
|
||||
@ -299,6 +307,13 @@ void serialDispatch(Serial* serial)
|
||||
printHelp(serial);
|
||||
ret = 0;
|
||||
}
|
||||
else if(strcmp(token, "free") == 0)
|
||||
{
|
||||
serial->write_p(PSTR("Free Ram: "));
|
||||
serial->write(freeRAM());
|
||||
serial->write_p(PSTR(" Bytes.\n"));
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
serial->putChar('\"');
|
||||
|
Reference in New Issue
Block a user