Skip to content

Fix TGXL Fwd Power/SWR gauges: parse meters from direct connection (#625)#627

Merged
ten9876 merged 3 commits into
aethersdr:mainfrom
boydsoftprez:fix/tgxl-meter-from-direct-connection
Apr 3, 2026
Merged

Fix TGXL Fwd Power/SWR gauges: parse meters from direct connection (#625)#627
ten9876 merged 3 commits into
aethersdr:mainfrom
boydsoftprez:fix/tgxl-meter-from-direct-connection

Conversation

@boydsoftprez

@boydsoftprez boydsoftprez commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #625.

  • Parse TGXL R responsesTgxlConnection was discarding all R response lines, which contain fwd= and swr= from the 1/sec status poll. Now parses the response body as KV pairs and emits statusUpdated().
  • Add fwd/swr to TunerModel — new fields, getters, and metersChanged() signal. Converts TGXL's native units: fwd (dBm→watts via 10^(dBm/10)/1000), swr (negative return loss dB→ratio via rho=10^(rl/20), SWR=(1+rho)/(1-rho)).
  • Wire TunerModel::metersChanged → TunerApplet::updateMeters — gauges now receive data from the TGXL direct TCP connection (port 9010).
  • Remove txMetersChanged fallback — the exciter's TX meters were overwriting TGXL readings with wrong values.

Root Cause

The TGXL reports forward power and SWR via its direct TCP connection (port 9010), not through the radio's VITA-49 meter stream (PCC 0x8002). SmartSDR v3.9.18+ gets TGXL meters this same way (introduced in TGXL firmware v1.2.17).

AetherSDR's TgxlConnection already polled status every 1 second and received the data, but:

  1. All R responses were discarded at line 91 (return;)
  2. TunerModel had no fields to store fwd/swr
  3. The txMetersChanged fallback sent exciter power (~100W) to the tuner gauge instead

TGXL Protocol Notes (port 9010, firmware v1.2.17)

Status poll: C<seq>|statusR<seq>|0|fwd=40.53 swr=-25.78 tuning=0 relayC1=0 ...

  • fwd: forward power in dBm (40.53 dBm ≈ 11.3 W)
  • swr: return loss in negative dB (-25.78 dB → SWR 1.10, -60.00 dB → SWR 1.00 idle)

Files Changed

  • src/core/TgxlConnection.cpp — parse R response bodies as KV pairs
  • src/models/TunerModel.h — add m_fwdPower, m_swr, getters, metersChanged() signal
  • src/models/TunerModel.cpp — parse fwd/swr with unit conversion in both status lambdas, add <cmath>
  • src/gui/TunerApplet.cpp — wire TunerModel::metersChanged to updateMeters
  • src/gui/MainWindow.cpp — remove txMetersChanged→TunerApplet connection

Test Plan

  • Fwd Power gauge shows correct power during TUNE (verified against 4O3A app)
  • SWR gauge shows correct ratio (~1.0 idle, ~1.1 during TX)
  • Gauges respond in real-time from TGXL 1/sec poll
  • Verify CI build passes (Linux — TGXL code is cross-platform)
  • Test without TGXL connected (gauges should remain at 0, no crash)

Known Remaining Issue

The TUNE button SWR capture after autotune still has a race condition between the radio's TCP tuning=0 (fast) and the TGXL's 1/sec poll (slow). This is a pre-existing issue documented in CLAUDE.md and will be addressed in a follow-up.

🤖 Generated with Claude Code

…ethersdr#625)

The TunerApplet power and SWR gauges always showed 0 because meter data
comes from the TGXL's direct TCP connection (port 9010), not the radio's
VITA-49 meter stream. Three issues fixed:

1. TgxlConnection discarded all R responses (status poll replies) which
   contain fwd= and swr= fields. Now parses R response bodies as KV
   pairs and emits statusUpdated().

2. TunerModel had no fwd/swr fields. Now parses fwd (dBm→watts) and
   swr (return loss dB→ratio) from both stateUpdated and statusUpdated
   signals, emitting metersChanged() for the gauge.

3. Removed txMetersChanged→TunerApplet connection that was overwriting
   TGXL readings with exciter power values.

TGXL protocol: fwd is reported in dBm (watts = 10^(dBm/10)/1000),
swr is reported as negative return loss in dB
(rho = 10^(rl/20), SWR = (1+rho)/(1-rho)).

Fixes aethersdr#625

Co-Authored-By: JJ Boyd ~ boydsoftprez ~ KG4VCF <kg4vcf@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ten9876

ten9876 commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Claude here. This is the right fix — TGXL meters come from the direct TCP connection, not VITA-49. Nice work parsing the R response body. This also explains #600 which we were investigating from the wrong angle.

73, Jeremy KK7GWY & Claude (AI dev partner)

@boydsoftprez

Copy link
Copy Markdown
Collaborator Author

After thinking through this more, this approach definitely solves the problem on LAN and over VPN. However, it probably doesn’t solve it with a SmartLink-connected radio — will need to investigate further. As a data point, with SmartSDR on iOS, the Tuner Genius and Power Genius integrations don’t appear to work unless you’re on the same LAN or VPN — though it’s not clear whether that’s a limitation of that particular client or whether FlexRadio does have a mechanism to relay those commands over SmartLink. I plan to do some packet captures between native SmartSDR, the tuner, and the amplifier to see exactly what commands are exchanged.
That said, I still think this PR should be merged while we work through the SmartLink situation.
— J.J. Boyd ~KG4VCF

@ten9876 ten9876 merged commit 5536603 into aethersdr:main Apr 3, 2026
3 checks passed
@boydsoftprez boydsoftprez deleted the fix/tgxl-meter-from-direct-connection branch April 4, 2026 03:45
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.

TGXL Fwd Power/SWR gauges always read incorrect — meter data from port 9010 not parsed

2 participants