Fix ESP8266 exception when using profiling

This commit is contained in:
Theo Arends 2021-10-31 11:57:06 +01:00
parent 5a3e380f4c
commit 25026b5923
3 changed files with 20 additions and 6 deletions

View File

@ -68,7 +68,7 @@ void AddLogDriver(const char *driver, uint8_t function, uint32_t start) {
uint32_t profile_millis = millis() - start;
if (profile_millis > PROFILE_THRESHOLD) {
char stemp1[20];
AddLog(LOG_LEVEL_DEBUG, PSTR("PRF: *** %s FUNC_%s (%d ms)"), driver, GetTextIndexed(stemp1, sizeof(stemp1), function, kXSnsFunctions), profile_millis);
AddLog(LOG_LEVEL_DEBUG, PSTR("PRF: *** x%s FUNC_%s (%d ms)"), driver, GetTextIndexed(stemp1, sizeof(stemp1), function, kXSnsFunctions), profile_millis);
}
}
#endif // USE_PROFILE_DRIVER
@ -78,7 +78,7 @@ void AddLogFunction(const char *driver, uint8_t index, uint8_t function, uint32_
uint32_t profile_millis = millis() - start;
if (profile_millis > PROFILE_THRESHOLD) {
char stemp1[20];
AddLog(LOG_LEVEL_DEBUG, PSTR("PRF: *** %s_%02d FUNC_%s (%d ms)"), driver, index, GetTextIndexed(stemp1, sizeof(stemp1), function, kXSnsFunctions), profile_millis);
AddLog(LOG_LEVEL_DEBUG, PSTR("PRF: *** x%s_%02d FUNC_%s (%d ms)"), driver, index, GetTextIndexed(stemp1, sizeof(stemp1), function, kXSnsFunctions), profile_millis);
}
}
#endif // USE_PROFILE_DRIVER

View File

@ -1145,7 +1145,14 @@ bool XdrvCall(uint8_t Function)
result = xdrv_func_ptr[x](Function);
PROFILE_FUNCTION(PSTR("xdrv"), kXdrvList[x], Function, profile_function_start);
#ifdef USE_PROFILE_FUNCTION
#ifdef XFUNC_PTR_IN_ROM
uint32_t index = pgm_read_byte(kXdrvList + x);
#else
uint32_t index = kXdrvList[x];
#endif
PROFILE_FUNCTION("drv", index, Function, profile_function_start);
#endif // USE_PROFILE_FUNCTION
if (result && ((FUNC_COMMAND == Function) ||
(FUNC_COMMAND_DRIVER == Function) ||
@ -1162,7 +1169,7 @@ bool XdrvCall(uint8_t Function)
}
}
PROFILE_DRIVER(PSTR("xdrv"), Function, profile_driver_start);
PROFILE_DRIVER("drv", Function, profile_driver_start);
return result;
}

View File

@ -1126,7 +1126,14 @@ bool XsnsCall(uint8_t Function) {
result = xsns_func_ptr[x](Function);
PROFILE_FUNCTION(PSTR("xsns"), kXsnsList[x], Function, profile_function_start);
#ifdef USE_PROFILE_FUNCTION
#ifdef XFUNC_PTR_IN_ROM
uint32_t index = pgm_read_byte(kXsnsList + x);
#else
uint32_t index = kXsnsList[x];
#endif
PROFILE_FUNCTION("sns", index, Function, profile_function_start);
#endif // USE_PROFILE_FUNCTION
if (result && ((FUNC_COMMAND == Function) ||
(FUNC_PIN_STATE == Function) ||
@ -1137,7 +1144,7 @@ bool XsnsCall(uint8_t Function) {
}
}
PROFILE_DRIVER(PSTR("xsns"), Function, profile_driver_start);
PROFILE_DRIVER("sns", Function, profile_driver_start);
return result;
}