fix(patterns): correct non-blocking timing and blink off phase
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,10 +16,11 @@ class Snowfall:
|
||||
d = max(1, int(preset.d))
|
||||
now = utime.ticks_ms()
|
||||
if utime.ticks_diff(now, last) >= d:
|
||||
bg_color = self.driver.apply_brightness(colors[-1], preset.b)
|
||||
if random.randint(0, 255) < density:
|
||||
flakes.append([self.driver.num_leds - 1, random.randint(0, len(colors)-1)])
|
||||
for i in range(self.driver.num_leds):
|
||||
self.driver.n[i] = (0, 0, 0)
|
||||
self.driver.n[i] = bg_color
|
||||
nf = []
|
||||
for pos, ci in flakes:
|
||||
if 0 <= pos < self.driver.num_leds:
|
||||
|
||||
Reference in New Issue
Block a user