Skip to content

Commit e4f46ec

Browse files
committed
Add diagnostics to level DEBUG and manually settable in the sketch
1 parent 54cbe5e commit e4f46ec

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

cores/esp32/Arduino.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ uint16_t makeWord(uint8_t h, uint8_t l);
200200
size_t getArduinoLoopTaskStackSize(void);
201201
#define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;}
202202

203+
bool shouldPrintChipDebugInfo(void);
204+
#define ENABLE_CHIP_DEBUG_INFO bool shouldPrintChipDebugInfo(void){return true;}
205+
203206
// allows user to bypass esp_spiram_test()
204207
bool esp_psram_extram_test(void);
205208
#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_psram_extram_test(); }

cores/esp32/main.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,26 @@ __attribute__((weak)) size_t getArduinoLoopTaskStackSize(void) {
4141
return ARDUINO_LOOP_STACK_SIZE;
4242
}
4343

44+
__attribute__((weak)) bool shouldPrintChipDebugInfo(void) {
45+
return false;
46+
}
47+
4448
void loopTask(void *pvParameters)
4549
{
46-
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
50+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
4751
printBeforeSetupInfo();
52+
#else
53+
if(shouldPrintChipDebugInfo()){
54+
printBeforeSetupInfo();
55+
}
4856
#endif
4957
setup();
50-
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
58+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
5159
printAfterSetupInfo();
60+
#else
61+
if(shouldPrintChipDebugInfo()){
62+
printAfterSetupInfo();
63+
}
5264
#endif
5365
for(;;) {
5466
#if CONFIG_FREERTOS_UNICORE

0 commit comments

Comments
 (0)