fix(patterns): correct non-blocking timing and blink off phase

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jimmyandCursor committed 2026-05-06 20:28:52 +12:00
1 parent a79c6f4dd3
commit fbebe9f4f9
19 files changed
+77 -28

No files matched your search

+3 -2
View File
@@ -39,6 +39,7 @@ class Twinkle:
"""Twinkle: n1 activity, n2 density; n3/n4 min/max length of adjacent on/off runs."""
palette = self._palette(preset)
num = self.driver.num_leds
bg_color = self.driver.apply_brightness(palette[-1], preset.b)
if num <= 0:
while True:
yield
@@ -125,7 +126,7 @@ class Twinkle:
base = palette[colour_i[i] % len(palette)]
self.driver.n[i] = self.driver.apply_brightness(base, preset.b)
else:
self.driver.n[i] = (0, 0, 0)
self.driver.n[i] = bg_color
self.driver.n.write()
yield
return
@@ -185,7 +186,7 @@ class Twinkle:
base = palette[next_ci[i] % len(palette)]
self.driver.n[i] = self.driver.apply_brightness(base, preset.b)
else:
self.driver.n[i] = (0, 0, 0)
self.driver.n[i] = bg_color
self.driver.n.write()
on = next_on
colour_i = next_ci