mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-01-11 21:31:02 +01:00
Change initial value for free memory.
Change initial value from 32767 (maximum value of a 16-bit signed integer) to __INT_MAX__ (compiler-defined maximum value for an int).
This commit is contained in:
parent
def6c24bac
commit
eb54c78d74
@ -124,7 +124,7 @@ void loop()
|
|||||||
LCDDisplay::loop(); // ignored if LCD not in use
|
LCDDisplay::loop(); // ignored if LCD not in use
|
||||||
|
|
||||||
// Report any decrease in memory (will automatically trigger on first call)
|
// Report any decrease in memory (will automatically trigger on first call)
|
||||||
static int ramLowWatermark = 32767; // replaced on first loop
|
static int ramLowWatermark = __INT_MAX__; // replaced on first loop
|
||||||
|
|
||||||
int freeNow = minimumFreeMemory();
|
int freeNow = minimumFreeMemory();
|
||||||
if (freeNow < ramLowWatermark)
|
if (freeNow < ramLowWatermark)
|
||||||
|
@ -32,7 +32,7 @@ extern char *__malloc_heap_start;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static volatile int minimum_free_memory = 32767;
|
static volatile int minimum_free_memory = __INT_MAX__;
|
||||||
|
|
||||||
|
|
||||||
static inline int freeMemory() {
|
static inline int freeMemory() {
|
||||||
@ -52,6 +52,7 @@ static inline int freeMemory() {
|
|||||||
//
|
//
|
||||||
void updateMinimumFreeMemory(unsigned char extraBytes) {
|
void updateMinimumFreeMemory(unsigned char extraBytes) {
|
||||||
int spare = freeMemory()-extraBytes;
|
int spare = freeMemory()-extraBytes;
|
||||||
|
if (spare < 0) spare = 0;
|
||||||
if (spare < minimum_free_memory) minimum_free_memory = spare;
|
if (spare < minimum_free_memory) minimum_free_memory = spare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user