Allow for rigs with neither get VFO nor toggle VFO CAT commands

Some    rigs    always    receive     on    the    same    VFO,    the
HamlibTransceiver::init_rig()  method was  not allowing  for this.  It
needs  to simply  do  nothing  and assume  VFO  MAIN/A  is current  at
startup.

Merged from wsjtx-1.4 branch.




git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4450 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-10-02 14:46:32 +00:00
parent aa6ece2262
commit 4e5c1713f2

View File

@ -290,7 +290,7 @@ void HamlibTransceiver::init_rig ()
rmode_t mb; rmode_t mb;
pbwidth_t w {rig_passband_wide (rig_.data (), m)}; pbwidth_t w {rig_passband_wide (rig_.data (), m)};
pbwidth_t wb; pbwidth_t wb;
if (!rig_->caps->get_vfo) if (!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 // Icom have deficient CAT protocol with no way of reading which
// VFO is selected or if SPLIT is selected so we have to simply // VFO is selected or if SPLIT is selected so we have to simply
@ -314,18 +314,10 @@ void HamlibTransceiver::init_rig ()
if (!rig_->caps->set_vfo) if (!rig_->caps->set_vfo)
{ {
if (rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE))
{
#if WSJT_TRACE_CAT #if WSJT_TRACE_CAT
qDebug () << "HamlibTransceiver::init_rig rig_vfo_op TOGGLE"; qDebug () << "HamlibTransceiver::init_rig rig_vfo_op TOGGLE";
#endif #endif
error_check (rig_vfo_op (rig_.data (), RIG_VFO_CURR, RIG_OP_TOGGLE), tr ("exchanging VFOs")); error_check (rig_vfo_op (rig_.data (), RIG_VFO_CURR, RIG_OP_TOGGLE), tr ("exchanging VFOs"));
}
else
{
throw error {tr ("Hamlib: unable to initialise rig")};
}
} }
else else
{ {
@ -401,14 +393,18 @@ void HamlibTransceiver::init_rig ()
} }
else else
{ {
vfo_t v; vfo_t v {RIG_VFO_A}; // assume RX always on VFO A/MAIN
if (rig_->caps->get_vfo)
{
#if WSJT_TRACE_CAT #if WSJT_TRACE_CAT
qDebug ().nospace () << "HamlibTransceiver::init_rig rig_get_vfo current VFO"; qDebug ().nospace () << "HamlibTransceiver::init_rig rig_get_vfo current VFO";
#endif #endif
error_check (rig_get_vfo (rig_.data (), &v), tr ("getting current VFO")); // has side effect of establishing current VFO inside hamlib error_check (rig_get_vfo (rig_.data (), &v), tr ("getting current VFO")); // has side effect of establishing current VFO inside hamlib
#if WSJT_TRACE_CAT #if WSJT_TRACE_CAT
qDebug ().nospace () << "HamlibTransceiver::init_rig rig_get_vfo current VFO = 0x" << hex << v; qDebug ().nospace () << "HamlibTransceiver::init_rig rig_get_vfo current VFO = 0x" << hex << v;
#endif #endif
}
reversed_ = RIG_VFO_B == v; reversed_ = RIG_VFO_B == v;