Remove unused pattern tests
This commit is contained in:
@@ -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,10 +116,34 @@ 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
|
||||
|
||||
# Cleanup
|
||||
print("Test complete, turning off")
|
||||
p.stopped = False
|
||||
|
||||
Reference in New Issue
Block a user