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 Rotation and Typing #54

Merged
merged 33 commits into from
May 13, 2024
Merged

Conversation

DJDevon3
Copy link
Contributor

Added new feature: ability to rotate display 0,90,180,270.

This will be particularly useful to arrange multiple charlieplexed matrixes together in any orientation for chaining. I don't think chaining multiple into 1 matrix is currently supported but it's a step in the right direction.

Added 16x9 charlieplex example that includes the new rotation feature.

"attempted" to add typing annotations... expect some to be wrong and that's ok, an attempt was made. i did not attempt to type every file. want to be sure i can do at least 1 correctly first then will do the other examples.

Rotation = 0 (hard to photograph because it's a scrolling marquee)
IMG_1487

Rotation = 90
IMG_1488

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.

Thanks for working on this.

You're on the right track with many of the types but there are a few changes that can be made. Most of these are the same few things like Optional and return value tweaks but there are a few other sprinkled in as well.

adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/__init__.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/matrix.py Outdated Show resolved Hide resolved
adafruit_is31fl3731/matrix.py Outdated Show resolved Hide resolved
@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

Oof, that'll keep me busy. I didn't try to type init on purpose because I thought you couldn't type init's.

Thank you for the review and the hints. I'm on it.

In the mean time here's a nice demo of the rotation.

2024-04-02_05-07-09.mp4

I'm pretty sure I won't even get it on my 2nd attempt so might as well number them.
@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

Note to self don't put pound symbols in commit titles. github formatted it to point at adafruit issue number 2. i don't know how to fix that.

oh dear lord the amount of errors... pylint hates me.

@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

🏳️ I Surrender. Pylint has defeated me.

I defined ReadableBuffer in both typing and circuitpython_typing. Pylint won't recognize either of them.

@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

I can only conclude that ReadableBuffer does not exist in circuitpython_typing.

@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

There are now 4 ReadableBuffer errors instead of 1... So it was correctly setting 3 of them previously.

@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

I set it back and now there's only 1 ReadableBuffer error again...

@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

So I replaced the error on line 119
def _i2c_read_reg(self, reg: Optional[int] = None, result: Optional[ReadableBuffer] = None):
with
def _i2c_read_reg(self, reg: Optional[int] = None, result: Optional[int] = None):
and that passes but now errors on line 128 which is the next Optional[ReadableBuffer] use.

@DJDevon3
Copy link
Contributor Author

DJDevon3 commented Apr 2, 2024

Nope, I'm not allowed to use ReadableBuffer or WriteableBuffer in any fashion.

@DJDevon3
Copy link
Contributor Author

Capture

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.

The latest version of this is looking good to me.

Thank you for working through all of those changes @DJDevon3! I know it was quite specific and perhaps not the funnest coding task. I appreciate your work.

I took another look through everything in this branch and made 1 commit with a few additional tweaks for things I didn't see the first time through.

I tested the lastest version successfully on a Feather RP2040 9.0.4 with a CharlieWing using a modified simpletest to set some different pixels on and confirm behavior of the new rotation argument.

@FoamyGuy FoamyGuy merged commit 9f1202c into adafruit:main May 13, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 14, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_BME680 to 3.7.5 from 3.7.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#72 from FoamyGuy/displayio_example

Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 to 3.4.0 from 3.3.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3731#54 from DJDevon3/DJDevon3-IS31FL3731

Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM69 to 2.1.21 from 2.1.20:
  > Merge pull request adafruit/Adafruit_CircuitPython_RFM69#54 from vladak/spelling_1

Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 3.1.0 from 3.0.13:
  > Merge pull request adafruit/Adafruit_CircuitPython_NTP#32 from justmobilize/esp32spi-support

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
@DJDevon3
Copy link
Contributor Author

@FoamyGuy God bless you. Thank you. 🙏 Yes that was a struggle. I don't want to see pylint again until next year.

@FoamyGuy FoamyGuy mentioned this pull request May 20, 2024
30 tasks
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