From 689d852a49cc6e374cbdfca72fd686028f302082 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 10 Dec 2022 10:52:58 -0500 Subject: [PATCH] Returd Q65W results to GUI, and some cleanup. --- q65w/commons.h | 6 ++++++ q65w/libm65/decode0.f90 | 9 +++------ q65w/libm65/map65a.f90 | 7 +++---- q65w/libm65/q65b.f90 | 10 +++++++--- q65w/mainwindow.cpp | 23 +++++++++++++++++++---- q65w/mainwindow.h | 3 ++- 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/q65w/commons.h b/q65w/commons.h index ecea5fb35..801330f06 100644 --- a/q65w/commons.h +++ b/q65w/commons.h @@ -83,6 +83,12 @@ extern struct { //This is "common/datcom/..." in Fortran int junk2; } datcom2_; +extern struct { + int ndecodes; + int ncand; + char result[50][60]; +} decodes_; + } #endif // COMMONS_H diff --git a/q65w/libm65/decode0.f90 b/q65w/libm65/decode0.f90 index fa66b4bbd..7f1ba2855 100644 --- a/q65w/libm65/decode0.f90 +++ b/q65w/libm65/decode0.f90 @@ -9,17 +9,17 @@ subroutine decode0(dd,ss,savg,nstandalone) logical ldecoded character mycall*12,hiscall*12,mygrid*6,hisgrid*6,datetime*20 character mycall0*12,hiscall0*12,hisgrid0*6 + character*60 result + common/decodes/ndecodes,ncand,result(50) common/npar/fcenter,nutc,idphi,mousedf,mousefqso,nagain, & ndepth,ndiskdat,neme,newdat,nfa,nfb,nfcal,nfshift, & mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,nmode, & ndop00,nsave,max_drift,nhsym,mycall,mygrid,hiscall,hisgrid,datetime common/early/nhsym1,nhsym2,ldecoded(32768) - common/decodes/ndecodes data neme0/-99/,mcall3b/1/ save call sec0(0,tquick) - ncand=0 if(newdat.ne.0) then nz=96000*nhsym/5.3833 hist=0 @@ -56,11 +56,8 @@ subroutine decode0(dd,ss,savg,nstandalone) mousedf,mousefqso,nagain,ndecdone,nfshift,ndphi,max_drift, & nfcal,nkeep,mcall3b,nsum,nsave,nxant,mycall,mygrid, & neme,ndepth,nstandalone,hiscall,hisgrid,nhsym,nfsample, & - ndiskdat,nxpol,nmode,ndop00,ncand) + ndiskdat,nxpol,nmode,ndop00) call timer('map65a ',1) - - if(nhsym.eq.nhsym2) write(*,1012) ndecodes,ncand -1012 format('',2i4) flush(6) return diff --git a/q65w/libm65/map65a.f90 b/q65w/libm65/map65a.f90 index 657d14269..756624e65 100644 --- a/q65w/libm65/map65a.f90 +++ b/q65w/libm65/map65a.f90 @@ -2,7 +2,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & mousedf,mousefqso,nagain,ndecdone,nfshift,ndphi,max_drift, & nfcal,nkeep,mcall3b,nsum,nsave,nxant,mycall,mygrid, & neme,ndepth,nstandalone,hiscall,hisgrid,nhsym,nfsample, & - ndiskdat,nxpol,nmode,ndop00,ncand) + ndiskdat,nxpol,nmode,ndop00) ! Processes timf2 data from Linrad to find and decode JT65 and Q65 signals. @@ -30,11 +30,11 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & real short(3,NFFT) !SNR dt ipol for potential shorthands real qphi(12) type(candidate) :: cand(MAX_CANDIDATES) - + character*60 result + common/decodes/ndecodes,ncand,result(50) common/c3com/ mcall3a common/testcom/ifreq common/early/nhsym1,nhsym2,ldecoded(32768) - common/decodes/ndecodes data blank/' '/,cm/'#'/ data shmsg0/'ATT','RO ','RRR','73 '/ @@ -42,7 +42,6 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & save rewind 12 - ndecodes=0 ! Clean start for Q65 at early decode if(nhsym.eq.nhsym1 .or. nagain.ne.0) ldecoded=.false. diff --git a/q65w/libm65/q65b.f90 b/q65w/libm65/q65b.f90 index f65e3b3d7..13023047e 100644 --- a/q65w/libm65/q65b.f90 +++ b/q65w/libm65/q65b.f90 @@ -33,9 +33,10 @@ subroutine q65b(nutc,nqd,nxant,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & character*80 line character*80 wsjtx_dir character*1 cp,cmode*2 + character*60 result + common/decodes/ndecodes,ncand,result(50) common/cacb/ca,cb common/early/nhsym1,nhsym2,ldecoded(32768) - common/decodes/ndecodes data nutc00/-1/,msg00/' '/ save @@ -189,10 +190,13 @@ subroutine q65b(nutc,nqd,nxant,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & freq1_00=freq1 frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal fsked=frx - 0.001*ndop00/2.0 - 1.5 + write(result(ndecodes),1120) nutc,fsked,xdt0,nsnr0,trim(msg0) write(12,1120) nutc,fsked,xdt0,nsnr0,trim(msg0) 1120 format(i4.4,f9.3,f7.2,i5,2x,a,i6) - write(*,1121) nutc,fsked,xdt0,nsnr0,trim(msg0) -1121 format('~',i4.4,f9.3,f7.2,i5,2x,a,i6) +! print*,ndecodes,result(ndecodes) + result(ndecodes)=trim(result(ndecodes))//char(0) +! write(*,1121) nutc,fsked,xdt0,nsnr0,trim(msg0) +!1121 format('~',i4.4,f9.3,f7.2,i5,2x,a,i6) endif endif diff --git a/q65w/mainwindow.cpp b/q65w/mainwindow.cpp index 547514ca1..e137805a0 100644 --- a/q65w/mainwindow.cpp +++ b/q65w/mainwindow.cpp @@ -75,7 +75,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(&soundInThread, SIGNAL(status(QString)), this, SLOT(showStatusMessage(QString))); createStatusBar(); - connect(&proc_m65, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStdout())); +// connect(&proc_m65, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStdout())); connect(&proc_m65, &QProcess::errorOccurred, this, &MainWindow::m65_error); connect(&proc_m65, static_cast (&QProcess::finished), [this] (int exitCode, QProcess::ExitStatus status) { @@ -499,8 +499,6 @@ void MainWindow::dataSink(int k) n=0; } -// qDebug() << "aa" << ihsym << k << px; - if(ihsym==302) { //Decode at t=56 s (for Q65 and data from disk) m_RxState=2; datcom_.newdat=1; @@ -861,6 +859,10 @@ void MainWindow::decoderFinished() //diskWriteFinished m_startAnother=m_loopall; ui->DecodeButton->setStyleSheet(""); decodeBusy(false); + + QString t1; + t1=t1.asprintf(" %3d/%d ",decodes_.ndecodes,decodes_.ncand); + lab5->setText(t1); } //Delete ../save/*.tf2 @@ -1036,6 +1038,9 @@ void MainWindow::decode() //decode() // QFile lockFile(m_appDir + "/.lock"); // Allow m65 to start // lockFile.remove(); + decodes_.ndecodes=0; + decodes_.ncand=0; + m_fetched=0; int itimer=0; watcher3.setFuture(QtConcurrent::run (std::bind (m65c_, &itimer))); @@ -1070,6 +1075,7 @@ void MainWindow::m65_error (QProcess::ProcessError) QTimer::singleShot (0, this, SLOT (close ())); } +/* void MainWindow::readFromStdout() //readFromStdout { while(proc_m65.canReadLine()) @@ -1099,6 +1105,7 @@ void MainWindow::readFromStdout() //readFromStdout } } } +*/ void MainWindow::on_EraseButton_clicked() { @@ -1140,8 +1147,16 @@ void MainWindow::guiUpdate() on_actionOpen_next_in_directory_triggered(); } + if(decodes_.ndecodes>m_fetched) { + while(m_fetcheddecodedTextBrowser->append(t.trimmed()); + m_fetched++; + } + } + if(nsec != m_sec0) { //Once per second -// qDebug() << "AAA" << nsec%60 << m_TRperiod; +// qDebug() << "AAA" << nsec%60 << decodes_.ndecodes << decodes_.ncand; soundInThread.setForceCenterFreqMHz(m_wide_graph_window->m_dForceCenterFreq); soundInThread.setForceCenterFreqBool(m_wide_graph_window->m_bForceCenterFreq); diff --git a/q65w/mainwindow.h b/q65w/mainwindow.h index 8128acbc7..e3042189e 100644 --- a/q65w/mainwindow.h +++ b/q65w/mainwindow.h @@ -44,7 +44,7 @@ public slots: void diskWriteFinished(); void decoderFinished(); void freezeDecode(int n); - void readFromStdout(); +// void readFromStdout(); void m65_error (QProcess::ProcessError); void guiUpdate(); @@ -133,6 +133,7 @@ private: qint32 m_modeQ65; qint32 m_RxState; qint32 m_dB; + qint32 m_fetched=0; double m_fAdd; double m_xavg;