From df93758d9bc758a8d38da8156ee0dea3c92fb6d2 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 1 Sep 2014 10:27:31 +0000 Subject: [PATCH] Allow for inconsistent Hamlib return codes. It appears that Hamlib uses two different return codes to indicate missing functionality and doesn't use them consistently. The Hamlib rig control code now checks for either code when testing for function availability. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4239 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- HamlibTransceiver.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/HamlibTransceiver.cpp b/HamlibTransceiver.cpp index 034c82b97..b5b104cf0 100644 --- a/HamlibTransceiver.cpp +++ b/HamlibTransceiver.cpp @@ -535,7 +535,7 @@ void HamlibTransceiver::do_tx_frequency (Frequency tx, bool rationalise_mode) #endif auto rc = rig_set_split_vfo (rig_.data (), RIG_VFO_CURR, tx ? RIG_SPLIT_ON : RIG_SPLIT_OFF, tx_vfo); - if (tx || -RIG_ENAVAIL != rc) + if (tx || (-RIG_ENAVAIL != rc && -RIG_ENIMPL != rc)) { // On rigs that can't have split controlled only throw an // exception when an error other than command not accepted @@ -672,7 +672,7 @@ void HamlibTransceiver::poll () 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_OK == rc && RIG_SPLIT_ON == s) { #if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS @@ -685,7 +685,7 @@ void HamlibTransceiver::poll () // reversed_ = true; // not sure if this helps us here // } } - else if (RIG_OK == rc) // not split + else if (-RIG_OK == rc) // not split { #if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS qDebug ().nospace () << "HamlibTransceiver::state rig_get_split_vfo split = " << s << " VFO = 0x" << hex << v; @@ -693,7 +693,7 @@ void HamlibTransceiver::poll () update_split (false); } - else if (-RIG_ENAVAIL == rc) // Some rigs (Icom) don't have a way of reporting SPLIT mode + 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::state rig_get_split_vfo can't do on this rig"; @@ -710,8 +710,9 @@ void HamlibTransceiver::poll () { ptt_t p; auto rc = rig_get_ptt (rig_.data (), RIG_VFO_CURR, &p); - if (RIG_ENAVAIL != rc) // may fail if Net rig ctl and target - // doesn't support command + if (-RIG_ENAVAIL != rc && -RIG_ENIMPL != rc) // may fail if + // Net rig ctl and target doesn't + // support command { error_check (rc, tr ("getting PTT state"));