-
Notifications
You must be signed in to change notification settings - Fork 86
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
Faster position lookup #3
Labels
enhancement
New feature or request
Comments
any chance you will open a PR with the proposed changes? |
ph1p
added a commit
that referenced
this issue
Jan 8, 2023
ph1p
added a commit
that referenced
this issue
Jan 8, 2023
Merged
ph1p
added a commit
that referenced
this issue
Jan 8, 2023
ph1p
added a commit
that referenced
this issue
Jan 19, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps this doesn't pose an issue since running compiled code on the ESP32 is fast enough, but here's a suggestion, at least for helping with maintainability. Take it with a grain of salt 😅
Calling
findPosition()
to search for a pixel index during the render loop is inefficient and makes it hard to understand how the LED pixels are laid out:ikea-led-obegraensad/src/screen.cpp
Line 164 in 6edc2ed
You could instead change the
positions
array to be the search results offindPosition()
.Here's a fiddle that does this: https://jsfiddle.net/atesgoral/njkx749g/14/
It uses a new lookup table called
remapped
:Your render loop just can be:
This might require moving rotations to the render loop first.
The text was updated successfully, but these errors were encountered: