Add External APD support (Radio Setup tab + sampler protocol)#2187
Merged
Add External APD support (Radio Setup tab + sampler protocol)#2187
Conversation
SmartSDR 4.2.18 introduced External APD (Adaptive Pre-Distortion): per-TX-antenna selection of where the radio takes the feedback sample its predistortion engine trains against. The default INTERNAL samples inside the radio (legacy behaviour); RX_A/RX_B/XVTA/XVTB take a coupled feedback signal from a receive or transverter input — required to train APD against the real RF when transmitting through an external linear amplifier (FLEX-8x00 + PGXL, etc.). Plumbing already existed for `apd enable`/`configurable`/`equalizer_active`. This change adds: * `apd sampler tx_ant=ANT1 selected_sampler=RX_A valid_samplers=...` status parsing, including "selected sampler not in valid list" → fall back to INTERNAL (matches FlexLib semantics). * `apd equalizer_reset` bare-flag handling (parser absorbs leading bare flags into the object name; we strip and merge into kvs). * New TransmitModel API: `apdSampler(txAnt)`, `setApdSamplerPort()`, `resetApdEqualizer()`, plus `apdSamplerChanged` / `apdEqualizerResetReceived` signals. * New "APD" tab in Radio Setup with four per-antenna sampler combos (ANT1/ANT2/XVTA/XVTB) and an Equalizer Reset button. Tab is hidden unless the radio reports `apd configurable=1`, so it stays invisible on 6000-series radios and pre-4.2.18 firmware. Reference: Flex.Smoothlake.FlexLib v4.2.18, FlexLib/APD.cs. Tests: tests/transmit_model_apd_test.cpp — 22 assertions covering status parsing, fallback behaviour, command formatting, equalizer reset, idempotency, and resetState. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
d7c7a30 to
0aaa60f
Compare
5 tasks
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements External APD support for SmartSDR 4.2.18 firmware. External APD lets the radio sample its outgoing RF from a coupled feedback path on one of the RX/XVTR inputs (rather than the internal sampler), so the predistortion engine trains against the actual transmitted signal — required when a FLEX-8x00 drives an external linear amplifier (PGXL, etc.).
The
apd enable/configurable/equalizer_activeplumbing was already in place. This PR adds the sampler subobject, the equalizer-reset command, and the UI.Changes
Protocol (
TransmitModel)apdSampler(txAnt)getter returning{selected, available}per ANT1/ANT2/XVTA/XVTB.applyApdSamplerStatus(kvs)parsesapd sampler tx_ant=ANT1 selected_sampler=RX_A valid_samplers=RX_A,XVTA. Ifselected_samplerisn't in the valid list, falls back toINTERNAL(matches FlexLib behaviour).setApdSamplerPort(txAnt, port)emitsapd sampler tx_ant=ANT sample_port=PORT.resetApdEqualizer()emitsapd reset.applyApdStatus()now also handles the bareequalizer_resetflag, emitting a newapdEqualizerResetReceivedsignal.RadioModeldispatcher routes"apd sampler"toapplyApdSamplerStatus; the bare-flag form gets merged into kvs and routed toapplyApdStatus.UI (
RadioSetupDialog)transmitModel.apdConfigurable()and updates live viaapdStateChanged, so the tab stays hidden on 6000-series radios and pre-4.2.18 firmware.apdSamplerChanged(signal-blocked refresh, so user-driven changes don't echo back to the radio).Tests —
tests/transmit_model_apd_test.cpp, 22 assertions:available(withINTERNALfirst) andselected.selected_samplerfalls back toINTERNAL.resetApdEqualizer()emitsapd reset.equalizer_resetclearsequalizer_activeand fires the reset signal.configurable=1/=0togglesapdConfigurable().resetState()clears the sampler hash on disconnect.Reference:
Flex.Smoothlake.FlexLibv4.2.18,FlexLib/APD.cs.Test plan
./build/transmit_model_apd_test— all 22 pass locally.valid_samplersplusINTERNAL.RX_Afor ANT1 sendsapd sampler tx_ant=ANT1 sample_port=RX_A; the echoed status updates the combo without firing a second command.apd reset; subsequent status arrival clears the active indicator.🤖 Generated with Claude Code