Remove unused pattern tests

This commit is contained in:
2025-11-12 19:20:50 +13:00
parent 1962638b81
commit 3dae9363e7
11 changed files with 64 additions and 273 deletions

View File

@@ -1,34 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 127)
p.set_param("dl", 50)
p.set_param("cl", [(0, 255, 0), (0, 255, 0)])
p.set_param("pt", "bidirectional_scanner")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()

View File

@@ -1,11 +1,12 @@
#!/usr/bin/env python3
import uasyncio as asyncio
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
async def main():
s = Settings()
pin = s.get("led_pin", 10)
num = s.get("num_leds", 30)
@@ -15,20 +16,17 @@ def run():
p.set_param("br", 64)
p.set_param("dl", 200)
p.set_param("cl", [(255, 0, 0), (0, 0, 255)])
p.set_param("pt", "blink")
p.select("blink")
task = asyncio.create_task(p.run())
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
await asyncio.sleep_ms(10)
await p.stop()
await task
if __name__ == "__main__":
run()
asyncio.run(main())

View File

@@ -1,34 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 64)
p.set_param("dl", 100)
p.set_param("cl", [(255, 0, 0), (0, 255, 0)])
p.set_param("pt", "color_transition")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()

View File

@@ -1,34 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 64)
p.set_param("dl", 60)
p.set_param("cl", [(0, 0, 255), (255, 0, 0)])
p.set_param("pt", "color_wipe")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()

View File

@@ -1,35 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 127)
p.set_param("dl", 100)
p.set_param("cl", [(255, 136, 0), (255, 136, 0)])
p.set_param("n1", 10)
p.set_param("pt", "flicker")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()

View File

@@ -1,24 +1,26 @@
#!/usr/bin/env python3
import utime
import uasyncio as asyncio
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
async 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)
p.set_param("pt", "off")
p.tick()
p.select("off")
task = asyncio.create_task(p.run())
wdt.feed()
utime.sleep_ms(200)
await asyncio.sleep_ms(200)
p.stopped = True
await task
if __name__ == "__main__":
run()
asyncio.run(main())

View File

@@ -1,11 +1,11 @@
#!/usr/bin/env python3
import utime
import uasyncio as asyncio
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
async def main():
s = Settings()
pin = s.get("led_pin", 10)
num = s.get("num_leds", 30)
@@ -15,20 +15,20 @@ def run():
p.set_param("br", 64)
p.set_param("dl", 120)
p.set_param("cl", [(255, 0, 0), (0, 0, 255)])
p.set_param("pt", "on")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 800:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
p.select("on")
task = asyncio.create_task(p.run())
await asyncio.sleep_ms(800)
p.stopped = True
await task
p.stopped = False
p.select("off")
task = asyncio.create_task(p.run())
await asyncio.sleep_ms(100)
p.stopped = True
await task
if __name__ == "__main__":
run()
asyncio.run(main())

View File

@@ -18,6 +18,7 @@ async def main():
print("Test 1: Basic pulse pattern")
p.set_param("br", 255)
p.set_param("dl", 1000) # 1 second delay between pulses
p.set_param("auto", True) # Run continuously
p.set_param("cl", [(255, 255, 255), (255, 255, 255)])
p.set_param("n1", 200) # Attack: 200ms
p.set_param("n2", 200) # Hold: 200ms
@@ -36,6 +37,7 @@ async def main():
print("Test 2: Fast pulse pattern")
p.stopped = False
p.set_param("dl", 500) # 500ms delay between pulses
p.set_param("auto", True) # Run continuously
p.set_param("n1", 100) # Attack: 100ms
p.set_param("n2", 100) # Hold: 100ms
p.set_param("n3", 100) # Decay: 100ms
@@ -53,6 +55,7 @@ async def main():
print("Test 3: Colored pulse pattern")
p.stopped = False
p.set_param("dl", 800)
p.set_param("auto", True) # Run continuously
p.set_param("cl", [(255, 0, 0), (0, 0, 255)]) # Red pulse
p.set_param("n1", 150)
p.set_param("n2", 150)
@@ -71,6 +74,7 @@ async def main():
print("Test 4: Testing delay restart timing")
p.stopped = False
p.set_param("dl", 500) # 500ms delay
p.set_param("auto", True) # Run continuously
p.set_param("n1", 100) # Total attack+hold+decay = 300ms, should wait 200ms more
p.set_param("n2", 100)
p.set_param("n3", 100)
@@ -89,10 +93,11 @@ async def main():
p.stopped = True
await task
# Test 5: Single-shot pulse (delay=0)
print("Test 5: Single-shot pulse (delay=0)")
# Test 5: Single-shot pulse (auto=False)
print("Test 5: Single-shot pulse (auto=False)")
p.stopped = False
p.set_param("dl", 0) # No delay - should run only once
p.set_param("dl", 500) # Delay between pulses
p.set_param("auto", False) # Run only once
p.set_param("cl", [(0, 255, 0), (0, 255, 0)]) # Green pulse
p.set_param("n1", 150) # Attack: 150ms
p.set_param("n2", 150) # Hold: 150ms
@@ -111,7 +116,31 @@ async def main():
# Task should have completed on its own (not stopped manually)
# Verify it's stopped
if not p.stopped:
print("Warning: Pulse should have stopped automatically with delay=0")
print("Warning: Pulse should have stopped automatically with auto=False")
p.stopped = True
await task
# Test 6: Pulse cycles through colors
print("Test 6: Pulse cycles through colors")
p.stopped = False
p.set_param("dl", 300) # cycle interval
p.set_param("auto", True) # Run continuously
p.set_param("cl", [
(255, 0, 0), # red
(0, 255, 0), # green
(0, 0, 255), # blue
(255, 255, 0), # yellow
])
p.set_param("n1", 50)
p.set_param("n2", 0)
p.set_param("n3", 50)
p.select("pulse")
task = asyncio.create_task(p.run())
start = utime.ticks_ms()
# Run long enough to observe multiple color cycles
while utime.ticks_diff(utime.ticks_ms(), start) < 10000:
wdt.feed()
await asyncio.sleep_ms(10)
p.stopped = True
await task

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 64)
p.set_param("dl", 100)
p.set_param("pt", "rainbow_cycle")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()

View File

@@ -1,34 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 127)
p.set_param("dl", 50)
p.set_param("cl", [(0, 255, 0), (0, 255, 0)])
p.set_param("pt", "scanner")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()

View File

@@ -1,34 +0,0 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def run():
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)
p.set_param("br", 64)
p.set_param("dl", 100)
p.set_param("cl", [(255, 255, 255), (0, 0, 0)])
p.set_param("pt", "theater_chase")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
p.tick()
wdt.feed()
utime.sleep_ms(10)
p.set_param("pt", "off")
p.tick()
utime.sleep_ms(100)
if __name__ == "__main__":
run()