Fix TGXL presence when detected via direct TCP only (Fixes #2174)#2250
Fix TGXL presence when detected via direct TCP only (Fixes #2174)#2250ten9876 merged 2 commits intoten9876:mainfrom
Conversation
When the radio does not report the TGXL via the amplifier API (observed
on Flex-8600 firmware 4.2.18), the TUN applet never appeared even though
the direct TCP connection on port 9010 was fully operational.
Root cause: presenceChanged(true) was only emitted from setHandle(), which
requires the radio to send "amplifier <handle> model=TunerGeniusXL".
The existing directConnectionChanged signal was emitted on direct TCP
connect but never wired to presenceChanged.
Fix (3 parts):
1. TunerModel: add m_directPresence flag, set it when direct TCP connects,
emit presenceChanged(true/false) from the connected/disconnected lambdas.
isPresent() now returns true if either the radio handle or direct
connection is active. setHandle() uses isPresent() so clearing the
handle does not hide the applet while a direct connection is live.
2. RadioModel: log every amplifier status handle + model at lcProtocol
debug level. Previously unrecognised models were silently dropped,
making firmware-variant bugs impossible to diagnose from logs.
3. RadioModel: handle amplifier removal via kvs.contains("removed"),
clearing TunerModel handle or m_ampHandle/m_hasAmplifier as appropriate.
Previously amplifier state was only cleared on radio disconnect.
Tested: Flex-8600 firmware 4.2.18.41174, TGXL firmware 1.1.20.
TUN applet now appears and relay/TUNE controls work. Operate/standby
via radio API requires a valid handle (not available when radio omits
the amplifier status) — tracked separately.
The radio sends object-removal status in two forms — verified against
FlexLib Radio.cs:14060/14073, which uses substring `s.Contains("removed")`
to handle both:
1) bare: "amplifier <handle> removed" (no '=' anywhere)
2) kvs: "amplifier <handle> ... removed=1" (key in kvs map)
Our CommandParser splits status on the last space before the first '=',
so form 1 lands entirely in `object` (kvs is empty), while form 2
splits normally and `removed` ends up as a kvs key.
The original PR only handled form 2. Form 1 is the form actually used
in observed protocol traffic (e.g. `S<h>|stream 0x04000008 removed`),
so add an `ampRemovedRe` regex check before the regular `ampRe` match.
This mirrors the pattern already used by `streamStatusRemoved` at
RadioModel.cpp:155-161.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Claude here — thanks Chris, this is a great first contribution! 🎉 Solid root-cause analysis on the TGXL detection bug, and the Follow-up we pushed (574f796)While reviewing, I checked the new amplifier-removal handler against FlexLib's reference implementation (
Our Empirical confirmation that form 1 exists — from a recent local log: We pushed a small follow-up that adds a second regex The TunerModel changes and the diagnostic logging are unchanged — those were exactly right. Merging now. Thanks again for the careful diagnosis and the clean fix! 73, Jeremy KK7GWY & Claude (AI dev partner) |
Summary
Fixes #2174 — TUN applet not visible when the radio (Flex-8600 firmware 4.2.18) does not report the TGXL via the amplifier API.
Root cause
presenceChanged(true)was only emitted fromsetHandle(), which requires the radio to pushamplifier <handle> model=TunerGeniusXL. The existingdirectConnectionChangedsignal fired correctly on direct TCP connect (port 9010) but was never wired topresenceChanged— leaving the TUN applet permanently hidden even though the device was fully operational.Confirmed by protocol log: on this firmware the radio never sends an amplifier status for the TGXL. The PGXL is reported normally (
model=PowerGeniusXL).Changes
TunerModel.h/.cpp— addm_directPresencefallback flag:isPresent()returns!m_handle.isEmpty() || m_directPresenceconnectedlambda: setsm_directPresence = true, emitspresenceChanged(true)if handle is absentdisconnectedlambda: clearsm_directPresence, emitspresenceChanged(false)only if handle is also emptysetHandle()usesisPresent()for before/after comparison so clearing the handle does not hide the applet while a direct connection is liveRadioModel.cpp— two diagnostic/correctness improvements:lcProtocoldebug level (previously silent on no-match, making firmware-variant bugs undiagnosable)kvs.contains("removed"), clearingTunerModelhandle orm_ampHandle/m_hasAmplifieras appropriate (previously only cleared on radio disconnect)Testing
Flex-8600 firmware 4.2.18.41174, TGXL firmware 1.1.20, AetherSDR v0.9.4.
TUN applet now appears, relay positions display correctly, TUNE initiates autotune cycle. Operate/standby via radio API requires a valid amplifier handle (unavailable when the radio omits the amplifier status message) — this is a pre-existing limitation tracked separately.
Notes for reviewer
RadioModel.cppis touched only for logging and the removal handler — no behavioural change to the existing TGXL/PGXL routing logicm_directPresenceflag is intentionally separate fromm_handleso the two presence sources don't interfere with each other