diff --git a/commons.h b/commons.h index 985119f98..a3fd00ba0 100644 --- a/commons.h +++ b/commons.h @@ -31,6 +31,8 @@ extern struct { //This is "common/datcom/..." in Fortran int nfsample; //Input sample rate int nxpol; //1 if using xpol antennas, 0 otherwise int mode65; //JT65 sub-mode: A=1, B=2, C=4 + int nfast; //1 for sub-modes ABC; 2 for B2, C2 + int nsave; //Number of s3(64,63) spectra saved char mycall[12]; char mygrid[6]; char hiscall[12]; diff --git a/libm65/decode0.f90 b/libm65/decode0.f90 index 203545011..8366cf259 100644 --- a/libm65/decode0.f90 +++ b/libm65/decode0.f90 @@ -11,7 +11,7 @@ subroutine decode0(dd,ss,savg,nstandalone) common/npar/fcenter,nutc,idphi,mousedf,mousefqso,nagain, & ndepth,ndiskdat,neme,newdat,nfa,nfb,nfcal,nfshift, & mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,mode65, & - mycall,mygrid,hiscall,hisgrid,datetime + nfast,nsave,mycall,mygrid,hiscall,hisgrid,datetime common/tracer/ limtrace,lu data neme0/-99/,mcall3b/1/ save @@ -53,12 +53,16 @@ subroutine decode0(dd,ss,savg,nstandalone) call timer('map65a ',0) call map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & mousedf,mousefqso,nagain,ndecdone,ndiskdat,nfshift,ndphi, & - nfcal,nkeep,mcall3b,nsave,nxant,rmsdd,mycall,mygrid, & + nfcal,nkeep,mcall3b,nsum,nsave0,nxant,rmsdd,mycall,mygrid, & neme,ndepth,hiscall,hisgrid,nhsym,nfsample,nxpol,mode65) call timer('map65a ',1) call timer('decode0 ',1) if(nstandalone.eq.0) call timer('decode0 ',101) + write(*,1010) nsum,nsave0 +1010 format('',2i4) + flush(6) + return end subroutine decode0 diff --git a/libm65/decode1a.f b/libm65/decode1a.f index 9790e083d..f9abd66d1 100644 --- a/libm65/decode1a.f +++ b/libm65/decode1a.f @@ -1,6 +1,7 @@ subroutine decode1a(dd,newdat,f0,nflip,mode65,nfsample,xpol, + mycall,hiscall,hisgrid,neme,ndepth,nqd,dphi,ndphi,iloop, - + nutc,nkhz,ndf,ipol,sync2,a,dt,pol,nkv,nhist,nsave,qual,decoded) + + nutc,nkhz,ndf,ipol,sync2,a,dt,pol,nkv,nhist,nsum,nsave, + + qual,decoded) ! Apply AFC corrections to a candidate JT65 signal, then decode it. @@ -139,7 +140,8 @@ nkhz0=nkhz nsave=min(32,nsave+1) npol=nint(57.296*pol) - call s3avg(nsave,mode65,nutc,ndf,dt+0.8,npol,s3,nkv,decoded) + call s3avg(nsave,mode65,nutc,ndf,dt+0.8,npol,s3,nsum, + + nkv,decoded) syncbest=sync2 endif nutc0=nutc diff --git a/libm65/m65.f90 b/libm65/m65.f90 index 27d9b373c..e963745a1 100644 --- a/libm65/m65.f90 +++ b/libm65/m65.f90 @@ -13,11 +13,11 @@ program m65 real*8 fc0,fcenter character*80 arg,infile character mycall*12,hiscall*12,mygrid*6,hisgrid*6,datetime*20 - common/datcom/dd(4,5760000),ss(4,322,NFFT),savg(4,NFFT),fc0,nutc0,junk(34) + common/datcom/dd(4,5760000),ss(4,322,NFFT),savg(4,NFFT),fc0,nutc0,junk(36) common/npar/fcenter,nutc,idphi,mousedf,mousefqso,nagain, & ndepth,ndiskdat,neme,newdat,nfa,nfb,nfcal,nfshift, & mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,mode65, & - mycall,mygrid,hiscall,hisgrid,datetime + nfast,nsave,mycall,mygrid,hiscall,hisgrid,datetime nargs=iargc() if(nargs.lt.1) then diff --git a/libm65/m65a.F90 b/libm65/m65a.F90 index b5fc4b11f..d8f378af2 100644 --- a/libm65/m65a.F90 +++ b/libm65/m65a.F90 @@ -45,10 +45,6 @@ subroutine m65a p_m65=>address_m65() call m65b(p_m65,nbytes) - write(*,1010) -1010 format('') - flush(6) - 100 inquire(file=trim(cwd)//'/.lock',exist=fileExists) if(fileExists) go to 10 call sleep_msec(100) @@ -70,14 +66,14 @@ subroutine m65c(dd,ss,savg,nparams0) integer*1 detach_m65 real*4 dd(4,5760000),ss(4,322,32768),savg(4,32768) real*8 fcenter - integer nparams0(37),nparams(37) + integer nparams0(40),nparams(40) character*12 mycall,hiscall character*6 mygrid,hisgrid character*20 datetime common/npar/fcenter,nutc,idphi,mousedf,mousefqso,nagain, & ndepth,ndiskdat,neme,newdat,nfa,nfb,nfcal,nfshift, & mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,mode65, & - mycall,mygrid,hiscall,hisgrid,datetime + nfast,nsave,mycall,mygrid,hiscall,hisgrid,datetime equivalence (nparams,fcenter) nparams=nparams0 !Copy parameters into common/npar/ diff --git a/libm65/map65a.f90 b/libm65/map65a.f90 index 03b1e4db4..711e3cbe2 100644 --- a/libm65/map65a.f90 +++ b/libm65/map65a.f90 @@ -1,6 +1,6 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & mousedf,mousefqso,nagain,ndecdone,ndiskdat,nfshift,ndphi, & - nfcal,nkeep,mcall3b,nsave,nxant,rmsdd,mycall,mygrid, & + nfcal,nkeep,mcall3b,nsum,nsave,nxant,rmsdd,mycall,mygrid, & neme,ndepth,hiscall,hisgrid,nhsym,nfsample,nxpol,mode65) ! Processes timf2 data from Linrad to find and decode JT65 signals. @@ -206,7 +206,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & call decode1a(dd,newdat,f00,nflip,mode65,nfsample,xpol, & mycall,hiscall,hisgrid,neme,ndepth,nqd,dphi,ndphi, & iloop,nutc,ikHz,idf,ipol,sync2,a,dt,pol,nkv,nhist, & - nsave,qual,decoded) + nsum,nsave,qual,decoded) dt=dt+0.8 !### empirical tweak call timer('decode1a',1) diff --git a/libm65/recvpkt.f90 b/libm65/recvpkt.f90 index f55288d88..e46252c66 100644 --- a/libm65/recvpkt.f90 +++ b/libm65/recvpkt.f90 @@ -11,7 +11,7 @@ subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8,buf16) integer*2 jd(4),kd(2),nblock2 real*4 xd(4),yd(2) real*8 fcenter - common/datcom/dd(4,5760000),ss(4,322,NFFT),savg(4,NFFT),fcenter,nutc,junk(34) + common/datcom/dd(4,5760000),ss(4,322,NFFT),savg(4,NFFT),fcenter,nutc,junk(36) equivalence (kd,d4) equivalence (jd,d8,yd) equivalence (xd,c16) diff --git a/libm65/s3avg.f90 b/libm65/s3avg.f90 index c50927bf3..87e1cfa37 100644 --- a/libm65/s3avg.f90 +++ b/libm65/s3avg.f90 @@ -1,34 +1,37 @@ -subroutine s3avg(nsave,mode65,nutc,ndf,xdt,npol,s3,nkv,decoded) +subroutine s3avg(nsave,mode65,nutc,ndf,xdt,npol,s3,nsum,nkv,decoded) - real s3(64,63),s3b(64,63) - real s3a(64,63,32) +! Save the current synchronized spectra, s3(64,63), for possible +! decoding of average. + + real s3(64,63) !Synchronized spectra for 63 symbols + real s3a(64,63,32) !Saved spectra + real s3b(64,63) !Average integer iutc(32),idf(32),ipol(32) real dt(32) character*22 decoded logical ltext save - n=nsave - iutc(n)=nutc - idf(n)=ndf - ipol(n)=npol - dt(n)=xdt - s3a(1:64,1:63,n)=s3 + iutc(nsave)=nutc !Save UTC + idf(nsave)=ndf !Save DF + ipol(nsave)=npol !Save pol + dt(nsave)=xdt !Save DT + s3a(1:64,1:63,nsave)=s3 !Save the spectra s3b=0. nsum=0 idfdiff=100 dtdiff=0.2 - do i=1,n - if(mod(iutc(i),2).ne.mod(nutc,2)) cycle - if(abs(ndf-idf(i)).gt.idfdiff) cycle - if(abs(xdt-dt(i)).gt.dtdiff) cycle + do i=1,nsave !Accumulate avg spectra + if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only 1st or 2nd sequence + if(abs(ndf-idf(i)).gt.idfdiff) cycle !DF must match + if(abs(xdt-dt(i)).gt.dtdiff) cycle !DT must match s3b=s3b + s3a(1:64,1:63,i) nsum=nsum+1 enddo decoded=' ' - if(nsum.ge.2) then + if(nsum.ge.2) then !Try decoding the sverage nadd=mode65*nsum call extract(s3b,nadd,ncount,nhist,decoded,ltext) !Extract the message nkv=nsum diff --git a/libm65/symspec.f90 b/libm65/symspec.f90 index a317d99fe..cdd33dc5f 100644 --- a/libm65/symspec.f90 +++ b/libm65/symspec.f90 @@ -22,7 +22,7 @@ subroutine symspec(k,nxpol,ndiskdat,nb,nbslider,idphi,nfsample,fgreen, & parameter (NFFT=32768) !Length of FFTs real*8 ts,hsym real*8 fcenter - common/datcom/dd(4,5760000),ss(4,322,NFFT),savg(4,NFFT),fcenter,nutc,junk(34) + common/datcom/dd(4,5760000),ss(4,322,NFFT),savg(4,NFFT),fcenter,nutc,junk(36) real*4 ssz5a(NFFT),w(NFFT) complex z,zfac complex zsumx,zsumy diff --git a/mainwindow.cpp b/mainwindow.cpp index 941a2f24e..a3bb5795a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -137,6 +137,8 @@ MainWindow::MainWindow(QWidget *parent) : m_adjustIQ=0; m_applyIQcal=0; m_colors="000066ff0000ffff00969696646464"; + m_nfast=1; + m_nsave=0; ui->xThermo->setFillBrush(Qt::green); ui->yThermo->setFillBrush(Qt::magenta); @@ -1196,6 +1198,8 @@ void MainWindow::decode() //decode() datcom_.nxpol=0; if(m_xpol) datcom_.nxpol=1; datcom_.mode65=m_mode65; + datcom_.nfast=m_nfast; + datcom_.nsave=m_nsave; QString mcall=(m_myCall+" ").mid(0,12); QString mgrid=(m_myGrid+" ").mid(0,6); @@ -1227,7 +1231,6 @@ void MainWindow::decode() //decode() QFile lockFile(m_appDir + "/.lock"); // Allow m65 to start lockFile.remove(); - decodeBusy(true); } @@ -1252,6 +1255,12 @@ void MainWindow::readFromStdout() //readFromStdout { QByteArray t=proc_m65.readLine(); if(t.indexOf("") >= 0) { +// int nsum,nsave; +// scanf(" %d %d",&nsum,&nsave); +// m_nsum=nsum; +// m_nsave=nsave; +// qDebug() << m_nsum << m_nsave; + qDebug() << t; if(m_widebandDecode) { g_pMessages->setText(m_messagesText); g_pBandMap->setText(m_bandmapText); diff --git a/mainwindow.h b/mainwindow.h index c6de2b120..45b6dab86 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -154,6 +154,9 @@ private: qint32 m_adjustIQ; qint32 m_applyIQcal; qint32 m_mult570; + qint32 m_nfast; + qint32 m_nsum; + qint32 m_nsave; double m_fAdd; double m_IQamp; diff --git a/soundin.cpp b/soundin.cpp index a6d4b24c6..a6091729a 100644 --- a/soundin.cpp +++ b/soundin.cpp @@ -32,6 +32,8 @@ extern struct { int nfsample; //Input sample rate int nxpol; //1 if using xpol antennas, 0 otherwise int mode65; //JT65 sub-mode: A=1, B=2, C=4 + int nfast; //1 for sub-modes ABC; 2 for B2, C2 + int nsave; //Number of s3(64,63) spectra saved char mycall[12]; char mygrid[6]; char hiscall[12];