[fix](trx-rs): harden hamlib rigctl compatibility

Improve rigctl interoperability with hamlib/WSJT-X and stabilize FT-817 PTT handling.\n\n- support extended '+' command replies\n- accept decimal and MHz-style frequency inputs\n- retry set_freq rounded to 10 Hz on CAT alignment errors\n- add compatibility handling for get_level probes\n- broaden PTT command parsing and aliases\n- derive PTT capability dynamically from snapshot data\n- improve dump_state/dump_caps compatibility behavior\n- move temporary rigctl diagnostics to debug level\n- make FT-817 set_ptt more reliable with unlock/clear and double-send\n\nCo-authored-by: OpenAI Codex <codex@openai.com>

Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-02-13 01:30:04 +01:00
parent c1a7eaa72d
commit 86ca1a60fb
2 changed files with 90 additions and 18 deletions
@@ -303,9 +303,17 @@ impl Ft817 {
/// Send CAT command to control PTT on FT-817.
pub async fn set_ptt(&mut self, ptt: bool) -> DynResult<()> {
let opcode = if ptt { CMD_PTT_ON } else { CMD_PTT_OFF };
// Mirror the reliability pattern used in set_mode: clear stale input and
// send twice because some radios occasionally drop the first CAT frame.
let _ = self.unlock().await;
let _ = self.port.clear(ClearBuffer::Input);
// PTT on/off does not take a payload; CAT uses separate opcodes.
let frame = [0x00, 0x00, 0x00, 0x00, opcode];
self.write_frame(&frame).await?;
self.port.flush().await?;
tokio::time::sleep(std::time::Duration::from_millis(80)).await;
self.write_frame(&frame).await?;
self.port.flush().await?;
Ok(())
}