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:
39
tests/patterns/gradient_scroll.py
Normal file
39
tests/patterns/gradient_scroll.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
import utime
|
||||
from machine import WDT
|
||||
from settings import Settings
|
||||
from presets import Presets, run_tick
|
||||
|
||||
|
||||
def run_for(p, wdt, ms):
|
||||
start = utime.ticks_ms()
|
||||
while utime.ticks_diff(utime.ticks_ms(), start) < ms:
|
||||
wdt.feed()
|
||||
run_tick(p)
|
||||
utime.sleep_ms(10)
|
||||
|
||||
|
||||
def main():
|
||||
s = Settings()
|
||||
p = Presets(pin=s.get("led_pin", 10), num_leds=s.get("num_leds", 30))
|
||||
wdt = WDT(timeout=10000)
|
||||
|
||||
print("Test gradient_scroll")
|
||||
p.edit("gradient_test", {
|
||||
"p": "gradient_scroll",
|
||||
"b": 220,
|
||||
"d": 60,
|
||||
"c": [(255, 0, 0), (0, 255, 0), (0, 0, 255)],
|
||||
"n1": 2,
|
||||
"a": True,
|
||||
})
|
||||
p.select("gradient_test")
|
||||
run_for(p, wdt, 4000)
|
||||
|
||||
p.edit("cleanup_off", {"p": "off"})
|
||||
p.select("cleanup_off")
|
||||
run_for(p, wdt, 100)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user