Allow for broken Kenwood CAT emulations

The HDSDR  software returns invalid  responses to mode  query commands
MD. This change detects that and does no more mode queries. This means
mode management is not possible with this rig until it is fixed.

Merged from ^/branches/wsjtx.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.6@6203 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-11-29 23:38:37 +00:00
parent 73b1b35685
commit 58e336e69e
2 changed files with 28 additions and 9 deletions

View File

@ -166,6 +166,7 @@ HamlibTransceiver::HamlibTransceiver (TransceiverFactory::PTTMethod ptt_type, QS
, back_ptt_port_ {false} , back_ptt_port_ {false}
, is_dummy_ {true} , is_dummy_ {true}
, reversed_ {false} , reversed_ {false}
, mode_query_works_ {true}
, split_query_works_ {true} , split_query_works_ {true}
, get_vfo_works_ {true} , get_vfo_works_ {true}
{ {
@ -213,6 +214,7 @@ HamlibTransceiver::HamlibTransceiver (int model_number, TransceiverFactory::Para
, back_ptt_port_ {TransceiverFactory::TX_audio_source_rear == params.audio_source} , back_ptt_port_ {TransceiverFactory::TX_audio_source_rear == params.audio_source}
, is_dummy_ {RIG_MODEL_DUMMY == model_number} , is_dummy_ {RIG_MODEL_DUMMY == model_number}
, reversed_ {false} , reversed_ {false}
, mode_query_works_ {true}
, split_query_works_ {true} , split_query_works_ {true}
, tickle_hamlib_ {false} , tickle_hamlib_ {false}
, get_vfo_works_ {true} , get_vfo_works_ {true}
@ -428,11 +430,21 @@ void HamlibTransceiver::do_start ()
reversed_ = RIG_VFO_B == v; reversed_ = RIG_VFO_B == v;
if (!(rig_->caps->targetable_vfo & (RIG_TARGETABLE_MODE | RIG_TARGETABLE_PURE))) if (mode_query_works_ && !(rig_->caps->targetable_vfo & (RIG_TARGETABLE_MODE | RIG_TARGETABLE_PURE)))
{
if (RIG_OK == rig_get_mode (rig_.data (), RIG_VFO_CURR, &m, &w))
{ {
error_check (rig_get_mode (rig_.data (), RIG_VFO_CURR, &m, &w), tr ("getting current mode"));
TRACE_CAT ("rig_get_mode current mode =" << rig_strrmode (m) << "bw =" << w); TRACE_CAT ("rig_get_mode current mode =" << rig_strrmode (m) << "bw =" << w);
} }
else
{
mode_query_works_ = false;
// Some rigs (HDSDR) don't have a working way of
// reporting MODE so we give up on mode queries -
// sets will still cause an error
TRACE_CAT_POLL ("rig_get_mode can't do on this rig");
}
}
} }
update_mode (map_mode (m)); update_mode (map_mode (m));
} }
@ -462,9 +474,12 @@ void HamlibTransceiver::do_stop ()
if (is_dummy_) if (is_dummy_)
{ {
rig_get_freq (rig_.data (), RIG_VFO_CURR, &dummy_frequency_); rig_get_freq (rig_.data (), RIG_VFO_CURR, &dummy_frequency_);
if (mode_query_works_)
{
pbwidth_t width; pbwidth_t width;
rig_get_mode (rig_.data (), RIG_VFO_CURR, &dummy_mode_, &width); rig_get_mode (rig_.data (), RIG_VFO_CURR, &dummy_mode_, &width);
} }
}
if (rig_) if (rig_)
{ {
rig_close (rig_.data ()); rig_close (rig_.data ());
@ -516,7 +531,7 @@ void HamlibTransceiver::do_frequency (Frequency f, MODE m)
// set // set
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, f), tr ("setting frequency")); error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, f), tr ("setting frequency"));
if (UNK != m) if (mode_query_works_ && UNK != m)
{ {
do_mode (m, false); do_mode (m, false);
@ -702,9 +717,12 @@ void HamlibTransceiver::poll ()
update_other_frequency (f); update_other_frequency (f);
} }
if (mode_query_works_)
{
error_check (rig_get_mode (rig_.data (), RIG_VFO_CURR, &m, &w), tr ("getting current VFO mode")); error_check (rig_get_mode (rig_.data (), RIG_VFO_CURR, &m, &w), tr ("getting current VFO mode"));
TRACE_CAT_POLL ("rig_get_mode mode =" << rig_strrmode (m) << "bw =" << w); TRACE_CAT_POLL ("rig_get_mode mode =" << rig_strrmode (m) << "bw =" << w);
update_mode (map_mode (m)); update_mode (map_mode (m));
}
if (!is_dummy_ && rig_->caps->get_split_vfo && split_query_works_) if (!is_dummy_ && rig_->caps->get_split_vfo && split_query_works_)
{ {

View File

@ -60,6 +60,7 @@ class HamlibTransceiver final
bool mutable reversed_; bool mutable reversed_;
bool mode_query_works_;
bool split_query_works_; bool split_query_works_;
bool tickle_hamlib_; // Hamlib requires a bool tickle_hamlib_; // Hamlib requires a
// rig_set_split_vfo() call to // rig_set_split_vfo() call to