minor improvements for debugging
* Info page: status of Serial (can be disconnected on new MCUs), and owner of RX/TX pins * improved handling of Serial (don't write if not connected) * added min available stack size to debug output (esp32 only) * webserver show remaining stack size * webserver: show string buffer usage
This commit is contained in:
@@ -676,6 +676,8 @@ function populateInfo(i)
|
||||
${urows}
|
||||
${urows===""?'':'<tr><td colspan=2><hr style="height:1px;border-width:0;color:SeaGreen;background-color:Seagreen"></td></tr>'}
|
||||
${i.opt&0x100?inforow("Net Serial ☾","<button class=\"btn btn-xs\" onclick=\"requestJson({'netDebug':"+(i.opt&0x0080?"false":"true")+"});\"><i class=\"icons "+(i.opt&0x0080?"on":"off")+"\"></i></button>"):''}
|
||||
${i.serialOnline?inforow(i.serialOnline,"TX="+i.sTX,"; RX="+i.sRX):""}
|
||||
${i.opt&0x100?'<tr><td colspan=2><hr style="height:1px;border-width:0;color:GoldenRod;background-color:GoldenRod"></td></tr>':''}
|
||||
${inforow("Build",i.vid)}
|
||||
${inforow("Estimated current",pwru)}
|
||||
${inforow("Average FPS",i.leds.fps)}
|
||||
|
||||
@@ -972,6 +972,12 @@ void serializeInfo(JsonObject root)
|
||||
default: root[F("e32flashtext")] = F(" (other)"); break;
|
||||
}
|
||||
#endif
|
||||
#if defined(WLED_DEBUG) || defined(WLED_DEBUG_HOST) || defined(SR_DEBUG) || defined(SR_STATS)
|
||||
// WLEDMM add status of Serial, incuding pin alloc
|
||||
root[F("serialOnline")] = Serial ? (canUseSerial()?F("Serial ready"):F("Serial in use")) : F("Serial disconected"); // "Disconnected" may happen on boards with USB CDC
|
||||
root[F("sRX")] = pinManager.isPinAllocated(hardwareRX) ? pinManager.getPinOwnerText(hardwareRX): F("free");
|
||||
root[F("sTX")] = pinManager.isPinAllocated(hardwareTX) ? pinManager.getPinOwnerText(hardwareTX): F("free");
|
||||
#endif
|
||||
// end WLEDMM
|
||||
|
||||
root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;
|
||||
|
||||
@@ -198,6 +198,9 @@ void WLED::loop()
|
||||
DEBUG_PRINT(F("Runtime: ")); DEBUG_PRINTLN(millis());
|
||||
DEBUG_PRINT(F("Unix time: ")); toki.printTime(toki.getTime());
|
||||
DEBUG_PRINT(F("Free heap: ")); DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
DEBUG_PRINT(pcTaskGetTaskName(NULL)); DEBUG_PRINT(F(" free stack ")); DEBUG_PRINTLN(uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
|
||||
if (psramFound()) {
|
||||
//DEBUG_PRINT(F("Total PSRAM: ")); DEBUG_PRINT(ESP.getPsramSize()/1024); DEBUG_PRINTLN("kB");
|
||||
@@ -292,17 +295,17 @@ void WLED::setup()
|
||||
#else
|
||||
#endif
|
||||
#if defined(WLED_DEBUG) && defined(ARDUINO_ARCH_ESP32) && (defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || ARDUINO_USB_CDC_ON_BOOT)
|
||||
delay(2500); // allow CDC USB serial to initialise
|
||||
if (!Serial) delay(2500); // WLEDMM allow CDC USB serial to initialise
|
||||
#endif
|
||||
|
||||
#if ARDUINO_USB_CDC_ON_BOOT
|
||||
delay(2500); // WLEDMM: always allow CDC USB serial to initialise
|
||||
if (!Serial) delay(2500); // WLEDMM: always allow CDC USB serial to initialise
|
||||
Serial.println("wait 1"); // waiting a bit longer ensures that a debug messages are shown in serial monitor
|
||||
delay(2500);
|
||||
if (!Serial) delay(2500);
|
||||
Serial.println("wait 2");
|
||||
delay(2500);
|
||||
if (!Serial) delay(2500);
|
||||
|
||||
Serial.flush();
|
||||
if (Serial) Serial.flush(); // WLEDMM
|
||||
Serial.setTimeout(350); // WLEDMM: don't change timeout, as it causes crashes later
|
||||
// WLEDMM: redirect debug output to HWCDC
|
||||
Serial0.setDebugOutput(false);
|
||||
@@ -403,6 +406,12 @@ void WLED::setup()
|
||||
DEBUG_PRINTLN(ESP.getCoreVersion());
|
||||
#endif
|
||||
DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) // unfortunately not availeable in older framework versions
|
||||
USER_PRINT(F("\nArduino max stack ")); USER_PRINTLN(getArduinoLoopTaskStackSize());
|
||||
#endif
|
||||
USER_PRINT(pcTaskGetTaskName(NULL)); USER_PRINT(F(" free stack ")); USER_PRINTLN(uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
|
||||
if (psramFound()) {
|
||||
@@ -456,6 +465,9 @@ void WLED::setup()
|
||||
registerUsermods();
|
||||
|
||||
DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
DEBUG_PRINT(pcTaskGetTaskName(NULL)); DEBUG_PRINT(F(" free stack ")); DEBUG_PRINTLN(uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
|
||||
for (uint8_t i=1; i<WLED_MAX_BUTTONS; i++) btnPin[i] = -1;
|
||||
|
||||
@@ -563,6 +575,9 @@ void WLED::setup()
|
||||
DEBUG_PRINTLN(F("initServer"));
|
||||
initServer();
|
||||
DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
DEBUG_PRINT(pcTaskGetTaskName(NULL)); DEBUG_PRINT(F(" free stack ")); DEBUG_PRINTLN(uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
|
||||
enableWatchdog();
|
||||
|
||||
@@ -827,9 +842,9 @@ void WLED::initConnection()
|
||||
USER_PRINT(F("Connecting to "));
|
||||
USER_PRINT(clientSSID);
|
||||
USER_PRINT(" / ");
|
||||
for(int i = 0; i<strlen(clientPass); i++){
|
||||
for(unsigned i = 0; i<strlen(clientPass); i++) {
|
||||
USER_PRINT("*");
|
||||
}
|
||||
}
|
||||
USER_PRINTLN(" ...");
|
||||
|
||||
// convert the "serverDescription" into a valid DNS hostname (alphanumeric)
|
||||
|
||||
@@ -364,6 +364,9 @@ void initServer()
|
||||
#endif
|
||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
USER_PRINTF("%s Client request %s\n", serverDescription, request->url().c_str()); //WLEDMM: want to see if client connects to wled, for netdebug also wants to know server
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
USER_PRINT(pcTaskGetTaskName(NULL)); USER_PRINT(F(" min free stack ")); USER_PRINTLN(uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
if (captivePortal(request)) return;
|
||||
serveIndexOrWelcome(request);
|
||||
});
|
||||
@@ -551,6 +554,13 @@ void serveSettingsJS(AsyncWebServerRequest* request)
|
||||
strcat_P(buf,PSTR("function GetV(){var d=document;"));
|
||||
getSettingsJS(request, subPage, buf+strlen(buf)); // this may overflow by 35bytes!!! WLEDMM add request
|
||||
strcat_P(buf,PSTR("}"));
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
DEBUG_PRINT(F("ServeSettingsJS: "));
|
||||
DEBUG_PRINT(pcTaskGetTaskName(NULL)); DEBUG_PRINT(F(" min free stack ")); DEBUG_PRINT(uxTaskGetStackHighWaterMark(NULL));
|
||||
DEBUG_PRINTF(PSTR(" bytes.\tString buffer usage: %4d of %d bytes\n"), strlen(buf)+1, SETTINGS_STACK_BUF_SIZE+37);
|
||||
#endif
|
||||
|
||||
request->send(200, "application/javascript", buf);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,8 @@ void sendDataWs(AsyncWebSocketClient * client)
|
||||
DEBUG_PRINTLN(F("Out of memory (WS)!"));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
//DEBUG_PRINT(pcTaskGetTaskName(NULL)); DEBUG_PRINT(F(" min free stack ")); DEBUG_PRINT(uxTaskGetStackHighWaterMark(NULL));
|
||||
#endif
|
||||
buffer = ws.makeBuffer(len); // will not allocate correct memory sometimes on ESP8266
|
||||
#ifdef ESP8266
|
||||
|
||||
Reference in New Issue
Block a user