mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 09:42:35 +00:00
Heap Debugging and Thread Disable
This commit is contained in:
parent
4e4a74379e
commit
a8f93d5f47
@ -74,8 +74,16 @@ bool OSThread::shouldRun(unsigned long time)
|
||||
|
||||
void OSThread::run()
|
||||
{
|
||||
#ifdef DEBUG_HEAP
|
||||
auto heap = ESP.getFreeHeap();
|
||||
#endif
|
||||
currentThread = this;
|
||||
auto newDelay = runOnce();
|
||||
#ifdef DEBUG_HEAP
|
||||
auto newHeap = ESP.getFreeHeap();
|
||||
if (newHeap < heap)
|
||||
DEBUG_MSG("Thread %s leaked heap %d -> %d (%d)\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
#endif
|
||||
|
||||
runned();
|
||||
|
||||
@ -85,6 +93,12 @@ void OSThread::run()
|
||||
currentThread = NULL;
|
||||
}
|
||||
|
||||
void OSThread::disable() {
|
||||
enabled = false;
|
||||
setInterval(INT32_MAX);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This flag is set **only** when setup() starts, to provide a way for us to check for sloppy static constructor calls.
|
||||
* Call assertIsSetup() to force a crash if someone tries to create an instance too early.
|
||||
|
@ -53,6 +53,8 @@ class OSThread : public Thread
|
||||
|
||||
static void setup();
|
||||
|
||||
void disable();
|
||||
|
||||
/**
|
||||
* Wait a specified number msecs starting from the current time (rather than the last time we were run)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user