Skip to content

Respect active band plan in Antenna SWR sweep (#2800). Principle IV.#2817

Merged
ten9876 merged 1 commit into
mainfrom
aetherclaude/issue-2800
May 17, 2026
Merged

Respect active band plan in Antenna SWR sweep (#2800). Principle IV.#2817
ten9876 merged 1 commit into
mainfrom
aetherclaude/issue-2800

Conversation

@aethersdr-agent

Copy link
Copy Markdown
Contributor

Summary

Fixes #2800

What was changed

Respect active band plan in Antenna SWR sweep (#2800). Principle IV.

Files modified

  • src/gui/MainWindow.cpp
 src/gui/MainWindow.cpp | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

Generated by AetherClaude (automated agent for AetherSDR)

The Antenna SWR sweep took its edges directly from BandDefs.h, which
holds ARRL/US allocations only.  For users on IARU R1 (EU) and other
regions where the regional allocation is narrower than the US one,
this caused the sweep to step past the in-region band edge and trip
the radio's interlock — e.g. on 40 m the sweep ran from 7.005 up to
~7.285 MHz, well past the 7.200 MHz IARU R1 limit.

Narrow the sweep range to the active BandPlanManager segments by
intersecting the static BandDef envelope with the plan's matching
segments (midpoint inside the static band), mirroring the pattern
already used by AtuPreTuneDialog::recomputeBands.  Falls back to the
static edges when no plan is loaded or no segments match, keeping
US/default behaviour unchanged.

The existing "band too narrow for guard" and "too many points" guards
downstream still apply.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aethersdr-agent aethersdr-agent Bot requested a review from ten9876 as a code owner May 17, 2026 18:29
@aethersdr-agent aethersdr-agent Bot enabled auto-merge (squash) May 17, 2026 18:29

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Targeted fix for #2800 — looks good. Thanks for the contribution.

Verified the approach is sound:

  • Reuses the same midpoint-in-band filter pattern as computeCentersForBand in AtuPreTuneDialog.cpp:86–101, which is the right precedent.
  • Uses std::max(effectiveLow, planLow) / std::min(effectiveHigh, planHigh) so the plan can only narrow the sweep, never expand it past the hardcoded BandDef — important safety property.
  • Null-checks m_bandPlanMgr and falls back cleanly when no segments match the band (infinity sentinels + std::isfinite).
  • std::numeric_limits and std::isfinite are already used elsewhere in MainWindow.cpp, so no header additions needed.
  • Edge guard (kSwrSweepEdgeGuardMhz) still applied after narrowing, preserving the "too narrow" warning.

One observation, not blocking:

For band plans with internal gaps (e.g. a region that splits a band into separate CW and SSB sub-allocations with a digital/illegal gap between them), this picks the outer [min, max] of all matching segments and the linear sweep walks across the gap. That's no worse than the pre-patch behaviour, and 60m (the band most likely to hit this) is already excluded upstream. If you want a follow-up, you could borrow the sort-and-merge logic from computeCentersForBand to emit a separate sweep run per contiguous region — but that's scope creep for this bug.

Minor comment nit (optional): the inline comment says "Mirrors the pattern used by AtuPreTuneDialog::recomputeBands" — the actual helper is the free function computeCentersForBand in the anonymous namespace (no member called recomputeBands exists). Worth correcting so future maintainers can find it.

Otherwise straightforward, well-scoped, single-file change. Nice cross-reference back to the AtuPreTune precedent.

@ten9876 ten9876 merged commit f225927 into main May 17, 2026
5 checks passed
@ten9876 ten9876 deleted the aetherclaude/issue-2800 branch May 17, 2026 21:28
@ten9876

ten9876 commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Claude here — merged. The EU 40 m interlock-trip is fixed; sweep range is now clamped to the active band plan's segments rather than the US-allocation kBands defaults.

Filed #NNNN as a follow-up to share the computeContiguousRegions walker that already exists in AtuPreTuneDialog so discrete-channel bands (US 60 m, etc.) get per-channel gap handling on the SWR sweep too. Not a blocker for this PR — the user-reported continuous-band case (40 m IARU R1) is fully resolved here.

73, Jeremy KK7GWY & Claude (AI dev partner)

@ten9876

ten9876 commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Follow-up filed: #2822 — extract computeContiguousRegions from AtuPreTuneDialog into a shared BandPlanManager helper so the SWR sweep can walk discrete-channel bands per-region.

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.

Sweep doesn't respected band limits

1 participant