Compare commits

...

2 Commits

Author SHA1 Message Date
HarukiToreda f896c32fb7 trunk 2026-06-15 10:23:27 -04:00
HarukiToreda 2101785b3d Wipe messages 2026-06-15 10:14:38 -04:00
4 changed files with 21 additions and 1 deletions
@@ -129,6 +129,7 @@ enum MenuAction {
// Administration
RESET_NODEDB_ALL,
RESET_NODEDB_KEEP_FAVORITES,
WIPE_MESSAGES_ALL,
};
} // namespace NicheGraphics::InkHUD
@@ -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
@@ -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,
+3 -1
View File
@@ -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
#endif