diff --git a/libs/RobotKit/include/StateMachine.h b/libs/RobotKit/include/StateMachine.h index bed5bf071..3dbab4f67 100644 --- a/libs/RobotKit/include/StateMachine.h +++ b/libs/RobotKit/include/StateMachine.h @@ -246,6 +246,7 @@ struct StateMachine { , sm::state::deep_sleeping + event = X , sm::state::deep_sleeping + event = X + , sm::state::deep_sleeping + event = X , sm::state::charging + boost::sml::on_entry<_> / (sm::action::start_deep_sleep_timeout {}, sm::action::start_charging_behavior {} ) , sm::state::charging + boost::sml::on_exit<_> / (sm::action::stop_deep_sleep_timeout {}, sm::action::stop_charging_behavior {} ) diff --git a/libs/RobotKit/tests/StateMachine_test.cpp b/libs/RobotKit/tests/StateMachine_test.cpp index 3de5137be..e08f2d4a1 100644 --- a/libs/RobotKit/tests/StateMachine_test.cpp +++ b/libs/RobotKit/tests/StateMachine_test.cpp @@ -289,6 +289,17 @@ TEST_F(StateMachineTest, stateDeepSleepingEventBleDisconnection) EXPECT_TRUE(sm.is(X)); } +TEST_F(StateMachineTest, stateDeepSleepingEventCommandReceived) +{ + sm.set_current_states(lksm::state::deep_sleeping); + + EXPECT_CALL(mock_rc, wakeUp); + + sm.process_event(lksm::event::command_received {}); + + EXPECT_TRUE(sm.is(X)); +} + TEST_F(StateMachineTest, stateIdleEventChargeDidStart) { sm.set_current_states(lksm::state::idle);