Skip to content

[antenna] Add SWR sweep power and PGXL amplifier safety hardening#2220

Merged
ten9876 merged 2 commits into
aethersdr:mainfrom
jensenpat:aether/swr-sweep-review-cleanup
May 1, 2026
Merged

[antenna] Add SWR sweep power and PGXL amplifier safety hardening#2220
ten9876 merged 2 commits into
aethersdr:mainfrom
jensenpat:aether/swr-sweep-review-cleanup

Conversation

@jensenpat

@jensenpat jensenpat commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up polish for the SWR sweep feature after #2202.

Changes

  • Adds a persisted sweep-power slider under the ANT panel sweep controls.
  • Limits SWR sweep power to 1-10 W and defaults to 1 W.
  • Saves the sweep power as SwrSweepPowerWatts and loads it into each panadapter overlay on startup.
  • Uses the sweep-specific power when starting the radio tune carrier, then restores the user's previous Tune Power after RF is stopped.
  • Refuses to start a sweep while a detected Power Genius XL amplifier is in operate mode.
  • Makes TransmitModel::setTunePower() update optimistically so moving Tune Power from 0 W back up no longer leaves the sweep blocked on a stale model value.
  • Keeps the earlier review cleanup: restored AppletPanel includes, clarified read-only tuner polling, and suppressed the empty SWR plot before the first sample.

Safety Notes

The sweep now avoids depending on the TX applet Tune Power state. The selected sweep power is applied immediately before the sweep and restored only after the tune carrier has stopped. PGXL operate mode is treated as a hard precondition failure so users must put the amplifier in standby before the sweep can drive RF.

Validation

  • git diff --check
  • cmake --build build -j10
  • ./build/transmit_model_test
  • ./build/transmit_model_apd_test

👨🏼‍💻 Generated with OpenAI Codex (GPT-5.5 Pro 4/23) and tested by @jensenpat

@jensenpat jensenpat changed the title Clean up SWR sweep review feedback Add SWR sweep power and amplifier safety polish Apr 30, 2026
@jensenpat jensenpat changed the title Add SWR sweep power and amplifier safety polish [antenna] Add SWR sweep power and PGXL amplifier safety hardening Apr 30, 2026
@jensenpat jensenpat marked this pull request as ready for review April 30, 2026 23:48
@jensenpat jensenpat requested a review from ten9876 as a code owner April 30, 2026 23:48

@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.

Nice work on decoupling sweep power from the TX applet Tune Power, @jensenpat. The PGXL safety gate is a good addition — preventing an SWR sweep from driving RF into an amplifier in operate mode is the right call. A few observations:

Looks good

  • Sweep power save/restore lifecycle — saving sweep power to AppSettings, applying it before RF, and restoring originalTunePower after finishSwrSweepAfterTuneStopped is clean and correct. The restore is positioned before the TGXL restore branch so it always runs.
  • QSignalBlocker in setSwrSweepPowerWatts — prevents feedback loops when syncing the slider across panadapters. Good.
  • const auto& tuner in advanceSwrSweep — correct, the sweep timer path is read-only there.
  • Suppressing the empty SWR plot (SpectrumWidget.cpp) — removing the && !m_swrSweepRunning check is the right fix; no reason to enter the draw path with zero points.
  • AppletPanel includesQContextMenuEvent / QMenu additions look like they were already needed by existing code but missing; fine to include here.

Items worth a look

  1. setTunePower optimistic update — The new code updates m_tunePower locally and emits stateChanged() before the command reaches the radio. This is fine for the sweep's immediate needs, but note that setRfPower() does not do this — the two setters now behave asymmetrically. If the radio responds with a status update carrying the same value, the status handler at line 46–48 will no-op (no double-emit), so there's no functional bug. But if the command fails silently (radio rejects the power level), the local model will be out of sync until the next status push. Worth a comment noting the intentional asymmetry, or consider reverting the model on command failure if that's feasible. Not blocking.

  2. Tune power restore on abort — If the sweep is aborted before tx.setTunePower(sweepPowerWatts) is reached (e.g., TGXL bypass wait times out and the sweep never starts RF), finishSwrSweepAfterTuneStopped will still call setTunePower(originalTunePower). Since originalTunePower == tx.tunePower() at that point (the sweep power was never applied), the originalTunePower != sweepTunePower guard correctly prevents a no-op restore — nice. Just wanted to confirm I traced that right.

  3. kSwrSweepPowerSettingKey is constexpr const char* — Minor: in C++20 you could use constexpr auto kSwrSweepPowerSettingKey = "SwrSweepPowerWatts"; or constexpr std::string_view. The current form is fine and consistent with the existing constants above it, so no action needed unless you want to tighten it.

  4. Signal signature changeswrSweepStartRequested(int, int) is a breaking signal change. Since this is internal (no QML/plugin consumers), it should be fine, but if any out-of-tree code connects to this signal by name they'll get a runtime connect failure. Just flagging.

Overall this is solid and well-scoped. Thanks for the contribution!

@ten9876 ten9876 merged commit 1162c56 into aethersdr:main May 1, 2026
5 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.

2 participants