diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-28 10:18:02 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-28 10:18:02 +1000 |
| commit | 8ff93f5467b0eef54d18b35d742de05c8a63da9a (patch) | |
| tree | ca0215b64d1a779a69c30b71f8d7870f5aa3dbcb /src/system_fsm/running.cpp | |
| parent | 0f5cf25e73fb2e789b472317966ff80323dddd75 (diff) | |
| download | tangara-fw-8ff93f5467b0eef54d18b35d742de05c8a63da9a.tar.gz | |
Make idle state more robust + check playback state
Diffstat (limited to 'src/system_fsm/running.cpp')
| -rw-r--r-- | src/system_fsm/running.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/system_fsm/running.cpp b/src/system_fsm/running.cpp index 9e250c9b..3fc5493f 100644 --- a/src/system_fsm/running.cpp +++ b/src/system_fsm/running.cpp @@ -5,6 +5,7 @@ */ #include "app_console.hpp" +#include "audio_events.hpp" #include "file_gatherer.hpp" #include "freertos/projdefs.h" #include "result.hpp" @@ -68,7 +69,13 @@ void Running::exit() { } void Running::react(const KeyLockChanged& ev) { - if (!ev.falling && audio::AudioState::is_in_state<audio::states::Standby>()) { + if (IdleCondition()) { + transit<Idle>(); + } +} + +void Running::react(const audio::PlaybackFinished& ev) { + if (IdleCondition()) { transit<Idle>(); } } |
