From 95b03592dc0b753dfcfa30c1cc17d8e1f2a547f9 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:57:45 +0100 Subject: [PATCH] Add ISR logging failsafe --- tasmota/tasmota_support/support.ino | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 8966df9f2..766a821dc 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -2570,6 +2570,15 @@ uint32_t HighestLogLevel() { } 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(); // If no logging is requested then do not access heap to fight fragmentation