Skip to content

Commit

Permalink
Fixed memory monitor to not depend on the OpenEVSE module being detected
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypoulter committed Feb 4, 2024
1 parent 98fc63b commit 6069bd7
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,6 @@ loop() {

import_timers(&scheduler);
}
// -------------------------------------------------------------------
// Do these things once every 2s
// -------------------------------------------------------------------
#ifdef ENABLE_DEBUG_MEMORY_MONITOR
if ((millis() - Timer3) >= 2000) {
uint32_t current = ESPAL.getFreeHeap();
int32_t diff = (int32_t)(last_mem - current);
if(diff != 0) {
DEBUG.printf("%s: Free memory %u - diff %d %d\n", time_format_time(time(NULL)).c_str(), current, diff, start_mem - current);
last_mem = current;
}
Timer3 = millis();
}
#endif
}
}

Expand Down Expand Up @@ -257,6 +243,18 @@ loop() {
handle_serial();
}

#ifdef ENABLE_DEBUG_MEMORY_MONITOR
if ((millis() - Timer3) >= 2000) {
uint32_t current = ESPAL.getFreeHeap();
int32_t diff = (int32_t)(last_mem - current);
if(diff != 0) {
DEBUG.printf("%s: Free memory %u - diff %d %d\n", time_format_time(time(NULL)).c_str(), current, diff, start_mem - current);
last_mem = current;
}
Timer3 = millis();
}
#endif

Profile_End(loop, 10);
} // end loop

Expand Down

0 comments on commit 6069bd7

Please sign in to comment.