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:
Frank
2023-03-25 21:10:15 +01:00
parent df9df5e4c8
commit f52e706c95
5 changed files with 42 additions and 7 deletions

View File

@@ -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);
}