Add logging, code cleanup, and add save on delete.

This commit is contained in:
Jason P
2026-01-12 09:04:16 -06:00
parent dfb8e21101
commit 5589d198a4
2 changed files with 9 additions and 30 deletions

View File

@@ -15,7 +15,7 @@
// Default autosave interval 12 hours, override per device later with -DMESSAGE_AUTOSAVE_INTERVAL_SEC=300 (etc)
#ifndef MESSAGE_AUTOSAVE_INTERVAL_SEC
#define MESSAGE_AUTOSAVE_INTERVAL_SEC (12 * 60 * 60)
#define MESSAGE_AUTOSAVE_INTERVAL_SEC (2 * 60 * 60)
#endif
// Global message text pool and state
@@ -152,8 +152,10 @@ static inline void autosaveTick(MessageStore *store)
// Autosave interval reached, Only save if there are unsaved messages.
if (g_messageStoreHasUnsavedChanges) {
LOG_INFO("Autosaving MessageStore to flash");
store->saveToFlash();
} else {
LOG_INFO("Autosave skipped, no changes to save");
g_lastAutoSaveMs = now;
}
}