Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "🔀️ Merge branch 'yann/feature/rc/deep-sleep-use-imu-to-wakeup' into develop" #1467

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/os/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ namespace robot {
commandkit,
rfidkit,
activitykit,
imu::coreimu,
};

} // namespace robot
Expand Down Expand Up @@ -541,6 +540,7 @@ namespace deep_sleep {
&motors::right::motor,
&display::internal::corelcd,
&rfidkit,
&imu::coreimu,
});
}

Expand Down
10 changes: 2 additions & 8 deletions libs/RobotKit/include/RobotController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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),
Expand All @@ -74,8 +73,7 @@ class RobotController : public interface::RobotController
_behaviorkit(behaviorkit),
_cmdkit(cmdkit),
_rfidkit(rfidkit),
_activitykit(activitykit),
_imu(imu)
_activitykit(activitykit)
{
// nothing to do
}
Expand Down Expand Up @@ -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(); }
Expand Down Expand Up @@ -608,7 +603,6 @@ class RobotController : public interface::RobotController
interface::VideoKit &_videokit;
RFIDKit &_rfidkit;
ActivityKit &_activitykit;
interface::IMU &_imu;

BehaviorKit &_behaviorkit;
CommandKit &_cmdkit;
Expand Down
10 changes: 3 additions & 7 deletions libs/RobotKit/include/StateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ namespace sm::event {
struct magic_card_detected {
};

struct robot_is_shaken {
};

} // namespace sm::event

namespace sm::state {
Expand Down Expand Up @@ -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<sm::event::charge_did_start> = X
, sm::state::deep_sleeping + event<sm::event::charge_did_stop> = X
, sm::state::deep_sleeping + event<sm::event::ble_connection> = X
, sm::state::deep_sleeping + event<sm::event::charge_did_start> = X
, sm::state::deep_sleeping + event<sm::event::charge_did_stop> = X
, sm::state::deep_sleeping + event<sm::event::ble_connection> = X
, sm::state::deep_sleeping + event<sm::event::magic_card_detected> = X
, sm::state::deep_sleeping + event<sm::event::robot_is_shaken> = 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
6 changes: 1 addition & 5 deletions libs/RobotKit/tests/RobotController_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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};

Expand All @@ -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();
Expand Down
11 changes: 0 additions & 11 deletions libs/RobotKit/tests/StateMachine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading