From 3b43a183624b397ec39d4690071f9961ab9404f1 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 30 Oct 2014 22:03:04 +0000 Subject: [PATCH] Fix various fake split mode issues Merged from wsjtx-1.4 branch. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4573 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- DXLabSuiteCommanderTransceiver.cpp | 2 +- EmulateSplitTransceiver.cpp | 14 ++++-- EmulateSplitTransceiver.hpp | 1 + mainwindow.cpp | 77 +++++++++++++++--------------- 4 files changed, 50 insertions(+), 44 deletions(-) diff --git a/DXLabSuiteCommanderTransceiver.cpp b/DXLabSuiteCommanderTransceiver.cpp index 0ff38c565..b6f36d1e1 100644 --- a/DXLabSuiteCommanderTransceiver.cpp +++ b/DXLabSuiteCommanderTransceiver.cpp @@ -111,7 +111,7 @@ void DXLabSuiteCommanderTransceiver::do_ptt (bool on) update_PTT (on); - do_frequency (state ().frequency ()); // gets Commander synchronized + // do_frequency (state ().frequency ()); // gets Commander synchronized } void DXLabSuiteCommanderTransceiver::do_frequency (Frequency f) diff --git a/EmulateSplitTransceiver.cpp b/EmulateSplitTransceiver.cpp index 3769b1bd9..4c959eb31 100644 --- a/EmulateSplitTransceiver.cpp +++ b/EmulateSplitTransceiver.cpp @@ -3,6 +3,7 @@ EmulateSplitTransceiver::EmulateSplitTransceiver (std::unique_ptr wrapped) : wrapped_ {std::move (wrapped)} , frequency_ {0, 0} + , pre_tx_frequency_ {0} , tx_ {false} { // Connect update signal of wrapped Transceiver object instance to ours. @@ -52,8 +53,11 @@ void EmulateSplitTransceiver::ptt (bool on) noexcept #endif // Save TX state for future frequency change requests. - if ((tx_ = on)) + if (on) { + // save the Rx frequency + pre_tx_frequency_ = frequency_[0]; + // Switch to other frequency if we have one i.e. client wants // split operation). wrapped_->frequency (frequency_[frequency_[1] ? 1 : 0]); @@ -67,8 +71,10 @@ void EmulateSplitTransceiver::ptt (bool on) noexcept wrapped_->ptt (false); // Switch to RX frequency. - wrapped_->frequency (frequency_[0]); + wrapped_->frequency (pre_tx_frequency_); + pre_tx_frequency_ = 0; } + tx_ = on; } void EmulateSplitTransceiver::handle_update (TransceiverState state) @@ -79,9 +85,9 @@ void EmulateSplitTransceiver::handle_update (TransceiverState state) // Change to reflect emulated state, we don't want to report the // shifted frequency when transmitting. - if (tx_) + if (pre_tx_frequency_) { - state.frequency (frequency_[0]); + state.frequency (pre_tx_frequency_); } else { diff --git a/EmulateSplitTransceiver.hpp b/EmulateSplitTransceiver.hpp index 7f32247e0..c57c3c4d9 100644 --- a/EmulateSplitTransceiver.hpp +++ b/EmulateSplitTransceiver.hpp @@ -46,6 +46,7 @@ private: std::unique_ptr wrapped_; Frequency frequency_[2]; // [0] <- RX, [1] <- other + Frequency pre_tx_frequency_; // return to this on switching to Rx bool tx_; }; diff --git a/mainwindow.cpp b/mainwindow.cpp index cf23db3e4..1e1e34348 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2846,13 +2846,8 @@ void MainWindow::on_cbPlus2kHz_toggled(bool checked) void MainWindow::handle_transceiver_update (Transceiver::TransceiverState s) { - static bool prior_ptt {false}; - if (!s.ptt () && prior_ptt) - { - transmitDisplay (false); - } - prior_ptt = s.ptt (); + transmitDisplay (false); if ((s.frequency () - m_dialFreq) || s.split () != m_splitMode) { @@ -3046,44 +3041,48 @@ void MainWindow::pskSetLocal () void MainWindow::transmitDisplay (bool transmitting) { - if (transmitting) - { - signalMeter->setValue(0); - if (m_monitoring) + if (transmitting == m_transmitting) + { + if (transmitting) { - monitor (false); + signalMeter->setValue(0); + + if (m_monitoring) + { + monitor (false); + } + + m_btxok=true; } - m_btxok=true; - } - - auto QSY_allowed = !transmitting || m_config.tx_QSY_allowed () || !m_config.split_mode (); - if (ui->cbTxLock->isChecked ()) - { - ui->RxFreqSpinBox->setEnabled (QSY_allowed); - ui->pbT2R->setEnabled (QSY_allowed); - } - ui->TxFreqSpinBox->setEnabled (QSY_allowed); - ui->pbR2T->setEnabled (QSY_allowed); - ui->cbTxLock->setEnabled (QSY_allowed); - - // only allow +2kHz when not transmitting or if TX QSYs are allowed - ui->cbPlus2kHz->setEnabled (!transmitting || m_config.tx_QSY_allowed ()); - - // the following are always disallowed in transmit - ui->menuMode->setEnabled (!transmitting); - ui->bandComboBox->setEnabled (!transmitting); - if (!transmitting) - { - if ("JT9+JT65" == m_mode) + auto QSY_allowed = !transmitting || m_config.tx_QSY_allowed () || !m_config.split_mode (); + if (ui->cbTxLock->isChecked ()) { - // allow mode switch in Rx when in dual mode - ui->pbTxMode->setEnabled (true); + ui->RxFreqSpinBox->setEnabled (QSY_allowed); + ui->pbT2R->setEnabled (QSY_allowed); + } + ui->TxFreqSpinBox->setEnabled (QSY_allowed); + ui->pbR2T->setEnabled (QSY_allowed); + ui->cbTxLock->setEnabled (QSY_allowed); + + // only allow +2kHz when not transmitting or if TX QSYs are allowed + ui->cbPlus2kHz->setEnabled (!transmitting || m_config.tx_QSY_allowed ()); + + // the following are always disallowed in transmit + ui->menuMode->setEnabled (!transmitting); + ui->bandComboBox->setEnabled (!transmitting); + if (!transmitting) + { + if ("JT9+JT65" == m_mode) + { + // allow mode switch in Rx when in dual mode + ui->pbTxMode->setEnabled (true); + } + } + else + { + ui->pbTxMode->setEnabled (false); } - } - else - { - ui->pbTxMode->setEnabled (false); } }