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 2725a6d559
commit 9fbb00f86e
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)} : 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))} , 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} , ptt_type_ {ptt_type}
, startup_poll_countdown_ {2}
, rig_number_ {n} , rig_number_ {n}
, readable_params_ {0} , readable_params_ {0}
, writable_params_ {0} , writable_params_ {0}
, send_update_signal_ {false} , send_update_signal_ {false}
, reversed_ {false} , reversed_ {false}
, starting_ {true}
{ {
} }
@ -183,11 +181,7 @@ void OmniRigTransceiver::do_start ()
.arg (writable_params_, 8, 16, QChar ('0')) .arg (writable_params_, 8, 16, QChar ('0'))
.arg (rig_number_).toLocal8Bit ()); .arg (rig_number_).toLocal8Bit ());
rig_->GetRxFrequency (); TRACE_CAT ("OmniRig status:" << rig_->StatusStr ());
if (OmniRig::ST_ONLINE != rig_->Status ())
{
throw_qstring ("OmniRig exception: " + rig_->StatusStr ());
}
init_rig (); init_rig ();
} }
@ -208,28 +202,23 @@ void OmniRigTransceiver::do_stop ()
void OmniRigTransceiver::online_check () void OmniRigTransceiver::online_check ()
{ {
if (starting_) if (OmniRig::ST_ONLINE != rig_->Status ())
{ {
if (--startup_poll_countdown_) offline ("OmniRig rig went offline for more than 5 seconds");
{
init_rig ();
QTimer::singleShot (5000, this, SLOT (online_check ()));
} }
else else
{ {
startup_poll_countdown_ = 2; init_rig ();
// signal that we haven't seen anything from OmniRig
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 () void OmniRigTransceiver::init_rig ()
{
if (OmniRig::ST_ONLINE != rig_->Status ())
{
QTimer::singleShot (5000, this, SLOT (online_check ()));
}
else
{ {
update_rx_frequency (rig_->GetRxFrequency ()); update_rx_frequency (rig_->GetRxFrequency ());
if (state ().split ()) if (state ().split ())
@ -243,6 +232,7 @@ void OmniRigTransceiver::init_rig ()
rig_->SetSimplexMode (state ().frequency ()); rig_->SetSimplexMode (state ().frequency ());
} }
} }
}
void OmniRigTransceiver::do_sync (bool force_signal) void OmniRigTransceiver::do_sync (bool force_signal)
{ {
@ -290,19 +280,6 @@ void OmniRigTransceiver::handle_status_change (int rig_number)
{ {
QTimer::singleShot (5000, this, SLOT (online_check ())); 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 (params, 8, 16, QChar ('0'))
.arg (rig_number).toLocal8Bit () .arg (rig_number).toLocal8Bit ()
<< "state before:" << state ()); << "state before:" << state ());
starting_ = false; // starting_ = false;
TransceiverState old_state {state ()}; TransceiverState old_state {state ()};
auto need_frequency = false; auto need_frequency = false;
// state_.online = true; // sometimes we don't get an initial // state_.online = true; // sometimes we don't get an initial

View File

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