aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-states.c
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster/fsm-states.c')
-rw-r--r--spaghetti-monster/fsm-states.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-states.c b/spaghetti-monster/fsm-states.c
index f91dc4b..4d9ac08 100644
--- a/spaghetti-monster/fsm-states.c
+++ b/spaghetti-monster/fsm-states.c
@@ -39,6 +39,9 @@ void _set_state(StatePtr new_state, uint16_t arg,
current_state = new_state;
// call new state-enter hook (don't use stack)
if (new_state != NULL) current_state(enter_event, arg);
+
+ // since state changed, stop any animation in progress
+ interrupt_nice_delays();
}
int8_t push_state(StatePtr new_state, uint16_t arg) {
@@ -79,6 +82,11 @@ uint8_t set_state(StatePtr new_state, uint16_t arg) {
return push_state(new_state, arg);
}
+void set_state_deferred(StatePtr new_state, uint16_t arg) {
+ deferred_state = new_state;
+ deferred_state_arg = arg;
+}
+
#ifndef DONT_USE_DEFAULT_STATE
// bottom state on stack
// handles default actions for LVP, thermal regulation, etc