Allow same GPIO for switching and sensing#223
Open
xaver-k wants to merge 4 commits intokantlivelong:develfrom
Open
Allow same GPIO for switching and sensing#223xaver-k wants to merge 4 commits intokantlivelong:develfrom
xaver-k wants to merge 4 commits intokantlivelong:develfrom
Conversation
kantlivelong
requested changes
Sep 7, 2021
Owner
kantlivelong
left a comment
There was a problem hiding this comment.
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
| self._waitForHeaters = False | ||
| self._skipIdleTimer = False | ||
| self._configuredGPIOPins = {} | ||
| self._configuredGPIOPins: Dict[str, periphery.CdevGPIO] = {} |
Owner
There was a problem hiding this comment.
This plugin still supports older Python 2.7 installations which doesn't support type annotations.
Author
There was a problem hiding this comment.
Sorry about that, I did not realize that octoprint still has support for python 2.7.
Owner
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CdevGPIOnow).inverted-parameter ofCdevGPIOto remove a lot of manual handling of inverted pin logic.