-
Notifications
You must be signed in to change notification settings - Fork 11
CursorManager: Add support for Start and Select buttons for PyGamer. #33
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
CursorManager: Add support for Start and Select buttons for PyGamer. #33
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.
Thanks for working on this @flom84. I tested start and select buttons successfully on PyGamer and the functionality of it looks good to me.
I think we should add the values in the dictionary for pybadge devices as well here:
Adafruit_CircuitPython_CursorControl/adafruit_cursorcontrol/cursorcontrol_cursormanager.py
Lines 82 to 89 in 43ff5c6
self._pad_btns = { | |
"btn_left": PYBADGE_BUTTON_LEFT, | |
"btn_right": PYBADGE_BUTTON_RIGHT, | |
"btn_up": PYBADGE_BUTTON_UP, | |
"btn_down": PYBADGE_BUTTON_DOWN, | |
"btn_a": PYBADGE_BUTTON_A, | |
"btn_b": PYBADGE_BUTTON_B, | |
} |
self._pad_btns = {
"btn_left": PYBADGE_BUTTON_LEFT,
"btn_right": PYBADGE_BUTTON_RIGHT,
"btn_up": PYBADGE_BUTTON_UP,
"btn_down": PYBADGE_BUTTON_DOWN,
"btn_a": PYBADGE_BUTTON_A,
"btn_b": PYBADGE_BUTTON_B,
+ "btn_select": PYBADGE_BUTTON_SELECT,
+ "btn_start": PYBADGE_BUTTON_START,
}
Without these the update()
function ends up raising this error:
Traceback (most recent call last):
File "code.py", line 23, in <module>
File "/lib/adafruit_cursorcontrol/cursorcontrol_cursormanager.py", line 166, in update
KeyError: btn_select
@FoamyGuy thank you for reviewing my code. I would add another commit with the changes requested. |
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.
Thank you!
These changes look good to me. Tested successfully on pygamer and pybadge
Updating https://github.com/adafruit/Adafruit_CircuitPython_CursorControl to 2.6.0 from 2.5.3: > Merge pull request adafruit/Adafruit_CircuitPython_CursorControl#33 from flom84/pygamer-start-select-buttons-support > Fixed readthedocs build > Consolidate Documentation sections of README
Hi
I have been using CursorControl with PyGamer for a personal projects and being quite fond of this library. Unfortunately, there is no support for PyGamer's
Select
andStart
buttons . This change makes it possible to check if eitherSelect
orStart
button have been pressed. Implementation is similar to how buttonsA
orB
states are handled.I hope that this pull request would be useful for others as well.