-
Notifications
You must be signed in to change notification settings - Fork 11
Added image function that uses numpy if available #19
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
Conversation
nice! could you by chance test this on a non-raspi? |
The only other circuitpython device I have is the Trinket M0. Would that device work to test this? How would I get my modified version of the software on that device? |
did it work on the trinket m0 before this change? |
I have not tried with the trinket m0. I got this display to work with a project I am building with the Raspberry Pi. I don't have much time to work on it during the week, but I will try to wire up the trinket and see if I can get it to work. |
I was going to wire up the Trinket M0, and realized that it would not work the way I thought. The Trinket M0 does not have access to the PIL library, right? This change only affects the image() function, which requires a PIL frame to decode. The only change that would affect a normal circuitpython device is the check for numpy. I guess I could try to test that bit, but it is a direct copy-paste from another of your repos. I do not have any other Linux SBCs that I can test this on. Let me know what you want me to do here. |
kk not sure when we'll get to testing this but we'll have to do a hardware test before merge since it could break existing projects! for now ya can just keep using it on raspi :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the simpletest example with this branch on a Feather RP2040 with https://www.adafruit.com/product/3502
Adafruit CircuitPython 7.3.0-beta.1 on 2022-04-07; Adafruit Feather RP2040 with rp2040
Board ID:adafruit_feather_rp2040
It does seem to function as expected.
I didn't test Raspberry Pi or the image() function but those changes do seem good to me as well.
Updating https://github.com/adafruit/Adafruit_CircuitPython_SD to 3.3.9 from 3.3.8: > Merge pull request adafruit/Adafruit_CircuitPython_SD#48 from tekktrik/doc/add-typing > change discord badge > Patch: Replaced discord badge image > Updated gitignore > Update Black to latest. Updating https://github.com/adafruit/Adafruit_CircuitPython_SharpMemoryDisplay to 1.4.0 from 1.2.9: > Merge pull request adafruit/Adafruit_CircuitPython_SharpMemoryDisplay#21 from tekktrik/dev/switch-bus-device > Merge pull request adafruit/Adafruit_CircuitPython_SharpMemoryDisplay#19 from ilikecake/image-function-numpy > change discord badge > Patch: Replaced discord badge image > Updated gitignore > Update Black to latest. > Fixed readthedocs build > Consolidate Documentation sections of README Updating https://github.com/adafruit/Adafruit_CircuitPython_PortalBase to 1.13.0 from 1.12.0: > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#70 from FoamyGuy/dont_require_secrets_if_no_network > change discord badge > Patch: Replaced discord badge image > Updated gitignore
Using the
display.image(image)
function to convert a PIL image to the proper format to display is very slow. See here for a thread with information on the issue. Using numpy to convert the image data is quite a bit faster. I measured the time to call thedisplay.image(image)
with the current method, and with numpy. The execution time decreased from ~7.1sec to .014sec on a Raspberry Pi Zero W.Similar to this function, I added a check for numpy to the code, and if it is available, numpy is used to generate the frame data. If numpy is not available, the function should work the same way as before.