ensure list is right length

This commit is contained in:
janeptrv 2020-11-07 16:14:25 -05:00
parent 6ee892d23b
commit 42ab015458

View file

@ -25,6 +25,9 @@ class LightStrip:
def get_next_pattern_tick(self):
n = self.np.n
t = self.cur_tick
if not len(self.cur_pattern) >= n - 1:
li = [(255, 255, 255)] * (n - len(self.cur_pattern))
self.cur_pattern.extend(li)
for i in range(n):
self.cur_pattern[i] = self.pattern(i, t)
self.cur_tick = t + 1