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

@@ -18,6 +18,7 @@ class Pulse:
# State machine based pulse using a single generator loop
while True:
bg_color = self.driver.apply_brightness(colors[-1], preset.b)
# Read current timing parameters from preset
attack_ms = max(0, int(preset.n1)) # Attack time in ms
hold_ms = max(0, int(preset.n2)) # Hold time in ms
@@ -49,7 +50,7 @@ class Pulse:
self.driver.fill(self.driver.apply_brightness(color, preset.b))
elif elapsed < total_ms:
# Delay phase: LEDs off between pulses
self.driver.fill((0, 0, 0))
self.driver.fill(bg_color)
else:
# End of cycle, move to next color and restart timing
color_index += 1