Skip to content

Commit 5470c6c

Browse files
committed
Using AS_IS mode.
1 parent 154524e commit 5470c6c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

octoprint_octorelay/driver.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ def __init__(self, pin: int, inverted: bool):
1111
self.request = request_lines(
1212
"/dev/gpiochip0",
1313
consumer = "OctoRelay",
14-
config = {
15-
pin: LineSettings(direction=Direction.OUTPUT, active_low=False)
16-
}
14+
config = { pin: LineSettings(direction=Direction.AS_IS) }
1715
)
1816
self.pin = pin # GPIO pin
1917
self.inverted = inverted # marks the relay as normally closed

tests/test_driver.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
sys.modules["gpiod"] = gpiod_mock
1212
gpiod_line_mock = Mock()
1313
gpiod_line_mock.Direction = Mock()
14-
gpiod_line_mock.Direction.OUTPUT = "OutputMock"
14+
gpiod_line_mock.Direction.AS_IS = "AsIsMock"
1515
gpiod_line_mock.Value = Mock()
1616
gpiod_line_mock.Value.ACTIVE = "ActiveMock"
1717
gpiod_line_mock.Value.INACTIVE = "InactiveMock"
@@ -31,7 +31,7 @@ def test_constructor(self):
3131
self.assertIsInstance(relay, Relay)
3232
self.assertEqual(relay.pin, 18)
3333
self.assertTrue(relay.inverted)
34-
gpiod_mock.LineSettings.assert_called_with(direction="OutputMock", active_low=False)
34+
gpiod_mock.LineSettings.assert_called_with(direction="AsIsMock")
3535
gpiod_mock.request_lines.assert_called_with(
3636
"/dev/gpiochip0",
3737
consumer = "OctoRelay",

0 commit comments

Comments
 (0)