Files
led-hoop/pico/src/patterns/calibration.py
jimmy 5f457b3ae7 Refine calibration, chase, and spin patterns and add spin test
Increase calibration brightness, update chase to use the new logical ring abstraction, and make spin start from a cleared frame with symmetric arm speed, alongside a dedicated on-device spin test script.

Made-with: Cursor
2026-03-05 23:41:25 +13:00

40 lines
1.1 KiB
Python

"""Calibration: strips 2 and 6 only. First 10 green, then alternating 10 blue / 10 red. 10% brightness."""
BRIGHTNESS = 1
BLOCK = 10
STRIPS_ON = (2, 6) # 0-based: 3rd and 7th strip only
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLUE = (0, 0, 255)
def _scale(color, factor):
return tuple(int(c * factor) for c in color)
class Calibration:
def __init__(self, driver):
self.driver = driver
def run(self, preset):
strips = self.driver.strips
green = _scale(GREEN, BRIGHTNESS)
red = _scale(RED, BRIGHTNESS)
blue = _scale(BLUE, BRIGHTNESS)
blue = (0,0,0)
on_set = set(STRIPS_ON)
for strip_idx, strip in enumerate(strips):
n = strip.num_leds
if strip_idx not in on_set:
strip.fill((0, 0, 0))
strip.show()
continue
for i in range(n):
if i < BLOCK:
strip.set(i, green)
else:
block = (i - BLOCK) // BLOCK
strip.set(i, blue if block % 2 == 0 else red)
strip.show()