mirror of https://github.com/arendst/Tasmota.git
Add ISR logging failsafe
This commit is contained in:
parent
bfd44d06f9
commit
95b03592dc
|
@ -2570,6 +2570,15 @@ uint32_t HighestLogLevel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddLog(uint32_t loglevel, PGM_P formatP, ...) {
|
void AddLog(uint32_t loglevel, PGM_P formatP, ...) {
|
||||||
|
#ifdef ESP32
|
||||||
|
if (xPortInIsrContext()) {
|
||||||
|
// When called from an ISR, you should not send out logs.
|
||||||
|
// Allocating memory from within an ISR is a big no-no.
|
||||||
|
// Also long-time blocking like sending logs (especially to a syslog server)
|
||||||
|
// is also really not a good idea from an ISR call.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
uint32_t highest_loglevel = HighestLogLevel();
|
uint32_t highest_loglevel = HighestLogLevel();
|
||||||
|
|
||||||
// If no logging is requested then do not access heap to fight fragmentation
|
// If no logging is requested then do not access heap to fight fragmentation
|
||||||
|
|
Loading…
Reference in New Issue