Skip to content

feat(radar): turn the OPS243 LEDs on or off, from the kiosk or the app - #328

Open
btripp wants to merge 5 commits into
open-flight:mainfrom
btripp:feat/radar-led-control
Open

btripp wants to merge 5 commits into
open-flight:mainfrom
btripp:feat/radar-led-control

Conversation

@btripp

@btripp btripp commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds radar LED control, from the kiosk and over Socket.IO.

  • radar_config gains leds (default true). set_radar_config with {"leds": false} sends Ol (OL turns them back on), per OmniPreSense AN-010-AF p16.
  • The choice is saved to ~/.config/openflight/radar-leds.json and re-applied when the monitor starts, because the radar powers up with its LEDs on.
  • Kiosk: Debug > Tuning gets a Radar LEDs Off/On switch (the existing SegmentedControl), shown only when radar_config reports leds. It's the first row so it's visible without scrolling at 800×400, 800×480 and 1024×600.

Clients that don't send leds are unaffected. The companion app (open-flight/openflight-mobile-kmp#190) shows the same switch when the Pi reports leds.

Why was this required?

Players asked in Discord: the blue LED is bright enough to glare on the screen, and covering it is the only workaround today.

Automated tests

  • test_ops243_mode_commands.py: set_leds(True/False) writes OL/Ol and never A!.
  • test_server.py::TestRadarLeds: off reaches the radar, updates radar_config and saves the file; a non-boolean is rejected without touching the radar; a saved false is applied at startup; no file or an unreadable file leaves the radar default.
  • DebugPanel.test.tsx: hidden without leds, pressed state, dimmed in mock mode, sends only the flipped value, a re-tap sends nothing.
  • app.spec.ts: touch test per kiosk size, the switch fully visible in Debug > Tuning.
  • Results: pytest tests/test_server.py tests/test_ops243_mode_commands.py 218 passed. npm run lint, npm run build, npm test (253), npm run test:e2e (44) all exit 0. The full pytest suite has 13 test_camera_* failures that fail the same way on main. Pylint 9.77; ruff check findings are only in files this PR doesn't touch (same on main).

Manual (human) testing

Run against openflight-server --mock-swing-speed (the mode that accepts set_radar_config), with a throwaway HOME so nothing touched a real config:

  • Kiosk: Debug > Tuning shows Radar LEDs with On selected. Tapping Off round-tripped through the server and showed Off pressed; {"leds": false} was saved (screenshot below).
  • Socket.IO client: get_radar_config reports leds: true on a fresh Pi; set_radar_config {"leds": false} replies leds: false and writes radar-leds.json; {"leds": "off"} gets radar_config_error and leaves leds unchanged.
  • Restart: stopped and restarted the server: get_radar_config reported leds: false from the saved file; {"leds": true} turned it back on and saved it.
  • Mobile app and kiosk tap: the author toggled Radar LEDs Off and back On from the companion app (Add a Radar LEDs switch to Settings > Radar openflight-mobile-kmp#190) and by tapping the kiosk switch; both round-tripped and each showed the other's change.
  • Still open — real hardware: not yet run on an OPS243-A. Needs a check that the blue LED goes out with Off, stays out after a Pi reboot, and comes back with On. A tester has been asked and results will be added here.

Radar LEDs switch in Debug > Tuning at 1024x600, mock swing-speed mode, Off selected

AI assistance (Claude Code) drafted the change and tests; the AN-010-AF command was checked against the PDF.

Checklist

  • Single feature/fix — this PR is scoped to one thing with a clear story above
  • Automated tests included — new or updated tests cover this change
  • Manual testing described — mock kiosk, Socket.IO, restart, mobile app and kiosk-tap checks; real-radar check still open
  • Python tests pass (uv run pytest tests/ -v) — 13 pre-existing camera failures on main
  • Pylint passes (uv run pylint src/openflight/ --fail-under=9)
  • Ruff passes (uv run ruff check src/openflight/) — pre-existing findings in untouched files
  • UI builds (cd ui && npm run build)
  • UI lint passes (cd ui && npm run lint)
  • Updated docs or CHANGELOG if needed
  • No unrelated changes mixed in

btripp and others added 3 commits October 31, 2026 03:54
radar_config gains leds (default true). set_radar_config {"leds": false} sends Ol (AN-010-AF p16), saves the choice to ~/.config/openflight/radar-leds.json, and start_monitor re-applies it because the radar powers up with its LEDs on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Debug > Tuning shows an Off/On SegmentedControl when radar_config reports leds; tapping the other option sends set_radar_config {leds}. It sits first in the list so it is visible without scrolling at 800x400, 800x480 and 1024x600, and dims with the other tuning controls in plain mock mode.

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

@HuggeK HuggeK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on real hardware: Pi 5 with an OPS243-A (rev D6, firmware 1.3.3) on the J3 UART, running the server in rolling-buffer mode with the sound trigger.

  • Ol / OL replied {"OutputFeature" : "l"} / "L", and the blue LED went out with Off.
  • Over Socket.IO, set_radar_config {"leds": false} / true round-tripped and saved radar-leds.json. {"leds": "off"} got radar_config_error. The trigger kept re-arming after the toggle.
  • After a server restart, the saved false was re-applied with no warning.
  • pytest tests/test_server.py tests/test_ops243_mode_commands.py on the Pi: 218 passed, 1 skipped.

Not covered: a radar power cycle, the kiosk tap on the device, and a real shot right after a toggle.

@HuggeK HuggeK added enhancement New feature or request radar ui labels Nov 10, 2026
# Conflicts:
#	docs/changelog.md

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request radar ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants