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

Implement display.rotate(degrees) method. #220

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Implement display.rotate(degrees) method. #220

merged 2 commits into from
Sep 16, 2024

Conversation

dpgeorge
Copy link
Collaborator

@dpgeorge dpgeorge commented Sep 9, 2024

This takes an angle in degrees and rounds it towards the nearest multiple of 90. All integer values of degrees are accepted, including negative values.

Eg display.rotate(44) will rotate 0 but display.rotate(46) will rotate 90 degrees.

Addresses issue #153.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
Copy link
Collaborator Author

dpgeorge commented Sep 9, 2024

@microbit-carlos does it make sense to accept floating point values as well, in case the user is using a formula to compute the angle?

@microbit-carlos
Copy link
Contributor

Thanks Damien!

@microbit-carlos does it make sense to accept floating point values as well, in case the user is using a formula to compute the angle?

Yes, accepting floats as well would be useful.

This takes an angle in degrees and rounds it towards the nearest multiple
of 90.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
Copy link
Collaborator Author

Updated to accept floats as input rotation angle.

Copy link
Contributor

@microbit-carlos microbit-carlos left a comment

Choose a reason for hiding this comment

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

Tested and looks great, thanks Damien!

@dpgeorge dpgeorge merged commit ff39fbf into master Sep 16, 2024
6 checks passed
@dpgeorge dpgeorge deleted the display-rotate branch September 16, 2024 00:42
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