Skip to content
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

Add rotate() to change rotation after init #54

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

radiac
Copy link
Contributor

@radiac radiac commented Feb 10, 2024

I'm writing a script which needs to change the rotation of an existing MacroPad instance.

I have refactored the __init__ method to move the rotation code out into a new rotate(rotation) method; this is called by __init__ so existing functionality is unaffected, but the new method allows the rotation to be changed after initialisation. I also added a rotation property to check the current rotation.

@FoamyGuy
Copy link
Contributor

@radiac thanks for adding this functionality! The actions checks automatically run pylint and it has flagged a few lines as being a little bit too long. The output of the checks that indicates which lines can be seen here: https://github.com/adafruit/Adafruit_CircuitPython_MacroPad/actions/runs/7853447347/job/21433071528?pr=54 or if you'd like you can follow this guide page: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code to setup pre-commit so that you can run the checks locally beforehand.

When you have a sec can you add another commit on this branch that re-arranges the text in those lines to be less than the pylint limit?

@radiac
Copy link
Contributor Author

radiac commented Feb 10, 2024

Sorry, totally missed you were on 100 char line lengths and had pre-commit there. Think that should be sorted now, thanks!

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Nice functionality thanks @radiac!

I added tweak with a new commit to add a setter for the rotation propertery so now you can use the sytanx macropad.rotation = 90.

I tested it successfully on a device with a modified version of the rotation example in the repo.

@FoamyGuy FoamyGuy merged commit 924ad9d into adafruit:main Feb 20, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants