Skip to content

v1.1.2 — Hamlib parity audit + Kenwood/Yaesu safety fixes

Latest

Choose a tag to compare

@jjones9527 jjones9527 released this 15 Jul 10:32

Safety-focused patch release. Started as a fix for the Yaesu HF serial-framing bug reported in issue #12, then expanded into a full seven-vendor Hamlib parity audit after the initial fix uncovered several more latent safety-critical bugs.

Full detail in the CHANGELOG entry.

Fixed — safety-critical (would key TX or transmit on wrong VFO)

  • Kenwood setPTT(false) no longer keys the transmitter. Pre-fix code sent TX0; for PTT-off, but on Kenwood TX0; means "PTT on via mic port" — the opposite of releasing PTT. Every setPTT(false) call was keying the radio. Now sends bare RX; per Hamlib kenwood_set_ptt.
  • Kenwood getPTT() no longer keys on every poll. Pre-fix code sent the TX; set command to query PTT state, keying the radio every time. Now reads IF; response byte 28 per Hamlib kenwood_get_ptt.
  • Yaesu setSplit() no longer risks TX on the wrong VFO. Pre-fix code sent FT0;/FT1; — but FT on modern Yaesu radios is TX-VFO selection, not split. Sending FT1; for "enable split" would silently reassign which VFO transmits. Now uses ST0;/ST1; per Hamlib newcat_set_split. On radios without ST support (FT-950/891/991/2000/DX3000/5000/1200/9000) the method throws explicitly rather than silently doing the wrong thing.
  • Yaesu selectVFO() uses the correct FT encoding per model. On FT-950/2000/DX3000/5000/1200/991(A)/DX10/DX101(D/MP), FT2; selects VFO A and FT3; selects VFO B (FT0;/FT1; toggle the TX function on those radios). On FT-710/450, classic FT0;/FT1; applies. On FT-891, the FT command doesn't exist at all — the method throws.
  • Yaesu getPTT() recognizes TX2;/TX3; as transmitting. Pre-fix code only checked for TX1; and misreported data-jack PTT (TX2) and CAT-port PTT (TX3) as RX. A UI that polled PTT would show the radio idle while it was actually keyed.

Fixed — per-radio serial framing

  • Per-radio stop bits and hardware handshake now propagate through RigController into SerialConfiguration. Pre-fix code left every serial-connected radio at SerialConfiguration.init defaults (8-N-1, no flow control). Correct for Icom, wrong for every modern Yaesu HF radio except FT-710 (needs 8-N-2) and desktop Kenwood TS-590/990S/2000/570/TH-D72 (needs RTS/CTS).
  • Serial framing corrected for TS-570D, TS-570S, TH-D72, TH-D72A (→ .kenwoodDesktop), TS-850S (→ new .kenwoodLegacy, 8-N-2 + HW), and Elecraft K2 (→ new .elecraftK2, 8-N-2 no HW).
  • Lab599 TX-500 baud rate corrected 115200 → 9600 (Hamlib locks it there — the pre-fix code left the radio completely unresponsive).
  • Yaesu FT-891 hasSplit capability corrected to false — the radio has no CAT path to establish split.

Fixed — protocol correctness

  • Kenwood mode-code table completed. Mode code 8 (FSK-R / RTTY-R) now round-trips per Hamlib ts990s.c:92.
  • Elecraft K2 post-write delay 50ms → 100ms per Hamlib k2.c:137. Pre-fix value could drop bytes under sustained command sequences.
  • Elecraft K2 response timeout 1s → 2s per Hamlib k2.c:139 (K2 can take up to 500ms on band-change frequency sets). K3 and later stay at 1s via per-instance resolution.
  • Ten-Tec Legacy (Jupiter/Pegasus) frequency encoding rewritten. Pre-fix code sent decimal ASCII that the radios silently ignored. Now emits three 16-bit binary tuning factors per Hamlib tentec_tuning_factor_calc. Unit-tested against hand-computed reference values for USB/LSB/CW/AM. Baud rate also corrected 38400 → 57600.

Added

  • RadioDefinition.SerialDefaults — new value type carrying stop bits, parity, and hardware/software flow control. Named profiles: .standard, .yaesuHFDesktop, .yaesuHFPortable, .kenwoodDesktop, .kenwoodLegacy, .elecraftK2, .tentecModern. RadioDefinition.init gains an optional serialDefaults: parameter defaulting to .standard for source compatibility.
  • YaesuCATProtocol.Quirks — per-model behavioural quirks (ST-split support, FT encoding variants) sourced from Hamlib newcat.c's valid_commands table. Named profiles: .classic, .newcatNoST, .newcatWithSTDX, .ft710, .ft450, .ft891.
  • Ten-Tec radio factories now public. RadioDefinition.TenTec.orion / .orionII / .eagle / .jupiter / .pegasus. All verificationStatus: .definition — the wire protocols match Hamlib but no radio has been driven against real hardware since the fixes.

Compatibility

No API breakage. All new parameters are optional with defaults that preserve pre-v1.1.2 behaviour for callers that don't opt in. Downstream apps should bump when convenient; the Kenwood PTT fixes are safety-relevant for anyone driving a Kenwood radio over CAT.

Audit provenance

Seven-agent Hamlib parity audit (Icom, Yaesu, Kenwood + THD72, Elecraft, Xiegu/Lab599/Flex, Ten-Tec, cross-vendor connect-path safety). Icom, connect-path, and Ten-Tec Orion vendors passed cleanly. Every fix cites the Hamlib source file:line in code comments.

Regression coverage

  • New Tier1SafetyFixesTests (16 tests) pins every Tier 1 safety fix to the exact wire semantics we now guarantee.
  • New SerialDefaultsTests (24 tests) verifies per-radio profile assignments across every affected radio.
  • New TenTecTuningFactorTests (5 tests) validates the ported tentec_tuning_factor_calc against hand-computed Hamlib reference values.
  • New TenTecRadioDefinitionsTests and ElecraftResponseTimeoutTests cover the exposed factories and K2 timeout.

Test status: 521 tests, 0 failures (up from 459 in v1.1.1). Zero new compiler warnings under Swift 6 strict concurrency.

Deferred to v1.2.0

K2 hardware re-verification at 8-N-2, K2 extended-power probing (K22;), baud-rate range API on RadioDefinition, Kenwood mic/data PTT variants, Ten-Tec hardware validators. Tracked in ROADMAP Phase 5.8.