From 8ff93f5467b0eef54d18b35d742de05c8a63da9a Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 28 Aug 2023 10:18:02 +1000 Subject: Make idle state more robust + check playback state --- src/system_fsm/running.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/system_fsm/running.cpp') 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()) { + if (IdleCondition()) { + transit(); + } +} + +void Running::react(const audio::PlaybackFinished& ev) { + if (IdleCondition()) { transit(); } } -- cgit v1.2.3