Add deley to rig resolution detection with DX Lab Suite Commander

Commander queues rig control commands  and can return stale or invalid
results immediately after state change commands so this change waits a
couple of seconds hoping that Commander gets around to polling the rig
before we read back the state.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7564 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-02-17 12:32:26 +00:00
parent 6349b602e8
commit 43cdd1df3c
1 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include <QTcpSocket>
#include <QRegularExpression>
#include <QLocale>
#include <QThread>
#include "NetworkServerLookup.hpp"
@ -69,7 +70,13 @@ int DXLabSuiteCommanderTransceiver::do_start ()
throw error {tr ("Failed to connect to DX Lab Suite Commander\n") + commander_->errorString ()};
}
// sleeps here are to ensure Commander has actually queried the rig
// rather than returning cached data which maybe stale or simply
// read backs of not yet committed values, the 2s delays are
// arbitrary but hopefully enough as the actual time required is rig
// and Commander setting dependent
int resolution {0};
QThread::msleep (2000);
auto reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>");
if (0 == reply.indexOf ("<CmdFreq:"))
{
@ -80,6 +87,7 @@ int DXLabSuiteCommanderTransceiver::do_start ()
auto f_string = frequency_to_string (test_frequency);
auto params = ("<xcvrfreq:%1>" + f_string).arg (f_string.size ());
simple_command (("<command:10>CmdSetFreq<parameters:%1>" + params).arg (params.size ()));
QThread::msleep (2000);
reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>");
if (0 == reply.indexOf ("<CmdFreq:"))
{
@ -98,6 +106,7 @@ int DXLabSuiteCommanderTransceiver::do_start ()
f_string = frequency_to_string (test_frequency);
params = ("<xcvrfreq:%1>" + f_string).arg (f_string.size ());
simple_command (("<command:10>CmdSetFreq<parameters:%1>" + params).arg (params.size ()));
QThread::msleep (2000);
reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>");
new_frequency = string_to_frequency (reply.mid (reply.indexOf ('>') + 1));
if (9 == static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))