diff --git a/WSPRBandHopping.cpp b/WSPRBandHopping.cpp index b2a1f49d5..f8309921a 100644 --- a/WSPRBandHopping.cpp +++ b/WSPRBandHopping.cpp @@ -319,15 +319,7 @@ auto WSPRBandHopping::next_hop () -> Hop band_index = next_hopping_band(); - if (100 == m_->tx_percent_) - { - tx_next = 1; - } - else - { - // consult scheduler to determine if next period should be a tx interval - tx_next = next_tx_state(m_->tx_percent_); - } + tx_next = next_is_tx (); int frequencies_index {-1}; auto const& frequencies = m_->configuration_->frequencies (); @@ -407,3 +399,16 @@ auto WSPRBandHopping::next_hop () -> Hop && !m_->bands_[5].testBit (band_index) // not an Rx only band }; } + +bool WSPRBandHopping::next_is_tx () +{ + if (100 == m_->tx_percent_) + { + return true; + } + else + { + // consult scheduler to determine if next period should be a tx interval + return next_tx_state(m_->tx_percent_); + } +} diff --git a/WSPRBandHopping.hpp b/WSPRBandHopping.hpp index 70fcc06c2..76e70830f 100644 --- a/WSPRBandHopping.hpp +++ b/WSPRBandHopping.hpp @@ -71,6 +71,8 @@ public: }; // return the next band parameters Hop next_hop (); + // determine if the next period should be a transmit period + bool next_is_tx (); private: class impl; diff --git a/mainwindow.cpp b/mainwindow.cpp index 5a7a77336..14d50b79f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4297,19 +4297,16 @@ void MainWindow::on_pbTxNext_clicked(bool b) void MainWindow::bandHopping() { - auto hop_data = m_WSPR_band_hopping.next_hop (); - qDebug () << "hop data: period:" << hop_data.period_name_ - << "frequencies index:" << hop_data.frequencies_index_ - << "tune:" << hop_data.tune_required_ - << "tx:" << hop_data.tx_next_; - - if (m_auto &&hop_data.tx_next_) { - m_nrx = 0; - } else { - m_nrx = 1; - } - + bool transmit {false}; if (ui->band_hopping_group_box->isChecked ()) { + auto hop_data = m_WSPR_band_hopping.next_hop (); + qDebug () << "hop data: period:" << hop_data.period_name_ + << "frequencies index:" << hop_data.frequencies_index_ + << "tune:" << hop_data.tune_required_ + << "tx:" << hop_data.tx_next_; + + transmit = hop_data.tx_next_; + // QThread::msleep(500); //### Is this OK to do ??? ### if (hop_data.frequencies_index_ >= 0) { // new band @@ -4323,7 +4320,7 @@ void MainWindow::bandHopping() QFile f {path}; if (f.exists ()) { m_cmnd = QDir::toNativeSeparators (f.fileName ()) + ' ' + - m_config.bands ()->find (m_dialFreq).remove ('m'); + m_config.bands ()->find (m_dialFreq).remove ('m'); } } if(m_cmnd!="") p3.start(m_cmnd); // Execute user's hardware controller @@ -4331,15 +4328,24 @@ void MainWindow::bandHopping() // Produce a short tuneup signal m_tuneup = false; if (hop_data.tune_required_) { - m_tuneup = true; - on_tuneButton_clicked (true); - tuneATU_Timer->start (2500); + m_tuneup = true; + on_tuneButton_clicked (true); + tuneATU_Timer->start (2500); } } // Display grayline status auto_tx_label->setText (hop_data.period_name_); } + else { + transmit = m_WSPR_band_hopping.next_is_tx (); + } + + if (m_auto && transmit) { + m_nrx = 0; + } else { + m_nrx = 1; + } } void MainWindow::on_tabWidget_currentChanged (int new_value)