Web light brightness control (home + debug)#59
Merged
Conversation
…r light The controller already owns the light level and resends it at 60 Hz, so the web must drive the same value rather than fight it. Add Controller.set_light/get_light (also pushing straight to the bitmask so it works when no joystick is connected), expose GET/POST /api/lights, and add a brightness slider on both the home dashboard and the debug page. GET /api/lights now returns the real level (percent), which also feeds the pilot HUD readout. Pairs with K2-Zephyr PR feature/light-pwm (firmware PWM on D6/PA8). Co-Authored-By: Claude Opus 4.8 <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
The command packet already carries a
lightbyte and the controller drives it via the D-pad. This adds web control of the same light, on the home dashboard and the debug page.Controller.set_light()/get_light()— the controller loop owns the light value and resends it at 60 Hz, so the web drives the same value rather than fighting it.set_lightalso pushes straight to the bitmask so it works even when no joystick is connected.GET /api/lightsnow returns the real level (percent) — this also feeds the existing pilot HUD readout.POST /api/lights {"level": 0..100}sets it.updateLights()(polled byconfiguration.js) syncs the home slider and won't yank it while you drag.Pairs with
K2-Zephyr PR feature/light-pwm (real PWM on D6/PA8). This topside PR is functional on its own (sends the
lightbyte); the LEDs only physically dim once the firmware PR is flashed.Verification
ruff check .+ruff format --check .— pass (CI checks).pytest tests/test_controller.py— pass (added aset_lightclamp/scale test)./api/lightsround-trips; D-pad changes reflect on the home slider via polling.🤖 Generated with Claude Code