From 3a6c4a3f7d07de9538db07d6236ea96e6d87b272 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 20 Apr 2015 13:45:55 +0000 Subject: [PATCH] Deal with Hamlib Net rigctl backed that promises more than it delivers git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5248 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- HamlibTransceiver.cpp | 23 +++++++++++++++++++---- HamlibTransceiver.hpp | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/HamlibTransceiver.cpp b/HamlibTransceiver.cpp index b1529eee3..3fbfa1737 100644 --- a/HamlibTransceiver.cpp +++ b/HamlibTransceiver.cpp @@ -169,6 +169,7 @@ HamlibTransceiver::HamlibTransceiver (int model_number , is_dummy_ {RIG_MODEL_DUMMY == model_number} , reversed_ {false} , split_query_works_ {true} + , get_vfo_works_ {true} { if (!rig_) { @@ -267,6 +268,19 @@ void HamlibTransceiver::do_start () error_check (rig_open (rig_.data ()), tr ("opening connection to rig")); + // the Net rigctl back end promises all functions work but we must + // test get_vfo as it determines our strategy for Icom rigs + vfo_t vfo; + int rc = rig_get_vfo (rig_.data (), &vfo); + if (-RIG_ENAVAIL == rc || -RIG_ENIMPL == rc) + { + get_vfo_works_ = false; + } + else + { + error_check (rc, "getting current VFO"); + } + if (!is_dummy_ && rig_->caps->set_split_vfo) // if split is possible // do some extra setup { @@ -276,7 +290,8 @@ void HamlibTransceiver::do_start () rmode_t mb; pbwidth_t w {RIG_PASSBAND_NORMAL}; pbwidth_t wb; - if (!rig_->caps->get_vfo && (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE))) + if ((!get_vfo_works_ || !rig_->caps->get_vfo) + && (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE))) { // Icom have deficient CAT protocol with no way of reading which // VFO is selected or if SPLIT is selected so we have to simply @@ -381,7 +396,7 @@ void HamlibTransceiver::do_start () { vfo_t v {RIG_VFO_A}; // assume RX always on VFO A/MAIN - if (rig_->caps->get_vfo) + if (get_vfo_works_ && rig_->caps->get_vfo) { #if WSJT_TRACE_CAT qDebug () << "HamlibTransceiver::init_rig rig_get_vfo current VFO"; @@ -431,7 +446,7 @@ void HamlibTransceiver::do_stop () auto HamlibTransceiver::get_vfos () const -> std::tuple { - if (rig_->caps->get_vfo) + if (get_vfo_works_ && rig_->caps->get_vfo) { vfo_t v; #if WSJT_TRACE_CAT @@ -697,7 +712,7 @@ void HamlibTransceiver::poll () pbwidth_t w; split_t s; - if (rig_->caps->get_vfo) + if (get_vfo_works_ && rig_->caps->get_vfo) { #if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS qDebug () << "HamlibTransceiver::poll rig_get_vfo"; diff --git a/HamlibTransceiver.hpp b/HamlibTransceiver.hpp index 20860b870..86b1b4233 100644 --- a/HamlibTransceiver.hpp +++ b/HamlibTransceiver.hpp @@ -69,6 +69,7 @@ class HamlibTransceiver final bool tickle_hamlib_; // Hamlib requires a // rig_set_split_vfo() call to // establish the Tx VFO + bool get_vfo_works_; // Net rigctl promises what it can't deliver }; #endif