From db111b6529d5b44c23a6940c9d0f267cba6da111 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Fri, 17 Feb 2017 12:32:33 +0000 Subject: [PATCH] Read mode before attempting to change it when using DX Lab Suite Commander This change is specifically to work around some surprising behaviour in the Elecraft K3[S] which suffers audio drop outs when null changes that might effect the internal DSP are processed. This manifests when a blind mode change is sent through Commander. Here we read the mode and only subsequently command a mode change if it is not what we expect. Blind mode changes were preferred with Commander until now since state queries through Commander are occasionally unreliable. This issue has been reported to Elecraft so may not be permanent if they can and will address it in the rig's firmware. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7565 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- DXLabSuiteCommanderTransceiver.cpp | 12 +++++++++--- DXLabSuiteCommanderTransceiver.hpp | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/DXLabSuiteCommanderTransceiver.cpp b/DXLabSuiteCommanderTransceiver.cpp index 4961c2a69..5880abcdf 100644 --- a/DXLabSuiteCommanderTransceiver.cpp +++ b/DXLabSuiteCommanderTransceiver.cpp @@ -163,7 +163,7 @@ void DXLabSuiteCommanderTransceiver::do_frequency (Frequency f, MODE m, bool /*n { TRACE_CAT ("DXLabSuiteCommanderTransceiver", f << state ()); auto f_string = frequency_to_string (f); - if (UNK != m) + if (UNK != m && m != get_mode ()) { auto m_string = map_mode (m); auto params = ("" + f_string + "" + m_string + "Y").arg (f_string.size ()).arg (m_string.size ()); @@ -281,11 +281,16 @@ void DXLabSuiteCommanderTransceiver::poll () throw error {tr ("DX Lab Suite Commander didn't respond correctly polling split status")}; } - reply = command_with_reply ("CmdSendMode", quiet); + get_mode (quiet); +} + +auto DXLabSuiteCommanderTransceiver::get_mode (bool no_debug) -> MODE +{ + MODE m {UNK}; + auto reply = command_with_reply ("CmdSendMode", no_debug); if (0 == reply.indexOf ("') + 1); - MODE m {UNK}; if ("AM" == mode) { m = AM; @@ -338,6 +343,7 @@ void DXLabSuiteCommanderTransceiver::poll () TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "unexpected response"); throw error {tr ("DX Lab Suite Commander didn't respond correctly polling mode")}; } + return m; } void DXLabSuiteCommanderTransceiver::simple_command (QString const& cmd, bool no_debug) diff --git a/DXLabSuiteCommanderTransceiver.hpp b/DXLabSuiteCommanderTransceiver.hpp index 92d042c99..b02fbef12 100644 --- a/DXLabSuiteCommanderTransceiver.hpp +++ b/DXLabSuiteCommanderTransceiver.hpp @@ -42,6 +42,7 @@ protected: void poll () override; private: + MODE get_mode (bool no_debug = false); void simple_command (QString const&, bool no_debug = false); QString command_with_reply (QString const&, bool no_debug = false); bool write_to_port (QString const&);