Skip to content

Commit

Permalink
Using AS_IS mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed May 20, 2024
1 parent 154524e commit 5a0ca35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions octoprint_octorelay/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def __init__(self, pin: int, inverted: bool):
self.request = request_lines(
"/dev/gpiochip0",
consumer = "OctoRelay",
config = {
pin: LineSettings(direction=Direction.OUTPUT, active_low=False)
}
config = { pin: LineSettings(direction=Direction.AS_IS) }
)
self.pin = pin # GPIO pin
self.inverted = inverted # marks the relay as normally closed
Expand Down
4 changes: 2 additions & 2 deletions tests/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
sys.modules["gpiod"] = gpiod_mock
gpiod_line_mock = Mock()
gpiod_line_mock.Direction = Mock()
gpiod_line_mock.Direction.OUTPUT = "OutputMock"
gpiod_line_mock.Direction.AS_IS = "AsIsMock"
gpiod_line_mock.Value = Mock()
gpiod_line_mock.Value.ACTIVE = "ActiveMock"
gpiod_line_mock.Value.INACTIVE = "InactiveMock"
Expand All @@ -31,7 +31,7 @@ def test_constructor(self):
self.assertIsInstance(relay, Relay)
self.assertEqual(relay.pin, 18)
self.assertTrue(relay.inverted)
gpiod_mock.LineSettings.assert_called_with(direction="OutputMock", active_low=False)
gpiod_mock.LineSettings.assert_called_with(direction="AsIsMock", active_low=False)
gpiod_mock.request_lines.assert_called_with(
"/dev/gpiochip0",
consumer = "OctoRelay",
Expand Down

0 comments on commit 5a0ca35

Please sign in to comment.