Skip to content

fix(ops243): make missing-radar port hint tool-neutral - #292

Merged
jewbetcha merged 1 commit into
open-flight:mainfrom
Gabeyocum28:fix/ops243-port-hint
Oct 7, 2026
Merged

jewbetcha merged 1 commit into
open-flight:mainfrom
Gabeyocum28:fix/ops243-port-hint

Conversation

@Gabeyocum28

Copy link
Copy Markdown
Contributor

What does this PR do?

Rewords the ConnectionError raised when no OPS243 is auto-detected on USB so it no longer names --radar-port. The hint now says to pass the serial port via your command's port option, e.g. /dev/ttyAMA0.

Fixes #270

Why was this required?

The UART build guide (docs/build/ops243-uart.md) walks you through scripts/hardware-test/test_rolling_buffer_persist.py. After the required power cycle, running --test with no --port fails with a message telling you to pass --radar-port /dev/ttyAMA0. That flag belongs to start-kiosk.sh; the test script only accepts --port, so following the hint produces error: unrecognized arguments: --radar-port. A user got stuck here and reported it in #270.

The driver (src/openflight/ops243.py) cannot know which CLI called it, so swapping one flag name for the other would just mislead the other set of callers. The message is now tool-neutral.

Automated tests

Added test_missing_radar_error_does_not_name_a_caller_specific_flag in tests/test_ops243_uart.py. It mocks find_radar_ports to return nothing, calls connect(), and asserts the ConnectionError text contains neither --radar-port nor --port. Written first and confirmed failing against the old message, then passing after the fix. The existing test that the message still mentions ttyAMA0 continues to pass.

Manual (human) testing

Ran the exact command from the issue on a Mac with no radar connected:

uv run python scripts/hardware-test/test_rolling_buffer_persist.py --test

Observed the new message at the end of the traceback:

ConnectionError: No OPS243 radar found on USB. If it is wired to the Pi GPIO UART (J3 pins 6/7), pass the serial port explicitly via your command's port option (e.g. /dev/ttyAMA0) — a raw UART has no USB descriptors to auto-detect.

Unlike before, following the hint no longer leads to unrecognized arguments: --radar-port, because no flag is named.

Full suite: uv run pytest tests/ gives 1625 passed, 13 failed. All 13 failures are in test_camera_* and fail identically on main in my environment because cv2 is not installed; unrelated to this change. uv run pylint src/openflight/ops243.py scores 9.91. ruff check passes on changed files. No UI changes.

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 — I documented what I verified by hand above
  • Python tests pass (uv run pytest tests/ -v)
  • Pylint passes (uv run pylint src/openflight/ --fail-under=9)
  • Ruff passes (uv run ruff check src/openflight/)
  • UI builds (cd ui && npm run build) — no UI changes
  • UI lint passes (cd ui && npm run lint) — no UI changes
  • Updated docs or CHANGELOG if needed
  • No unrelated changes mixed in

The "No OPS243 radar found on USB" error told users to pass
--radar-port, which only start-kiosk.sh accepts. The hardware-test
scripts the UART build guide sends you to take --port instead, so
following the hint produced "unrecognized arguments: --radar-port".

The driver cannot know which CLI invoked it, so the hint now says to
pass the serial port via your command's port option instead of naming
a specific flag. Adds a test pinning that the message names neither
flag.

Fixes open-flight#270

@jewbetcha jewbetcha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👌

@jewbetcha
jewbetcha merged commit 3392f9f into open-flight:main Oct 7, 2026
14 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.

Wrong variable --radar-port as a wrong e.g.

2 participants