Skip to content

AetherSweep: Phase 2#2320

Merged
ten9876 merged 2 commits into
aethersdr:mainfrom
jensenpat:swr-sweep-polish
May 3, 2026
Merged

AetherSweep: Phase 2#2320
ten9876 merged 2 commits into
aethersdr:mainfrom
jensenpat:swr-sweep-polish

Conversation

@jensenpat

Copy link
Copy Markdown
Collaborator

Summary

This PR polishes the SWR sweep analyzer overlay so completed sweeps are easier to read and safer to carry across operating changes.

What Changed

  • Render the SWR trace on a logarithmic SWR scale for cleaner low-ratio detail.
  • Change the corner readout to report the best measured SWR and resonant frequency instead of the latest/worst-looking sample.
  • Trim resonant frequency display to kHz precision.
  • Add visual start/end notches on the sweep trace.
  • Add a resonance caret and marker at the best SWR point.
  • Add subtle threshold shading for SWR quality bands: 1.0-1.5, 1.5-2.0, and above 2.0.
  • Calculate usable bandwidth around the resonance point for SWR <= 1.5 and SWR <= 2.0, including interpolated threshold crossings between measured samples.
  • Draw compact bandwidth brackets on the completed plot and include a concise BW readout in the corner label.
  • Clear completed sweep plots when the swept TX slice changes bands.
  • If a band change happens while a sweep is running, stop and clear the sweep without restoring the old frequency/pan range afterward, so cleanup does not fight the user-requested band switch.

Notes

The radio command/timer path for normal SWR sweeps is intentionally left intact: the existing TGXL bypass handling, tune power restore, fresh meter checks, sample ordering, and intra-band frequency stepping are preserved. The new band-change path only changes finish behavior when the user leaves the swept band.

Validation

Built locally with the required 22 parallel jobs:

env -u CPLUS_INCLUDE_PATH cmake --build build --parallel 22

Also launched the resulting app bundle locally for manual test setup:

open -n /Users/patj/Documents/AetherSDR-swr-sweep-polish/build/AetherSDR.app

@jensenpat jensenpat changed the title Polish SWR sweep analyzer AetherSweep: Phase 2 May 3, 2026
@jensenpat jensenpat marked this pull request as ready for review May 3, 2026 20:13
@jensenpat jensenpat requested a review from ten9876 as a code owner May 3, 2026 20:13

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @jensenpat — nice polish pass. The log SWR scale, resonance caret, threshold-band shading, and interpolated bandwidth math are all easy to follow and read cleanly on the diff. Confirmed originalBandName is set/cleared in all the right spots (startSwrSweep, clearSwrSweepPlot, clearSwrSweepForBandChange, completeSwrSweepFinish), and preserveBandSwitchOnFinish correctly skips both the freq and pan-range restoration in finishSwrSweepAfterTuneStopped so cleanup doesn't fight the new band switch.

One concern worth a look:

clearSwrSweepForBandChange(-1, bandName) from wirePanadapter is panadapter-agnostic. The call site at MainWindow.cpp:9205 fires for any applet's band change, but the function is invoked with sliceId=-1, which bypasses the sliceId != m_swrSweep.sliceId guard. In a multi-panadapter setup, switching the band on a panadapter that isn't the swept one will still match newBandName != m_swrSweep.originalBandName and either clear a completed plot or abort a running sweep on the unrelated panadapter. That seems contrary to the PR's stated intent ("Clear completed sweep plots when the swept TX slice changes bands").

Suggested fix — either gate the call on the applet's pan id, e.g.:

if (m_swrSweep.panId.isEmpty() || applet->panId() == m_swrSweep.panId)
    clearSwrSweepForBandChange(-1, bandName);

or pass the panId into clearSwrSweepForBandChange and add a panId == m_swrSweep.panId check alongside the existing slice filter. The TX-slice frequencyChanged path at MainWindow.cpp:7712 is fine since it correctly filters on sliceId.

Minor nit (take or leave): bestSwr is the clamp-to-1.0 value, so the corner readout displays SWR 1.00:1 for any sample below 1.0. That's physically reasonable, but if the underlying meter ever hands you something pathological, the displayed best won't match the raw sample. Probably fine as-is.

Otherwise looks good — no AppSettings/RAII issues, scope is tight to the three files, and the existing TGXL/tune/timer paths are preserved as documented.

@ten9876 ten9876 merged commit 61e71a7 into aethersdr:main May 3, 2026
4 checks passed
M7HNF-Ian added a commit to M7HNF-Ian/AetherSDR that referenced this pull request Jun 29, 2026
Add a "Limit range" checkbox and From/To frequency fields to the SWR sweep
controls so operators can confine a sweep to a licence sub-band or a slice
of interest instead of always sweeping the whole band.

Off by default — the full-band sweep behaviour is unchanged. Ticking the box
enables the fields and seeds them with the current band's edges (via
BandSettings). The seed is refreshed whenever the fields are empty or no
longer lie within the active band, so changing band and re-opening the range
always starts from a sensible in-band point while a range narrowed within the
current band is preserved.

The chosen bounds are passed through swrSweepStartRequested() to
startSwrSweep(), where they are intersected with the existing in-region safe
range. They can therefore only ever narrow the sweep — never widen it past
what the regional band plan already permits (aethersdr#2800) — preserving the
out-of-region transmit guard. A positive-but-inverted range (From > To) is
rejected up front with a warning rather than silently falling through to a
full-band sweep, and a range that does not overlap the band by at least one
step is likewise rejected.

Part of aethersdr#2241 (the resonance/bandwidth display landed earlier in aethersdr#2320).
ten9876 pushed a commit that referenced this pull request Jun 30, 2026
Adds the user-bounded sweep range from #2241 (rnash2's request to
"manually set the start and end sweep frequency to respect his operating
privileges").

A **Limit range** checkbox with **From**/**To** fields in the SWR sweep
controls lets an operator confine a sweep to a licence sub-band or a
slice of interest instead of always sweeping the whole band.

- **Off by default** — full-band sweep behaviour is unchanged.
- Ticking the box enables the fields and **seeds them with the current
band's edges** (via `BandSettings`) as a starting point to narrow from.
- The bounds pass through `swrSweepStartRequested()` to
`startSwrSweep()`, where they are **intersected with the existing
in-region safe range** — so they can only ever *narrow* the sweep, never
widen it past what the regional band plan already permits (#2800). The
out-of-region transmit guard is preserved.
- A range that doesn't overlap the band by at least one step is rejected
with a warning.

**Tested** live on a FLEX-6600: ticked Limit range (auto-seeded
14.000–14.350 on 20 m), narrowed To to 14.150, and confirmed the sweep
trace covered only 14.000–14.150 instead of the full band.

Note: the resonance/bandwidth-marker portion of #2241 already landed in
#2320, so this completes the remaining actionable scope.
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.

2 participants