Skip to content

feat(sat): error when no PlutoSDR is connected#43

Merged
buckleypaul merged 1 commit into
mainfrom
feat/sat-detect-no-pluto
Jun 17, 2026
Merged

feat(sat): error when no PlutoSDR is connected#43
buckleypaul merged 1 commit into
mainfrom
feat/sat-detect-no-pluto

Conversation

@buckleypaul

Copy link
Copy Markdown
Collaborator

Summary

Real (non-mock) sat scan raises a clear SatelliteError when no PlutoSDR is plugged in, instead of silently yielding nothing forever.

Motivation

When no Pluto is attached, the sdr-docker receiver container still comes up: Flask serves /api/status and /api/packets (empty), while the RX thread retries the SDR open forever in the background. The SDK only ever observed /api/packets, so it had no way to distinguish "no hardware plugged in" from "hardware present but quiet sky" — scan() just ran until --timeout (or forever).

Changes

  • sat.py: new _wait_for_sdr() polls the receiver's /api/status sdr_connected field after the API is ready. scan() calls it for real scans and raises SatelliteError("No PlutoSDR detected …") if the SDR never connects within a 15s grace period.
  • Skipped for mock scans, and for older receiver images that don't report sdr_connected (back-compat).
  • Tests for _wait_for_sdr (connected / field-absent / never-connected / connects-after-polls) plus scan-wiring assertions; CLAUDE.md updated.

Design note

The SDR open isn't instant even when hardware is present (the receiver starts its flowgraph after Flask is already serving), so a one-shot check would false-positive. The 15s grace-period poll is sized against the container's 3s SDR_RETRY_INTERVAL_S: present hardware connects well within it, absent hardware never does.

Dependency

The sdr_connected field is added by HubbleNetwork/sdr-docker#24. This change is back-compat and safe to merge first, but the error only fires once a new sdr-docker:latest containing that PR is published; until then the check no-ops against older images.

Testing

  • pytest -m "not integration and not ble" — 239 passed.
  • ruff check src — clean.

Real (non-mock) 'sat scan' previously ran forever yielding nothing when no
Pluto was plugged in: the receiver container serves its API and silently
retries the SDR open in the background, so the SDK had no signal.

After the receiver API is ready, poll /api/status for the new sdr_connected
field and raise SatelliteError('No PlutoSDR detected ...') if the SDR never
connects within a 15s grace period (the open isn't instant even when the
device is present). The check is skipped for mock scans and for older
receiver images that don't report sdr_connected.
@buckleypaul buckleypaul force-pushed the feat/sat-detect-no-pluto branch from 8822e6b to 6997b00 Compare June 17, 2026 16:51
@buckleypaul buckleypaul merged commit ccd75e2 into main Jun 17, 2026
2 checks passed
@buckleypaul buckleypaul deleted the feat/sat-detect-no-pluto branch June 17, 2026 16:57
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