Add Pico presets engine, patterns, and tests.

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
This commit is contained in:
2026-03-03 19:28:11 +13:00
parent 646b988cdd
commit 52a5f0f8c4
44 changed files with 2175 additions and 373 deletions

28
pico/src/patterns/test.py Normal file
View File

@@ -0,0 +1,28 @@
"""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()