- Fix initialization order: initialize self.presets before calling self.select() - Separate add() and edit() methods: add() creates new presets, edit() updates existing ones - Update all test files to use add() instead of edit() for creating presets - Add comprehensive auto/manual mode test - Remove tool.py (moved to led-tool project)
31 lines
581 B
Python
31 lines
581 B
Python
#!/usr/bin/env python3
|
|
import utime
|
|
from machine import WDT
|
|
from settings import Settings
|
|
from patterns import Patterns
|
|
|
|
|
|
def main():
|
|
s = Settings()
|
|
pin = s.get("led_pin", 10)
|
|
num = s.get("num_leds", 30)
|
|
|
|
p = Patterns(pin=pin, num_leds=num)
|
|
wdt = WDT(timeout=10000)
|
|
|
|
# Create an "off" preset
|
|
p.add("test_off", {"pattern": "off"})
|
|
p.select("test_off")
|
|
|
|
start = utime.ticks_ms()
|
|
while utime.ticks_diff(utime.ticks_ms(), start) < 200:
|
|
wdt.feed()
|
|
p.tick()
|
|
utime.sleep_ms(10)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|
|
|