From 358e4e2fcd3fb800a9440ac50afab259b9cac01e Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Wed, 17 Jun 2026 14:34:05 -0400 Subject: [PATCH] InkHUD: Wipe all messages option (#10721) * Wipe messages * trunk --- .../InkHUD/Applets/System/Menu/MenuAction.h | 1 + .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 16 ++++++++++++++++ .../niche/InkHUD/Applets/System/Menu/MenuPage.h | 1 + src/graphics/niche/InkHUD/Persistence.cpp | 4 +++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h index 564afa558..4c70c434f 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h @@ -129,6 +129,7 @@ enum MenuAction { // Administration RESET_NODEDB_ALL, RESET_NODEDB_KEEP_FAVORITES, + WIPE_MESSAGES_ALL, }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index 12dde48e9..288dc0037 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -6,6 +6,7 @@ #include "GPS.h" #include "MeshRadio.h" #include "MeshService.h" +#include "MessageStore.h" #include "RTC.h" #include "Router.h" #include "airtime.h" @@ -1013,6 +1014,13 @@ void InkHUD::MenuApplet::execute(MenuItem item) rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000; break; + case WIPE_MESSAGES_ALL: + LOG_INFO("Wiping all messages from menu"); + messageStore.clearAllMessages(); + inkhud->persistence->loadLatestMessage(); + inkhud->forceUpdate(Drivers::EInk::UpdateTypes::FULL, true); + break; + default: LOG_WARN("Action not implemented"); } @@ -1130,6 +1138,7 @@ void InkHUD::MenuApplet::showPage(MenuPage page) // Administration Section items.push_back(MenuItem::Header("Administration")); items.push_back(MenuItem("Reset NodeDB", MenuPage::NODE_CONFIG_ADMIN_RESET)); + items.push_back(MenuItem("Wipe Messages", MenuPage::NODE_CONFIG_ADMIN_MESSAGES)); // Exit items.push_back(MenuItem("Exit", MenuPage::EXIT)); @@ -1534,6 +1543,13 @@ void InkHUD::MenuApplet::showPage(MenuPage page) items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; + case NODE_CONFIG_ADMIN_MESSAGES: + previousPage = MenuPage::NODE_CONFIG; + items.push_back(MenuItem("Back", previousPage)); + items.push_back(MenuItem("Wipe All Messages", MenuAction::WIPE_MESSAGES_ALL, MenuPage::EXIT)); + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + // Exit case EXIT: sendToBackground(); // Menu applet dismissed, allow normal behavior to resume diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h index 9bc6bb0cc..275bb97f2 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h @@ -36,6 +36,7 @@ enum MenuPage : uint8_t { NODE_CONFIG_BLUETOOTH, NODE_CONFIG_POSITION, NODE_CONFIG_ADMIN_RESET, + NODE_CONFIG_ADMIN_MESSAGES, TIMEZONE, APPLETS, AUTOSHOW, diff --git a/src/graphics/niche/InkHUD/Persistence.cpp b/src/graphics/niche/InkHUD/Persistence.cpp index 4197b81e0..8a8140bb3 100644 --- a/src/graphics/niche/InkHUD/Persistence.cpp +++ b/src/graphics/niche/InkHUD/Persistence.cpp @@ -22,6 +22,8 @@ void InkHUD::Persistence::loadSettings() // are immediately available to applets (DMApplet, AllMessageApplet, NotificationApplet). void InkHUD::Persistence::loadLatestMessage() { + latestMessage = LatestMessage(); + int lastBroadcastPos = -1, lastDMPos = -1, pos = 0; for (const StoredMessage &m : messageStore.getLiveMessages()) { if (m.type == MessageType::BROADCAST) { @@ -75,4 +77,4 @@ void InkHUD::Persistence::printSettings(Settings *settings) } */ -#endif \ No newline at end of file +#endif