From 343fe4460a86ddb1320efebd13487e7e7359a554 Mon Sep 17 00:00:00 2001 From: WillB97 Date: Wed, 10 Jul 2024 21:27:43 +0100 Subject: [PATCH 1/3] Update power port for KCH usage --- sbot/power_board.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbot/power_board.py b/sbot/power_board.py index 15e4f9c..86cbbf6 100644 --- a/sbot/power_board.py +++ b/sbot/power_board.py @@ -61,7 +61,7 @@ def from_status_response(cls, response: str) -> PowerStatus: # This output is always on, and cannot be controlled via the API. -BRAIN_OUTPUT = PowerOutputPosition.FIVE_VOLT +BRAIN_OUTPUT = PowerOutputPosition.L2 class PowerBoard(Board): From e3c87cccb9916acef134d6dd72f69d3f8721a549 Mon Sep 17 00:00:00 2001 From: WillB97 Date: Wed, 10 Jul 2024 21:33:24 +0100 Subject: [PATCH 2/3] Update tests for new brain output --- tests/test_power_board.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_power_board.py b/tests/test_power_board.py index db91aa1..981632c 100644 --- a/tests/test_power_board.py +++ b/tests/test_power_board.py @@ -155,14 +155,14 @@ def test_power_board_outputs(powerboard_serial: MockPowerBoard) -> None: ("OUT:1:SET:1", "ACK"), ("OUT:2:SET:1", "ACK"), ("OUT:3:SET:1", "ACK"), - ("OUT:4:SET:1", "ACK"), ("OUT:5:SET:1", "ACK"), + ("OUT:6:SET:1", "ACK"), ("OUT:0:SET:0", "ACK"), ("OUT:1:SET:0", "ACK"), ("OUT:2:SET:0", "ACK"), ("OUT:3:SET:0", "ACK"), - ("OUT:4:SET:0", "ACK"), ("OUT:5:SET:0", "ACK"), + ("OUT:6:SET:0", "ACK"), ]) power_board.outputs.power_on() power_board.outputs.power_off() @@ -177,10 +177,10 @@ def test_power_board_outputs(powerboard_serial: MockPowerBoard) -> None: ("OUT:2:SET:0", "ACK"), ("OUT:3:SET:1", "ACK"), ("OUT:3:SET:0", "ACK"), - ("OUT:4:SET:1", "ACK"), - ("OUT:4:SET:0", "ACK"), ("OUT:5:SET:1", "ACK"), ("OUT:5:SET:0", "ACK"), + ("OUT:6:SET:1", "ACK"), + ("OUT:6:SET:0", "ACK"), ]) power_board.outputs[PowerOutputPosition.H0].is_enabled = True power_board.outputs[PowerOutputPosition.H0].is_enabled = False @@ -190,14 +190,14 @@ def test_power_board_outputs(powerboard_serial: MockPowerBoard) -> None: power_board.outputs[PowerOutputPosition.L0].is_enabled = False power_board.outputs[PowerOutputPosition.L1].is_enabled = True power_board.outputs[PowerOutputPosition.L1].is_enabled = False - power_board.outputs[PowerOutputPosition.L2].is_enabled = True - power_board.outputs[PowerOutputPosition.L2].is_enabled = False power_board.outputs[PowerOutputPosition.L3].is_enabled = True power_board.outputs[PowerOutputPosition.L3].is_enabled = False + power_board.outputs[PowerOutputPosition.FIVE_VOLT].is_enabled = True + power_board.outputs[PowerOutputPosition.FIVE_VOLT].is_enabled = False # Test that we can't enable or disable the 5V output with pytest.raises(RuntimeError, match=r"Brain output cannot be controlled.*"): - power_board.outputs[PowerOutputPosition.FIVE_VOLT].is_enabled = True + power_board.outputs[PowerOutputPosition.L2].is_enabled = True # Test that we can detect whether the power board outputs are enabled powerboard_serial.serial_wrapper._add_responses([ From 3c66c6840df166010e579b34f7c7b58777dd0559 Mon Sep 17 00:00:00 2001 From: WillB97 Date: Wed, 10 Jul 2024 21:35:54 +0100 Subject: [PATCH 3/3] Also fix sbot test --- tests/test_sbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sbot.py b/tests/test_sbot.py index d3c71e5..a936ed4 100644 --- a/tests/test_sbot.py +++ b/tests/test_sbot.py @@ -22,8 +22,8 @@ def test_robot(monkeypatch, caplog) -> None: ("OUT:1:SET:1", "ACK"), ("OUT:2:SET:1", "ACK"), ("OUT:3:SET:1", "ACK"), - ("OUT:4:SET:1", "ACK"), ("OUT:5:SET:1", "ACK"), + ("OUT:6:SET:1", "ACK"), ("*IDN?", "Student Robotics:PBv4B:POW123:4.4.1"), ("BTN:START:GET?", "0:1"), ("NOTE:1760:100", "ACK"), # Start up sound