The Elecraft K3 is very picky about going to split mode

We have to ensure  that the band and mode along  with the frequency of
both VFOs is set before attempting to enable split mode.

Merged from wsjtx-1.4 branch.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4879 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-01-02 21:49:41 +00:00
parent 7d02ab0e10
commit 142f9eb2bd
2 changed files with 47 additions and 15 deletions

View File

@ -406,6 +406,8 @@ void HamlibTransceiver::do_start ()
update_mode (map_mode (m)); update_mode (map_mode (m));
} }
tickle_hamlib_ = true;
poll (); poll ();
#if WSJT_TRACE_CAT #if WSJT_TRACE_CAT
@ -476,6 +478,13 @@ void HamlibTransceiver::do_frequency (Frequency f, MODE m)
qDebug () << "HamlibTransceiver::do_frequency:" << f << "mode:" << m << "reversed:" << reversed_; qDebug () << "HamlibTransceiver::do_frequency:" << f << "mode:" << m << "reversed:" << reversed_;
#endif #endif
if (!is_dummy_)
{
// for the 1st time as a band change may cause a recalled mode
// to be set
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, f), tr ("setting frequency"));
}
if (UNK != m) if (UNK != m)
{ {
do_mode (m, false); do_mode (m, false);
@ -483,6 +492,8 @@ void HamlibTransceiver::do_frequency (Frequency f, MODE m)
if (!is_dummy_) if (!is_dummy_)
{ {
// for the 2nd time because a mode change may have caused a
// frequency change
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"));
} }
@ -509,19 +520,31 @@ void HamlibTransceiver::do_tx_frequency (Frequency tx, bool rationalise_mode)
// ensures that the internal Hamlib state is correct // ensures that the internal Hamlib state is correct
// otherwise rig_set_split_freq() will target the wrong VFO // otherwise rig_set_split_freq() will target the wrong VFO
// on some rigs // on some rigs
#if WSJT_TRACE_CAT
qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_vfo split =" << split; if (tickle_hamlib_)
#endif
auto rc = rig_set_split_vfo (rig_.data (), RIG_VFO_CURR, split, tx_vfo);
if (tx || (-RIG_ENAVAIL != rc && -RIG_ENIMPL != rc))
{ {
// On rigs that can't have split controlled only throw an // This potentially causes issues with the Elecraft K3
// exception when an error other than command not accepted // which will block setting split mode when it deems
// is returned when trying to leave split mode. This allows // cross mode split operation not possible. There's not
// fake split mode and non-split mode to work without error // much we can do since the Hamlib Library needs this
// on such rigs without having to know anything about the // call at least once to establish the Tx VFO. Best we
// specific rig. // can do is only do this once per session.
error_check (rc, tr ("setting/unsetting split mode")); #if WSJT_TRACE_CAT
qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_vfo split =" << split;
#endif
auto rc = rig_set_split_vfo (rig_.data (), RIG_VFO_CURR, split, tx_vfo);
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
// is returned when trying to leave split mode. This allows
// fake split mode and non-split mode to work without error
// on such rigs without having to know anything about the
// specific rig.
error_check (rc, tr ("setting/unsetting split mode"));
}
tickle_hamlib_ = false;
} }
#if WSJT_TRACE_CAT #if WSJT_TRACE_CAT
@ -529,6 +552,9 @@ void HamlibTransceiver::do_tx_frequency (Frequency tx, bool rationalise_mode)
#endif #endif
hamlib_tx_vfo_fixup fixup (rig_.data (), tx_vfo); hamlib_tx_vfo_fixup fixup (rig_.data (), tx_vfo);
// do this before setting the mode because changing band may
// recall the last mode used on the target band
error_check (rig_set_split_freq (rig_.data (), RIG_VFO_CURR, tx), tr ("setting split TX frequency")); error_check (rig_set_split_freq (rig_.data (), RIG_VFO_CURR, tx), tr ("setting split TX frequency"));
if (rationalise_mode) if (rationalise_mode)
@ -551,14 +577,17 @@ void HamlibTransceiver::do_tx_frequency (Frequency tx, bool rationalise_mode)
qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_mode mode = " << rig_strrmode (new_mode); qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_mode mode = " << rig_strrmode (new_mode);
#endif #endif
error_check (rig_set_split_mode (rig_.data (), RIG_VFO_CURR, new_mode, rig_passband_wide (rig_.data (), new_mode)), tr ("setting split TX VFO mode")); error_check (rig_set_split_mode (rig_.data (), RIG_VFO_CURR, new_mode, rig_passband_wide (rig_.data (), new_mode)), tr ("setting split TX VFO mode"));
// do this again as setting the mode may change the frequency
error_check (rig_set_split_freq (rig_.data (), RIG_VFO_CURR, tx), tr ("setting split TX frequency"));
} }
} }
} }
// enable split last since some rigs (Kenwood for one) come out // Enable split last since some rigs (Kenwood for one) come out
// of split when you switch RX VFO (to set split mode above for // of split when you switch RX VFO (to set split mode above for
// example) // example). Also the Elecraft K3 will refuse to go to split
// with certain VFO A/B mode combinations.
#if WSJT_TRACE_CAT #if WSJT_TRACE_CAT
qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_vfo split =" << split; qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_vfo split =" << split;
#endif #endif

View File

@ -66,6 +66,9 @@ class HamlibTransceiver final
bool mutable reversed_; bool mutable reversed_;
bool split_query_works_; bool split_query_works_;
bool tickle_hamlib_; // Hamlib requires a
// rig_set_split_vfo() call to
// establish the Tx VFO
}; };
#endif #endif