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/ui/ui_fsm.cpp | 5 +++++ src/tangara/ui/ui_fsm.hpp | 2 ++ 2 files changed, 7 insertions(+) (limited to 'src/tangara/ui') diff --git a/src/tangara/ui/ui_fsm.cpp b/src/tangara/ui/ui_fsm.cpp index a22c704b..ebc4b635 100644 --- a/src/tangara/ui/ui_fsm.cpp +++ b/src/tangara/ui/ui_fsm.cpp @@ -714,6 +714,11 @@ void Lua::entry() { }); registry.AddPropertyModule("sd_card", { {"mounted", &sSdMounted}, + {"unmount", [&](lua_State*) { + events::System().Dispatch( + UnmountRequest{}); + return 0; + }}, }); registry.AddPropertyModule("usb", { diff --git a/src/tangara/ui/ui_fsm.hpp b/src/tangara/ui/ui_fsm.hpp index aae69f94..d4354bec 100644 --- a/src/tangara/ui/ui_fsm.hpp +++ b/src/tangara/ui/ui_fsm.hpp @@ -37,6 +37,8 @@ namespace ui { +struct UnmountRequest : tinyfsm::Event {}; + class UiState : public tinyfsm::Fsm { public: static auto InitBootSplash(drivers::IGpios&, drivers::NvsStorage&) -> bool; -- cgit v1.2.3