Skip to content

Commit

Permalink
Fixing driver for automatic pin factory (#281)
Browse files Browse the repository at this point in the history
* fix(driver): remove explicit PinFactory (to be tested)

* fix(setup): add RPi.GPIO
  • Loading branch information
ch3p4ll3 authored Jul 10, 2024
1 parent fec1ea9 commit 197d511
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions octoprint_octorelay/driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from typing import Optional, List
from gpiozero.pins.lgpio import LGPIOFactory
from gpiozero import LED


Expand All @@ -10,10 +9,6 @@ class Relay():
def __init__(self, pin: int, inverted: bool, pin_factory=None):
self.pin = pin # GPIO pin
self.inverted = inverted # marks the relay as normally closed

if pin_factory is None:
pin_factory = LGPIOFactory(chip=0)

self.relay = LED(pin, pin_factory=pin_factory)

def __repr__(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_version_and_cmdclass(pkg_path):

# Any additional requirements besides OctoPrint should be listed here
# todo after dropping 3.7 remove typing-extensions (used by model.py and listing.py)
plugin_requires = ["gpiozero", "typing-extensions", "lgpio"]
plugin_requires = ["gpiozero", "typing-extensions", "lgpio", "RPi.GPIO"]

# --------------------------------------------------------------------------------------------------------------------
# More advanced options that you usually shouldn't have to touch follow after this point
Expand Down

0 comments on commit 197d511

Please sign in to comment.