From 403e5c304ecf22ed084b341c203147d5be2400c9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 29 Sep 2024 07:29:53 -0500 Subject: [PATCH] Fix: Not being able to stop Ext. Notification nagging for screenless devices (#4899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move logic up to button thread for screen-less devices * Comment doesn't apply * Fiddy --------- Co-authored-by: Thomas Göttgens --- src/ButtonThread.cpp | 5 +++++ src/graphics/Screen.cpp | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 5351fa049..9e6ef55f5 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -124,6 +124,11 @@ int32_t ButtonThread::runOnce() switch (btnEvent) { case BUTTON_EVENT_PRESSED: { LOG_BUTTON("press!\n"); + // If a nag notification is running, stop it and prevent other actions + if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) { + externalNotificationModule->stopNow(); + return 50; + } #ifdef BUTTON_PIN if (((config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN) != moduleConfig.canned_message.inputbroker_pin_press) || diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 4f6a5a45f..ef6b05ca4 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1884,13 +1884,7 @@ int32_t Screen::runOnce() handleSetOn(false); break; case Cmd::ON_PRESS: - // If a nag notification is running, stop it - if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) { - externalNotificationModule->stopNow(); - } else { - // Don't advance the screen if we just wanted to switch off the nag notification - handleOnPress(); - } + handleOnPress(); break; case Cmd::SHOW_PREV_FRAME: handleShowPrevFrame();