Add flicker and n_chase patterns, increase test brightness to 255, add test suites
This commit is contained in:
@@ -6,17 +6,32 @@ Run with: mpremote run test/blink.py
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
def test_blink():
|
||||
print("Testing blink pattern...")
|
||||
|
||||
# Initialize patterns with LED pin 10 and 59 LEDs at 20% brightness
|
||||
p = patterns.Patterns(pin=10, num_leds=59, brightness=51, delay=500)
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000) # 10 second timeout
|
||||
wdt.feed()
|
||||
|
||||
# Load settings
|
||||
settings = Settings()
|
||||
|
||||
# Initialize patterns using settings
|
||||
p = patterns.Patterns(
|
||||
pin=settings["led_pin"],
|
||||
num_leds=settings["num_leds"], # Set to 200 LEDs for test
|
||||
brightness=255, # Full brightness
|
||||
delay=500
|
||||
)
|
||||
|
||||
# Set a bright red color
|
||||
p.colors = [(255, 0, 0)] # Red
|
||||
|
||||
print(f"LEDs: {p.num_leds}")
|
||||
print(f"LED Pin: {settings['led_pin']}")
|
||||
print(f"LEDs: {p.num_leds} (test override: 200)")
|
||||
print(f"Brightness: {p.brightness}")
|
||||
print(f"Delay: {p.delay}ms")
|
||||
print(f"Color: {p.colors[0]}")
|
||||
@@ -25,8 +40,11 @@ def test_blink():
|
||||
print("Starting blink pattern for 5 seconds...")
|
||||
p.select("bl")
|
||||
|
||||
# Let it run for 5 seconds
|
||||
utime.sleep(5)
|
||||
# Let it run for 5 seconds with WDT feeding
|
||||
start_time = utime.ticks_ms()
|
||||
while utime.ticks_diff(utime.ticks_ms(), start_time) < 5000:
|
||||
wdt.feed()
|
||||
utime.sleep_ms(100)
|
||||
|
||||
# Stop the pattern
|
||||
p.run = False
|
||||
|
||||
Reference in New Issue
Block a user