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:
40
tests/patterns/scanner.py
Normal file
40
tests/patterns/scanner.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/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 scanner")
|
||||
p.edit("scanner_test", {
|
||||
"p": "scanner",
|
||||
"b": 255,
|
||||
"d": 30,
|
||||
"c": [(255, 0, 0)],
|
||||
"n1": 4,
|
||||
"n2": 2,
|
||||
"a": True,
|
||||
})
|
||||
p.select("scanner_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