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

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

View File

@@ -16,6 +16,7 @@ class StrobeBurst:
cooldown = max(1, int(preset.n3) if int(preset.n3) > 0 else 400)
on_ms = max(1, int(preset.d) // 2)
c = self.driver.apply_brightness(colors[0], preset.b)
bg_color = self.driver.apply_brightness(colors[-1], preset.b)
now = utime.ticks_ms()
if state == "flash_on":
@@ -24,7 +25,7 @@ class StrobeBurst:
state = "flash_off"
state_start = utime.ticks_add(state_start, on_ms)
elif state == "flash_off":
self.driver.fill((0, 0, 0))
self.driver.fill(bg_color)
if utime.ticks_diff(now, state_start) >= gap:
flash_idx += 1
if flash_idx >= count:
@@ -37,7 +38,7 @@ class StrobeBurst:
state = "flash_on"
state_start = utime.ticks_add(state_start, gap)
else:
self.driver.fill((0, 0, 0))
self.driver.fill(bg_color)
if utime.ticks_diff(now, state_start) >= cooldown:
state = "flash_on"
state_start = utime.ticks_add(state_start, cooldown)