mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 01:42:15 +00:00
Also reboot if no heap debugging enabled
This commit is contained in:
parent
e8186f7dba
commit
19d864b5ce
@ -1,7 +1,8 @@
|
||||
#include "OSThread.h"
|
||||
#include "configuration.h"
|
||||
#ifdef DEBUG_HEAP
|
||||
#ifdef HAS_SCREEN
|
||||
#include "graphics/Screen.h"
|
||||
#endif
|
||||
#include "main.h"
|
||||
#endif
|
||||
#include <assert.h>
|
||||
@ -83,18 +84,21 @@ void OSThread::run()
|
||||
#endif
|
||||
currentThread = this;
|
||||
auto newDelay = runOnce();
|
||||
#ifdef DEBUG_HEAP
|
||||
#ifdef ARCH_ESP32
|
||||
auto newHeap = ESP.getFreeHeap();
|
||||
if (newHeap < 10000) {
|
||||
LOG_DEBUG("\n\n====== heap too low [10000] -> reboot in 5s ======\n\n");
|
||||
#ifdef HAS_SCREEN
|
||||
screen->startRebootScreen();
|
||||
#endif
|
||||
rebootAtMsec = millis() + 5000;
|
||||
}
|
||||
#ifdef DEBUG_HEAP
|
||||
if (newHeap < heap)
|
||||
LOG_DEBUG("------ Thread %s leaked heap %d -> %d (%d) ------\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
if (heap < newHeap)
|
||||
LOG_DEBUG("++++++ Thread %s freed heap %d -> %d (%d) ++++++\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
|
||||
if (newHeap < 10000) {
|
||||
LOG_DEBUG("\n\n====== heap too low [10000] -> reboot in 5s ======\n\n");
|
||||
screen->startRebootScreen();
|
||||
rebootAtMsec = millis() + 5000;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
runned();
|
||||
|
Loading…
Reference in New Issue
Block a user