From 21d767af890a8fc5fbe45f3ea4806baa9c93690e Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Thu, 15 Dec 2022 18:03:50 +0100 Subject: [PATCH] :children_crossing: (BehaviorKit): Trigger back BlinkOnCharge after BleConnection --- libs/BehaviorKit/source/BehaviorKit.cpp | 3 +++ libs/BehaviorKit/tests/BehaviorKit_test.cpp | 3 ++- libs/RobotKit/tests/RobotController_test_stateCharging.cpp | 3 +++ libs/RobotKit/tests/RobotController_test_stateConnected.cpp | 3 +++ .../tests/RobotController_test_stateEmergencyStopped.cpp | 3 +++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/BehaviorKit/source/BehaviorKit.cpp b/libs/BehaviorKit/source/BehaviorKit.cpp index f4a8e55137..8664442a5a 100644 --- a/libs/BehaviorKit/source/BehaviorKit.cpp +++ b/libs/BehaviorKit/source/BehaviorKit.cpp @@ -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(); } } diff --git a/libs/BehaviorKit/tests/BehaviorKit_test.cpp b/libs/BehaviorKit/tests/BehaviorKit_test.cpp index 3b9b8eea62..f85ed07677 100644 --- a/libs/BehaviorKit/tests/BehaviorKit_test.cpp +++ b/libs/BehaviorKit/tests/BehaviorKit_test.cpp @@ -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); } diff --git a/libs/RobotKit/tests/RobotController_test_stateCharging.cpp b/libs/RobotKit/tests/RobotController_test_stateCharging.cpp index 37d3625bee..e79cc1c52a 100644 --- a/libs/RobotKit/tests/RobotController_test_stateCharging.cpp +++ b/libs/RobotKit/tests/RobotController_test_stateCharging.cpp @@ -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); diff --git a/libs/RobotKit/tests/RobotController_test_stateConnected.cpp b/libs/RobotKit/tests/RobotController_test_stateConnected.cpp index 15f8a01d5f..d1ef7e2e50 100644 --- a/libs/RobotKit/tests/RobotController_test_stateConnected.cpp +++ b/libs/RobotKit/tests/RobotController_test_stateConnected.cpp @@ -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(); } diff --git a/libs/RobotKit/tests/RobotController_test_stateEmergencyStopped.cpp b/libs/RobotKit/tests/RobotController_test_stateEmergencyStopped.cpp index 73197a4691..6731fba6d6 100644 --- a/libs/RobotKit/tests/RobotController_test_stateEmergencyStopped.cpp +++ b/libs/RobotKit/tests/RobotController_test_stateEmergencyStopped.cpp @@ -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);