Skip to content

Lighting and servo drivers as libraries, driver base, and their tests - #18

Merged
AnakinRaW merged 8 commits into
mainfrom
claude/lighting-driver-c53859
Nov 16, 2026
Merged

AnakinRaW merged 8 commits into
mainfrom
claude/lighting-driver-c53859

Conversation

@AnakinRaW

Copy link
Copy Markdown
Owner

What changes

Driver base. firmware/lib/driver-base holds what every driver shares: Driver, Fault, the one DriverTick and DEBUG_LOG(). Every refusal now shows in a debug build through DEBUG_LOG(). quiet-libraries.py hands build_src_flags to the firmware's own libraries and tests, so DEBUG and -Wall -Wextra -Werror reach them and stay out of freertos-teensy.

Settings handed in. A driver reads no config and does not register itself with the device monitor. The main task hands a driver its settings with configure() before begin(), and registers a watched driver right after begin(). The driver documents follow.

Servo driver. firmware/lib/servo-driver, split into header and source, with its angles and speed handed in through configure().

Lighting driver. firmware/lib/lighting: FastLED 3.10.9 with ObjectFLED as its only driver, the strip's measured power model, the 3 A and 6 A profiles and the cap. LightingChains takes each chain's length, and Lighting carries the light layout's chains. FastLED's header leaves two warnings off, so every include of it sits between diagnostic push and pop.

Lighting model. The ambient limits now come from FastLED's own power sum, which charges the processor and a dithering reserve on top of the LEDs. Four inner and outer lane lights join chain D: 244 LEDs, ambient limits 96 at 3 A and 126 at 6 A.

Gists. The lighting, servo and driver-design gists go, since their drivers stand as code.

Tests

Program Runs on Result
driver-tick Teensy END 2 0 0, every run within 55 ns of its tick
test_driver-tick (due, refused, timer-start, no-timer) computer, in CI 4 of 4 passed
servo bench, wire from pin 0 to pin 1 END 5 0 0
lighting bench, three LEDs on chain A END 7 0 0
every-driver (begin-fails, at-once) Teensy END 2 0 0, show() returns after 367 µs of a 2370 µs frame

The native test environment is renamed computer and runs with pio test -e computer. testing.md gains the lighting rows, the driver-tick computer rows and a heap test for the start-up program, which is not implemented yet.

python tools/figcheck.py passes.

🤖 Generated with Claude Code

AnakinRaW and others added 8 commits November 16, 2026 15:03
…lights

FastLED's limiter charges 125 mW for the processor and a dithering
reserve on every lit channel besides the LEDs' own draw. With the old
limits the whole layout summed to 2096 mA at the 3 A profile, so
FastLED would have dimmed it to 242 of 255. The model now takes the
ambient limits from that sum.

Four inner and outer lane lights join chain D, so the layout plans
244 LEDs. The ambient limits are 96 with the 3 A adapter and 126 with
the 6 A adapter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
firmware/lib/driver-base holds what every driver shares, the one driver
tick and DEBUG_LOG(). quiet-libraries.py hands build_src_flags to the
firmware's own libraries and tests, so DEBUG and the warning flags
reach them and stay out of freertos-teensy. In a release build
DEBUG_LOG() stands behind if (false), so a variable only a log line
reads raises no warning.

firmware/CLAUDE.md adds two rules: every refusal shows in a debug
build through DEBUG_LOG(), and a gist goes once its driver stands as
code. The driver-design gist goes with this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A driver reads no config and does not register itself with the device
monitor. The main task reads a driver's settings from the config and
hands them over with configure() before begin(), the solenoids after
their begin(). It registers a watched driver right after its begin(),
whether begin() succeeded or not. The driver documents, the start-up
order and begin-fails in testing.md follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
firmware/lib/servo-driver holds ServoDriver in the firmware's code
style, split into header and source. It takes its angles and speed
through configure(), holds each inside its range and logs a value it
moved. The servo test drops its own copies of the driver and the
driver base and calls configure() directly. It passes END 5 0 0 on
the bench with the wire from pin 0 to pin 1. The servo gist goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
firmware/lib/lighting holds the driver as the gist designed it:
FastLED 3.10.9 with ObjectFLED as its only driver, the strip's
measured power model, the two adapter profiles and the cap. The
template LightingChains takes each chain's length, so a bench program
drives the LEDs it has, and Lighting carries the chains of the light
layout. The adapter's rating comes in through configure().

FastLED 3.10.9 leaves two warnings off after its header, so every
include of it sits between diagnostic push and pop.

firmware/tests/lighting checks the profiles, the power model, colors,
the brightness limits, the cap against the live limiter and the whole
layout against FastLED's sum. With three LEDs on chain A it passes
END 7 0 0 on the bench. The lighting gist goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
firmware/tests/driver-tick times every callback against the processor's
cycle counter for a minute and provokes every refusal. On the bench it
passes END 2 0 0, with every run on its tick within 55 ns.

firmware/tests/test_driver-tick steps DriverTick on a fake
IntervalTimer from firmware/tests/fakes: due, refused, timer-start and
no-timer. They build in the computer environment of platformio.ini,
which replaces the env named native and is PlatformIO's native
platform, and CI runs them on each push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gram checks

every-driver runs begin-fails and at-once for the servo and lighting drivers on the Teensy.
Each test program now opens with what it checks, one line per test, its wiring and how it runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It checks that a block taken in a static constructor and one taken in the main task both lie
in RAM2 and do not overlap, which pull request 43 and configTEENSY_HEAP_ALLOCATION 2 promise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnakinRaW
AnakinRaW merged commit 0673f7a into main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant