feat(patterns): add expanded animation pack with smoke tests
Add a broad set of new pattern modules and matching pattern smoke scripts so the new effects can be validated directly on-device.
This commit is contained in:
24
src/patterns/strobe_burst.py
Normal file
24
src/patterns/strobe_burst.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import utime
|
||||
|
||||
|
||||
class StrobeBurst:
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
|
||||
def run(self, preset):
|
||||
colors = preset.c if preset.c else [(255, 255, 255)]
|
||||
count = max(1, int(preset.n1) if int(preset.n1) > 0 else 3)
|
||||
gap = max(1, int(preset.n2) if int(preset.n2) > 0 else 60)
|
||||
cooldown = max(1, int(preset.n3) if int(preset.n3) > 0 else 400)
|
||||
c = self.driver.apply_brightness(colors[0], preset.b)
|
||||
while True:
|
||||
for _ in range(count):
|
||||
self.driver.fill(c)
|
||||
utime.sleep_ms(max(1, int(preset.d)//2))
|
||||
self.driver.fill((0, 0, 0))
|
||||
utime.sleep_ms(gap)
|
||||
yield
|
||||
utime.sleep_ms(cooldown)
|
||||
yield
|
||||
if not preset.a:
|
||||
return
|
||||
Reference in New Issue
Block a user