Rename patterns module to presets
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>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import utime
|
||||
from machine import WDT
|
||||
from settings import Settings
|
||||
from patterns import Patterns
|
||||
from presets import Presets
|
||||
|
||||
|
||||
def main():
|
||||
@@ -10,17 +10,19 @@ def main():
|
||||
pin = s.get("led_pin", 10)
|
||||
num = s.get("num_leds", 30)
|
||||
|
||||
p = Patterns(pin=pin, num_leds=num)
|
||||
p = Presets(pin=pin, num_leds=num)
|
||||
wdt = WDT(timeout=10000)
|
||||
|
||||
# Create presets for on and off
|
||||
# Create presets for on and off using the short-key fields that Presets expects
|
||||
# Preset fields:
|
||||
# p = pattern name, b = brightness, d = delay, c = list of (r,g,b) colors
|
||||
p.edit("test_on", {
|
||||
"pattern": "on",
|
||||
"brightness": 64,
|
||||
"delay": 120,
|
||||
"colors": [(255, 0, 0), (0, 0, 255)]
|
||||
"p": "on",
|
||||
"b": 64,
|
||||
"d": 120,
|
||||
"c": [(255, 0, 0), (0, 0, 255)],
|
||||
})
|
||||
p.edit("test_off", {"pattern": "off"})
|
||||
p.edit("test_off", {"p": "off"})
|
||||
|
||||
# ON phase
|
||||
p.select("test_on")
|
||||
|
||||
Reference in New Issue
Block a user