From 764b01e913d0123747757e5efd3545d46e921848 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 21 Aug 2023 15:43:23 +1000 Subject: Add idle->standby support when locked and no music --- src/system_fsm/include/system_fsm.hpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/system_fsm/include/system_fsm.hpp') diff --git a/src/system_fsm/include/system_fsm.hpp b/src/system_fsm/include/system_fsm.hpp index b31cc6b7..0698be9b 100644 --- a/src/system_fsm/include/system_fsm.hpp +++ b/src/system_fsm/include/system_fsm.hpp @@ -22,6 +22,9 @@ #include "tinyfsm.hpp" #include "touchwheel.hpp" +#include "freertos/FreeRTOS.h" +#include "freertos/timers.h" + #include "system_events.hpp" #include "track_queue.hpp" @@ -47,10 +50,10 @@ class SystemState : public tinyfsm::Fsm { virtual void react(const DisplayReady&) {} virtual void react(const BootComplete&) {} - virtual void react(const StorageUnmountRequested&) {} - virtual void react(const internal::ReadyToUnmount&) {} virtual void react(const StorageMounted&) {} virtual void react(const StorageError&) {} + virtual void react(const KeyLockChanged&) {} + virtual void react(const internal::IdleTimeout&) {} protected: static std::shared_ptr sGpios; @@ -95,13 +98,24 @@ class Running : public SystemState { void entry() override; void exit() override; - void react(const StorageUnmountRequested&) override; - void react(const internal::ReadyToUnmount&) override; + void react(const KeyLockChanged&) override; void react(const StorageError&) override; using SystemState::react; }; -class Unmounted : public SystemState {}; +class Idle : public SystemState { + public: + void entry() override; + void exit() override; + + void react(const KeyLockChanged&) override; + void react(const internal::IdleTimeout&) override; + + using SystemState::react; + + private: + TimerHandle_t sIdleTimeout; +}; /* * Something unrecoverably bad went wrong. Shows an error (if possible), awaits -- cgit v1.2.3