From 2ae391197f7c1fd92bce8f60c75ff3482aab2bbf Mon Sep 17 00:00:00 2001 From: Igor Danilov <59930161+polarikus@users.noreply.github.com> Date: Mon, 8 Dec 2025 00:50:53 +0300 Subject: [PATCH] Fix #8883 (lora-Pager fter playing the notification, voltage does not disappear from the speaker) (#8884) * Fix #8883 * Fix crash when delete not inicialized rtttlFile --- src/AudioThread.h | 11 +++++++---- src/modules/ExternalNotificationModule.cpp | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/AudioThread.h b/src/AudioThread.h index df4892b6e..23552c421 100644 --- a/src/AudioThread.h +++ b/src/AudioThread.h @@ -50,8 +50,11 @@ class AudioThread : public concurrency::OSThread delete i2sRtttl; i2sRtttl = nullptr; } - delete rtttlFile; - rtttlFile = nullptr; + + if (rtttlFile != nullptr) { + delete rtttlFile; + rtttlFile = nullptr; + } setCPUFast(false); #ifdef T_LORA_PAGER @@ -99,9 +102,9 @@ class AudioThread : public concurrency::OSThread }; AudioGeneratorRTTTL *i2sRtttl = nullptr; - AudioOutputI2S *audioOut; + AudioOutputI2S *audioOut = nullptr; - AudioFileSourcePROGMEM *rtttlFile; + AudioFileSourcePROGMEM *rtttlFile = nullptr; }; #endif diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 91e96b8d4..ecbe71b27 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -310,8 +310,7 @@ void ExternalNotificationModule::stopNow() rtttl::stop(); #ifdef HAS_I2S LOG_INFO("Stop audioThread playback"); - if (audioThread->isPlaying()) - audioThread->stop(); + audioThread->stop(); #endif // Turn off all outputs LOG_INFO("Turning off setExternalStates");