From cdda10c7ac3be47b3af9cab1b48e8fd18c1af116 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sat, 29 Nov 2014 18:15:05 +0000 Subject: [PATCH] Don't keep querying split status on rigs where it doesn't work Merged from wsjtx-1.4 branch. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4691 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- HamlibTransceiver.cpp | 86 +++++++++++++++++++++---------------------- HamlibTransceiver.hpp | 3 +- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/HamlibTransceiver.cpp b/HamlibTransceiver.cpp index b0f8590db..08bd14d1e 100644 --- a/HamlibTransceiver.cpp +++ b/HamlibTransceiver.cpp @@ -168,6 +168,7 @@ HamlibTransceiver::HamlibTransceiver (int model_number , back_ptt_port_ {TransceiverFactory::TX_audio_source_rear == back_ptt_port} , is_dummy_ {RIG_MODEL_DUMMY == model_number} , reversed_ {false} + , split_query_works_ {true} { if (!rig_) { @@ -265,23 +266,6 @@ void HamlibTransceiver::do_start () error_check (rig_open (rig_.data ()), tr ("opening connection to rig")); - init_rig (); -} - -void HamlibTransceiver::do_stop () -{ - if (rig_) - { - rig_close (rig_.data ()); - } - -#if WSJT_TRACE_CAT - qDebug () << "HamlibTransceiver::do_stop: state:" << state () << "reversed =" << reversed_; -#endif -} - -void HamlibTransceiver::init_rig () -{ if (!is_dummy_) { freq_t f1; @@ -429,6 +413,18 @@ void HamlibTransceiver::init_rig () #endif } +void HamlibTransceiver::do_stop () +{ + if (rig_) + { + rig_close (rig_.data ()); + } + +#if WSJT_TRACE_CAT + qDebug () << "HamlibTransceiver::do_stop: state:" << state () << "reversed =" << reversed_; +#endif +} + auto HamlibTransceiver::get_vfos () const -> std::tuple { if (rig_->caps->get_vfo) @@ -696,42 +692,46 @@ void HamlibTransceiver::poll () update_mode (map_mode (m)); -#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS - qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo"; -#endif - vfo_t v {RIG_VFO_NONE}; // so we can tell if it doesn't get updated :( - auto rc = rig_get_split_vfo (rig_.data (), RIG_VFO_CURR, &s, &v); - if (-RIG_OK == rc && RIG_SPLIT_ON == s) + if (rig_->caps->get_split_vfo && split_query_works_) { #if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS - qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo split = " << s << " VFO = 0x" << hex << v; + qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo"; +#endif + vfo_t v {RIG_VFO_NONE}; // so we can tell if it doesn't get updated :( + auto rc = rig_get_split_vfo (rig_.data (), RIG_VFO_CURR, &s, &v); + if (-RIG_OK == rc && RIG_SPLIT_ON == s) + { +#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS + qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo split = " << s << " VFO = 0x" << hex << v; #endif - update_split (true); - // if (RIG_VFO_A == v) - // { - // reversed_ = true; // not sure if this helps us here - // } - } - else if (-RIG_OK == rc) // not split - { + update_split (true); + // if (RIG_VFO_A == v) + // { + // reversed_ = true; // not sure if this helps us here + // } + } + else if (-RIG_OK == rc) // not split + { #if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS - qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo split = " << s << " VFO = 0x" << hex << v; + qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo split = " << s << " VFO = 0x" << hex << v; #endif - update_split (false); - } - else if (-RIG_ENAVAIL == rc || -RIG_ENIMPL == rc) // Some rigs (Icom) don't have a way of reporting SPLIT mode - { + update_split (false); + } + else if (-RIG_ENAVAIL == rc || -RIG_ENIMPL == rc) // Some rigs (Icom) don't have a way of reporting SPLIT mode + { #if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS - qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo can't do on this rig"; + qDebug ().nospace () << "HamlibTransceiver::poll rig_get_split_vfo can't do on this rig"; #endif - // just report how we see it based on prior commands - } - else - { - error_check (rc, tr ("getting split TX VFO")); + // just report how we see it based on prior commands + split_query_works_ = false; + } + else + { + error_check (rc, tr ("getting split TX VFO")); + } } if (RIG_PTT_NONE != rig_->state.pttport.type.ptt && rig_->caps->get_ptt) diff --git a/HamlibTransceiver.hpp b/HamlibTransceiver.hpp index 4a6e1a724..c8a5c0ba3 100644 --- a/HamlibTransceiver.hpp +++ b/HamlibTransceiver.hpp @@ -55,7 +55,6 @@ class HamlibTransceiver final QByteArray get_conf (char const * item); Transceiver::MODE map_mode (rmode_t) const; rmode_t map_mode (Transceiver::MODE mode) const; - void init_rig (); std::tuple get_vfos () const; struct RIGDeleter {static void cleanup (RIG *);}; @@ -65,6 +64,8 @@ class HamlibTransceiver final bool is_dummy_; bool mutable reversed_; + + bool split_query_works_; }; #endif