[feature] AetherSweep SWR analyzer#2202
Conversation
There was a problem hiding this comment.
Thanks for this contribution, @jensenpat — really well-thought-out feature. The safety preconditions are thorough, the TGXL bypass/restore state machine is carefully sequenced, and the overall design of stopping tune before restoring state is exactly right for this kind of RF-driving workflow. A few observations:
Looks good
- Safety checks: The precondition gauntlet in
startSwrSweep()covers all the right cases — connected radio, no split, TX slice visible/unlocked, no active transmit, non-zero tune power, 60m exclusion, band edge guards. Solid. - State machine: The phased approach (
WaitingForTgxlBypass→TgxlBypassSettle→Sweeping→StoppingTune→RestoringTgxl) with timeouts at each stage is clean. The "stop tune carrier before restoring frequency/TGXL state" ordering is correct. - Meter freshness: Requiring both SWR and forward power timestamps to be ≥
sampleNotBeforeMsprevents stale readings. ThefwdPowerInstantaddition toMeterModel(un-smoothed watts) is the right call for per-step validation — the smoothedfwdPower()would lag. - MeterModel changes: The new timestamp accessors and
fwdPowerInstantare well-placed. Using the existingpacketUpdatedMsfor the new timestamps is consistent with the compression meter pattern already in place. Theclear()/removeMeter()/setTgxlHandle()updates correctly reset the new fields.
Items worth a second look
-
AppletPanel.cppinclude removal — Removing<QMenu>and<QContextMenuEvent>is unrelated to SWR sweep and could break if another open PR adds a context menu to AppletPanel. I'd suggest dropping this hunk or splitting it into its own commit to keep the PR scope clean. -
advanceSwrSweep()—tunerModel()returns a non-const ref viaconstpolling —advanceSwrSweep()grabsauto& tuner = m_radioModel.tunerModel()to checkisPresent()/isOperate()/isBypass(). This works becausetunerModel()returns a non-const ref, but since the sweep code only reads tuner state here (the onesetBypass()call is elsewhere), consider usingconst auto&to signal read-only intent. Minor. -
finishSwrSweep()re-entrancy —finishSwrSweep(true, ...)is called from many places (Escape key, disconnect, slice disappear, meter timeout, TGXL state change). The early returns forStoppingTune/RestoringTgxlphases are correct. However,completeSwrSweepFinish()accessesm_panStack->allApplets()in theclearPlotpath — if the radio disconnects while inRestoringTgxlphase andonConnectionStateChanged(false)fires again, the!m_swrSweep.runningguard at the top protects against this, which is good. Just noting this was verified. -
Pan restore on abort only — After a successful (non-aborted) sweep, the panadapter stays zoomed to the full band. This seems intentional per the UX description (the user wants to compare SWR against the active frequency). Worth confirming this is the desired behavior, since on abort the original pan center/bandwidth is restored but on success it isn't.
-
drawSwrSweep()— minor edge case — Ifm_swrSweepRunningistruebutm_swrSweepPointsis empty (the sweep just started, no samples yet), the function still enters and draws the label/background. This is fine — the label shows "SWR Sweep RUN" — but theplotRectbackground rectangle gets drawn with no curve data. This is a cosmetic choice, not a bug, but you might want the "RUN" indicator to wait until the first sample arrives.
Overall this is clean, well-guarded code. The feature is well-scoped and the abort paths are thorough. Nice work.
🤖 Reviewed by AetherClaude
Summary
This adds an in-panadapter SWR sweep that can step through the current TX band, plot measured SWR directly on the spectrum surface, and clear the plot from the ANT slice controls.
The sweep is designed as a fast diagnostic view rather than a tuner command. It uses the existing radio tune carrier path, samples fresh meter data at each step, and draws the resulting curve low enough to stay below the slice flag so the user can compare the SWR curve against the active frequency line.
UX
Start SweepandClear Sweepbuttons under the ANT slice menu, below the WNB slider.SWR n.nn:1and includes periodic value callouts along the plotted curve.TGXL BYPASSwhen the sweep is measuring antenna-side TGXL bypass data.Safety
transmit tune 1/transmit tune 0carrier path and relies on the radio interlock for final enforcement.TGXL behavior
When a TGXL is present and already in
OPERATE, the sweep now measures raw antenna performance instead of the tuned result:BYPASS.The sweep does not automatically switch a TGXL from standby into operate. If the TGXL is present but not operating, the sweep falls back to the radio SWR source and labels the plot accordingly.
Validation
git diff --checkcmake --build build -j10./build/meter_model_testmeter_model_teststill reports the existing compression-meter failures unrelated to this SWR/TGXL change; the build itself succeeds.👨🏼💻 Generated with OpenAI Codex (GPT-5.5 Pro 4/23) and tested by @jensenpat