From 9fdf94e9cee5a5180ffefc2b8314f7a9879ebbc6 Mon Sep 17 00:00:00 2001 From: ayumi Date: Sat, 15 Feb 2025 02:25:27 +0100 Subject: Allow manually unmounting the SD card --- src/tangara/audio/audio_fsm.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/tangara/audio/audio_fsm.cpp') 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([=]() { 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}); }); } -- cgit v1.2.3