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

Neopixel performance improvements #12

Closed
wants to merge 7 commits into from

Conversation

dsheets
Copy link
Contributor

@dsheets dsheets commented Jan 17, 2025

Building on #11, this enables driving a NeoTrellis 4x4 at a reasonable framerate by adding an API to perform bulk neopixel updates in a single transaction and reducing copying.

Previously, the array dimension was dependent on an associated
constant but this opens up a portal to the Plane of Torment due to
Rust's poor compositionality between const generics, associated
consts, and trait parameter types. Now, the user is just expected to
have these dimensions aligned.
This allows abstracting the number and order of neopixel color
channels (e.g. RGBW, GRB, etc). It is now mandatory to supply a color
layout when instantiating a Neopixel module.
In the Neotrellis 4x4 case, this is an 8x improvement in number of i2c
transactions and seesaw i2c timeouts. Generic const exprs have been
removed from the interface as they infect library user programs and
are not completely implemented resulting in compiler crashes
(normalization is not implemented).
@dsheets
Copy link
Contributor Author

dsheets commented Jan 31, 2025

I use this to run my 4 neotrellis 4x4 pad (8x8 total) driven by some esp32 at 125Hz with full display refresh and button reading (and still have some cycles for wifi and the kids' games).

@alexeden
Copy link
Owner

alexeden commented Feb 7, 2025

Hey @dsheets. I've put out two new versions: one that adds the rgb crate for color handling and the other adds a chunking optimization to the neopixel writer somewhat similar to your impl. If you get the chance, would you mind verifying that it works/meets your expectations performance-wise? I've been using this example to test a strand of 50 LEDs and it's running at least 60 updates per sec. Thanks!

@alexeden alexeden closed this Feb 7, 2025
@alexeden
Copy link
Owner

alexeden commented Feb 7, 2025

Closing but happy to reopen if necessary.

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