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
This commit is contained in:
Bill Somerville 2014-11-29 18:15:05 +00:00
parent eaea408189
commit 2b614fd9e2
2 changed files with 45 additions and 44 deletions

View File

@ -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<vfo_t, vfo_t>
{
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)

View File

@ -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<vfo_t, vfo_t> 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