1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Update freeMemory.cpp

This commit is contained in:
Neil McKechnie 2021-03-09 10:27:38 +00:00
parent fab05bac79
commit 7954c85b7d

View File

@ -50,9 +50,9 @@ int freeMemory() {
// by estimation or inspection, that may be used by other // by estimation or inspection, that may be used by other
// called subroutines. // called subroutines.
int updateMinimumFreeMemory(unsigned char extraBytes) { int updateMinimumFreeMemory(unsigned char extraBytes) {
int spare = freeMemory()-extraBytes;
byte sreg_save = SREG; byte sreg_save = SREG;
noInterrupts(); noInterrupts();
int spare = freeMemory()-extraBytes;
if (spare < minimum_free_memory) minimum_free_memory = spare; if (spare < minimum_free_memory) minimum_free_memory = spare;
int returnValue = minimum_free_memory; int returnValue = minimum_free_memory;
SREG = sreg_save; SREG = sreg_save;