sforkowany z mirror/meshtastic-firmware
				
			basic stack debugging - we are okay for now
							rodzic
							
								
									a8d4b5479d
								
							
						
					
					
						commit
						03cb3c2145
					
				| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
#include "WorkerThread.h"
 | 
					#include "WorkerThread.h"
 | 
				
			||||||
 | 
					#include "debug.h"
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Thread::start(const char *name, size_t stackSize, uint32_t priority)
 | 
					void Thread::start(const char *name, size_t stackSize, uint32_t priority)
 | 
				
			||||||
| 
						 | 
					@ -16,6 +17,15 @@ void WorkerThread::doRun()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    while (!wantExit) {
 | 
					    while (!wantExit) {
 | 
				
			||||||
        block();
 | 
					        block();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef DEBUG_STACK
 | 
				
			||||||
 | 
					        static uint32_t lastPrint = 0;
 | 
				
			||||||
 | 
					        if (millis() - lastPrint > 10 * 1000L) {
 | 
				
			||||||
 | 
					            lastPrint = millis();
 | 
				
			||||||
 | 
					            meshtastic::printThreadInfo("net");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop();
 | 
					        loop();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -28,8 +38,6 @@ void NotifiedWorkerThread::notify(uint32_t v, eNotifyAction action)
 | 
				
			||||||
    xTaskNotify(taskHandle, v, action);
 | 
					    xTaskNotify(taskHandle, v, action);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void NotifiedWorkerThread::block()
 | 
					void NotifiedWorkerThread::block()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    xTaskNotifyWait(0,                                          // don't clear notification on entry
 | 
					    xTaskNotifyWait(0,                                          // don't clear notification on entry
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,8 @@ class Thread
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    virtual ~Thread() { vTaskDelete(taskHandle); }
 | 
					    virtual ~Thread() { vTaskDelete(taskHandle); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint32_t getStackHighwaterMark() { return uxTaskGetStackHighWaterMark(taskHandle); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * The method that will be called when start is called.
 | 
					     * The method that will be called when start is called.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,7 @@
 | 
				
			||||||
#include "power.h"
 | 
					#include "power.h"
 | 
				
			||||||
// #include "rom/rtc.h"
 | 
					// #include "rom/rtc.h"
 | 
				
			||||||
#include "DSRRouter.h"
 | 
					#include "DSRRouter.h"
 | 
				
			||||||
 | 
					#include "debug.h"
 | 
				
			||||||
#include "main.h"
 | 
					#include "main.h"
 | 
				
			||||||
#include "screen.h"
 | 
					#include "screen.h"
 | 
				
			||||||
#include "sleep.h"
 | 
					#include "sleep.h"
 | 
				
			||||||
| 
						 | 
					@ -314,6 +315,14 @@ void loop()
 | 
				
			||||||
        showingBootScreen = false;
 | 
					        showingBootScreen = false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef DEBUG_STACK
 | 
				
			||||||
 | 
					    static uint32_t lastPrint = 0;
 | 
				
			||||||
 | 
					    if (millis() - lastPrint > 10 * 1000L) {
 | 
				
			||||||
 | 
					        lastPrint = millis();
 | 
				
			||||||
 | 
					        meshtastic::printThreadInfo("main");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Update the screen last, after we've figured out what to show.
 | 
					    // Update the screen last, after we've figured out what to show.
 | 
				
			||||||
    screen.debug()->setNodeNumbersStatus(nodeDB.getNumOnlineNodes(), nodeDB.getNumNodes());
 | 
					    screen.debug()->setNodeNumbersStatus(nodeDB.getNumOnlineNodes(), nodeDB.getNumNodes());
 | 
				
			||||||
    screen.debug()->setChannelNameStatus(channelSettings.name);
 | 
					    screen.debug()->setChannelNameStatus(channelSettings.name);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue