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/system_fsm/running.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/tangara/system_fsm/running.cpp') diff --git a/src/tangara/system_fsm/running.cpp b/src/tangara/system_fsm/running.cpp index 13f58ef9..87b7f1ac 100644 --- a/src/tangara/system_fsm/running.cpp +++ b/src/tangara/system_fsm/running.cpp @@ -59,9 +59,22 @@ void Running::react(const database::event::UpdateFinished&) { checkIdle(); } +void Running::react(const ui::UnmountRequest& ev) { + events::Audio().Dispatch(audio::TogglePlayPause{.set_to = false}); + events::Audio().Dispatch(UnmountRequest{.idle = false}); +} + +void Running::react(const audio::UnmountReady& ev) { + if (ev.idle) { + transit(); + } else { + unmountStorage(); + } +} + void Running::react(const internal::UnmountTimeout&) { if (IdleCondition()) { - transit(); + events::Audio().Dispatch(UnmountRequest{.idle = true}); } } -- cgit v1.2.3