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

Is31pixelbuf #5726

Merged
merged 17 commits into from
Feb 2, 2022
Merged

Is31pixelbuf #5726

merged 17 commits into from
Feb 2, 2022

Conversation

gamblor21
Copy link
Member

Added new functions to the is31fl3741 module similar to neopixel_write but for is31fl3741 LEDs. Included an initialize function as well. These two functions are used with a yet to be submitted python library to use with with the adafruit_pixelbuf class.

Also includes a small bug fix to the existing library and changes the map from list to tuple upon advice I was given. There are no libraries released that were lists so best to do so now.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Why does this need to be done in C? Can't write be done from Python alone?

shared-bindings/is31fl3741/__init__.c Outdated Show resolved Hide resolved
shared-bindings/is31fl3741/__init__.c Outdated Show resolved Hide resolved
@gamblor21
Copy link
Member Author

Why does this need to be done in C? Can't write be done from Python alone?

I did it in C as I thought it would need it for speed (especially the mapping) and for coordination with the displayio work I did. I will do a test of C vs Python to see if it is required. Now that I understand how all the parts work doing it in Python may make sense.

@tannewt
Copy link
Member

tannewt commented Dec 16, 2021

I didn't see any coordination here. Did I miss it?

If it does need to be coordinated, then I'd expect it to be part of the existing object.

It'd also be helpful if you'd link to the prototype library.

Thanks!

@gamblor21
Copy link
Member Author

The python library (not yet merged upstream) https://github.com/gamblor21/Adafruit_CircuitPython_IS31FL3741/tree/native_changes

I added a is31fl3741_pixelbuf.py that is a subclass of pixelbuf the same way Neopixel is. Also led_glasses_map.py that provides the pre-defined mapping coordinates that a user will need if they're using the glasses.

I did some testing to see if the is31fl3741_write makes sense in C vs python, all this was modeled after the neopixel_write submodule. Doing the mapping of the LEDs from pixels on the glasses is faster in C (just over twice as fast). For the test I just changed every pixel color repeatedly. Just like the neopixel_write function this is meant for the entire display being written, same as the existing buffered functionality.

It may be easiest to discuss this at the next CP meeting.

@tannewt
Copy link
Member

tannewt commented Jan 4, 2022

@gamblor21 Sorry I wasn't at this weeks meeting. I took the day off. What did you conclude there? 2x speed-up seems worth it.

@gamblor21
Copy link
Member Author

@gamblor21 Sorry I wasn't at this weeks meeting. I took the day off. What did you conclude there? 2x speed-up seems worth it.

I was checking with Kattni on the library end of things which looks good (it won't break the existing library on smaller boards). I'll clean up the code I have with the comments above and also submit the PR to the library so they can be looked at together.

@gamblor21 gamblor21 changed the base branch from 7.1.x to main January 18, 2022 02:51
@tannewt
Copy link
Member

tannewt commented Jan 18, 2022

I see you pushed the library PR. Let me know when you'd like me to look at this and I will. Thanks!

@gamblor21
Copy link
Member Author

I see you pushed the library PR. Let me know when you'd like me to look at this and I will. Thanks!

Both PRs are passing checks and I did a final check on my hardware here so should be good for reviews.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you for the reorg. I like the separation you have between the IS31FL3741 and FrameBuffer classes! I just requested some doc updates to match. Thanks!

//| """Displays an in-memory framebuffer to a IS31FL3741 drive display."""
//|

//| def __init__(self, *, width: int) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Update this please.

shared-bindings/is31fl3741/IS31FL3741.c Outdated Show resolved Hide resolved

//| width: int
//| """The width of the display, in pixels"""
//| def is31fl3741_write(mapping: Tuple[int, ...], buf: ReadableBuffer) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//| def is31fl3741_write(mapping: Tuple[int, ...], buf: ReadableBuffer) -> None:
//| def write(mapping: Tuple[int, ...], buf: ReadableBuffer) -> None:

shared-bindings/is31fl3741/IS31FL3741.c Show resolved Hide resolved
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Very close! Just a typo and a question about kw_only required arguments.

shared-bindings/is31fl3741/FrameBuffer.c Show resolved Hide resolved
shared-bindings/is31fl3741/IS31FL3741.c Outdated Show resolved Hide resolved
shared-bindings/is31fl3741/FrameBuffer.c Outdated Show resolved Hide resolved
@gamblor21
Copy link
Member Author

Not sure why there was one cancelled check, but with the rest passing I don't think it is worth re-running the whole thing.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Sorry, two more minor things. I suggested conflicting changes to you before wrt the * and kw_only. More folks are using the stubs so think it's worth correcting now.

shared-bindings/is31fl3741/IS31FL3741.c Outdated Show resolved Hide resolved
shared-bindings/is31fl3741/FrameBuffer.c Outdated Show resolved Hide resolved
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you! This looks good. It just needs conflicts resolved and then will be good to go.

@gamblor21
Copy link
Member Author

All the merge fixes are good. One build failed with a 403 error that doesn't seem related to the changes.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

One spot where I think you want a write_read.

shared-module/is31fl3741/IS31FL3741.c Outdated Show resolved Hide resolved
@dhalbert dhalbert requested a review from tannewt February 2, 2022 19:48
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you!

@tannewt tannewt merged commit db34db2 into adafruit:main Feb 2, 2022
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.

3 participants