mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-07-26 10:42:26 -04:00
Igonored CAT polls of RX frequency from Commander when transmitting as
they are unreliable on Icom radios. Simplified diagnostic output for HRD CAT interface and DX Labs Suite Commander CAT interface. Removed duplicate diagnostic message from configuration CAT control. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3983 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
badcdd563d
commit
3ddf0d64d3
@ -1740,10 +1740,6 @@ bool Configuration::impl::open_rig ()
|
|||||||
|
|
||||||
void Configuration::impl::transceiver_frequency (Frequency f)
|
void Configuration::impl::transceiver_frequency (Frequency f)
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
|
||||||
qDebug () << "Configuration::transceiver_frequency:" << f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (set_mode () || cached_rig_state_.frequency () != f)
|
if (set_mode () || cached_rig_state_.frequency () != f)
|
||||||
{
|
{
|
||||||
cached_rig_state_.frequency (f);
|
cached_rig_state_.frequency (f);
|
||||||
|
@ -101,7 +101,7 @@ void DXLabSuiteCommanderTransceiver::do_ptt (bool on)
|
|||||||
|
|
||||||
if (use_for_ptt_)
|
if (use_for_ptt_)
|
||||||
{
|
{
|
||||||
send_command (on ? "<command:5>CmdTX<parameters:0>" : "<command:5>CmdRX<parameters:0>");
|
simple_command (on ? "<command:5>CmdTX<parameters:0>" : "<command:5>CmdRX<parameters:0>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -109,6 +109,8 @@ void DXLabSuiteCommanderTransceiver::do_ptt (bool on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_PTT (on);
|
update_PTT (on);
|
||||||
|
|
||||||
|
do_frequency (state ().frequency ()); // gets Commander synchronized
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXLabSuiteCommanderTransceiver::do_frequency (Frequency f)
|
void DXLabSuiteCommanderTransceiver::do_frequency (Frequency f)
|
||||||
@ -119,7 +121,7 @@ void DXLabSuiteCommanderTransceiver::do_frequency (Frequency f)
|
|||||||
|
|
||||||
// number is localised
|
// number is localised
|
||||||
// avoid floating point translation errors by adding a small number (0.1Hz)
|
// avoid floating point translation errors by adding a small number (0.1Hz)
|
||||||
send_command ("<command:10>CmdSetFreq<parameters:23><xcvrfreq:10>" + QString ("%L1").arg (f / 1e3 + 1e-4, 10, 'f', 3).toLocal8Bit ());
|
simple_command ("<command:10>CmdSetFreq<parameters:23><xcvrfreq:10>" + QString ("%L1").arg (f / 1e3 + 1e-4, 10, 'f', 3).toLocal8Bit ());
|
||||||
update_rx_frequency (f);
|
update_rx_frequency (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +133,7 @@ void DXLabSuiteCommanderTransceiver::do_tx_frequency (Frequency tx, bool /* rati
|
|||||||
|
|
||||||
if (tx)
|
if (tx)
|
||||||
{
|
{
|
||||||
send_command ("<command:8>CmdSplit<parameters:7><1:2>on");
|
simple_command ("<command:8>CmdSplit<parameters:7><1:2>on");
|
||||||
update_split (true);
|
update_split (true);
|
||||||
|
|
||||||
// number is localised
|
// number is localised
|
||||||
@ -140,13 +142,15 @@ void DXLabSuiteCommanderTransceiver::do_tx_frequency (Frequency tx, bool /* rati
|
|||||||
// set TX frequency after going split because going split
|
// set TX frequency after going split because going split
|
||||||
// rationalises TX VFO mode and that can change the frequency on
|
// rationalises TX VFO mode and that can change the frequency on
|
||||||
// Yaesu rigs if CW is involved
|
// Yaesu rigs if CW is involved
|
||||||
send_command ("<command:12>CmdSetTxFreq<parameters:23><xcvrfreq:10>" + QString ("%L1").arg (tx / 1e3 + 1e-4, 10, 'f', 3).toLocal8Bit ());
|
simple_command ("<command:12>CmdSetTxFreq<parameters:23><xcvrfreq:10>" + QString ("%L1").arg (tx / 1e3 + 1e-4, 10, 'f', 3).toLocal8Bit ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send_command ("<command:8>CmdSplit<parameters:8><1:3>off");
|
simple_command ("<command:8>CmdSplit<parameters:8><1:3>off");
|
||||||
}
|
}
|
||||||
update_other_frequency (tx);
|
update_other_frequency (tx);
|
||||||
|
|
||||||
|
do_frequency (state ().frequency ()); // gets Commander synchronized
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXLabSuiteCommanderTransceiver::do_mode (MODE mode, bool /* rationalise */)
|
void DXLabSuiteCommanderTransceiver::do_mode (MODE mode, bool /* rationalise */)
|
||||||
@ -156,15 +160,17 @@ void DXLabSuiteCommanderTransceiver::do_mode (MODE mode, bool /* rationalise */)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto mapped = map_mode (mode);
|
auto mapped = map_mode (mode);
|
||||||
send_command ((QString ("<command:10>CmdSetMode<parameters:%1><1:%2>").arg (5 + mapped.size ()).arg (mapped.size ()) + mapped).toLocal8Bit ());
|
simple_command ((QString ("<command:10>CmdSetMode<parameters:%1><1:%2>").arg (5 + mapped.size ()).arg (mapped.size ()) + mapped).toLocal8Bit ());
|
||||||
|
|
||||||
if (state ().split ())
|
if (state ().split ())
|
||||||
{
|
{
|
||||||
// this toggle ensures that the TX VFO mode is the same as the RX VFO
|
// this toggle ensures that the TX VFO mode is the same as the RX VFO
|
||||||
send_command ("<command:8>CmdSplit<parameters:8><1:3>off");
|
simple_command ("<command:8>CmdSplit<parameters:8><1:3>off");
|
||||||
send_command ("<command:8>CmdSplit<parameters:7><1:2>on");
|
simple_command ("<command:8>CmdSplit<parameters:7><1:2>on");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_frequency (state ().frequency ()); // gets Commander synchronized
|
||||||
|
|
||||||
// setting TX frequency rationalises the mode on Icoms so get current and set
|
// setting TX frequency rationalises the mode on Icoms so get current and set
|
||||||
poll ();
|
poll ();
|
||||||
}
|
}
|
||||||
@ -177,14 +183,19 @@ void DXLabSuiteCommanderTransceiver::poll ()
|
|||||||
bool quiet {true};
|
bool quiet {true};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
send_command ("<command:11>CmdSendFreq<parameters:0>", quiet);
|
auto reply = command_with_reply ("<command:11>CmdSendFreq<parameters:0>", quiet);
|
||||||
auto reply = read_reply (quiet);
|
|
||||||
if (0 == reply.indexOf ("<CmdFreq:"))
|
if (0 == reply.indexOf ("<CmdFreq:"))
|
||||||
{
|
{
|
||||||
// remove thousands separator and DP - relies of n.nnn kHz format so we can do uint conversion
|
// remove thousands separator and DP - relies of n.nnn kHz
|
||||||
|
// format so we can do uint conversion
|
||||||
reply = reply.mid (reply.indexOf ('>') + 1).replace (",", "").replace (".", "");
|
reply = reply.mid (reply.indexOf ('>') + 1).replace (",", "").replace (".", "");
|
||||||
|
|
||||||
|
if (!state ().ptt ()) // Commander is not reliable on frequency
|
||||||
|
// polls while transmitting
|
||||||
|
{
|
||||||
update_rx_frequency (reply.toUInt ());
|
update_rx_frequency (reply.toUInt ());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
@ -194,8 +205,7 @@ void DXLabSuiteCommanderTransceiver::poll ()
|
|||||||
throw error {"DX Lab Suite Commander didn't respond correctly polling frequency"};
|
throw error {"DX Lab Suite Commander didn't respond correctly polling frequency"};
|
||||||
}
|
}
|
||||||
|
|
||||||
send_command ("<command:13>CmdSendTXFreq<parameters:0>", quiet);
|
reply = command_with_reply ("<command:13>CmdSendTXFreq<parameters:0>", quiet);
|
||||||
reply = read_reply (quiet);
|
|
||||||
if (0 == reply.indexOf ("<CmdTXFreq:"))
|
if (0 == reply.indexOf ("<CmdTXFreq:"))
|
||||||
{
|
{
|
||||||
// remove thousands separator and DP - relies of n.nnn kHz format so we ca do uint conversion
|
// remove thousands separator and DP - relies of n.nnn kHz format so we ca do uint conversion
|
||||||
@ -214,8 +224,7 @@ void DXLabSuiteCommanderTransceiver::poll ()
|
|||||||
throw error {"DX Lab Suite Commander didn't respond correctly polling TX frequency"};
|
throw error {"DX Lab Suite Commander didn't respond correctly polling TX frequency"};
|
||||||
}
|
}
|
||||||
|
|
||||||
send_command ("<command:12>CmdSendSplit<parameters:0>", quiet);
|
reply = command_with_reply ("<command:12>CmdSendSplit<parameters:0>", quiet);
|
||||||
reply = read_reply (quiet);
|
|
||||||
if (0 == reply.indexOf ("<CmdSplit:"))
|
if (0 == reply.indexOf ("<CmdSplit:"))
|
||||||
{
|
{
|
||||||
auto split = reply.mid (reply.indexOf ('>') + 1);
|
auto split = reply.mid (reply.indexOf ('>') + 1);
|
||||||
@ -245,8 +254,7 @@ void DXLabSuiteCommanderTransceiver::poll ()
|
|||||||
throw error {"DX Lab Suite Commander didn't respond correctly polling split status"};
|
throw error {"DX Lab Suite Commander didn't respond correctly polling split status"};
|
||||||
}
|
}
|
||||||
|
|
||||||
send_command ("<command:11>CmdSendMode<parameters:0>", quiet);
|
reply = command_with_reply ("<command:11>CmdSendMode<parameters:0>", quiet);
|
||||||
reply = read_reply (quiet);
|
|
||||||
if (0 == reply.indexOf ("<CmdMode:"))
|
if (0 == reply.indexOf ("<CmdMode:"))
|
||||||
{
|
{
|
||||||
auto mode = reply.mid (reply.indexOf ('>') + 1);
|
auto mode = reply.mid (reply.indexOf ('>') + 1);
|
||||||
@ -311,21 +319,21 @@ void DXLabSuiteCommanderTransceiver::poll ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXLabSuiteCommanderTransceiver::send_command (QByteArray const& cmd, bool no_debug)
|
void DXLabSuiteCommanderTransceiver::simple_command (QByteArray const& cmd, bool no_debug)
|
||||||
{
|
{
|
||||||
Q_ASSERT (commander_);
|
Q_ASSERT (commander_);
|
||||||
|
|
||||||
if (!no_debug)
|
if (!no_debug)
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "DXLabSuiteCommanderTransceiver:send_command(" << cmd << ')';
|
qDebug () << "DXLabSuiteCommanderTransceiver:simple_command(" << cmd << ')';
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QTcpSocket::ConnectedState != commander_->state ())
|
if (QTcpSocket::ConnectedState != commander_->state ())
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "DXLabSuiteCommanderTransceiver::send_command failed:" << commander_->errorString ();
|
qDebug () << "DXLabSuiteCommanderTransceiver::simple_command failed:" << commander_->errorString ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
throw error {"DX Lab Suite Commander send command failed\n" + commander_->errorString ().toLocal8Bit ()};
|
throw error {"DX Lab Suite Commander send command failed\n" + commander_->errorString ().toLocal8Bit ()};
|
||||||
@ -335,30 +343,40 @@ void DXLabSuiteCommanderTransceiver::send_command (QByteArray const& cmd, bool n
|
|||||||
if (!commander_->waitForBytesWritten (socket_wait_time))
|
if (!commander_->waitForBytesWritten (socket_wait_time))
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "DXLabSuiteCommanderTransceiver::send_command failed:" << commander_->errorString ();
|
qDebug () << "DXLabSuiteCommanderTransceiver::simple_command failed:" << commander_->errorString ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
throw error {"DX Lab Suite Commander send command failed\n" + commander_->errorString ().toLocal8Bit ()};
|
throw error {"DX Lab Suite Commander send command failed\n" + commander_->errorString ().toLocal8Bit ()};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DXLabSuiteCommanderTransceiver::read_reply (bool no_debug)
|
QByteArray DXLabSuiteCommanderTransceiver::command_with_reply (QByteArray const& cmd, bool no_debug)
|
||||||
{
|
{
|
||||||
Q_ASSERT (commander_);
|
Q_ASSERT (commander_);
|
||||||
|
|
||||||
if (QTcpSocket::ConnectedState != commander_->state ())
|
if (QTcpSocket::ConnectedState != commander_->state ())
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "DXLabSuiteCommanderTransceiver::read_reply failed:" << commander_->errorString ();
|
qDebug () << "DXLabSuiteCommanderTransceiver::command_with_reply failed:" << commander_->errorString ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
throw error {"DX Lab Suite Commander read reply failed\n" + commander_->errorString ().toLocal8Bit ()};
|
throw error {"DX Lab Suite Commander read reply failed\n" + commander_->errorString ().toLocal8Bit ()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commander_->write (cmd);
|
||||||
|
if (!commander_->waitForBytesWritten (socket_wait_time) || QTcpSocket::ConnectedState != commander_->state ())
|
||||||
|
{
|
||||||
|
#if WSJT_TRACE_CAT
|
||||||
|
qDebug () << "DXLabSuiteCommanderTransceiver::simple_command failed:" << commander_->errorString ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
throw error {"DX Lab Suite Commander send command failed\n" + commander_->errorString ().toLocal8Bit ()};
|
||||||
|
}
|
||||||
|
|
||||||
if (!commander_->waitForReadyRead (socket_wait_time))
|
if (!commander_->waitForReadyRead (socket_wait_time))
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "DXLabSuiteCommanderTransceiver::read_reply failed:" << commander_->errorString ();
|
qDebug () << "DXLabSuiteCommanderTransceiver::command_with_reply failed:" << commander_->errorString ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
throw error {"DX Lab Suite Commander read reply failed\n" + commander_->errorString ().toLocal8Bit ()};
|
throw error {"DX Lab Suite Commander read reply failed\n" + commander_->errorString ().toLocal8Bit ()};
|
||||||
@ -369,7 +387,7 @@ QByteArray DXLabSuiteCommanderTransceiver::read_reply (bool no_debug)
|
|||||||
if (!no_debug)
|
if (!no_debug)
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "DXLabSuiteCommanderTransceiver:read_reply() ->" << result;
|
qDebug () << "DXLabSuiteCommanderTransceiver:command_with_reply(" << cmd << ") ->" << result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
explicit DXLabSuiteCommanderTransceiver (std::unique_ptr<TransceiverBase> wrapped, QString const& address, bool use_for_ptt, int poll_interval);
|
explicit DXLabSuiteCommanderTransceiver (std::unique_ptr<TransceiverBase> wrapped, QString const& address, bool use_for_ptt, int poll_interval);
|
||||||
~DXLabSuiteCommanderTransceiver ();
|
~DXLabSuiteCommanderTransceiver ();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void do_start () override;
|
void do_start () override;
|
||||||
void do_stop () override;
|
void do_stop () override;
|
||||||
void do_frequency (Frequency) override;
|
void do_frequency (Frequency) override;
|
||||||
@ -38,8 +38,9 @@ private:
|
|||||||
|
|
||||||
void poll () override;
|
void poll () override;
|
||||||
|
|
||||||
void send_command (QByteArray const&, bool no_debug = false);
|
private:
|
||||||
QByteArray read_reply (bool no_debug = false);
|
void simple_command (QByteArray const&, bool no_debug = false);
|
||||||
|
QByteArray command_with_reply (QByteArray const&, bool no_debug = false);
|
||||||
|
|
||||||
std::unique_ptr<TransceiverBase> wrapped_;
|
std::unique_ptr<TransceiverBase> wrapped_;
|
||||||
bool use_for_ptt_;
|
bool use_for_ptt_;
|
||||||
|
@ -627,9 +627,8 @@ QString HRDTransceiver::send_command (QString const& cmd, bool no_debug, bool pr
|
|||||||
|
|
||||||
if (current_radio_ && prepend_context && vfo_count_ < 2)
|
if (current_radio_ && prepend_context && vfo_count_ < 2)
|
||||||
{
|
{
|
||||||
// TODO G4WJS: get rid of this or move to a thread required on some
|
// required on some radios because commands don't get executed
|
||||||
// radios because commands don't get executed correctly (ICOM for
|
// correctly otherwise (ICOM for example)
|
||||||
// example)
|
|
||||||
QThread::msleep (50);
|
QThread::msleep (50);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,13 +683,6 @@ QString HRDTransceiver::send_command (QString const& cmd, bool no_debug, bool pr
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto string = prepend_context ? context + cmd : cmd;
|
auto string = prepend_context ? context + cmd : cmd;
|
||||||
if (!no_debug)
|
|
||||||
{
|
|
||||||
#if WSJT_TRACE_CAT
|
|
||||||
qDebug () << "HRDTransceiver::send_command:" << string;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QScopedPointer<HRDMessage> message (new (string) HRDMessage);
|
QScopedPointer<HRDMessage> message (new (string) HRDMessage);
|
||||||
bytes_to_send = message->size_;
|
bytes_to_send = message->size_;
|
||||||
bytes_sent = hrd_->write (reinterpret_cast<char *> (message.data ()), bytes_to_send);
|
bytes_sent = hrd_->write (reinterpret_cast<char *> (message.data ()), bytes_to_send);
|
||||||
@ -746,7 +738,7 @@ QString HRDTransceiver::send_command (QString const& cmd, bool no_debug, bool pr
|
|||||||
if (!no_debug)
|
if (!no_debug)
|
||||||
{
|
{
|
||||||
#if WSJT_TRACE_CAT
|
#if WSJT_TRACE_CAT
|
||||||
qDebug () << "HRDTransceiver::send_command: reply: " << result;
|
qDebug () << "HRDTransceiver::send_command(" << cmd << "): ->" << result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
explicit HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped, QString const& server, bool use_for_ptt, int poll_interval);
|
explicit HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped, QString const& server, bool use_for_ptt, int poll_interval);
|
||||||
~HRDTransceiver ();
|
~HRDTransceiver ();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void do_start () override;
|
void do_start () override;
|
||||||
void do_stop () override;
|
void do_stop () override;
|
||||||
void do_frequency (Frequency) override;
|
void do_frequency (Frequency) override;
|
||||||
@ -43,6 +43,7 @@ private:
|
|||||||
|
|
||||||
void poll () override;
|
void poll () override;
|
||||||
|
|
||||||
|
private:
|
||||||
void init_radio ();
|
void init_radio ();
|
||||||
QString send_command (QString const&, bool no_debug = false, bool prepend_context = true, bool recurse = false);
|
QString send_command (QString const&, bool no_debug = false, bool prepend_context = true, bool recurse = false);
|
||||||
void send_simple_command (QString const&, bool no_debug = false);
|
void send_simple_command (QString const&, bool no_debug = false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user