Skip to content

Add loop antenna controls#2863

Open
rfoust wants to merge 1 commit into
aethersdr:mainfrom
rfoust:codex/loop-ant-buttons
Open

Add loop antenna controls#2863
rfoust wants to merge 1 commit into
aethersdr:mainfrom
rfoust:codex/loop-ant-buttons

Conversation

@rfoust
Copy link
Copy Markdown
Collaborator

@rfoust rfoust commented May 18, 2026

Summary

  • add LoopA/LoopB support to panadapter status and ANT overlay controls
  • show loop controls only for radios with FlexLib loop capabilities
  • keep loop selections mutually exclusive and disable selection unless RX ANT is ANT1 or ANT2

Verification

  • cmake --build build --parallel 8
  • ctest --test-dir build -R model_capabilities_test --output-on-failure
  • git diff --check
  • merge-tree checks against PR 2860, PR 2862, and both combined

Copilot AI review requested due to automatic review settings May 18, 2026 21:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds LoopA/LoopB awareness to panadapter state and the spectrum ANT overlay, using model capabilities to expose loop controls only on supported radios.

Changes:

  • Extends ModelCapabilities and tests with LoopA/LoopB flags.
  • Tracks panadapter RX antenna and loop state from status updates.
  • Adds loop controls to the spectrum overlay and wires commands through MainWindow.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/model_capabilities_test.cpp Adds LoopA/LoopB expectations to capability tests.
src/models/PanadapterModel.h Adds RX antenna and loop state accessors/signals/storage.
src/models/PanadapterModel.cpp Parses rxant, loopa, and loopb from panadapter status.
src/models/ModelCapabilities.h Adds loop capability fields.
src/models/ModelCapabilities.cpp Populates loop capability table per model.
src/gui/SpectrumOverlayMenu.h Adds loop UI API, signals, and panadapter wiring state.
src/gui/SpectrumOverlayMenu.cpp Adds loop buttons, visibility gating, and panadapter RX antenna synchronization.
src/gui/MainWindow.cpp Wires overlay pan/model/capabilities and sends loop commands.
Comments suppressed due to low confidence (1)

src/gui/SpectrumOverlayMenu.cpp:384

  • This mirrors the LoopA switching path: unchecking LoopA under QSignalBlocker suppresses loopAToggled(false), so switching from LoopA to LoopB only sends loopb=1 and does not explicitly clear LoopA on the radio. Emit/send the complete state transition so the radio and UI stay mutually exclusive.
        if (on && m_loopABtn && m_loopABtn->isChecked()) {
            QSignalBlocker blocker(m_loopABtn);
            m_loopABtn->setChecked(false);
        }
        emit loopBToggled(on);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gui/MainWindow.cpp Outdated
if (m_panStack->panadapter(pan->panId())) {
if (auto* sw = m_panStack->spectrum(pan->panId())) {
sw->overlayMenu()->setPanId(pan->panId());
sw->overlayMenu()->setRadioModel(&m_radioModel);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in f281fc7 by mirroring the normal wirePanadapter initialization in the duplicate-pan path: the overlay now gets setPanId, setRadioModel, and setRadioCapabilities before that path returns. Verified with cmake --build build --parallel 8 and ctest --test-dir build -R model_capabilities_test --output-on-failure.

Comment on lines +366 to +370
if (on && m_loopBBtn && m_loopBBtn->isChecked()) {
QSignalBlocker blocker(m_loopBBtn);
m_loopBBtn->setChecked(false);
}
emit loopAToggled(on);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in f281fc7. When switching LoopA/LoopB, the UI still blocks the opposite button signal while updating the check state, but now manually emits the opposite loop false signal so MainWindow sends loopb=0 or loopa=0 before the selected loop command. Verified with cmake --build build --parallel 8 and ctest --test-dir build -R model_capabilities_test --output-on-failure.

Copy link
Copy Markdown
Contributor

@aethersdr-agent aethersdr-agent Bot left a comment

Choose a reason for hiding this comment

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

Looks good — nicely scoped feature with capability gating, RAII connection management via QPointer<PanadapterModel>, and the test table extended to cover the two new flags. Both Copilot findings are addressed in f281fc7:

  • The duplicate-panadapter path in MainWindow.cpp now mirrors wirePanadapter() by calling setPanId/setRadioModel/setRadioCapabilities before the early return, so loop button visibility is seeded correctly.
  • The loop-toggle mutex in SpectrumOverlayMenu.cpp now manually emits loopBToggled(false) / loopAToggled(false) when unchecking the opposite button under QSignalBlocker, so the radio receives the complete desired state.

A couple of minor notes (non-blocking):

  1. Implicit mutex in PanadapterModel::applyPanStatus (PanadapterModel.cpp +97): when the radio reports loopa=1, the parser proactively clears m_loopB (and vice versa) even if the status frame doesn't contain loopb. In practice FlexLib emits both keys, so this is defensive and harmless — but if a future firmware ever reported loopa=1 standalone with loopb unchanged-but-true, the client would silently drop the LoopB state without a radio echo. Worth a brief comment noting this is a UI-mirror assumption, not a protocol guarantee.

  2. Scope overlap with #2862: this PR's rxant parsing in PanadapterModel and the "send via pan set when panadapter-authoritative" change in the RX ANT combo overlap with PR #2862's stated changes. You called out the merge-tree check in the description, so this is just a flag for the maintainer's attention on landing order.

Thanks for the FlexLib-mirroring discipline (capability table + matching test row) and for citing the FLEX-6500 LoopA / FLEX-6700 LoopA+LoopB hardware specifics in the model table comments. Appreciate the contribution! 🎯

@rfoust rfoust force-pushed the codex/loop-ant-buttons branch from f281fc7 to a4e343a Compare May 21, 2026 03:37
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