From f014fd2a7e56332a850ba831cd8f1fdafb17931e Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 20 Feb 2019 10:41:55 -0500 Subject: [PATCH 1/5] Temporarily, at least, remove the default timestamps from qDebug() messages. --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index fd510bffb..e10dc22c1 100644 --- a/main.cpp +++ b/main.cpp @@ -92,7 +92,7 @@ namespace int main(int argc, char *argv[]) { // Add timestamps to all debug messages - qSetMessagePattern ("[%{time yyyyMMdd HH:mm:ss.zzz t} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}"); +// qSetMessagePattern ("[%{time yyyyMMdd HH:mm:ss.zzz t} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}"); init_random_seed (); From f1e7b0c30a2f50e3759af243d80c42dbca2a191f Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 20 Feb 2019 10:43:30 -0500 Subject: [PATCH 2/5] Add (temporary?) code for converting FoxQSO.txt to an ADIF log. --- widgets/mainwindow.cpp | 98 +++++++++++++++++++++++++++++++++++++++++- widgets/mainwindow.h | 11 +++++ 2 files changed, 107 insertions(+), 2 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 177907f12..9767e513b 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2005,7 +2005,8 @@ void MainWindow::keyPressEvent (QKeyEvent * e) return; case Qt::Key_X: if(e->modifiers() & Qt::AltModifier) { - foxTest(); +// foxTest(); + foxLog(); return; } case Qt::Key_E: @@ -5384,6 +5385,7 @@ void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button void MainWindow::on_logQSOButton_clicked() //Log QSO button { + qDebug() << "bbb" << m_hisCall << m_hisGrid; if (!m_hisCall.size ()) { MessageBox::warning_message (this, tr ("Warning: DX Call field is empty.")); } @@ -8367,7 +8369,9 @@ list2Done: { writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid) .arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand)); - logQSOTimer.start(0); + qDebug() << "aaa" << hc1; +// logQSOTimer.start(0); + on_logQSOButton_clicked(); m_foxRateQueue.enqueue (now); //Add present time in seconds //to Rate queue. } @@ -8796,3 +8800,93 @@ void MainWindow::save_FT4() this, m_fnameWE, &dec_data.d2[0], nsec, m_config.my_callsign(), m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); } + +void MainWindow::foxLog() +{ + // This is part of the "Fox-log fixup" code + QFile f("FoxQSO_XX9D_1.txt"); + if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) return; + QTextStream s(&f); + QString line; + QString msg; + QString hc1; + QString rptRcvd; + int nRx=0; + int nTx=0; + + while(!s.atEnd()) { + line=s.readLine(); + if(line.length()==0) continue; + + if(line.contains(" Sel:")) { + QStringList w=line.split(' ', QString::SkipEmptyParts); + hc1=w.at(7); // his call + m_fixupQSO[hc1].sent=w.at(8); // sent report + m_fixupQSO[hc1].grid=w.at(9); // his grid + } + + if(line.contains(" Rx:")) { + int i0=line.indexOf(" ~ ") + 4; + msg=line.mid(i0); + if(msg.left(4)!="XX9D") { + break; + } + int i1=msg.indexOf(" "); + nRx++; + hc1=msg.mid(i1+1); + int i2=hc1.indexOf(" "); + hc1=hc1.mid(0,i2); + int i3=qMax(msg.indexOf("R+"),msg.indexOf("R-")); + if(i3>8) { + m_fixupQSO[hc1].rcvd=msg.mid(i3+1,3); + } + } + + if(line.contains(" Tx")) { + int i0=line.indexOf(" Tx") + 7; + msg=line.mid(i0); + nTx++; + QStringList w=msg.split(' ', QString::SkipEmptyParts); + if(w.size()<3) continue; + if(w.at(2).left(1)=="+" or w.at(2).left(1)=="-") { + hc1=w.at(0); + m_fixupQSO[hc1].sent=w.at(2); + } + if(w.at(2)=="RR73") { + hc1=w.at(0); + loggit(hc1,line); + } + if(w.at(1)=="RR73;") { + hc1=w.at(0); + loggit(hc1,line); + } + hc1=w.at(0); + } + } +} + +void MainWindow::loggit(QString hc1, QString line) +{ + // This is part of the "Fox-log fixup" code + static int nQSO=0; + // Log a QSO with callsign hc1; + QDateTime QSO_time = QDateTime::fromString(line.left(19),"yyyy-MM-dd hh:mm:ss"); + QString sMHz=line.split(' ', QString::SkipEmptyParts).at(2); + Frequency nHz=1000000.0 * sMHz.toDouble() + 0.5; + auto const& band_name = m_config.bands()->find(nHz); + m_hisCall=hc1; + m_hisGrid=m_fixupQSO[hc1].grid; + if(m_hisGrid=="....") m_hisGrid=""; + m_rptSent=m_fixupQSO[hc1].sent; + m_rptRcvd=m_fixupQSO[hc1].rcvd; + nQSO++; + if (!m_foxLog) m_foxLog.reset (new FoxLog {&m_config}); + if (!m_foxLogWindow) on_fox_log_action_triggered (); + bool ok=m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, band_name); + qDebug().noquote() << nQSO << line.left(19) << m_hisCall << m_hisGrid << m_rptSent + << m_rptRcvd << sMHz << band_name << ok; + + m_logDlg->initLogQSO (m_hisCall, m_hisGrid, m_modeTx, m_rptSent, m_rptRcvd, + QSO_time, QSO_time, nHz, m_noSuffix, "", "", + m_cabrilloLog.data ()); +} diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index f97bdef32..cfb8e2a25 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -347,6 +347,7 @@ private: void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance); void hideMenus(bool b); void foxTest(); + void foxLog(); void setColorHighlighting(); NetworkAccessManager m_network_manager; @@ -634,6 +635,15 @@ private: QMap m_foxQSO; //Key = HoundCall, value = parameters for QSO in progress QMap m_loggedByFox; //Key = HoundCall, value = logged band + struct FixupQSO //Info for fixing Fox's log from file "FoxQSO.txt" + { + QString grid; //Hound's declared locator + QString sent; //Report sent to Hound + QString rcvd; //Report received from Hound + QDateTime QSO_time; + }; + QMap m_fixupQSO; //Key = HoundCall, value = info for QSO in progress + QQueue m_houndQueue; //Selected Hounds available for starting a QSO QQueue m_foxQSOinProgress; //QSOs in progress: Fox has sent a report QQueue m_foxRateQueue; @@ -752,6 +762,7 @@ private: void writeFoxQSO (QString const& msg); void FT4_writeTx(); void save_FT4(); + void loggit(QString hc1, QString line); }; extern int killbyname(const char* progName); From d5a16712104f74584a8e2ac26d475711b9dd3c3a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 21 Feb 2019 10:08:18 -0500 Subject: [PATCH 3/5] FT4 decoding interval is now 288 ms. Saving of FT4 files is somewhat rationalized. --- lib/ft4/ft4_decode.f90 | 4 +-- lib/ft4/ft4d.f90 | 7 +++-- main.cpp | 2 +- widgets/mainwindow.cpp | 64 +++++++++++++++++++++++++----------------- widgets/mainwindow.h | 3 +- 5 files changed, 48 insertions(+), 32 deletions(-) diff --git a/lib/ft4/ft4_decode.f90 b/lib/ft4/ft4_decode.f90 index fe983bb08..8d40aa8cd 100644 --- a/lib/ft4/ft4_decode.f90 +++ b/lib/ft4/ft4_decode.f90 @@ -186,7 +186,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & idfmax=12 idfstp=3 ibmin=0 - ibmax=215 + ibmax=216 !Max DT = 216/750 = 0.288 s ibstp=4 else idfmin=idfbest-4 @@ -474,7 +474,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & 1002 format(a17,i4,f5.1,i5,' Rx ',a37,5i5) close(24) linex(ndecodes)=line - if(ibest.ge.210) msg0=message !Possible dupe candidate + if(ibest.ge.ibmax-15) msg0=message !Possible dupe candidate !### Temporary: assume most recent decoded message conveys "hiscall". ### i0=index(message,' ') diff --git a/lib/ft4/ft4d.f90 b/lib/ft4/ft4d.f90 index 12aa26181..b92ff8711 100644 --- a/lib/ft4/ft4d.f90 +++ b/lib/ft4/ft4d.f90 @@ -60,12 +60,13 @@ program ft4d close(10) cdatetime=infile(1:13)//'.000' - nsteps=(npts-60000)/3456 + 1 + istep=3456 + nsteps=(npts-52800)/istep + 1 do n=1,nsteps - i0=(n-1)*3456 + 1 + i0=(n-1)*istep + 1 tbuf=(i0-1)/12000.0 call ft4_decode(cdatetime,tbuf,nfa,nfb,nQSOProgress,ncontest, & - nfqso,iwave(i0),ndecodes,mycall,hiscall,nrx,line,data_dir) + nfqso,iwave(i0),ndecodes,mycall,hiscall,nrx,line,data_dir) do idecode=1,ndecodes call get_ft4msg(idecode,nrx,line) write(*,'(a61)') line diff --git a/main.cpp b/main.cpp index e10dc22c1..fd510bffb 100644 --- a/main.cpp +++ b/main.cpp @@ -92,7 +92,7 @@ namespace int main(int argc, char *argv[]) { // Add timestamps to all debug messages -// qSetMessagePattern ("[%{time yyyyMMdd HH:mm:ss.zzz t} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}"); + qSetMessagePattern ("[%{time yyyyMMdd HH:mm:ss.zzz t} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}"); init_random_seed (); diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 9767e513b..a69283989 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1460,7 +1460,7 @@ void MainWindow::dataSink(qint64 frames) // the following is potential a threading hazard - not a good // idea to pass pointer to be processed in another thread m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, - this, m_fnameWE, &dec_data.d2[0], m_TRperiod, m_config.my_callsign(), + this, m_fnameWE, &dec_data.d2[0], m_TRperiod*12000, m_config.my_callsign(), m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); if (m_mode=="WSPR") { QString c2name_string {m_fnameWE + ".c2"}; @@ -1519,7 +1519,7 @@ void MainWindow::startP1() p1.start(m_cmndP1); } -QString MainWindow::save_wave_file (QString const& name, short const * data, int seconds, +QString MainWindow::save_wave_file (QString const& name, short const * data, int samples, QString const& my_callsign, QString const& my_grid, QString const& mode, qint32 sub_mode, Frequency frequency, QString const& his_call, QString const& his_grid) const { @@ -1555,7 +1555,7 @@ QString MainWindow::save_wave_file (QString const& name, short const * data, int BWFFile wav {format, file_name, list_info}; if (!wav.open (BWFFile::WriteOnly) || 0 > wav.write (reinterpret_cast (data) - , sizeof (short) * seconds * format.sampleRate ())) + , sizeof (short) * samples)) { return file_name + ": " + wav.errorString (); } @@ -1670,7 +1670,7 @@ void MainWindow::fastSink(qint64 frames) // the following is potential a threading hazard - not a good // idea to pass pointer to be processed in another thread m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, - this, m_fnameWE, &dec_data.d2[0], m_TRperiod, m_config.my_callsign(), + this, m_fnameWE, &dec_data.d2[0], m_TRperiod*12000, m_config.my_callsign(), m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); } if(m_mode!="MSK144") { @@ -4768,8 +4768,12 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie return; } if(m_mode=="FT4" and ui->cbAutoSeq->isChecked()) { - if((m_ntx==4 or m_ntx==5) and !m_diskData) logQSOTimer.start(0); // Log the QSO + if((m_ntx==4 or m_ntx==5) and !m_diskData) { + save_FT4(); + logQSOTimer.start(0); // Log the QSO + } if((m_ntx==3 and ui->cbFirst->isChecked()) or m_ntx==4 or m_bDoubleClicked) { + QThread::msleep(600); //Wait a bit. ### Is this a good idea??? ### ft4_tx(m_ntx); } } @@ -5385,7 +5389,6 @@ void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button void MainWindow::on_logQSOButton_clicked() //Log QSO button { - qDebug() << "bbb" << m_hisCall << m_hisGrid; if (!m_hisCall.size ()) { MessageBox::warning_message (this, tr ("Warning: DX Call field is empty.")); } @@ -8369,8 +8372,6 @@ list2Done: { writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid) .arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand)); - qDebug() << "aaa" << hc1; -// logQSOTimer.start(0); on_logQSOButton_clicked(); m_foxRateQueue.enqueue (now); //Add present time in seconds //to Rate queue. @@ -8616,14 +8617,22 @@ void MainWindow::write_all(QString txRx, QString message) void MainWindow::ft4Data(int k) { + static int nhsec0=-1; static bool wrapped=false; short id[60000]; + const int istep=3456; - if(k<60000 and !wrapped) return; + if(knhsec) nhsec0=-1; + if(nhsec==nhsec0) return; -//Process FT4 data at 0.288 s intervals - int j=k/3456; - j=3456*j-60000; +// if(k<60000 and !wrapped) return; + if(k<52800 and !wrapped) return; + +//Process FT4 data at intervals of istep/12000.0 seconds + int j=k/istep; + j=istep*j-52800; if(j<0) j+=NRING; float tbuf=j/12000.0; for(int i=0; i<60000; i++) { @@ -8635,9 +8644,10 @@ void MainWindow::ft4Data(int k) } } if(j>60000) wrapped=false; + if(((k-m_kin0)/12000.0 > 15.0) and !m_diskData) save_FT4(); if(k>=NRING) { - if(m_saveAll) save_FT4(); + if(m_saveAll and !m_diskData) save_FT4(); //Wrap the ring buffer pointer k=k-NRING; dec_data.params.kin=k; @@ -8673,7 +8683,6 @@ void MainWindow::ft4Data(int k) ft4_decode_(cdatetime,&tbuf,&nfa,&nfb,&nQSOProgress,&nContest,&nfqso,id,&ndecodes,&mycall[0],&hiscall[0], &nrx,&line[0],&ddir[0],17,12,12,61,512); line[60]=0; -// if(ndecodes>0) { for (int idecode=1; idecode<=ndecodes; idecode++) { get_ft4msg_(&idecode,&nrx,&line[0],61); line[60]=0; @@ -8707,7 +8716,8 @@ void MainWindow::ft4Data(int k) } //### } - if(m_diskData and (k > (dec_data.params.kin-3456))) m_startAnother=m_loopall; + nhsec0=nhsec; + if(m_diskData and (k > (dec_data.params.kin-istep))) m_startAnother=m_loopall; if(m_bNoMoreFiles) { MessageBox::information_message(this, tr("Just one more file to open.")); m_bNoMoreFiles=false; @@ -8743,7 +8753,6 @@ void MainWindow::ft4_tx(int ntx) int n=t.size(); m_xSent=t.at(n-2) + " " + t.at(n-1); } - auto_tx_mode(true); //Enable Tx icw[0]=0; g_iptt = 1; @@ -8753,7 +8762,7 @@ void MainWindow::ft4_tx(int ntx) m_tx_when_ready = true; qint64 ms=QDateTime::currentMSecsSinceEpoch(); m_modulator->set_ms0(ms); - FT4_TxTimer.start(5000); //Slightly more than FT4 transmission length + FT4_TxTimer.start(4600); //Slightly more than FT4 transmission length if (g_iptt == 1 && m_iptt0 == 0) { auto const& current_message = QString::fromLatin1 (msgsent); @@ -8779,7 +8788,7 @@ void MainWindow::ft4_tx(int ntx) } m_dateTimeQSOOn=QDateTime::currentDateTimeUtc(); if(!m_btxok && m_btxok0 && g_iptt==1) stopTx(); - if(m_saveAll) save_FT4(); + if(m_saveAll and !m_diskData) save_FT4(); } void MainWindow::FT4_writeTx() @@ -8789,16 +8798,21 @@ void MainWindow::FT4_writeTx() void MainWindow::save_FT4() { - int nsec=(dec_data.params.kin + 3456)/12000; - if(nsec<5) return; //Saved data must be at least 5 seconds long. + double tsec=(dec_data.params.kin - m_kin0)/12000.0; + if(tsec<4.4) return; //Saved data must be at least 4.4 seconds long. auto time = QDateTime::currentDateTimeUtc (); QString t=time.toString("yyMMdd_hhmmss"); m_fnameWE=m_config.save_directory().absoluteFilePath(t); + // The following is potential a threading hazard - not a good // idea to pass pointer to be processed in another thread + int nsamples=dec_data.params.kin - m_kin0 + 1; m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, - this, m_fnameWE, &dec_data.d2[0], nsec, m_config.my_callsign(), - m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); + this, m_fnameWE, &dec_data.d2[m_kin0], nsamples, m_config.my_callsign(), + m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, + m_hisGrid))); + + m_kin0=dec_data.params.kin; } void MainWindow::foxLog() @@ -8882,9 +8896,9 @@ void MainWindow::loggit(QString hc1, QString line) nQSO++; if (!m_foxLog) m_foxLog.reset (new FoxLog {&m_config}); if (!m_foxLogWindow) on_fox_log_action_triggered (); - bool ok=m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, band_name); - qDebug().noquote() << nQSO << line.left(19) << m_hisCall << m_hisGrid << m_rptSent - << m_rptRcvd << sMHz << band_name << ok; + m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, band_name); +// qDebug().noquote() << nQSO << line.left(19) << m_hisCall << m_hisGrid << m_rptSent +// << m_rptRcvd << sMHz << band_name; m_logDlg->initLogQSO (m_hisCall, m_hisGrid, m_modeTx, m_rptSent, m_rptRcvd, QSO_time, QSO_time, nHz, m_noSuffix, "", "", diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index cfb8e2a25..b54193815 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -467,6 +467,7 @@ private: qint32 m_tFoxTxSinceCQ=999; //Fox Tx cycles since most recent CQ qint32 m_nFoxFreq; //Audio freq at which Hound received a call from Fox qint32 m_nSentFoxRrpt=0; //Serial number for next R+rpt Hound will send to Fox + qint32 m_kin0=0; bool m_btxok; //True if OK to transmit bool m_diskData; @@ -726,7 +727,7 @@ private: QString save_wave_file (QString const& name , short const * data - , int seconds + , int samples , QString const& my_callsign , QString const& my_grid , QString const& mode From 57a20f838f638ae2ee9d778ef41ea6a750a1cad3 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 21 Feb 2019 10:24:58 -0500 Subject: [PATCH 4/5] Remove the code that builds an ADIF file from FoxQSO.txt. --- widgets/mainwindow.cpp | 91 ------------------------------------------ widgets/mainwindow.h | 2 - 2 files changed, 93 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index a69283989..eb3fc2f82 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2006,7 +2006,6 @@ void MainWindow::keyPressEvent (QKeyEvent * e) case Qt::Key_X: if(e->modifiers() & Qt::AltModifier) { // foxTest(); - foxLog(); return; } case Qt::Key_E: @@ -8814,93 +8813,3 @@ void MainWindow::save_FT4() m_kin0=dec_data.params.kin; } - -void MainWindow::foxLog() -{ - // This is part of the "Fox-log fixup" code - QFile f("FoxQSO_XX9D_1.txt"); - if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) return; - QTextStream s(&f); - QString line; - QString msg; - QString hc1; - QString rptRcvd; - int nRx=0; - int nTx=0; - - while(!s.atEnd()) { - line=s.readLine(); - if(line.length()==0) continue; - - if(line.contains(" Sel:")) { - QStringList w=line.split(' ', QString::SkipEmptyParts); - hc1=w.at(7); // his call - m_fixupQSO[hc1].sent=w.at(8); // sent report - m_fixupQSO[hc1].grid=w.at(9); // his grid - } - - if(line.contains(" Rx:")) { - int i0=line.indexOf(" ~ ") + 4; - msg=line.mid(i0); - if(msg.left(4)!="XX9D") { - break; - } - int i1=msg.indexOf(" "); - nRx++; - hc1=msg.mid(i1+1); - int i2=hc1.indexOf(" "); - hc1=hc1.mid(0,i2); - int i3=qMax(msg.indexOf("R+"),msg.indexOf("R-")); - if(i3>8) { - m_fixupQSO[hc1].rcvd=msg.mid(i3+1,3); - } - } - - if(line.contains(" Tx")) { - int i0=line.indexOf(" Tx") + 7; - msg=line.mid(i0); - nTx++; - QStringList w=msg.split(' ', QString::SkipEmptyParts); - if(w.size()<3) continue; - if(w.at(2).left(1)=="+" or w.at(2).left(1)=="-") { - hc1=w.at(0); - m_fixupQSO[hc1].sent=w.at(2); - } - if(w.at(2)=="RR73") { - hc1=w.at(0); - loggit(hc1,line); - } - if(w.at(1)=="RR73;") { - hc1=w.at(0); - loggit(hc1,line); - } - hc1=w.at(0); - } - } -} - -void MainWindow::loggit(QString hc1, QString line) -{ - // This is part of the "Fox-log fixup" code - static int nQSO=0; - // Log a QSO with callsign hc1; - QDateTime QSO_time = QDateTime::fromString(line.left(19),"yyyy-MM-dd hh:mm:ss"); - QString sMHz=line.split(' ', QString::SkipEmptyParts).at(2); - Frequency nHz=1000000.0 * sMHz.toDouble() + 0.5; - auto const& band_name = m_config.bands()->find(nHz); - m_hisCall=hc1; - m_hisGrid=m_fixupQSO[hc1].grid; - if(m_hisGrid=="....") m_hisGrid=""; - m_rptSent=m_fixupQSO[hc1].sent; - m_rptRcvd=m_fixupQSO[hc1].rcvd; - nQSO++; - if (!m_foxLog) m_foxLog.reset (new FoxLog {&m_config}); - if (!m_foxLogWindow) on_fox_log_action_triggered (); - m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, band_name); -// qDebug().noquote() << nQSO << line.left(19) << m_hisCall << m_hisGrid << m_rptSent -// << m_rptRcvd << sMHz << band_name; - - m_logDlg->initLogQSO (m_hisCall, m_hisGrid, m_modeTx, m_rptSent, m_rptRcvd, - QSO_time, QSO_time, nHz, m_noSuffix, "", "", - m_cabrilloLog.data ()); -} diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index b54193815..db732e053 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -347,7 +347,6 @@ private: void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance); void hideMenus(bool b); void foxTest(); - void foxLog(); void setColorHighlighting(); NetworkAccessManager m_network_manager; @@ -763,7 +762,6 @@ private: void writeFoxQSO (QString const& msg); void FT4_writeTx(); void save_FT4(); - void loggit(QString hc1, QString line); }; extern int killbyname(const char* progName); From aeddaeab9eae660ff53e28a562cb94f0b9e1e94e Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 21 Feb 2019 12:10:27 -0500 Subject: [PATCH 5/5] FT4 now transmits a waveform generated from Gaussian-filtered frequency changes. --- Modulator.cpp | 10 +++++++--- widgets/mainwindow.cpp | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Modulator.cpp b/Modulator.cpp index c80889a7d..0b1b9a929 100644 --- a/Modulator.cpp +++ b/Modulator.cpp @@ -51,6 +51,9 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, // Time according to this computer which becomes our base time qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000; +// qDebug() << "ModStart" << symbolsLength << framesPerSymbol +// << frequency << toneSpacing; + if(m_state != Idle) stop (); m_quickClose = false; @@ -90,7 +93,7 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, m_silentFrames = m_ic + m_frameRate / (1000 / delay_ms) - (mstr * (m_frameRate / 1000)); } if((symbolsLength==103 or symbolsLength==105) and framesPerSymbol==512 - and toneSpacing==12000.0/512.0) { + and (toneSpacing==12000.0/512.0 or toneSpacing==-2.0)) { //### FT4 parameters delay_ms=100; mstr=5000; @@ -300,8 +303,9 @@ qint64 Modulator::readData (char * data, qint64 maxSize) //Here's where we transmit from a precomputed wave[] array: if(m_toneSpacing < 0) sample=qRound(m_amp*foxcom_.wave[m_ic]); - -// if(m_ic < 100) qDebug() << "Mod C" << m_ic << m_amp << foxcom_.wave[m_ic] << sample; +// if(m_ic < 10) qDebug() << "Mod Tx" << m_ic << m_amp +// << foxcom_.wave[m_ic] << sample +// << m_toneSpacing; samples = load(postProcessSample(sample), samples); ++framesGenerated; diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index eb3fc2f82..616c8d257 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -102,6 +102,9 @@ extern "C" { void genft4_(char* msg, int* ichk, char* msgsent, int itone[], fortran_charlen_t, fortran_charlen_t); + void gen_ft4wave_(int itone[], int* nsym, int* nsps, float* fsample, float* f0, + float wave[], int* nwave); + void gen4_(char* msg, int* ichk, char* msgsent, int itone[], int* itext, fortran_charlen_t, fortran_charlen_t); @@ -6869,8 +6872,8 @@ void MainWindow::transmit (double snr) } if (m_modeTx == "FT4") { - toneSpacing=12000.0/512.0; -// if(SpecOp::FOX==m_config.special_op_id() and !m_tune) toneSpacing=-1; +// toneSpacing=12000.0/512.0; //Generate Tx waveform from itone[] array + toneSpacing=-2.0; //Transmit a pre-computed, filtered waveform. Q_EMIT sendMessage (NUM_FT4_SYMBOLS, 512.0, ui->TxFreqSpinBox->value() - m_XIT, toneSpacing, m_soundOutput, m_config.audio_output_channel (), @@ -8757,6 +8760,14 @@ void MainWindow::ft4_tx(int ntx) g_iptt = 1; setRig (); setXIT (ui->TxFreqSpinBox->value ()); + + int nsym=103; + int nsps=4*512; + float fsample=48000.0; + float f0=ui->TxFreqSpinBox->value() - m_XIT; + int nwave=(nsym+2)*nsps; + gen_ft4wave_(const_cast(itone),&nsym,&nsps,&fsample,&f0,foxcom_.wave,&nwave); + Q_EMIT m_config.transceiver_ptt (true); //Assert the PTT m_tx_when_ready = true; qint64 ms=QDateTime::currentMSecsSinceEpoch();