From 764d1bacccd0b89a8d01370fb1cd77b0f6cb2cb3 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 2 Jul 2017 02:37:34 +0000 Subject: [PATCH] Do not wait for PTT report from DX Lab Suite Commander when using direct DTR or RTS PTT The recent change to delay Tx audio until Commander reports PTT is really asserted should not be done when a direct RTS or DTR PTT method is being used. This does leave a remote chance of ALC overshoot issues from audio starting too early so it is down to the user to set an appropriate "Settings->Advanced->Tx Delay" to ensure safe operating. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7774 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- DXLabSuiteCommanderTransceiver.cpp | 77 +++++++++++++++--------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/DXLabSuiteCommanderTransceiver.cpp b/DXLabSuiteCommanderTransceiver.cpp index 679cd8951..4e9270cfe 100644 --- a/DXLabSuiteCommanderTransceiver.cpp +++ b/DXLabSuiteCommanderTransceiver.cpp @@ -149,6 +149,44 @@ void DXLabSuiteCommanderTransceiver::do_ptt (bool on) if (use_for_ptt_) { simple_command (on ? "CmdTX" : "CmdRX"); + + bool tx {!on}; + auto start = QDateTime::currentMSecsSinceEpoch (); + // we must now wait for Tx on the rig, we will wait a short while + // before bailing out + while (tx != on && QDateTime::currentMSecsSinceEpoch () - start < 1000) + { + auto reply = command_with_reply ("CmdSendTx"); + if (0 == reply.indexOf ("') + 1); + if ("ON" == state) + { + tx = true; + } + else if ("OFF" == state) + { + tx = false; + } + else + { + TRACE_CAT ("DXLabSuiteCommanderTransceiver", "unexpected TX state" << state); + throw error {tr ("DX Lab Suite Commander sent an unrecognised TX state: ") + state}; + } + } + else + { + TRACE_CAT ("DXLabSuiteCommanderTransceiver", "get TX unexpected response" << reply); + throw error {tr ("DX Lab Suite Commander didn't respond correctly polling TX status: ") + reply}; + } + if (tx != on) QThread::msleep (10); // don't thrash Commander + } + update_PTT (tx); + if (tx != on) + { + TRACE_CAT ("DXLabSuiteCommanderTransceiver", "rig failed to respond to PTT: " << on); + throw error {tr ("DX Lab Suite Commander rig did not respond to PTT: ") + (on ? "ON" : "OFF")}; + } } else { @@ -156,44 +194,7 @@ void DXLabSuiteCommanderTransceiver::do_ptt (bool on) TransceiverState new_state {wrapped_->state ()}; new_state.ptt (on); wrapped_->set (new_state, 0); - } - - bool tx {!on}; - auto start = QDateTime::currentMSecsSinceEpoch (); - // we must now wait for Tx on the rig, we will wait a short while - // before bailing out - while (tx != on && QDateTime::currentMSecsSinceEpoch () - start < 1000) - { - auto reply = command_with_reply ("CmdSendTx"); - if (0 == reply.indexOf ("') + 1); - if ("ON" == state) - { - tx = true; - } - else if ("OFF" == state) - { - tx = false; - } - else - { - TRACE_CAT ("DXLabSuiteCommanderTransceiver", "unexpected TX state" << state); - throw error {tr ("DX Lab Suite Commander sent an unrecognised TX state: ") + state}; - } - } - else - { - TRACE_CAT ("DXLabSuiteCommanderTransceiver", "get TX unexpected response" << reply); - throw error {tr ("DX Lab Suite Commander didn't respond correctly polling TX status: ") + reply}; - } - if (tx != on) QThread::msleep (10); // don't thrash Commander - } - update_PTT (tx); - if (tx != on) - { - TRACE_CAT ("DXLabSuiteCommanderTransceiver", "rig failed to respond to PTT: " << on); - throw error {tr ("DX Lab Suite Commander rig did not respond to PTT: ") + (on ? "ON" : "OFF")}; + update_PTT (on); } }