mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-03 05:53:24 +00:00
add optional debug logging to see which OSThread / loops have what delays
This commit is contained in:
parent
91e2e3f0e8
commit
0b4a28866b
@ -56,6 +56,7 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
#-DBUILD_EPOCH=$UNIX_TIME ; set in platformio-custom.py now
|
#-DBUILD_EPOCH=$UNIX_TIME ; set in platformio-custom.py now
|
||||||
#-D OLED_PL=1
|
#-D OLED_PL=1
|
||||||
#-D DEBUG_HEAP=1 ; uncomment to add free heap space / memory leak debugging logs
|
#-D DEBUG_HEAP=1 ; uncomment to add free heap space / memory leak debugging logs
|
||||||
|
#-D DEBUG_LOOP_TIMING=1 ; uncomment to add main loop timing logs
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters = direct
|
monitor_filters = direct
|
||||||
|
@ -90,7 +90,9 @@ void OSThread::run()
|
|||||||
if (heap < newHeap)
|
if (heap < newHeap)
|
||||||
LOG_HEAP("++++++ Thread %s freed heap %d -> %d (%d) ++++++", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
LOG_HEAP("++++++ Thread %s freed heap %d -> %d (%d) ++++++", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DEBUG_LOOP_TIMING
|
||||||
|
LOG_DEBUG("====== Thread next run in: %d", newDelay);
|
||||||
|
#endif
|
||||||
runned();
|
runned();
|
||||||
|
|
||||||
if (newDelay >= 0)
|
if (newDelay >= 0)
|
||||||
|
@ -1607,6 +1607,9 @@ void loop()
|
|||||||
|
|
||||||
// We want to sleep as long as possible here - because it saves power
|
// We want to sleep as long as possible here - because it saves power
|
||||||
if (!runASAP && loopCanSleep()) {
|
if (!runASAP && loopCanSleep()) {
|
||||||
|
#ifdef DEBUG_LOOP_TIMING
|
||||||
|
LOG_DEBUG("main loop delay: %d", delayMsec);
|
||||||
|
#endif
|
||||||
mainDelay.delay(delayMsec);
|
mainDelay.delay(delayMsec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user