From ec644ae5f624cdb3f48e35978bb2ee6268ac6d38 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 2 Feb 2018 15:18:39 +0000 Subject: [PATCH] Implement optional x4 tone spacing for FT8, JT9, WSPR. Also some code cleanup. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8447 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Configuration.cpp | 35 ++++++++++++++++++++--------------- Configuration.hpp | 2 +- Configuration.ui | 16 ++++++++-------- mainwindow.cpp | 37 +++++++++++-------------------------- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 393867f80..3d19c0878 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -446,6 +446,8 @@ private: Q_SLOT void on_pbNewCall_clicked(); Q_SLOT void on_cbFox_clicked (bool); Q_SLOT void on_cbHound_clicked (bool); + Q_SLOT void on_cbx2ToneSpacing_clicked(bool); + Q_SLOT void on_cbx4ToneSpacing_clicked(bool); // typenames used as arguments must match registered type names :( Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const; @@ -566,7 +568,7 @@ private: bool bFox_; bool bHound_; bool x2ToneSpacing_; - bool realTimeDecode_; + bool x4ToneSpacing_; QString opCall_; QString udp_server_name_; port_type udp_server_port_; @@ -667,7 +669,7 @@ bool Configuration::twoPass() const {return m_->twoPass_;} bool Configuration::bFox() const {return m_->bFox_;} bool Configuration::bHound() const {return m_->bHound_;} bool Configuration::x2ToneSpacing() const {return m_->x2ToneSpacing_;} -bool Configuration::realTimeDecode() const {return m_->realTimeDecode_;} +bool Configuration::x4ToneSpacing() const {return m_->x4ToneSpacing_;} bool Configuration::split_mode () const {return m_->split_mode ();} QString Configuration::opCall() const {return m_->opCall_;} QString Configuration::udp_server_name () const {return m_->udp_server_name_;} @@ -1138,8 +1140,7 @@ void Configuration::impl::initialize_models () ui_->cbFox->setChecked(bFox_); ui_->cbHound->setChecked(bHound_); ui_->cbx2ToneSpacing->setChecked(x2ToneSpacing_); - ui_->cbRealTime->setChecked(realTimeDecode_); - ui_->cbRealTime->setVisible(false); //Tempoary -- probably will remove this control + ui_->cbx4ToneSpacing->setChecked(x4ToneSpacing_); ui_->type_2_msg_gen_combo_box->setCurrentIndex (type_2_msg_gen_); ui_->rig_combo_box->setCurrentText (rig_params_.rig_name); ui_->TX_mode_button_group->button (data_mode_)->setChecked (true); @@ -1375,7 +1376,7 @@ void Configuration::impl::read_settings () bFox_ = settings_->value("Fox",false).toBool (); bHound_ = settings_->value("Hound",false).toBool (); x2ToneSpacing_ = settings_->value("x2ToneSpacing",false).toBool (); - realTimeDecode_ = settings_->value("RealTimeDecode",false).toBool (); + x4ToneSpacing_ = settings_->value("x4ToneSpacing",false).toBool (); rig_params_.poll_interval = settings_->value ("Polling", 0).toInt (); rig_params_.split_mode = settings_->value ("SplitMode", QVariant::fromValue (TransceiverFactory::split_mode_none)).value (); opCall_ = settings_->value ("OpCall", "").toString (); @@ -1480,7 +1481,7 @@ void Configuration::impl::write_settings () settings_->setValue ("Fox", bFox_); settings_->setValue ("Hound", bHound_); settings_->setValue ("x2ToneSpacing", x2ToneSpacing_); - settings_->setValue ("RealTimeDecode", realTimeDecode_); + settings_->setValue ("x4ToneSpacing", x4ToneSpacing_); settings_->setValue ("OpCall", opCall_); settings_->setValue ("UDPServer", udp_server_name_); settings_->setValue ("UDPServerPort", udp_server_port_); @@ -1882,7 +1883,7 @@ void Configuration::impl::accept () bFox_ = ui_->cbFox->isChecked (); bHound_ = ui_->cbHound->isChecked (); x2ToneSpacing_ = ui_->cbx2ToneSpacing->isChecked (); - realTimeDecode_ = ui_->cbRealTime->isChecked (); + x4ToneSpacing_ = ui_->cbx4ToneSpacing->isChecked (); calibration_.intercept = ui_->calibration_intercept_spin_box->value (); calibration_.slope_ppm = ui_->calibration_slope_ppm_spin_box->value (); pwrBandTxMemory_ = ui_->checkBoxPwrBandTxMemory->isChecked (); @@ -2360,18 +2361,22 @@ void Configuration::impl::on_calibration_slope_ppm_spin_box_valueChanged (double void Configuration::impl::on_cbFox_clicked (bool checked) { - if (checked) - { - ui_->cbHound->setChecked (false); - } + if (checked) ui_->cbHound->setChecked (false); } void Configuration::impl::on_cbHound_clicked (bool checked) { - if (checked) - { - ui_->cbFox->setChecked (false); - } + if (checked) ui_->cbFox->setChecked (false); +} + +void Configuration::impl::on_cbx2ToneSpacing_clicked(bool b) +{ + if(b) ui_->cbx4ToneSpacing->setChecked(false); +} + +void Configuration::impl::on_cbx4ToneSpacing_clicked(bool b) +{ + if(b) ui_->cbx2ToneSpacing->setChecked(false); } bool Configuration::impl::have_rig () diff --git a/Configuration.hpp b/Configuration.hpp index 1f4a19245..a87e33814 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -129,8 +129,8 @@ public: bool bFox() const; bool bHound() const; bool x2ToneSpacing() const; + bool x4ToneSpacing() const; bool contestMode() const; - bool realTimeDecode() const; bool MyDx() const; bool CQMyN() const; bool NDxG() const; diff --git a/Configuration.ui b/Configuration.ui index 3c4831933..c31fe3f22 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -7,7 +7,7 @@ 0 0 534 - 507 + 530 @@ -2439,15 +2439,15 @@ Right click for insert and delete options. - + - false + true <html><head/><body><p>Decode on-the-fly rather than at end of Rx sequence.</p></body></html> - MSK144 Realtime decode + x 4 Tone Spacing @@ -2683,7 +2683,7 @@ soundcard changes sbBandwidth sbTxDelay cbx2ToneSpacing - cbRealTime + cbx4ToneSpacing @@ -2753,12 +2753,12 @@ soundcard changes - + - - + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 7ae94c8b2..46af6e79f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1522,7 +1522,6 @@ void MainWindow::fastSink(qint64 frames) m_k0=k; if(m_diskData and m_k0 >= dec_data.params.kin - 7 * 512) decodeNow=true; if(!m_diskData and m_tRemaining<0.35 and !m_bFastDecodeCalled) decodeNow=true; -// if(m_mode=="MSK144" and m_config.realTimeDecode()) decodeNow=false; if(m_mode=="MSK144") decodeNow=false; if(decodeNow) { @@ -2682,7 +2681,6 @@ void MainWindow::decode() //decode() if(m_nPick > 0) { t0=m_t0Pick; t1=m_t1Pick; -// if(t1 > m_kdone/12000.0 and !m_config.realTimeDecode()) t1=m_kdone/12000.0; } static short int d2b[360000]; narg[0]=dec_data.params.nutc; @@ -2803,8 +2801,8 @@ void MainWindow::readFromStdout() //readFromStdout if(m_mode=="FT8" and !m_config.bHound() and t.contains(";")) { QString errorMsg; MessageBox::critical_message (this, - tr("Should you be in FT8 DXpedition mode?"), errorMsg); - } + tr("Should you be in \"FT8 DXpedition Hound\" mode?"), errorMsg); + } // qint64 ms=QDateTime::currentMSecsSinceEpoch() - m_msec0; bool bAvgMsg=false; int navg=0; @@ -3601,7 +3599,6 @@ void MainWindow::guiUpdate() tx_status_label.setStyleSheet("QLabel{background-color: #00ff00}"); QString t; t="Receiving"; -// if(m_mode=="MSK144" and m_config.realTimeDecode()) { if(m_mode=="MSK144") { int npct=int(100.0*m_fCPUmskrtd/0.298667); if(npct>90) tx_status_label.setStyleSheet("QLabel{background-color: #ff0000}"); @@ -6082,6 +6079,7 @@ void MainWindow::transmit (double snr) if (m_modeTx == "FT8") { toneSpacing=12000.0/1920.0; if(m_config.x2ToneSpacing()) toneSpacing=2*12000.0/1920.0; + if(m_config.x4ToneSpacing()) toneSpacing=4*12000.0/1920.0; if(m_config.bFox() and !m_tune) toneSpacing=-1; Q_EMIT sendMessage (NUM_FT8_SYMBOLS, 1920.0, ui->TxFreqSpinBox->value () - m_XIT, @@ -6107,6 +6105,7 @@ void MainWindow::transmit (double snr) double sps=m_nsps; m_toneSpacing=nsub*12000.0/6912.0; if(m_config.x2ToneSpacing()) m_toneSpacing=2.0*m_toneSpacing; + if(m_config.x4ToneSpacing()) m_toneSpacing=4.0*m_toneSpacing; bool fastmode=false; if(m_bFast9 and (m_nSubMode>=4)) { fastmode=true; @@ -6153,6 +6152,7 @@ void MainWindow::transmit (double snr) if (m_mode=="WSPR") { int nToneSpacing=1; if(m_config.x2ToneSpacing()) nToneSpacing=2; + if(m_config.x4ToneSpacing()) nToneSpacing=4; Q_EMIT sendMessage (NUM_WSPR_SYMBOLS, 8192.0, ui->TxFreqSpinBox->value() - 1.5 * 12000 / 8192, m_toneSpacing*nToneSpacing, m_soundOutput, @@ -7425,8 +7425,8 @@ void MainWindow::foxTxSequencer() m_hisGrid=m_foxQSO[hc1].grid; m_rptSent=m_foxQSO[hc1].sent; m_rptRcvd=m_foxQSO[hc1].rcvd; - qDebug() << "Fox Logged :" << islot << m_hisCall << m_hisGrid << m_rptSent - << m_rptRcvd << m_lastBand; +// qDebug() << "Fox Logged :" << islot << m_hisCall << m_hisGrid << m_rptSent +// << m_rptRcvd << m_lastBand; QDateTime logTime {QDateTime::currentDateTimeUtc ()}; QString logLine=logTime.toString("yyyy-MM-dd hh:mm") + " " + m_hisCall + " " + m_hisGrid + " " + m_rptSent + " " + m_rptRcvd + " " + m_lastBand; @@ -7439,27 +7439,19 @@ void MainWindow::foxTxSequencer() if(m_foxQSOqueue.contains(hc1)) m_foxQSOqueue.removeOne(hc1); islot++; - //Generate tx waveform - foxGenWaveform(islot-1,fm); + foxGenWaveform(islot-1,fm); //Generate tx waveform if(islot >= m_Nslots) goto Transmit; } //One or more Tx slots are still available, repeat call to a Hound in the QSOqueue while (!m_foxQSOqueue.isEmpty()) { - //should limit repeat transmissions here + //should limit repeat transmissions here ? hc1=m_foxQSOqueue.dequeue(); //Recover hound callsign from QSO queue m_foxQSOqueue.enqueue(hc1); //Put him back in, at the end fm = hc1 + " " + m_baseCall + " " + m_foxQSO[hc1].sent; //Tx msg -/* - if(now-m_fullFoxCallTime > 300) { - fm = hc1 + " " + m_config.my_callsign(); //Tx msg - m_fullFoxCallTime=now; - } -*/ if(islot>0 and fm==m_fm0) break; //Suppress duplicate Fox signals islot++; - //Generate tx waveform - foxGenWaveform(islot-1,fm); + foxGenWaveform(islot-1,fm); //Generate tx waveform m_fm0=fm; if(islot >= m_Nslots) goto Transmit; } @@ -7475,15 +7467,8 @@ void MainWindow::foxTxSequencer() m_foxQSO[hc1].t0=now; //QSO start time rm_tb4(hc1); //Remove this hound from tb4 fm = hc1 + " " + m_baseCall + " " + rpt; //Tx msg -/* - if(now-m_fullFoxCallTime > 300) { - fm = hc1 + " " + m_config.my_callsign(); //Tx msg - m_fullFoxCallTime=now; - } -*/ islot++; - //Generate tx waveform - foxGenWaveform(islot-1,fm); + foxGenWaveform(islot-1,fm); //Generate tx waveform if(islot >= m_Nslots) goto Transmit; }