From d864e7f4cbadbdc5d096311c84d2db34b0a3fc66 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 6 Apr 2016 17:11:49 +0000 Subject: [PATCH] Allow split operating for "None" rig, use for testing only not for release Setting the CMake option WSJT_RIG_NONE_CAN_SPLIT=ON will buold a version taht allows split operating with the dummy rig. This must not be shipped since it will generate incorrect Tx tones. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6589 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 1 + Configuration.cpp | 15 +++++++-------- HamlibTransceiver.cpp | 16 +++++++++------- wsjtx_config.h.in | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0024dff5..947467f33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,7 @@ option (WSJT_HAMLIB_TRACE "Debugging option that turns on minimal Hamlib interna option (WSJT_SOFT_KEYING "Apply a ramp to CW keying envelope to reduce transients." ON) option (WSJT_SKIP_MANPAGES "Skip *nix manpage generation.") option (WSJT_GENERATE_DOCS "Generate documentation files." ON) +option (WSJT_RIG_NONE_CAN_SPLIT "Allow split operation with \"None\" as rig.") CMAKE_DEPENDENT_OPTION (WSJT_HAMLIB_VERBOSE_TRACE "Debugging option that turns on full Hamlib internal diagnostics." OFF WSJT_HAMLIB_TRACE OFF) CMAKE_DEPENDENT_OPTION (WSJT_QDEBUG_IN_RELEASE "Leave Qt debugging statements in Release configuration." OFF diff --git a/Configuration.cpp b/Configuration.cpp index ef69f77c8..a14157d62 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -638,8 +638,9 @@ bool Configuration::EMEonly() const {return m_->EMEonly_;} bool Configuration::offsetRxFreq () const {return m_->offsetRxFreq_;} bool Configuration::split_mode () const { - return !m_->rig_is_dummy_ and - (m_->rig_params_.split_mode != TransceiverFactory::split_mode_none); + return + (WSJT_RIG_NONE_CAN_SPLIT || !m_->rig_is_dummy_) && + (m_->rig_params_.split_mode != TransceiverFactory::split_mode_none); } QString Configuration::udp_server_name () const {return m_->udp_server_name_;} auto Configuration::udp_server_port () const -> port_type {return m_->udp_server_port_;} @@ -1483,8 +1484,6 @@ void Configuration::impl::set_rig_invariants () ui_->test_PTT_push_button->setEnabled (TransceiverFactory::PTT_method_DTR == ptt_method || TransceiverFactory::PTT_method_RTS == ptt_method); ui_->TX_audio_source_group_box->setEnabled (false); - ui_->mode_group_box->setEnabled (false); - ui_->split_operation_group_box->setEnabled (false); } else { @@ -1493,8 +1492,6 @@ void Configuration::impl::set_rig_invariants () ui_->test_CAT_push_button->setEnabled (true); ui_->test_PTT_push_button->setEnabled (false); ui_->TX_audio_source_group_box->setEnabled (transceiver_factory_.has_CAT_PTT_mic_data (rig) && TransceiverFactory::PTT_method_CAT == ptt_method); - ui_->mode_group_box->setEnabled (true); - ui_->split_operation_group_box->setEnabled (true); if (port_type != last_port_type) { last_port_type = port_type; @@ -1552,9 +1549,11 @@ void Configuration::impl::set_rig_invariants () && (cat_port != ptt_port || !ui_->PTT_RTS_radio_button->isEnabled () || !ui_->PTT_RTS_radio_button->isChecked ())); - ui_->reset_split_check_box->setEnabled (TransceiverFactory::split_mode_rig - == static_cast (ui_->split_mode_button_group->checkedId ())); } + ui_->mode_group_box->setEnabled (WSJT_RIG_NONE_CAN_SPLIT + || TransceiverFactory::basic_transceiver_name_ != rig); + ui_->split_operation_group_box->setEnabled (WSJT_RIG_NONE_CAN_SPLIT + || TransceiverFactory::basic_transceiver_name_ != rig); } bool Configuration::impl::validate () diff --git a/HamlibTransceiver.cpp b/HamlibTransceiver.cpp index 32fcb2600..cc9f26281 100644 --- a/HamlibTransceiver.cpp +++ b/HamlibTransceiver.cpp @@ -413,8 +413,8 @@ void HamlibTransceiver::do_start () error_check (rc, "getting current VFO"); } - if (!is_dummy_ && rig_->caps->set_split_vfo) // if split is possible - // do some extra setup + if ((WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_) + && rig_->caps->set_split_vfo) // if split is possible do some extra setup { freq_t f1; freq_t f2; @@ -576,7 +576,7 @@ auto HamlibTransceiver::get_vfos () const -> std::tuple // else only toggle available but both VFOs should be substitutable auto rx_vfo = rig_->state.vfo_list & RIG_VFO_A ? RIG_VFO_A : RIG_VFO_MAIN; - auto tx_vfo = !is_dummy_ && state ().split () + auto tx_vfo = (WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_) ? (rig_->state.vfo_list & RIG_VFO_B ? RIG_VFO_B : RIG_VFO_SUB) : rx_vfo; if (reversed_) @@ -617,8 +617,7 @@ void HamlibTransceiver::do_tx_frequency (Frequency tx, bool rationalise_mode) { TRACE_CAT (tx << "rationalise mode:" << rationalise_mode << "reversed:" << reversed_); - if (!is_dummy_) // split is meaning less if you can't - // see it + if (WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_) // split is meaningless if you can't see it { auto split = tx ? RIG_SPLIT_ON : RIG_SPLIT_OFF; update_split (tx); @@ -766,7 +765,9 @@ void HamlibTransceiver::poll () TRACE_CAT_POLL ("rig_get_freq frequency =" << f); update_rx_frequency (f); - if (!is_dummy_ && state ().split () && (rig_->caps->targetable_vfo & (RIG_TARGETABLE_FREQ | RIG_TARGETABLE_PURE))) + if ((WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_) + && state ().split () + && (rig_->caps->targetable_vfo & (RIG_TARGETABLE_FREQ | RIG_TARGETABLE_PURE))) { // only read "other" VFO if in split, this allows rigs like // FlexRadio to work in Kenwood TS-2000 mode despite them @@ -803,7 +804,8 @@ void HamlibTransceiver::poll () } } - if (!is_dummy_ && rig_->caps->get_split_vfo && split_query_works_) + if ((WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_) + && rig_->caps->get_split_vfo && split_query_works_) { 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); diff --git a/wsjtx_config.h.in b/wsjtx_config.h.in index 4fc873726..23f4f2952 100644 --- a/wsjtx_config.h.in +++ b/wsjtx_config.h.in @@ -27,7 +27,7 @@ #cmakedefine01 WSJT_HAMLIB_VERBOSE_TRACE #cmakedefine01 WSJT_SOFT_KEYING #cmakedefine01 WSJT_ENABLE_EXPERIMENTAL_FEATURES -#cmakedefine01 WSJT_INCLUDE_KVASD +#cmakedefine01 WSJT_RIG_NONE_CAN_SPLIT #define WSJTX_STRINGIZE1(x) #x #define WSJTX_STRINGIZE(x) WSJTX_STRINGIZE1(x)