added cumstom Panic Handler
parent
73f57b4d11
commit
b5cd04fb86
|
@ -38,4 +38,6 @@ static EventGroupHandle_t s_wifi_event_group;
|
|||
static const char *jannexTAG = "JANNEX";
|
||||
|
||||
void initJannex();
|
||||
void updateJannex();
|
||||
void updateJannex();
|
||||
|
||||
void setCustomPanicHandler(void (*func)());
|
11
src/jannex.c
11
src/jannex.c
|
@ -216,12 +216,23 @@ void updateJannex()
|
|||
// Declare the real panic handler function. We'll be able to call it after executing our custom code
|
||||
void __real_esp_panic_handler(void *);
|
||||
|
||||
void (*customPanicHandler)() = NULL;
|
||||
|
||||
void setCustomPanicHandler(void (*func)())
|
||||
{
|
||||
customPanicHandler = func;
|
||||
}
|
||||
// This function will be considered the esp_panic_handler to call in case a panic occurs
|
||||
void __wrap_esp_panic_handler(panic_info_t *info)
|
||||
{
|
||||
// Custom code, count the number of panics or simply print a message
|
||||
panicRetryCounter++;
|
||||
|
||||
if (customPanicHandler != NULL)
|
||||
{
|
||||
customPanicHandler();
|
||||
}
|
||||
|
||||
// Convert the integer to a string
|
||||
// char retryCounterStr[10]; // Adjust the size as needed
|
||||
// snprintf(retryCounterStr, sizeof(retryCounterStr), "%d", panicRetryCounter);
|
||||
|
|
Loading…
Reference in New Issue