Wire the Pico to UART-driven preset selection, add pattern modules and presets data, remove old p2p/settings code, and update tests and LED driver. Made-with: Cursor
29 lines
834 B
Python
29 lines
834 B
Python
"""Test pattern: strip i has (i+1) LEDs on at the start (indices 0..i) plus the midpoint LED on. 50% red."""
|
|
|
|
BRIGHTNESS = 0.50
|
|
|
|
RED = (255, 0, 0)
|
|
|
|
|
|
def _scale(color, factor):
|
|
return tuple(int(c * factor) for c in color)
|
|
|
|
|
|
class Test:
|
|
def __init__(self, driver):
|
|
self.driver = driver
|
|
|
|
def run(self, preset):
|
|
strips = self.driver.strips
|
|
red = _scale(RED, BRIGHTNESS)
|
|
for strip_idx, strip in enumerate(strips):
|
|
n = strip.num_leds
|
|
mid = self.driver.strip_midpoints[strip_idx] # from STRIP_CONFIG
|
|
strip.fill((0, 0, 0))
|
|
# First (strip_idx + 1) LEDs on: indices 0..strip_idx
|
|
for i in range(min(strip_idx + 1, n)):
|
|
strip.set(i, red)
|
|
# Midpoint LED on
|
|
strip.set(mid, red)
|
|
strip.show()
|