Commit b65c8c1
authored
Fix setting a pixels slice
When setting the pixels with a slice, set the correct pixel to a value provided (not to the index).
This was discovered using `adafruit_led_animation.animation.rainbow`
```py
from adafruit_led_animation.animation.rainbow import Rainbow
rainbow = Rainbow(macropad.pixels, speed=.1, period=2)
while True:
rainbow.animate()
```
And tested with this (with all values of rotation)
```py
from adafruit_macropad import MacroPad
import time
macropad = MacroPad(rotation=0)
macropad.pixels[:] = (
(255,0,0), (128,255,0), (0,255,0), (0,255,128),
(0,0,255), (128,0,255), (255,255,255), (0,0,0),
(255,0,0), (128,255,0), (0,255,0), (0,255,128),
)
time.sleep(2)
for x in range(9):
macropad.pixels.fill(0)
macropad.pixels[x:x+4] = (
(255,0,0), (0,255,0), (0,0,255), (255,255,255)
)
time.sleep(1)
```1 parent 73f85d2 commit b65c8c1
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
928 | | - | |
| 928 | + | |
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
| |||
0 commit comments