From 9fbb00f86ef5dd5bc7bc11effdf73e89caa91d2c Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 2 Jun 2015 23:32:37 +0000 Subject: [PATCH] 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 --- OmniRigTransceiver.cpp | 63 ++++++++++++++---------------------------- OmniRigTransceiver.hpp | 2 -- 2 files changed, 20 insertions(+), 45 deletions(-) diff --git a/OmniRigTransceiver.cpp b/OmniRigTransceiver.cpp index b7a9a6adc..4621d5f98 100644 --- a/OmniRigTransceiver.cpp +++ b/OmniRigTransceiver.cpp @@ -97,13 +97,11 @@ OmniRigTransceiver::OmniRigTransceiver (std::unique_ptr 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 diff --git a/OmniRigTransceiver.hpp b/OmniRigTransceiver.hpp index f2b4e3528..d5c41a9b2 100644 --- a/OmniRigTransceiver.hpp +++ b/OmniRigTransceiver.hpp @@ -58,7 +58,6 @@ private: std::unique_ptr wrapped_; bool use_for_ptt_; TransceiverFactory::PTTMethod ptt_type_; - unsigned startup_poll_countdown_; QScopedPointer omni_rig_; RigNumber rig_number_; QScopedPointer rig_; @@ -67,7 +66,6 @@ private: int writable_params_; bool send_update_signal_; bool reversed_; // some rigs can reverse VFOs - bool starting_; }; #endif