refactor(led-driver): simplify websocket runtime and test layout

This commit is contained in:
2026-04-14 22:08:23 +12:00
parent ded6e3d360
commit 0a33f399e1
30 changed files with 2850 additions and 503 deletions

35
tests/patterns/blink.py Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from presets import Presets, run_tick
def main():
s = Settings()
pin = s.get("led_pin", 10)
num = s.get("num_leds", 30)
p = Presets(pin=pin, num_leds=num)
wdt = WDT(timeout=10000)
# Create blink preset (use short-key fields: p=pattern, b=brightness, d=delay, c=colors)
p.edit("test_blink", {
"p": "blink",
"b": 64,
"d": 200,
"c": [(255, 0, 0), (0, 0, 255)],
})
p.select("test_blink")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
wdt.feed()
run_tick(p)
utime.sleep_ms(10)
if __name__ == "__main__":
main()