Repository navigation
Lighting and servo drivers as libraries, driver base, and their tests - #18
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Driver base.
firmware/lib/driver-baseholds what every driver shares:Driver,Fault, the oneDriverTickandDEBUG_LOG(). Every refusal now shows in a debug build throughDEBUG_LOG().quiet-libraries.pyhandsbuild_src_flagsto the firmware's own libraries and tests, soDEBUGand-Wall -Wextra -Werrorreach 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()beforebegin(), and registers a watched driver right afterbegin(). The driver documents follow.Servo driver.
firmware/lib/servo-driver, split into header and source, with its angles and speed handed in throughconfigure().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.LightingChainstakes each chain's length, andLightingcarries 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
driver-ticktest_driver-tick(due, refused, timer-start, no-timer)servolightingevery-driver(begin-fails, at-once)show()returns after 367 µs of a 2370 µs frameThe native test environment is renamed
computerand runs withpio test -e computer.testing.mdgains the lighting rows, the driver-tick computer rows and aheaptest for the start-up program, which is not implemented yet.python tools/figcheck.pypasses.🤖 Generated with Claude Code