-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support any number of strands from 1 to 8; make demo more like arduino demo #4
Conversation
This requires slightly different PIO code, because a variable number of bits have to be thrown away
This shows a phase shifted chase animation on each strip, each in a different color.
@gamblor21 do you want to test this PR with fewer than 8 pins? |
Hope to test it tomorrow |
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.
Nice way of accounting for less then 8 strands. One issue though - bitops.bit_tranpose
does not work for 1 strand (works 2-8).
I did test my setup (which is 1 strand) but setting num_strands to 2 and doubled the pixels and it did work. But either the library has to exclude 1 strand or bit_transpose needs a tweak or a 3rd PIO program that handles just 1 strand with a different data format.
Good news, filling 300 pixels (well 600 but half the fake ones) went from 73fps to about 182fps so I think getting it to work even for 1 strand may have worth.
I did manage to make a quick core change to case 2:
y |= *src << 8;
src -= src_stride;
MP_FALLTHROUGH;
case 1:
y |= *src; and in the shared-bindings change the check to 1 instead of 2 as the minimum Also noticed there are some print statements still in the code. |
You're not wrong to want support for 1 strip using background writes! Let's make that a separate issue, especially in case it requires a core change. However, I think I'd rather have a separate program for 1 strip, because the extra memory usage and processing time for the bit_transpose operation can be eliminated entirely. A 2nd copy of the data is still needed in order to be free from tearing (writing a partially updated strip) but not a copy that's enlarged by 8x because each bit becomes a full byte! And it means no core change is required. (a smaller savings could be had for 2 to 4 strands, with a core change, but I'm less convinced this is worth it) |
I've filed an issue for the 1 strand case, so hopefully you can approve this PR as it stands. |
adafruit_neopxl8.py
Outdated
assembled = adafruit_pioasm.assemble(_PROGRAM8) | ||
else: | ||
program = _PROGRAMN.format(num_strands, 8 - num_strands) | ||
print(program) |
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.
Debugging print left behind. Also on line 171. Otherwise looks great.
.. this calls for a different memory layout to save memory size in the 'background' buffer
I went ahead and added 1-strand support, but changed the structure a bit so it probably deserves a full re-test I tested the 1-strand version on the neopixel bff. The text scroller demo running unthrottled increases from 167 to 210fps! (and just commenting out |
There was a mistake in my benchmarking of the neobff text scroller. The actual frame rates were 928fps (neopxl8 background) and 446fps (standard neopixel) 🚀 |
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.
Tested with 1 and 2 strands, both worked great.
1 strand measure a speed-up from 73.2fps to 99.6fps over 300 neopixels. A 36% increase in speed.
Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPxl8 to 0.2.0 from 0.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_NeoPxl8#4 from adafruit/enhancements Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.12.18 from 1.12.17: > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#81 from BiffoBear/detect_5500_error Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 1.1.0 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#22 from paul-1/my-main Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Also closes #5