Here is a portion that exhibits the problem:
void startmenu() {
menusize = 3;
GLCD.DrawRoundRect(0, 0, 126, 20, 5);
ptitle(28, 4, ("Main Menu"));
pnorm(3, 4, ("Start Run"));
pnorm(3, 5, ("Run Options"));
pnorm(3, 6, ("System Options"));
pnorm(3, 3, ("Pressure: "));
ListMenu.print(analogRead(6));
pnorm(0, cursor+3, ("->"));
while (1) {
buttons();
if (down == 1) {
scrolldown();
GLCD.FillRect(0,22,10,50,WHITE);
pnorm(0, cursor+3, ("->"));
ListMenu.CursorTo(0,7); ListMenu.print(freeMemory());}
if (up == 1) {
scrollup();
GLCD.FillRect(0,22,10,50,WHITE);
pnorm(0, cursor+3, ("->"));
ListMenu.CursorTo(0,7); ListMenu.print(freeMemory());}
if (select == 1) {
GLCD.ClearScreen();
switch (cursor) {
case 1: startrun();
case 2:
cursor = 1;
menupos = 1;
optionsmenu();}}
if (bitRead(pinvalues, butdown) == 1 && bitRead(pinvalues, butup) == 1) {
cursor = 1;
menupos = 1;
engmenu();}
}
}
void optionsmenu() {
menusize = 5;
GLCD.DrawRoundRect(0, 0, 126, 20, 5);
ptitle(40,4, ("Options"));
pnorm(3,3, (readoptions(menupos-1)));
pnorm(3,4, (readoptions(menupos)));
pnorm(3,5, (readoptions(menupos+1)));
pnorm(3,6, (readoptions(menupos+2)));
pnorm(3,7, (readoptions(menupos+3)));
pnorm(0,cursor-menupos+3, "->");
while (1) {
buttons();
if (down == 1){
scrolldown();
GLCD.FillRect(0,22,10,63,WHITE);
pnorm(0,cursor-menupos+3, "->");
ListMenu.CursorTo(0,7); ListMenu.print(freeMemory());}
if (up == 1){
scrollup();
GLCD.FillRect(0,22,10,63,WHITE);
pnorm(0,cursor-menupos+3, "->");
ListMenu.CursorTo(0,7); ListMenu.print(freeMemory());}
if (select == 1) {
switch(cursor) {
case 1: GLCD.ClearScreen(); extract();
case 2: foampurge();
case 3: decon();
case 4:
pnorm(0,cursor-menupos+3, " ");
cursorlast = cursor;
menuposlast = menupos;
cursor = extsize;
extractvolume();
case 5:
GLCD.ClearScreen();
cursor = 2;
startmenu();
}
}
}
}
It's part of an LCD interface, it's fairly straightfoward. Each function declares the size of the menu(for scrolling etc), prints all the necessary lines, then checks for button presses. If I go back and forth between startmenu() and optionsmenu() (or to any other of the several similar functions the program has), it uses up a few bytes of RAM. If I understand what you are saying correctly, there is no way to free this memory? Apparently I still have a lot to learn then.