faster generation of zero-arrays

pull/6/head
Greg Smith 2022-06-05 19:45:20 -04:00
rodzic 4932d91202
commit 7bc29398d2
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -68,7 +68,7 @@ class Neopixel:
#]
def __init__(self, num_leds, state_machine, pin, mode="RGB", delay=0.0001):
self.pixels = array.array("I", [0 for _ in range(num_leds)])
self.pixels = array.array("I", [0] * num_leds)
self.mode = mode
self.W_in_mode = 'W' in mode
if self.W_in_mode:
@ -248,4 +248,5 @@ class Neopixel:
# Clear the strip
def clear(self):
self.pixels = array.array("I", [0 for _ in range(self.num_leds)])
self.pixels = array.array("I", [0] * self.num_leds)