summaryrefslogtreecommitdiff
path: root/src/tangara/audio/audio_fsm.cpp
diff options
context:
space:
mode:
authorayumi <ayumi@noreply.codeberg.org>2025-02-15 02:25:27 +0100
committerayumi <ayumi@noreply.codeberg.org>2025-03-05 08:57:46 +0100
commit9fdf94e9cee5a5180ffefc2b8314f7a9879ebbc6 (patch)
tree80c2ca8003fe32e59eccf2e208a53e1e87c66790 /src/tangara/audio/audio_fsm.cpp
parent42c2a4f2445ff56a2a0a78c4ef265e5be346d40d (diff)
downloadtangara-fw-9fdf94e9cee5a5180ffefc2b8314f7a9879ebbc6.tar.gz
Allow manually unmounting the SD card
Diffstat (limited to 'src/tangara/audio/audio_fsm.cpp')
-rw-r--r--src/tangara/audio/audio_fsm.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tangara/audio/audio_fsm.cpp b/src/tangara/audio/audio_fsm.cpp
index 7854818d..27c29eee 100644
--- a/src/tangara/audio/audio_fsm.cpp
+++ b/src/tangara/audio/audio_fsm.cpp
@@ -534,10 +534,7 @@ auto Standby::entry() -> void {
updateOutputMode();
}
-void Standby::react(const system_fsm::KeyLockChanged& ev) {
- if (!ev.locking) {
- return;
- }
+void Standby::react(const system_fsm::UnmountRequest& ev) {
auto current = sStreamCues.current();
sServices->bg_worker().Dispatch<void>([=]() {
auto db = sServices->database().lock();
@@ -548,6 +545,7 @@ void Standby::react(const system_fsm::KeyLockChanged& ev) {
if (queue.totalSize() <= queue.currentPosition()) {
// Nothing is playing, so don't bother saving the queue.
db->put(kQueueKey, "");
+ events::System().Dispatch(UnmountReady{.idle = ev.idle});
return;
}
db->put(kQueueKey, queue.serialise());
@@ -562,6 +560,7 @@ void Standby::react(const system_fsm::KeyLockChanged& ev) {
};
db->put(kCurrentFileKey, current_track.toString());
}
+ events::System().Dispatch(UnmountReady{.idle = ev.idle});
});
}