-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow same GPIO for switching and sensing #223
base: devel
Are you sure you want to change the base?
Allow same GPIO for switching and sensing #223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks! I took a quick look and seems pretty good. Will carve out some time in the next week or so to test. Only one thing stands at the moment.
octoprint_psucontrol/__init__.py
Outdated
@@ -64,7 +64,7 @@ def __init__(self): | |||
self._idleTimer = None | |||
self._waitForHeaters = False | |||
self._skipIdleTimer = False | |||
self._configuredGPIOPins = {} | |||
self._configuredGPIOPins: Dict[str, periphery.CdevGPIO] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin still supports older Python 2.7 installations which doesn't support type annotations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, I did not realize that octoprint still has support for python 2.7.
RE: Refactoring, could you provide more detail in a separate ticket? Code definitely needs some general refactoring(format, make more use of constants, simplification, etc..) but not sure where your going with splitting things. |
What does this PR do and why is it necessary?
The changes allow to re-use the switching GPIO for sensing the current on/off state.
This addresses #182.
How was it tested? How can it be tested by the reviewer?
Tested on my personal setup, which uses a Raspberry 4 and pulls GPIO 2 to GND for switching the printer on:
Further testing on other setups is needed, but I only have the one printer.
What are the relevant tickets if any?
#182
Further notes
CdevGPIO
now).inverted
-parameter ofCdevGPIO
to remove a lot of manual handling of inverted pin logic.