Skip to content

make use of core PixelMap #104

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

Closed
wants to merge 1 commit into from

Conversation

FoamyGuy
Copy link
Contributor

@FoamyGuy FoamyGuy commented Nov 24, 2022

This goes along with and relies upon: adafruit/circuitpython#7191

The core PR must get merged before this for it to be functional.

This changes the helper PixelMap class in this library to make use of the core _pixelmap.PixelMap internally. The intention is that the API for adafruit_led_animation.helpers.PixelMap should remain the same as best as possible but make use of the more efficient core class internally.

At this time only basic testing has been performed, so far basic usage and a few of the animations seem to work properly but there is more to check. The helper functions that generate maps for you will need adjusted still as well I think.

A few things to note:

  • I've left this in this here in the helpers file of this library for now, but perhaps it should be in it's own library / repo to be imported as adafruit_pixelmap.PixelMap? If so this can be closed and I'll cookie cut a new home for this class.
  • The original python helpers.PixelMap allowed tuples or lists to be passed in it's constructor, both as the outer list and the inner ones. The core class does not allow this, it permits tuple only. This PR resolves by checking for and converting lists to tuples before sending them to the core class constructor.
  • There are a few other things that the original python class allowed that the core does not. Currently in this PR these are implemented on the python side to make them possible to use. I am unsure which if any should be moved into the core class, am interested in thoughts on this from others.
    • get and set negative indexes. The python side checks for them and moves to appropriate positive index before calling into core object
    • get slices. I've left most of the previously existing getter that handled slices, this seems to work as expected with the core map.

@FoamyGuy
Copy link
Contributor Author

Closing this in favor of using: https://github.com/adafruit/Adafruit_CircuitPython_PixelMap

Once the core PR is merged I'll make a followup PR in this repo to remove PixelMap and change the example to import it from the new library.

@FoamyGuy FoamyGuy closed this Nov 29, 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.

1 participant