Skip to content

Web light brightness control (home + debug)#59

Merged
mringsby merged 2 commits into
mainfrom
feature/light-control
Jun 6, 2026
Merged

Web light brightness control (home + debug)#59
mringsby merged 2 commits into
mainfrom
feature/light-control

Conversation

@mringsby

@mringsby mringsby commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

What

The command packet already carries a light byte 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_light also pushes straight to the bitmask so it works even when no joystick is connected.
  • GET /api/lights now returns the real level (percent) — this also feeds the existing pilot HUD readout. POST /api/lights {"level": 0..100} sets it.
  • Brightness sliders added to the home Lights card and the debug page; updateLights() (polled by configuration.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 light byte); 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 a set_light clamp/scale test).
  • Manual: drag the home/debug sliders and confirm /api/lights round-trips; D-pad changes reflect on the home slider via polling.

🤖 Generated with Claude Code

mringsby and others added 2 commits June 5, 2026 15:06
…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>
@mringsby mringsby marked this pull request as ready for review June 6, 2026 15:52
@mringsby mringsby merged commit ff74d22 into main Jun 6, 2026
1 check 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