feat(sat): error when no PlutoSDR is connected#43
Merged
Conversation
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.
8822e6b to
6997b00
Compare
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.
Summary
Real (non-mock)
sat scanraises a clearSatelliteErrorwhen no PlutoSDR is plugged in, instead of silently yielding nothing forever.Motivation
When no Pluto is attached, the
sdr-dockerreceiver container still comes up: Flask serves/api/statusand/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/statussdr_connectedfield after the API is ready.scan()calls it for real scans and raisesSatelliteError("No PlutoSDR detected …")if the SDR never connects within a 15s grace period.sdr_connected(back-compat)._wait_for_sdr(connected / field-absent / never-connected / connects-after-polls) plus scan-wiring assertions;CLAUDE.mdupdated.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_connectedfield is added by HubbleNetwork/sdr-docker#24. This change is back-compat and safe to merge first, but the error only fires once a newsdr-docker:latestcontaining 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.