feat(patterns): add icicles blizzard and rime winter effects

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-16 15:09:59 +12:00
parent 2a768376d0
commit 8f8bc894a9
6 changed files with 328 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from presets import Presets
def run_for(p, wdt, ms):
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < ms:
wdt.feed()
p.tick()
utime.sleep_ms(10)
def main():
s = Settings()
p = Presets(pin=s.get("led_pin", 10), num_leds=s.get("num_leds", 48))
wdt = WDT(timeout=10000)
p.edit(
"test_blizzard",
{
"p": "blizzard",
"b": 220,
"d": 40,
"c": [(255, 255, 255), (200, 220, 255)],
"n1": 100,
"n2": 2,
"n3": 150,
"a": True,
},
)
p.select("test_blizzard")
run_for(p, wdt, 2500)
p.edit("cleanup_off", {"p": "off"})
p.select("cleanup_off")
run_for(p, wdt, 80)
if __name__ == "__main__":
main()

43
tests/patterns/icicles.py Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from presets import Presets
def run_for(p, wdt, ms):
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < ms:
wdt.feed()
p.tick()
utime.sleep_ms(10)
def main():
s = Settings()
p = Presets(pin=s.get("led_pin", 10), num_leds=s.get("num_leds", 40))
wdt = WDT(timeout=10000)
p.edit(
"test_icicles",
{
"p": "icicles",
"b": 220,
"d": 50,
"c": [(200, 230, 255), (255, 255, 255)],
"n1": 10,
"n2": 8,
"n3": 1,
"a": True,
},
)
p.select("test_icicles")
run_for(p, wdt, 2500)
p.edit("cleanup_off", {"p": "off"})
p.select("cleanup_off")
run_for(p, wdt, 80)
if __name__ == "__main__":
main()

43
tests/patterns/rime.py Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from presets import Presets
def run_for(p, wdt, ms):
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < ms:
wdt.feed()
p.tick()
utime.sleep_ms(10)
def main():
s = Settings()
p = Presets(pin=s.get("led_pin", 10), num_leds=s.get("num_leds", 40))
wdt = WDT(timeout=10000)
p.edit(
"test_rime",
{
"p": "rime",
"b": 200,
"d": 80,
"c": [(240, 248, 255), (255, 255, 255)],
"n1": 48,
"n2": 14,
"n3": 4,
"a": True,
},
)
p.select("test_rime")
run_for(p, wdt, 2800)
p.edit("cleanup_off", {"p": "off"})
p.select("cleanup_off")
run_for(p, wdt, 80)
if __name__ == "__main__":
main()