Open Gadgetoid opened 6 years ago
Note, I think I've seen what might have happened here- I found a generic "pyb" MicroPython board based example and modified it into the following: https://github.com/Gadgetoid/wipy-WS2812/blob/master/ws2812alt.py
This packs two bits per byte correctly, whereas the code in this repository (at time of writing) discards one bit, and packs the other ones 1 bit per byte, with an empty spacing byte between each one.
I don't know if I'm missing something, but the way
bytearray
is used in the code is, as far as I can tell, not how bytearray actually works.In C I would expect this paradigm because a strongly typed uint16_t being written to an array pointer of type uint8_t would set two bytes. But for a bytearray in Python, the high-byte is simply ignored. Example:
In order to fix this, I rewrote the buffer preparation code to the following:
Where
buf_bytes
is:For WiPy 2.0 I also used G22/P11 and removed the pull-up setting.