From 6fadea63411c02d7064228dfa533146348afcd6a Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 20 Sep 2024 11:36:39 +0200 Subject: [PATCH] =?UTF-8?q?=E2=8F=AA=EF=B8=8F=20(git):=20Revert=20"?= =?UTF-8?q?=F0=9F=94=80=EF=B8=8F=20Merge=20branch=20'yann/feature/rc/deep-?= =?UTF-8?q?sleep-use-imu-to-wakeup'=20into=20develop"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3dd931d9c959d50de6bc688580a6348c26e9c870, reversing changes made to 94a0112140e925e3dcab48fba7b2ecf83bd49705. --- app/os/main.cpp | 2 +- libs/RobotKit/include/RobotController.h | 10 ++-------- libs/RobotKit/include/StateMachine.h | 10 +++------- libs/RobotKit/tests/RobotController_test.h | 6 +----- libs/RobotKit/tests/StateMachine_test.cpp | 11 ----------- 5 files changed, 7 insertions(+), 32 deletions(-) diff --git a/app/os/main.cpp b/app/os/main.cpp index c5ed58521e..aad505a219 100644 --- a/app/os/main.cpp +++ b/app/os/main.cpp @@ -434,7 +434,6 @@ namespace robot { commandkit, rfidkit, activitykit, - imu::coreimu, }; } // namespace robot @@ -541,6 +540,7 @@ namespace deep_sleep { &motors::right::motor, &display::internal::corelcd, &rfidkit, + &imu::coreimu, }); } diff --git a/libs/RobotKit/include/RobotController.h b/libs/RobotKit/include/RobotController.h index e52a263440..58e65ad576 100644 --- a/libs/RobotKit/include/RobotController.h +++ b/libs/RobotKit/include/RobotController.h @@ -32,7 +32,6 @@ #include "interface/RobotController.h" #include "interface/drivers/DeepSleepEnabled.h" #include "interface/drivers/FirmwareUpdate.h" -#include "interface/drivers/IMU.hpp" #include "interface/drivers/LCD.hpp" #include "interface/drivers/Motor.h" #include "interface/drivers/Timeout.h" @@ -57,7 +56,7 @@ class RobotController : public interface::RobotController interface::Motor &motor_left, interface::Motor &motor_right, interface::LED &ears, interface::LED &belt, interface::LedKit &ledkit, interface::LCD &lcd, interface::VideoKit &videokit, BehaviorKit &behaviorkit, CommandKit &cmdkit, - RFIDKit &rfidkit, ActivityKit &activitykit, interface::IMU &imu) + RFIDKit &rfidkit, ActivityKit &activitykit) : _timeout_state_internal(timeout_state_internal), _timeout_state_transition(timeout_state_transition), _timeout_autonomous_activities(timeout_autonomous_activities), @@ -74,8 +73,7 @@ class RobotController : public interface::RobotController _behaviorkit(behaviorkit), _cmdkit(cmdkit), _rfidkit(rfidkit), - _activitykit(activitykit), - _imu(imu) + _activitykit(activitykit) { // nothing to do } @@ -321,9 +319,6 @@ class RobotController : public interface::RobotController auto advertising_data = _ble.getAdvertisingData(); advertising_data.is_deep_sleeping = true; _ble.setAdvertisingData(advertising_data); - - _imu.registerOnWakeUpCallback([this] { raise(event::robot_is_shaken {}); }); - _imu.enableOnWakeUpInterrupt(); } void wakeUp() final { system_reset(); } @@ -608,7 +603,6 @@ class RobotController : public interface::RobotController interface::VideoKit &_videokit; RFIDKit &_rfidkit; ActivityKit &_activitykit; - interface::IMU &_imu; BehaviorKit &_behaviorkit; CommandKit &_cmdkit; diff --git a/libs/RobotKit/include/StateMachine.h b/libs/RobotKit/include/StateMachine.h index d3cfe0bb1b..8eb34a4ad2 100644 --- a/libs/RobotKit/include/StateMachine.h +++ b/libs/RobotKit/include/StateMachine.h @@ -46,9 +46,6 @@ namespace sm::event { struct magic_card_detected { }; - struct robot_is_shaken { - }; - } // namespace sm::event namespace sm::state { @@ -247,11 +244,10 @@ struct StateMachine { , sm::state::deep_sleeping + boost::sml::on_entry<_> / sm::action::suspend_hardware_for_deep_sleep {} , sm::state::deep_sleeping + boost::sml::on_exit<_> / sm::action::wake_up {} - , sm::state::deep_sleeping + event = X - , sm::state::deep_sleeping + event = X - , sm::state::deep_sleeping + event = X + , sm::state::deep_sleeping + event = X + , sm::state::deep_sleeping + event = X + , 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/RobotController_test.h b/libs/RobotKit/tests/RobotController_test.h index 443604e733..2fe10f924b 100644 --- a/libs/RobotKit/tests/RobotController_test.h +++ b/libs/RobotKit/tests/RobotController_test.h @@ -27,7 +27,6 @@ #include "mocks/leka/CoreMotor.h" #include "mocks/leka/EventQueue.h" #include "mocks/leka/FirmwareUpdate.h" -#include "mocks/leka/IMU.h" #include "mocks/leka/LEDAnimation.h" #include "mocks/leka/LedKit.h" #include "mocks/leka/MCU.h" @@ -109,8 +108,6 @@ class RobotControllerTest : public testing::Test ActivityKit activitykit {mock_videokit}; activity::DisplayTags display_tag {rfidkit, mock_videokit}; - mock::IMU mock_imu {}; - stub::EventLoopKit event_loop {}; CommandKit cmdkit {event_loop}; @@ -130,8 +127,7 @@ class RobotControllerTest : public testing::Test bhvkit, cmdkit, rfidkit, - activitykit, - mock_imu}; + activitykit}; ble::GapMock &mbed_mock_gap = ble::gap_mock(); ble::GattServerMock &mbed_mock_gatt = ble::gatt_server_mock(); diff --git a/libs/RobotKit/tests/StateMachine_test.cpp b/libs/RobotKit/tests/StateMachine_test.cpp index 80c7879d1e..45db4abcb0 100644 --- a/libs/RobotKit/tests/StateMachine_test.cpp +++ b/libs/RobotKit/tests/StateMachine_test.cpp @@ -290,17 +290,6 @@ TEST_F(StateMachineTest, stateDeepSleepingEventMagicCardDetected) EXPECT_TRUE(sm.is(X)); } -TEST_F(StateMachineTest, stateDeepSleepingEventRobotIsShaken) -{ - sm.set_current_states(lksm::state::deep_sleeping); - - EXPECT_CALL(mock_rc, wakeUp); - - sm.process_event(lksm::event::robot_is_shaken {}); - - EXPECT_TRUE(sm.is(X)); -} - TEST_F(StateMachineTest, stateIdleEventChargeDidStart) { sm.set_current_states(lksm::state::idle);