Closed dunkmann00 closed 4 years ago
I tested the pixelbuf branch successfully on Itsy Bitsy M0 CP version 5.3.0 with this code:
import time
import random
import board
import adafruit_dotstar as dotstar
# Using a DotStar Digital LED Strip with 30 LEDs connected to hardware SPI
dots = dotstar.DotStar(board.SCK, board.MOSI, 30, brightness=0.2)
# HELPERS
# a random color 0 -> 224
def random_color():
return random.randrange(0, 7) * 32
# MAIN LOOP
n_dots = len(dots)
while True:
# Fill each dot with a random color
for dot in range(n_dots):
dots[dot] = (random_color(), random_color(), random_color())
for dot in range(n_dots):
dots[dot] = (0,0,0)
Seems to work correctly as far as I can tell and blazing fast compared to current library.
Is it worth cleaning up the comment in the example code (https://github.com/adafruit/Adafruit_CircuitPython_DotStar/blob/master/examples/dotstar_simpletest.py#L17-L19) on the back of this? It should read 0 -> 192
as random.randrange()
upper limit is exclusive.
@FoamyGuy If you could, it would be good to test the library with the same code, but with a version of CP < 5. This way you are also testing the pypixelbuf
library implementation (which is needed in CP < 5 since pixelbuf
isn't included).
@dunkmann00 On CP version 4.1.2 with the external pixelbuf library in the lib directory I get this error:
Traceback (most recent call last):
File "code.py", line 7, in <module>
File "/lib/adafruit_dotstar.py", line 144, in __init__
TypeError: unexpected keyword argument 'header'
On CP Version 5.0.0 the example code does work successfully as long as the external pixelbuf library in the lib directory. whether or not the external lib is present.
@dunkmann00 Actually the previous error was a result of using the new dotstar branch along with a newer pixelbuf library on the Itsy Bitsy M0 with CP 4.1.2.
Using the new dotstar branch along with the pixelbuf library from the 4.x bundle it does work successfully (albeit noticeably a tad slower than the 5.X ones imo)
@FoamyGuy Thanks for checking that out! And you are correct that it is slower. The python version of pixelbuf, being python, isn't as performant. So if someone is currently using CP 4.x and looking for a performance boost, they would need to upgrade to CP 5.
@dunkmann00 Thank you for picking this up! Please take a look at the PR submitted to your PR by @rhooper as it resolves a couple of issues we found with your submission.
@dunkmann00 this looks great! Thanks for finishing it up!
I sent a small PR (@kattni already mentioned it).
I really should have checked for new PRs before I re-did my work... I even totally forgot about my old fork and branch, because I couldn't find it locally (It must be on my laptop).
@dunkmann00 @FoamyGuy Were the updates to dotstar_image_pov.py
tested with a DotStar strip as intended?
@rhooper Np! I'm glad that @kattni did point out you already had worked on it...saved me some time!
@FoamyGuy will be testing the dotstar_image_pov.py
update. Please wait to merge until the example is tested. Thanks!
Tested with RasPi 3 B+. I had to install these:
pip3 install pillow
apt install libopenjp2-7
apt install libtiff5
After doing so the dotstar_image_pov.py
seems to be working correctly. It's difficult to see with the bare eye. But I was able to wave a camera in front of it and see the text getting displayed.
This adds support for
pixelbuf
which addresses #25.I tested this with the DotStar on my itsybitsy and everything seemed to work okay. If someone else could give it a look with multiple DotStars that would be great.
This also fixes #37 and fixes #41.