mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 18:31:37 +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()
|
void OSThread::run()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_HEAP
|
||||||
|
auto heap = ESP.getFreeHeap();
|
||||||
|
#endif
|
||||||
currentThread = this;
|
currentThread = this;
|
||||||
auto newDelay = runOnce();
|
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();
|
runned();
|
||||||
|
|
||||||
@ -85,6 +93,12 @@ void OSThread::run()
|
|||||||
currentThread = NULL;
|
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.
|
* 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.
|
* 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();
|
static void setup();
|
||||||
|
|
||||||
|
void disable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait a specified number msecs starting from the current time (rather than the last time we were run)
|
* 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