OmniRig interface fixes

Split mode  was inadvertently disabled  in a prior change  to disallow
split mode on the "None" rig.

Allow OmniRig to report a rig offline  status for up to 5s since short
periods of "rig  not responding" seem to happen regularly  for no good
reason.

Use  high level  OmniRig SetSimplexMode()/SetSplitMode()  functions to
initialize rig.

Merged from wsjtx-1.4 branch.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4578 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-11-01 22:34:44 +00:00
parent 3b43a18362
commit 1cf6756138
3 changed files with 25 additions and 29 deletions

View File

@ -384,6 +384,7 @@ private:
RigParams rig_params_;
RigParams saved_rig_params_;
bool rig_is_dummy_;
bool rig_active_;
bool have_rig_;
bool rig_changed_;
@ -472,8 +473,7 @@ bool Configuration::watchdog () const {return m_->watchdog_;}
bool Configuration::TX_messages () const {return m_->TX_messages_;}
bool Configuration::split_mode () const
{
bool have_rig = m_->transceiver_factory_.CAT_port_type (m_->rig_params_.rig_name_) != TransceiverFactory::Capabilities::none;
return have_rig && m_->rig_params_.split_mode_ != TransceiverFactory::split_mode_none;
return !m_->rig_is_dummy_ && m_->rig_params_.split_mode_ != TransceiverFactory::split_mode_none;
}
Bands * Configuration::bands () {return &m_->bands_;}
StationList * Configuration::stations () {return &m_->stations_;}
@ -1059,6 +1059,7 @@ void Configuration::impl::read_settings ()
log_as_RTTY_ = settings_->value ("toRTTY", false).toBool ();
report_in_comments_ = settings_->value("dBtoComments", false).toBool ();
rig_params_.rig_name_ = settings_->value ("Rig", TransceiverFactory::basic_transceiver_name_).toString ();
rig_is_dummy_ = TransceiverFactory::basic_transceiver_name_ == rig_params_.rig_name_;
rig_params_.CAT_network_port_ = settings_->value ("CATNetworkPort").toString ();
rig_params_.CAT_serial_port_ = settings_->value ("CATSerialPort").toString ();
rig_params_.CAT_baudrate_ = settings_->value ("CATSerialRate", 4800).toInt ();
@ -1171,7 +1172,7 @@ void Configuration::impl::set_rig_invariants ()
ui_->CAT_poll_interval_label->setEnabled (!asynchronous_CAT);
ui_->CAT_poll_interval_spin_box->setEnabled (!asynchronous_CAT);
static TransceiverFactory::Capabilities::PortType last_port_type = TransceiverFactory::Capabilities::none;
static auto last_port_type = TransceiverFactory::Capabilities::none;
auto port_type = transceiver_factory_.CAT_port_type (rig);
bool is_serial_CAT (TransceiverFactory::Capabilities::serial == port_type);
@ -1383,7 +1384,8 @@ void Configuration::impl::accept ()
}
rig_params_ = temp_rig_params; // now we can go live with the rig
// related configuration parameters
// related configuration parameters
rig_is_dummy_ = TransceiverFactory::basic_transceiver_name_ == rig_params_.rig_name_;
// Check to see whether SoundInThread must be restarted,
// and save user parameters.

View File

@ -105,7 +105,7 @@ OmniRigTransceiver::OmniRigTransceiver (std::unique_ptr<TransceiverBase> wrapped
, writable_params_ {0}
, send_update_signal_ {false}
, reversed_ {false}
, starting_ {false}
, starting_ {true}
{
}
@ -199,8 +199,7 @@ void OmniRigTransceiver::do_start ()
;
#endif
starting_ = true;
QTimer::singleShot (5000, this, SLOT (startup_check ()));
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
void OmniRigTransceiver::do_stop ()
@ -224,14 +223,14 @@ void OmniRigTransceiver::do_stop ()
#endif
}
void OmniRigTransceiver::startup_check ()
void OmniRigTransceiver::online_check ()
{
if (starting_)
{
if (--startup_poll_countdown_)
{
init_rig ();
QTimer::singleShot (5000, this, SLOT (startup_check ()));
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
else
{
@ -241,36 +240,30 @@ void OmniRigTransceiver::startup_check ()
offline ("OmniRig initialisation timeout");
}
}
else if (OmniRig::ST_ONLINE != rig_->Status ())
{
offline ("OmniRig rig went offline for more than 5 seconds");
}
}
void OmniRigTransceiver::init_rig ()
{
if (writable_params_ & OmniRig::PM_VFOA)
if (state ().split ())
{
#if WSJT_TRACE_CAT
qDebug () << "OmniRigTransceiver::init_rig: set VFO A";
qDebug () << "OmniRigTransceiver::init_rig: set split";
#endif
rig_->SetVfo (OmniRig::PM_VFOA);
if (writable_params_ & OmniRig::PM_SPLITOFF)
{
#if WSJT_TRACE_CAT
qDebug () << "OmniRigTransceiver::init_rig: set SPLIT off";
#endif
rig_->SetSplit (OmniRig::PM_SPLITOFF);
}
rig_->SetSplitMode (state ().frequency (), state ().tx_frequency ());
}
else if (writable_params_ & OmniRig::PM_VFOAA)
else
{
#if WSJT_TRACE_CAT
qDebug () << "OmniRigTransceiver::init_rig: set VFO A and SPLIT off";
qDebug () << "OmniRigTransceiver::init_rig: set simplex";
#endif
rig_->SetVfo (OmniRig::PM_VFOAA);
rig_->SetSimplexMode (state ().frequency ());
}
reversed_ = false;
}
void OmniRigTransceiver::do_sync (bool force_signal)
@ -281,6 +274,7 @@ void OmniRigTransceiver::do_sync (bool force_signal)
// leads to a whole mess of trouble since its internal state is
// garbage until it has done its first rig poll.
send_update_signal_ = force_signal;
update_complete ();
}
void OmniRigTransceiver::handle_COM_exception (int code, QString source, QString desc, QString help)
@ -326,14 +320,14 @@ void OmniRigTransceiver::handle_status_change (int rig_number)
{
#if WSJT_TRACE_CAT
qDebug ()
<< QString ("OmniRig status change: new status for rig %1 =").arg (rig_number).toLocal8Bit () << rig_->StatusStr ().toLocal8Bit ();
<< QString ("OmniRig status change: new status for rig %1 = ").arg (rig_number).toLocal8Bit () << rig_->StatusStr ().toLocal8Bit ();
#endif
if (OmniRig::ST_ONLINE != rig_->Status ())
{
offline ("OmniRig rig went offline");
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
else
else if (starting_)
{
starting_ = false;

View File

@ -42,7 +42,7 @@ public:
void do_sync (bool force_signal) override;
private:
Q_SLOT void startup_check ();
Q_SLOT void online_check ();
Q_SLOT void handle_COM_exception (int, QString, QString, QString);
Q_SLOT void handle_visible_change ();
Q_SLOT void handle_rig_type_change (int rig_number);