From 3e2aba52ec99ab0d8fd0f20edcf90fe0334343e7 Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Sun, 3 Feb 2019 10:41:48 +0100 Subject: [PATCH] Added output of heap to check memory leakage. --- src/Display.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Display.cpp b/src/Display.cpp index a97896a..9a87e26 100644 --- a/src/Display.cpp +++ b/src/Display.cpp @@ -4,6 +4,9 @@ #include #include #include "MD_RobotEyes.h" +extern "C" { +#include "user_interface.h" +} #define DISPLAY_CLK_PIN D5 #define DISPLAY_DATA_PIN D7 @@ -181,6 +184,7 @@ void Display::loop() { } void Display::reInitializeDisplay() { + uint32_t free = system_get_free_heap_size(); #define REINIT_AFTER_ms 5000 #define AVOID_REINIT_BEFORE_AND_AFTER_FULLMINUTE_FOR_s 3 @@ -190,7 +194,7 @@ void Display::reInitializeDisplay() { && currentTime->getSeconds() < 60 - AVOID_REINIT_BEFORE_AND_AFTER_FULLMINUTE_FOR_s && currentTime->getSeconds() > AVOID_REINIT_BEFORE_AND_AFTER_FULLMINUTE_FOR_s) { P.begin(); - Serial.println("reinit display"); + Serial.print("reinit display, free="); Serial.println(free); last_reinit_ts = millis(); } }