OmniRig startup changes

OmniRig startup  continues to  be stubborn,  this change  relaxes some
error checking in the hope that  we can stumble on until OmniRig sends
us some status information that we can be sure about.

Merged from the wsjtx-1.5 branch.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5503 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-06-02 23:32:37 +00:00
parent 55e0e414df
commit a26caaf708
2 changed files with 20 additions and 45 deletions

View File

@ -97,13 +97,11 @@ OmniRigTransceiver::OmniRigTransceiver (std::unique_ptr<TransceiverBase> wrapped
: wrapped_ {std::move (wrapped)}
, use_for_ptt_ {TransceiverFactory::PTT_method_CAT == ptt_type || ("CAT" == ptt_port && (TransceiverFactory::PTT_method_RTS == ptt_type || TransceiverFactory::PTT_method_DTR == ptt_type))}
, ptt_type_ {ptt_type}
, startup_poll_countdown_ {2}
, rig_number_ {n}
, readable_params_ {0}
, writable_params_ {0}
, send_update_signal_ {false}
, reversed_ {false}
, starting_ {true}
{
}
@ -183,11 +181,7 @@ void OmniRigTransceiver::do_start ()
.arg (writable_params_, 8, 16, QChar ('0'))
.arg (rig_number_).toLocal8Bit ());
rig_->GetRxFrequency ();
if (OmniRig::ST_ONLINE != rig_->Status ())
{
throw_qstring ("OmniRig exception: " + rig_->StatusStr ());
}
TRACE_CAT ("OmniRig status:" << rig_->StatusStr ());
init_rig ();
}
@ -208,39 +202,35 @@ void OmniRigTransceiver::do_stop ()
void OmniRigTransceiver::online_check ()
{
if (starting_)
{
if (--startup_poll_countdown_)
{
init_rig ();
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
else
{
startup_poll_countdown_ = 2;
// signal that we haven't seen anything from OmniRig
offline ("OmniRig initialisation timeout");
}
}
else if (OmniRig::ST_ONLINE != rig_->Status ())
if (OmniRig::ST_ONLINE != rig_->Status ())
{
offline ("OmniRig rig went offline for more than 5 seconds");
}
else
{
init_rig ();
}
}
void OmniRigTransceiver::init_rig ()
{
update_rx_frequency (rig_->GetRxFrequency ());
if (state ().split ())
if (OmniRig::ST_ONLINE != rig_->Status ())
{
TRACE_CAT ("set split");
rig_->SetSplitMode (state ().frequency (), state ().tx_frequency ());
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
else
{
TRACE_CAT ("set simplex");
rig_->SetSimplexMode (state ().frequency ());
update_rx_frequency (rig_->GetRxFrequency ());
if (state ().split ())
{
TRACE_CAT ("set split");
rig_->SetSplitMode (state ().frequency (), state ().tx_frequency ());
}
else
{
TRACE_CAT ("set simplex");
rig_->SetSimplexMode (state ().frequency ());
}
}
}
@ -290,19 +280,6 @@ void OmniRigTransceiver::handle_status_change (int rig_number)
{
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
else if (starting_)
{
starting_ = false;
TransceiverState old_state {state ()};
init_rig ();
if (old_state != state () || send_update_signal_)
{
update_complete ();
send_update_signal_ = false;
}
}
}
}
@ -314,7 +291,7 @@ void OmniRigTransceiver::handle_params_change (int rig_number, int params)
.arg (params, 8, 16, QChar ('0'))
.arg (rig_number).toLocal8Bit ()
<< "state before:" << state ());
starting_ = false;
// starting_ = false;
TransceiverState old_state {state ()};
auto need_frequency = false;
// state_.online = true; // sometimes we don't get an initial

View File

@ -58,7 +58,6 @@ private:
std::unique_ptr<TransceiverBase> wrapped_;
bool use_for_ptt_;
TransceiverFactory::PTTMethod ptt_type_;
unsigned startup_poll_countdown_;
QScopedPointer<OmniRig::OmniRigX> omni_rig_;
RigNumber rig_number_;
QScopedPointer<OmniRig::RigX> rig_;
@ -67,7 +66,6 @@ private:
int writable_params_;
bool send_update_signal_;
bool reversed_; // some rigs can reverse VFOs
bool starting_;
};
#endif