Rename the driver module and update imports so tests and main entry use the new presets naming, while moving Preset to its own file. Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
735 B
Python
36 lines
735 B
Python
#!/usr/bin/env python3
|
|
import utime
|
|
from machine import WDT
|
|
from settings import Settings
|
|
from presets import Presets
|
|
|
|
|
|
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()
|
|
p.tick()
|
|
utime.sleep_ms(10)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|
|
|