Add command trace code to be enabled with define DEBUG_COMMAND_HANG (#23481)

This commit is contained in:
Theo Arends 2025-05-27 11:31:15 +02:00
parent 6aca98673d
commit b822a37a7c
2 changed files with 52 additions and 0 deletions

View File

@ -1157,12 +1157,32 @@ bool XdrvCall(uint32_t function) {
uint32_t profile_driver_start = millis();
#endif // USE_PROFILE_FUNCTION
#ifdef DEBUG_COMMAND_HANG
char tstchr[10];
if (FUNC_COMMAND == function) {
sprintf(tstchr, "DRV: ");
TasConsole.printf(tstchr);
}
#endif // DEBUG_COMMAND_HANG
for (uint32_t x = 0; x < xdrv_present; x++) {
#ifdef USE_PROFILE_FUNCTION
uint32_t profile_function_start = millis();
#endif // USE_PROFILE_FUNCTION
#ifdef DEBUG_COMMAND_HANG
if (FUNC_COMMAND == function) {
#ifdef XFUNC_PTR_IN_ROM
uint32_t driverid = pgm_read_byte(kXdrvList + x);
#else
uint32_t driverid = kXdrvList[x];
#endif
sprintf(tstchr, "%d,", driverid);
TasConsole.printf(tstchr);
}
#endif // DEBUG_COMMAND_HANG
result = xdrv_func_ptr[x](function);
#ifdef USE_WEBSERVER
@ -1197,6 +1217,12 @@ bool XdrvCall(uint32_t function) {
}
}
#ifdef DEBUG_COMMAND_HANG
if (FUNC_COMMAND == function) {
TasConsole.println();
}
#endif // DEBUG_COMMAND_HANG
PROFILE_DRIVER("drv", function, profile_driver_start);
return result;

View File

@ -1117,6 +1117,14 @@ bool XsnsCall(uint32_t function) {
uint32_t profile_driver_start = millis();
#endif // USE_PROFILE_FUNCTION
#ifdef DEBUG_COMMAND_HANG
char tstchr[10];
if (FUNC_COMMAND == function) {
sprintf(tstchr, "SNS: ");
TasConsole.printf(tstchr);
}
#endif // DEBUG_COMMAND_HANG
for (uint32_t x = 0; x < xsns_present; x++) {
if (XsnsEnabled(0, x)) { // Skip disabled sensor
if ((FUNC_WEB_SENSOR == function) && !XsnsEnabled(1, x)) { continue; } // Skip web info for disabled sensors
@ -1125,6 +1133,18 @@ bool XsnsCall(uint32_t function) {
uint32_t profile_function_start = millis();
#endif // USE_PROFILE_FUNCTION
#ifdef DEBUG_COMMAND_HANG
if (FUNC_COMMAND == function) {
#ifdef XFUNC_PTR_IN_ROM
uint32_t sensorid = pgm_read_byte(kXsnsList + x);
#else
uint32_t sensorid = kXsnsList[x];
#endif
sprintf(tstchr, "%d,", sensorid);
TasConsole.printf(tstchr);
}
#endif // DEBUG_COMMAND_HANG
result = xsns_func_ptr[x](function);
#ifdef USE_WEBSERVER
@ -1147,6 +1167,12 @@ bool XsnsCall(uint32_t function) {
}
}
#ifdef DEBUG_COMMAND_HANG
if (FUNC_COMMAND == function) {
TasConsole.println();
}
#endif // DEBUG_COMMAND_HANG
PROFILE_DRIVER("sns", function, profile_driver_start);
return result;