From 159b8a97f74b50673f3589081d0254410f39ac5c Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sun, 19 Jul 2020 13:20:41 -0400 Subject: [PATCH] Better handling of fSpread in mainwindow.cpp. Makes auto-seq work when plotspec is used. --- lib/decoder.f90 | 18 +++++++++++------- widgets/mainwindow.cpp | 21 ++++++++++++++++----- widgets/mainwindow.h | 3 ++- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 27c49a82c..bb7aaaa8e 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -719,6 +719,7 @@ contains character*2 annot character*37 decoded0 + character*70 line decoded0=decoded annot=' ' @@ -728,22 +729,25 @@ contains endif if(ntrperiod.lt.60) then - write(*,1001) nutc,nsnr,dt,nint(freq),decoded0,annot + write(line,1001) nutc,nsnr,dt,nint(freq),decoded0,annot 1001 format(i6.6,i4,f5.1,i5,' ` ',1x,a37,1x,a2) write(13,1002) nutc,nint(sync),nsnr,dt,freq,0,decoded0 1002 format(i6.6,i4,i5,f6.1,f8.0,i4,3x,a37,' FST240') else - if(fmid.ne.-999.0) then - if(w50.lt.0.95) write(decoded0(18:22),'(f5.3)') w50 - if(w50.ge.0.95) write(decoded0(18:22),'(f5.2)') w50 - if(decoded0(18:18).eq.'0') decoded0(18:18)=' ' - endif - write(*,1003) nutc,nsnr,dt,nint(freq),decoded0,annot + write(line,1003) nutc,nsnr,dt,nint(freq),decoded0,annot 1003 format(i4.4,i4,f5.1,i5,' ` ',1x,a37,1x,a2,2f7.3) write(13,1004) nutc,nint(sync),nsnr,dt,freq,0,decoded0 1004 format(i4.4,i4,i5,f6.1,f8.0,i4,3x,a37,' FST240') endif + if(fmid.ne.-999.0) then + if(w50.lt.0.95) write(line(65:70),'(f6.3)') w50 + if(w50.ge.0.95) write(line(65:70),'(f6.2)') w50 + endif + + write(*,1005) line +1005 format(a70) + call flush(6) call flush(13) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 3a3bbd1ea..e45a8a90f 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1575,7 +1575,6 @@ QString MainWindow::save_wave_file (QString const& name, short const * data, int 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 { - qDebug() << "aa" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz"); // // This member function runs in a thread and should not access // members that may be changed in the GUI thread or any other thread @@ -1612,7 +1611,6 @@ QString MainWindow::save_wave_file (QString const& name, short const * data, int { return file_name + ": " + wav.errorString (); } - qDebug() << "bb" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz"); return QString {}; } @@ -3147,6 +3145,8 @@ void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { auto line_read = proc_jt9.readLine (); + m_fSpread=line_read.mid(64,6).toFloat(); + line_read=line_read.left(64); if (auto p = std::strpbrk (line_read.constData (), "\n\r")) { // truncate before line ending chars line_read = line_read.left (p - line_read.constData ()); @@ -3231,7 +3231,18 @@ void MainWindow::readFromStdout() //readFromStdout m_bDisplayedOnce=true; } } else { - ui->decodedTextBrowser->displayDecodedText(decodedtext0,m_baseCall,m_mode,m_config.DXCC(), + DecodedText decodedtext1=decodedtext0; + if(m_mode.startsWith("FST240") and m_fSpread>0.0) { + QString t=decodedtext0.string(); + QString t2; + if(m_fSpread<0.95) t2.sprintf("%5.3f",m_fSpread); + if(m_fSpread>=0.95) t2.sprintf("%5.2f",m_fSpread); + t=t.left(46)+t2+t.mid(50); + t=t.trimmed(); + DecodedText dt2{t}; + decodedtext1=dt2; + } + ui->decodedTextBrowser->displayDecodedText(decodedtext1,m_baseCall,m_mode,m_config.DXCC(), m_logBook,m_currentBand,m_config.ppfx(), (ui->cbCQonly->isVisible() and ui->cbCQonly->isChecked())); @@ -3476,7 +3487,6 @@ void MainWindow::pskPost (DecodedText const& decodedtext) int snr = decodedtext.snr(); Frequency frequency = m_freqNominal + audioFrequency; pskSetLocal (); -// qDebug() << "bb" << deCall << grid << frequency << msgmode << snr; if(grid.contains (grid_regexp)) { // qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr; psk_Reporter->addRemoteStation(deCall,grid,QString::number(frequency),msgmode, @@ -4529,7 +4539,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie || ("JT9" == m_mode && mode != "@") || ("MSK144" == m_mode && !("&" == mode || "^" == mode)) || ("QRA64" == m_mode && mode.left (1) != ":")) { - return; //Currently we do auto-sequencing only in FT4, FT8, and MSK144 + return; //Currently we do auto-sequencing only in FT4, FT8, MSK144, and FST240 } //Skip the rest if no decoded text extracted @@ -4570,6 +4580,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie QString hiscall; QString hisgrid; message.deCallAndGrid(/*out*/hiscall,hisgrid); + if(message.string().contains(hiscall+"/R")) { hiscall+="/R"; ui->dxCallEntry->setText(hiscall); diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 3653cfd5c..630935ac8 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -419,6 +419,7 @@ private: float m_t0Pick; float m_t1Pick; float m_fCPUmskrtd; + float m_fSpread; qint32 m_waterfallAvg; qint32 m_ntx; @@ -716,7 +717,7 @@ private: void pskPost(DecodedText const& decodedtext); void displayDialFrequency (); void transmitDisplay (bool); - void processMessage(DecodedText const&, Qt::KeyboardModifiers = Qt::NoModifier); + void processMessage(DecodedText const& message, Qt::KeyboardModifiers = Qt::NoModifier); void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text, bool low_confidence, quint8 modifiers); void locationChange(QString const& location); void replayDecodes ();