Skip to content

Commit

Permalink
Merge branch 'kch-power-port' into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
WillB97 committed Jul 10, 2024
2 parents 14cd5d5 + 3c66c68 commit 74bf5bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sbot/power_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,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):
Expand Down
14 changes: 7 additions & 7 deletions tests/test_power_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 74bf5bb

Please sign in to comment.