Please post your code (the whole thing) if you want help on how to reduce it's sram usage. Otherwise we're all blindfolded in a sea of unknown code trying to play marco-polo with sram use
See attachment. Using method 1 My Free Ram was 6608, using Method2 my Free Ram was 6432 and using Method 3 my Free Ram was 6424. Now that's only loosing 200, which doesn't sound bad, but when you take the way I was coding, and multiply that times a sketch that has 20 times that amount of variables, I ran out of Free Ram.
Using method 1 gets around the Free Ram issue, but it takes so much code, to be able to use the information in a Server code, and save the information to a sd card, and print it in the serial monitor for debugging using many many if statements each time, it's way to much code. If anyone can offer a solution that i'm not seeing, it would be greatly appreciated!
You end up with the internal 8K devoted to stack use and 8 56K (64K - the internal 8K in the shared address space) banks for heap.
I don't understand the concept of heap, but are you saying this basically take the 8k SRAM that I currently have and safely modify it to 56K? If so, that might do the trick.
As per earlier advice: don't build up long strings just to print. That's wasteful. Serial data is passed a char or byte at a time and even that is passed one bit at a time. Send the characters as you have them.
I don't understand how else to do it without using a billion if statements throughout the code. The simpler the code, and less lines, the better. At this rate I would use more lines of if statements, than the rest of the code combined. I tried putting it in an char instead of a string like this
if (timeZoneSD==1)
{
TempNC = 0;
while (MSChars > TempNC)
{
char c = TZ1[TempNC];
quickreferenceTZ[TempNC] = c;
TempNC++;
if (TempNC>MSChars)
{
TempNC = MSChars - 1;
}
}
}
but that didn't seem to help the SRAM issue much.
if you can print very long text from F() macros then cut it into shorter pieces and print those one after the other. Did you even think to try?
Are you saying you can use a F()macro and parse from that, instead of parsing from a string?
I get this feeling that you labor under some false impressions about computers and code that come from what you have seen and maybe even been taught. If that is the case then I feel sorry for you and want you to know and have it better.
That actually means a lot, and is very accurate. Thank you.
SRAM_Help_Needed.ino (8.37 KB)