summaryrefslogtreecommitdiff
path: root/src/system_fsm/running.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-01-30 11:03:31 +1100
committerjacqueline <me@jacqueline.id.au>2024-01-30 11:03:31 +1100
commiteacea59e8a3f9602ed06834a8edc4e6ab18a4bb9 (patch)
treecfafc753e2f9280dd81d2cb48520a427da54e141 /src/system_fsm/running.cpp
parentc399199bfccb5298fe4b0cf566d8e69729596ba4 (diff)
downloadtangara-fw-eacea59e8a3f9602ed06834a8edc4e6ab18a4bb9.tar.gz
Do more to avoid and recover from partial db updates
- do not power off in an update is in progress - explicitly store last update time, rather than deriving it from unchanged tracks.
Diffstat (limited to 'src/system_fsm/running.cpp')
-rw-r--r--src/system_fsm/running.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/system_fsm/running.cpp b/src/system_fsm/running.cpp
index 9e10f9ec..ec448657 100644
--- a/src/system_fsm/running.cpp
+++ b/src/system_fsm/running.cpp
@@ -7,6 +7,7 @@
#include "app_console.hpp"
#include "audio_events.hpp"
#include "database.hpp"
+#include "db_events.hpp"
#include "file_gatherer.hpp"
#include "freertos/projdefs.h"
#include "result.hpp"
@@ -47,6 +48,12 @@ void Running::react(const audio::PlaybackFinished& ev) {
}
}
+void Running::react(const database::event::UpdateFinished&) {
+ if (IdleCondition()) {
+ transit<Idle>();
+ }
+}
+
void Running::react(const SdDetectChanged& ev) {
if (ev.has_sd_card) {
if (!sStorage && mountStorage()) {