Skip to content

Commit 6069bd7

Browse files
committed
Fixed memory monitor to not depend on the OpenEVSE module being detected
1 parent 98fc63b commit 6069bd7

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/main.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,6 @@ loop() {
202202

203203
import_timers(&scheduler);
204204
}
205-
// -------------------------------------------------------------------
206-
// Do these things once every 2s
207-
// -------------------------------------------------------------------
208-
#ifdef ENABLE_DEBUG_MEMORY_MONITOR
209-
if ((millis() - Timer3) >= 2000) {
210-
uint32_t current = ESPAL.getFreeHeap();
211-
int32_t diff = (int32_t)(last_mem - current);
212-
if(diff != 0) {
213-
DEBUG.printf("%s: Free memory %u - diff %d %d\n", time_format_time(time(NULL)).c_str(), current, diff, start_mem - current);
214-
last_mem = current;
215-
}
216-
Timer3 = millis();
217-
}
218-
#endif
219205
}
220206
}
221207

@@ -257,6 +243,18 @@ loop() {
257243
handle_serial();
258244
}
259245

246+
#ifdef ENABLE_DEBUG_MEMORY_MONITOR
247+
if ((millis() - Timer3) >= 2000) {
248+
uint32_t current = ESPAL.getFreeHeap();
249+
int32_t diff = (int32_t)(last_mem - current);
250+
if(diff != 0) {
251+
DEBUG.printf("%s: Free memory %u - diff %d %d\n", time_format_time(time(NULL)).c_str(), current, diff, start_mem - current);
252+
last_mem = current;
253+
}
254+
Timer3 = millis();
255+
}
256+
#endif
257+
260258
Profile_End(loop, 10);
261259
} // end loop
262260

0 commit comments

Comments
 (0)