Skip to content

Commit

Permalink
🩹 (StateMachine): Add transition to reboot on command receveived duri…
Browse files Browse the repository at this point in the history
…ng DS
  • Loading branch information
YannLocatelli committed Jul 15, 2024
1 parent 569b838 commit 0fc2d02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions libs/RobotKit/include/StateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ struct StateMachine {

, sm::state::deep_sleeping + event<sm::event::ble_connection> = X
, sm::state::deep_sleeping + event<sm::event::ble_disconnection> = X
, sm::state::deep_sleeping + event<sm::event::command_received> = 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 {} )
Expand Down
11 changes: 11 additions & 0 deletions libs/RobotKit/tests/StateMachine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0fc2d02

Please sign in to comment.