Skip to content

Commit

Permalink
🚸 (BehaviorKit): Trigger back BlinkOnCharge after BleConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Dec 15, 2022
1 parent cf4a918 commit 21d767a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions libs/BehaviorKit/source/BehaviorKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ void BehaviorKit::bleConnection(bool with_video)
_ledkit.start(&led::animation::ble_connection);
if (with_video) {
_videokit.playVideoOnce("/fs/home/vid/system/robot-system-ble_connection-wink-no_eyebrows.avi");
} else {
rtos::ThisThread::sleep_for(5s);
blinkOnCharge();
}
}

Expand Down
3 changes: 2 additions & 1 deletion libs/BehaviorKit/tests/BehaviorKit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ TEST_F(BehaviorKitTest, batteryBehaviors)

TEST_F(BehaviorKitTest, bleConnectionWhileCharging)
{
EXPECT_CALL(mock_videokit, playVideoOnce).Times(0);
EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::ble_connection))).Times(1);
EXPECT_CALL(mock_videokit, playVideoOnce).Times(0);
EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::blink_on_charge))).Times(1);

behaviorkit.bleConnection(false);
}
Expand Down
3 changes: 3 additions & 0 deletions libs/RobotKit/tests/RobotController_test_stateCharging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ TEST_F(RobotControllerTest, stateChargingDisconnectedEventBleConnection)
.InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_videokit, playVideoOnce).Times(0).InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_lcd, turnOn).Times(0).InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::blink_on_charge)))
.Times(1)
.InSequence(on_ble_connection_sequence);

Sequence on_charging_entry_sequence;
EXPECT_CALL(battery, level).InSequence(on_charging_entry_sequence);
Expand Down
3 changes: 3 additions & 0 deletions libs/RobotKit/tests/RobotController_test_stateConnected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ TEST_F(RobotControllerTest, startConnectionBehaviorIsCharging)
.InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_videokit, playVideoOnce).Times(0).InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_lcd, turnOn).Times(0).InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::blink_on_charge)))
.Times(1)
.InSequence(on_ble_connection_sequence);

rc.startConnectionBehavior();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ TEST_F(RobotControllerTest, stateEmergencyStoppedEventBleConnectionGuardIsChargi
.InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_videokit, playVideoOnce).Times(0).InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_lcd, turnOn).Times(0).InSequence(on_ble_connection_sequence);
EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::blink_on_charge)))
.Times(1)
.InSequence(on_ble_connection_sequence);

Sequence start_charging_behavior_sequence;
EXPECT_CALL(battery, level).InSequence(start_charging_behavior_sequence);
Expand Down

0 comments on commit 21d767a

Please sign in to comment.