diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-01-30 09:55:31 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-01-30 09:55:31 +1100 |
| commit | c399199bfccb5298fe4b0cf566d8e69729596ba4 (patch) | |
| tree | 224655d23c9e2db64c1f4fb90ed91154475f56ea /src/system_fsm/include/system_fsm.hpp | |
| parent | 9039a97ab47c280555ba891f2aaf34119776d695 (diff) | |
| download | tangara-fw-c399199bfccb5298fe4b0cf566d8e69729596ba4.tar.gz | |
Improve handling of sd card changes during runtime
- mount if an sd card is inserted
- unmount if it's removed
Diffstat (limited to 'src/system_fsm/include/system_fsm.hpp')
| -rw-r--r-- | src/system_fsm/include/system_fsm.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/system_fsm/include/system_fsm.hpp b/src/system_fsm/include/system_fsm.hpp index cb733639..2db1cddc 100644 --- a/src/system_fsm/include/system_fsm.hpp +++ b/src/system_fsm/include/system_fsm.hpp @@ -59,6 +59,7 @@ class SystemState : public tinyfsm::Fsm<SystemState> { virtual void react(const StorageMounted&) {} virtual void react(const StorageError&) {} virtual void react(const KeyLockChanged&) {} + virtual void react(const SdDetectChanged&) {} virtual void react(const audio::PlaybackFinished&) {} virtual void react(const internal::IdleTimeout&) {} @@ -95,12 +96,22 @@ class Running : public SystemState { void exit() override; void react(const KeyLockChanged&) override; - void react(const StorageError&) override; + void react(const SdDetectChanged&) override; void react(const audio::PlaybackFinished&) override; using SystemState::react; + + private: + auto mountStorage() -> bool; + auto unmountStorage() -> void; + + bool storage_mounted_; }; +/** + * State for when the screen is off, controls locked, and music paused. Prelude + * to shutting off power completely. + */ class Idle : public SystemState { public: void entry() override; |
