From 93f7198f9c2864ef9630cc0cc9e46d6cc1933aa9 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Sat, 27 Apr 2024 12:26:26 +0100 Subject: New upstream version 2.7.0~rc4+repack --- qmap/about.cpp | 2 +- qmap/about.ui | 2 +- qmap/astro.cpp | 52 +++--- qmap/astro.h | 7 +- qmap/astro.ui | 70 +++++-- qmap/commons.h | 52 +++--- qmap/devsetup.cpp | 3 + qmap/devsetup.h | 8 +- qmap/devsetup.ui | 20 +- qmap/getfile.cpp | 35 ++-- qmap/getfile.h | 4 +- qmap/libqmap/CMakeLists.txt | 9 +- qmap/libqmap/cfom.f90 | 40 ++++ qmap/libqmap/cfom_iq.f90 | 48 +++++ qmap/libqmap/chkstat.f90 | 28 +++ qmap/libqmap/decode0.f90 | 27 ++- qmap/libqmap/fftbig.f90 | 56 ++++++ qmap/libqmap/filbig.f90 | 123 ------------- qmap/libqmap/four2a.f90 | 115 ------------ qmap/libqmap/ftninit.f90 | 13 -- qmap/libqmap/ftnquit.f90 | 2 +- qmap/libqmap/getcand2.f90 | 77 ++++++-- qmap/libqmap/njunk.f90 | 2 +- qmap/libqmap/q65_sync.f90 | 44 +++-- qmap/libqmap/q65b.f90 | 102 ++++++++--- qmap/libqmap/q65c.f90 | 90 +++++++-- qmap/libqmap/qmapa.f90 | 98 +++++++--- qmap/libqmap/read_qm.f90 | 44 +++++ qmap/libqmap/recvpkt.f90 | 21 ++- qmap/libqmap/save_qm.f90 | 63 +++++++ qmap/libqmap/symspec.f90 | 69 +++---- qmap/libqmap/zaptx.f90 | 9 + qmap/main.cpp | 5 +- qmap/mainwindow.cpp | 438 +++++++++++++++++++++++++++++--------------- qmap/mainwindow.h | 73 ++++---- qmap/mainwindow.ui | 315 +++++++++++++++++-------------- qmap/plotter.cpp | 1 + qmap/soundin.cpp | 38 ++-- qmap/soundin.h | 3 +- 39 files changed, 1336 insertions(+), 872 deletions(-) create mode 100755 qmap/libqmap/cfom.f90 create mode 100755 qmap/libqmap/cfom_iq.f90 create mode 100755 qmap/libqmap/chkstat.f90 create mode 100755 qmap/libqmap/fftbig.f90 delete mode 100755 qmap/libqmap/filbig.f90 delete mode 100755 qmap/libqmap/four2a.f90 create mode 100755 qmap/libqmap/read_qm.f90 create mode 100755 qmap/libqmap/save_qm.f90 create mode 100755 qmap/libqmap/zaptx.f90 (limited to 'qmap') diff --git a/qmap/about.cpp b/qmap/about.cpp index fb618558..7dabdd1f 100755 --- a/qmap/about.cpp +++ b/qmap/about.cpp @@ -13,7 +13,7 @@ CAboutDlg::CAboutDlg(QWidget *parent) : "QMAP is a wideband receiver for the Q65 protocol, intnded
" "primarily for amateur radio EME communication. It works
" "in close cooperation with WSJT-X, versions 2.7 and later.

" - "Copyright 2001-2023 by Joe Taylor, K1JT. Additional
" + "Copyright 2001-2024 by Joe Taylor, K1JT. Additional
" "acknowledgments are contained in the source code."); } diff --git a/qmap/about.ui b/qmap/about.ui index 94603460..bb87a54e 100755 --- a/qmap/about.ui +++ b/qmap/about.ui @@ -20,7 +20,7 @@ - About MAP65 + About QMAP diff --git a/qmap/astro.cpp b/qmap/astro.cpp index 8b2cb00e..894c14cf 100755 --- a/qmap/astro.cpp +++ b/qmap/astro.cpp @@ -44,10 +44,8 @@ Astro::~Astro() delete ui; } -void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, - int fQSO, int nsetftx, int ntxFreq, QString azelDir, double xavg) +void Astro::astroUpdate(QDateTime t, QString mygrid, QString azelDir, double xavg) { - static int ntxFreq0=-99; char cc[300]; double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx; double ramoon,decmoon,dgrd,poloffset,xnr; @@ -63,32 +61,29 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, int isec=sec; double uth=nhr + nmin/60.0 + sec/3600.0; int nfreq=(int)datcom_.fcenter; -// if(nfreq<10 or nfreq > 50000) nfreq=144; astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(), - hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon, + mygrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon, &azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon, &dgrd, &poloffset, &xnr, 6, 6); datcom_.ndop00=ndop00; //Send self Doppler to decoder, via datcom -// qDebug() << "aa" << isec << datcom_.fcenter << nfreq << ndop00; + m_ndop00=ndop00; + snprintf(cc, sizeof(cc), - "Az: %6.1f\n" - "El: %6.1f\n" - "MyDop: %6d\n" - "DxAz: %6.1f\n" - "DxEl: %6.1f\n" - "DxDop: %6d\n" - "Dec: %6.1f\n" - "SunAz: %6.1f\n" - "SunEl: %6.1f\n" - "Freq: %6d\n" - "Tsky: %6d\n" - "MNR: %6.1f\n" - "Dgrd: %6.1f", - azmoon,elmoon,ndop00,azmoondx,elmoondx,ndop,decmoon,azsun,elsun, + "Az: %6.1f\n" + "El: %6.1f\n" + "SelfDop:%6d\n" + "MoonDec:%6.1f\n" + "SunAz: %6.1f\n" + "SunEl: %6.1f\n" + "Freq: %6d\n" + "Tsky: %6d\n" + "MNR: %6.1f\n" + "Dgrd: %6.1f", + azmoon,elmoon,ndop00,decmoon,azsun,elsun, nfreq,ntsky,xnr,dgrd); - ui->astroTextBrowser->setText(" "+ date + "\nUTC: " + utc + "\n" + cc); + ui->astroTextBrowser->setText(" "+ date + "\nUTC: " + utc + "\n" + cc); double azOffset=0.0; double elOffset=0.0; @@ -154,7 +149,6 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, // Write pointing data to azel.dat QString fname=azelDir+"/azel.dat"; -// qDebug() << "aa" << fname << isec << bPointing << azOffset << elOffset; QFile f(fname); if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) { if(azelDir==m_AzElDir0) return; @@ -164,22 +158,18 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, mb.exec(); return; } - int ndiff=0; - if(ntxFreq != ntxFreq0) ndiff=1; - ntxFreq0=ntxFreq; + QTextStream out(&f); snprintf(cc,sizeof(cc),"%2.2d:%2.2d:%2.2d,%5.1f,%5.1f,Moon\n" "%2.2d:%2.2d:%2.2d,%5.1f,%5.1f,Sun\n" "%2.2d:%2.2d:%2.2d,%5.1f,%5.1f,Source\n" "%4d,%6d,%6d,Doppler\n" - "%3d,%1d,fQSO\n" - "%3d,%1d,fQSO2\n", + "%3d,%1d,fQSO\n", nhr,nmin,isec,azmoon,elmoon, nhr,nmin,isec,azsun+azOffset,elsun+elOffset, nhr,nmin,isec,0.0,0.0, nfreq,ndop,ndop00, - fQSO,nsetftx, - ntxFreq,ndiff); + datcom_.mousefqso,0); out << cc; f.close(); } @@ -199,3 +189,7 @@ void Astro::on_cbOnOff_clicked(bool checked) if(checked) ui->cbAutoCycle->setChecked(false); } +int Astro::getSelfDop() +{ + return m_ndop00; +} diff --git a/qmap/astro.h b/qmap/astro.h index c752a2db..e4d8ee48 100755 --- a/qmap/astro.h +++ b/qmap/astro.h @@ -14,9 +14,10 @@ class Astro : public QWidget public: explicit Astro (QString const& settings_filename, QWidget *parent = 0); - void astroUpdate(QDateTime t, QString mygrid, QString hisgrid, - int fQSO, int nsetftx, int ntxFreq, QString azelDir, double xavg); + void astroUpdate(QDateTime t, QString mygrid, QString azelDir, double xavg); void setFontSize(int n); + int getSelfDop(); + ~Astro (); private slots: @@ -27,6 +28,8 @@ private: Ui::Astro *ui; QString m_settings_filename; QString m_AzElDir0; + + qint32 m_ndop00=0; }; #endif diff --git a/qmap/astro.ui b/qmap/astro.ui index fc31352a..5b0e43c5 100755 --- a/qmap/astro.ui +++ b/qmap/astro.ui @@ -6,8 +6,8 @@ 0 0 - 441 - 483 + 431 + 393 @@ -19,7 +19,7 @@ 269 19 151 - 431 + 361 @@ -29,7 +29,7 @@ 10 - 100 + 70 30 17 @@ -42,7 +42,7 @@ 60 - 100 + 70 40 17 @@ -58,7 +58,7 @@ 110 - 100 + 70 30 17 @@ -71,7 +71,7 @@ 60 - 150 + 120 30 17 @@ -84,7 +84,7 @@ 60 - 50 + 20 30 17 @@ -97,7 +97,7 @@ 10 - 230 + 180 130 22 @@ -131,7 +131,7 @@ 30 - 330 + 260 91 17 @@ -144,7 +144,7 @@ 30 - 380 + 300 70 17 @@ -157,7 +157,7 @@ 10 - 280 + 220 130 22 @@ -172,28 +172,46 @@ Dwell - 10 + 15 300 - 10 + 5 - + 0 10 258 - 471 + 371 + + + 0 + 0 + + + + + 0 + 325 + + + + + 16777215 + 16777215 + + Courier New @@ -207,7 +225,7 @@ - + Qt::Horizontal @@ -227,7 +245,7 @@ - + Qt::Horizontal @@ -241,6 +259,22 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + diff --git a/qmap/commons.h b/qmap/commons.h index a958fe6c..04123b3b 100755 --- a/qmap/commons.h +++ b/qmap/commons.h @@ -7,7 +7,7 @@ extern "C" { extern struct { //This is "common/datcom/..." in Fortran float d4[2*5760000]; //Raw I/Q data from Linrad - float ss[322*NFFT]; //Half-symbol spectra at 0,45,90,135 deg pol + float ss[400*NFFT]; //Half-symbol spectra at 0,45,90,135 deg pol float savg[NFFT]; //Avg spectra at 0,45,90,135 deg pol double fcenter; //Center freq from Linrad (MHz) int nutc; //UTC as integer, HHMM @@ -17,22 +17,22 @@ extern struct { //This is "common/datcom/..." in Fortran int nagain; //1 ==> decode only at fQSO +/- Tol int ndepth; //How much hinted decoding to do? int ndiskdat; //1 ==> data read from *.iq file - int neme; //Hinted decoding tries only for EME calls + int ntx60; //Number of seconds transmitted in Q65-60x int newdat; //1 ==> new data, must do long FFT int nfa; //Low decode limit (kHz) int nfb; //High decode limit (kHz) int nfcal; //Frequency correction, for calibration (Hz) int nfshift; //Shift of displayed center freq (kHz) - int mcall3; //1 ==> CALL3.TXT has been modified - int ntimeout; //Max for timeouts in Messages and BandMap + int ntx30a; //Number of seconds transmitted in first half minute , Q65-30x + int ntx30b; //Number of seconds transmitted in second half minute, Q65-30x int ntol; //+/- decoding range around fQSO (Hz) - int nxant; //1 ==> add 45 deg to measured pol angle - int junk_1; + int n60; //nsecs%60 + int junk4; // int nfsample; //Input sample rate - int nxpol; //1 if using xpol antennas, 0 otherwise - int nmode; //nmode = 10*m_modeQ65 + m_modeJT65 - int ndop00; //EME Self Doppler - int nsave; //Number of s3(64,63) spectra saved + int ndop58; //EME Self Doppler at t=58 + int nBaseSubmode; //Base submode for Q65-60x (aka m_modeQ65) + int ndop00; //EME Self Doppler at t=0 + int nsave; //0=None, 1=SaveDecoded, 2=SaveAll int max_drift; //Maximum Q65 drift: units symbol_rate/TxT int offset; //Offset in Hz int nhsym; //Number of available JT65 half-symbols @@ -43,11 +43,12 @@ extern struct { //This is "common/datcom/..." in Fortran char datetime[20]; int junk1; //Used to test extent of copy to shared memory int junk2; + bool bAlso30; //Process for 30-second submode as well as 60-second } datcom_; extern struct { //This is "common/datcom/..." in Fortran float d4[2*5760000]; //Raw I/Q data from Linrad - float ss[322*NFFT]; //Half-symbol spectra at 0,45,90,135 deg pol + float ss[400*NFFT]; //Half-symbol spectra at 0,45,90,135 deg pol float savg[NFFT]; //Avg spectra at 0,45,90,135 deg pol double fcenter; //Center freq from Linrad (MHz) int nutc; //UTC as integer, HHMM @@ -57,22 +58,22 @@ extern struct { //This is "common/datcom/..." in Fortran int nagain; //1 ==> decode only at fQSO +/- Tol int ndepth; //How much hinted decoding to do? int ndiskdat; //1 ==> data read from *.iq file - int neme; //Hinted decoding tries only for EME calls + int ntx60; //Number of seconds transmitted in Q65-60x int newdat; //1 ==> new data, must do long FFT int nfa; //Low decode limit (kHz) int nfb; //High decode limit (kHz) int nfcal; //Frequency correction, for calibration (Hz) int nfshift; //Shift of displayed center freq (kHz) - int mcall3; //1 ==> CALL3.TXT has been modified - int ntimeout; //Max for timeouts in Messages and BandMap + int ntx30a; //Number of seconds transmitted in first half minute , Q65-30x + int ntx30b; //Number of seconds transmitted in second half minute, Q65-30x int ntol; //+/- decoding range around fQSO (Hz) - int nxant; //1 ==> add 45 deg to measured pol angle - int junk_1; + int n60; //nsecs%60 + int junk4; // int nfsample; //Input sample rate - int nxpol; //1 if using xpol antennas, 0 otherwise - int nmode; //nmode = 10*m_modeQ65 + m_modeJT65 - int ndop00; //EME Self Doppler - int nsave; //Number of s3(64,63) spectra saved + int ndop58; //EME Self Doppler at t=58 + int nBaseSubmode; //Base submode for Q65-60x (aka m_modeQ65) + int ndop00; //EME Self Doppler at t=0 + int nsave; //0=None, 1=SaveDecoded, 2=SaveAll int max_drift; //Maximum Q65 drift: units symbol_rate/TxT int offset; //Offset in Hz int nhsym; //Number of available JT65 half-symbols @@ -83,6 +84,7 @@ extern struct { //This is "common/datcom/..." in Fortran char datetime[20]; int junk1; //Used to test extent of copy to shared memory int junk2; + bool bAlso30; //Process for 30-second submode as well as 60-second } datcom2_; extern struct { @@ -90,10 +92,16 @@ extern struct { int ncand; //between QMAP and WSJT-X int nQDecoderDone; //1 for real-time decodes, 2 for data from disk int nWDecoderBusy; //Set to 1 when WSJT-X decoder is busy - int nWTransmitting; //Set to 1 when WSJT-X is transmitting - char result[50][60]; //Staging area for QMAP decodes + int nWTransmitting; //Set to TRperiod when WSJT-X is transmitting + int kHzRequested; //Integer kHz dial frequency request to WSJT-X + char result[50][64]; //Staging area for QMAP decodes } decodes_; +extern struct { + char revision[22]; + char saveFileName[120]; +} savecom_; + } #endif // COMMONS_H diff --git a/qmap/devsetup.cpp b/qmap/devsetup.cpp index 2617952b..c1edae03 100755 --- a/qmap/devsetup.cpp +++ b/qmap/devsetup.cpp @@ -20,6 +20,8 @@ void DevSetup::initDlg() ui.myCallEntry->setText(m_myCall); ui.myGridEntry->setText(m_myGrid); ui.astroFont->setValue(m_astroFont); + ui.myCallColor->addItems({"","red","green","cyan"}); + ui.myCallColor->setCurrentIndex(m_myCallColor); ui.saveDirEntry->setText(m_saveDir); ui.azelDirEntry->setText(m_azelDir); ui.fCalSpinBox->setValue(m_fCal); @@ -38,6 +40,7 @@ void DevSetup::accept() m_myCall=ui.myCallEntry->text(); m_myGrid=ui.myGridEntry->text(); m_astroFont=ui.astroFont->value(); + m_myCallColor=ui.myCallColor->currentIndex(); m_saveDir=ui.saveDirEntry->text(); m_azelDir=ui.azelDirEntry->text(); m_fCal=ui.fCalSpinBox->value(); diff --git a/qmap/devsetup.h b/qmap/devsetup.h index 30d0bf85..85e7620c 100755 --- a/qmap/devsetup.h +++ b/qmap/devsetup.h @@ -12,10 +12,6 @@ public: ~DevSetup(); void initDlg(); - qint32 m_idInt; - qint32 m_pttPort; - qint32 m_timeout; - qint32 m_dPhi; qint32 m_fCal; qint32 m_udpPort; qint32 m_astroFont; @@ -25,14 +21,14 @@ public: double m_TxOffset; bool m_network; - bool m_fs96000; bool m_restartSoundIn; + int m_myCallColor; + QString m_myCall; QString m_myGrid; QString m_saveDir; QString m_azelDir; - QString m_editorCommand; public slots: void accept(); diff --git a/qmap/devsetup.ui b/qmap/devsetup.ui index bd0bc1a4..a13b9d24 100755 --- a/qmap/devsetup.ui +++ b/qmap/devsetup.ui @@ -7,7 +7,7 @@ 0 0 400 - 250 + 268 @@ -63,6 +63,13 @@ + + + + Highlight My Call: + + + @@ -106,6 +113,9 @@ + + + @@ -175,10 +185,10 @@ - -20000 + -50000 - 20000 + 50000 @@ -287,7 +297,7 @@ - Input from Linrad + Input from Linrad or SDR Console @@ -312,7 +322,7 @@ -50 - 10 + 50 1 diff --git a/qmap/getfile.cpp b/qmap/getfile.cpp index 95dd0791..715d7249 100755 --- a/qmap/getfile.cpp +++ b/qmap/getfile.cpp @@ -6,10 +6,10 @@ extern qint16 id[2*60*96000]; -void getfile(QString fname, bool xpol, int dbDgrd) +void getfile(QString fname, int dbDgrd) { - int npts=2*56*96000; - if(xpol) npts=2*npts; +// int npts=2*56*96000; + int npts=2*60*96000; // Degrade S/N by dbDgrd dB -- for tests only!! float dgrd=0.0; @@ -23,31 +23,32 @@ void getfile(QString fname, bool xpol, int dbDgrd) if(fp != NULL) { auto n = fread(&datcom_.fcenter,sizeof(datcom_.fcenter),1,fp); -// qDebug() << "aa0" << sizeof(datcom_.fcenter) << n << datcom_.fcenter; - n = fread(id,2,npts,fp); - Q_UNUSED (n); + n=fread(id,2,npts,fp); + n=fread(&datcom_.ntx30a,4,1,fp); + n=fread(&datcom_.ntx30b,4,1,fp); + if(n==0) { + datcom_.ntx30a=0; + datcom_.ntx30b=0; + } int j=0; if(dbDgrd<0) { for(int i=0; i0) { datcom_.nutc=100*fname.mid(i0-4,2).toInt() + fname.mid(i0-2,2).toInt(); @@ -55,11 +56,9 @@ void getfile(QString fname, bool xpol, int dbDgrd) } } -void savetf2(QString fname, bool xpol) +void save_iq(QString fname) { - int npts=2*56*96000; - if(xpol) npts=2*npts; - + int npts=2*60*96000; qint16* buf=(qint16*)malloc(2*npts); char name[80]; strcpy(name,fname.toLocal8Bit()); @@ -69,11 +68,11 @@ void savetf2(QString fname, bool xpol) fwrite(&datcom_.fcenter,sizeof(datcom_.fcenter),1,fp); int j=0; for(int i=0; i #include "commons.h" -void getfile(QString fname, bool xpol, int dbDgrd); -void savetf2(QString fname, bool xpol); +void getfile(QString fname, int dbDgrd); +void save_iq(QString fname); float gran(); #endif // GETFILE_H diff --git a/qmap/libqmap/CMakeLists.txt b/qmap/libqmap/CMakeLists.txt index ecf3ccdf..34e3382c 100755 --- a/qmap/libqmap/CMakeLists.txt +++ b/qmap/libqmap/CMakeLists.txt @@ -5,14 +5,14 @@ set (libq65_FSRCS astro.f90 astro0.f90 astrosub.f90 + chkstat.f90 dcoord.f90 decode0.f90 dot.f90 fchisq0.f90 - filbig.f90 - four2a.f90 + fftbig.f90 ftninit.f90 - ftnquit.f90 +# ftnquit.f90 geocentric.f90 getcand2.f90 grid2deg.f90 @@ -24,12 +24,15 @@ set (libq65_FSRCS q65c.f90 q65_sync.f90 qmapa.f90 + read_qm.f90 recvpkt.f90 + save_qm.f90 sun.f90 symspec.f90 timf2.f90 tm2.f90 toxyz.f90 + zaptx.f90 f77_wisdom.f ) diff --git a/qmap/libqmap/cfom.f90 b/qmap/libqmap/cfom.f90 new file mode 100755 index 00000000..986a39dc --- /dev/null +++ b/qmap/libqmap/cfom.f90 @@ -0,0 +1,40 @@ +subroutine cfom(dd,k0,k,ndop0) + + parameter(NMAX=60*96000) + real dd(2,NMAX) + complex*16 w,wstep + complex*8 c + real*8 twopi,dphi + logical first + data first/.true./ + save twopi,w,first + + if(first) then + twopi=8.d0*atan(1.d0) + w=1.d0 + first=.false. + endif + + dop0=0.5*ndop0 + dphi=dop0*twopi/96000.0 + wstep=cmplx(cos(dphi),sin(dphi)) + + do j=k0+1,k + c=w*cmplx(dd(1,j),dd(2,j)) + dd(1,j)=real(c) + dd(2,j)=aimag(c) + w=w*wstep + enddo + + return +end subroutine cfom + +subroutine zaptx(dd,k0,k) + + parameter(NMAX=60*96000) + real dd(2,NMAX) + + dd(1:2,k0+1:k)=0. + + return +end subroutine zaptx diff --git a/qmap/libqmap/cfom_iq.f90 b/qmap/libqmap/cfom_iq.f90 new file mode 100755 index 00000000..f63af5ae --- /dev/null +++ b/qmap/libqmap/cfom_iq.f90 @@ -0,0 +1,48 @@ +program cfom_iq + + parameter(NMAX=60*96000) + integer*2 id2(2,NMAX) + complex*16 c,w,wstep + real*8 fcenter,uth8,twopi,dphi + character*6 mygrid + + twopi=8.d0*atan(1.d0) + open(10,file='231028_0131.iq',status='old',access='stream') + open(12,file='231028_0131.cfom',status='unknown',access='stream') + + mygrid='FN20OG' + nyear=2023 + month=10 + nday=28 + uth8=01 + 31.d0/60 + nfreq=1296 + call astrosub00(nyear,month,nday,uth8,nfreq,mygrid,ndop0) + call astrosub00(nyear,month,nday,uth8+1.d0/60.d0,nfreq,mygrid,ndop1) + + print*,ndop0,ndop1 + + read(10) fcenter,id2(1:2,1:56*96000) + id2(1:2,56*96000+1:NMAX)=0 + + dop0=0.5*ndop0 + dop1=0.5*ndop1 + j=0 + w=1.0 + do isec=1,60 + dop=dop0 + (isec-0.5)*(dop1-dop0)/60. + dphi=dop*twopi/96000.0 + wstep=cmplx(cos(dphi),sin(dphi)) + do n=1,96000 + j=j+1 + x=id2(1,j) + y=id2(2,j) + w=w*wstep + c=100.d0*w*cmplx(x,y) + id2(1,j)=0.01d0*real(c) + id2(2,j)=0.01d0*aimag(c) + enddo + enddo + + write(12) fcenter,id2 + +end program cfom_iq diff --git a/qmap/libqmap/chkstat.f90 b/qmap/libqmap/chkstat.f90 new file mode 100755 index 00000000..cb0c69d1 --- /dev/null +++ b/qmap/libqmap/chkstat.f90 @@ -0,0 +1,28 @@ +subroutine chkstat(dd,nhsym,pdb) + + real dd(2,5760000) + real pdb(4) + integer ia(4),ib(4) + logical*1 btx0,btx1 + + btx0=.false. + btx1=.false. + ia(1)=23*96000+1 + ib(1)=24*96000 + ia(2)=27*96000+1 + ib(2)=28*96000 + ia(3)=53*96000+1 + ib(3)=54*96000 + ia(4)=57*96000+1 + ib(4)=58*96000 + + do j=1,4 + sq=0. + do i=ia(j),ib(j) + sq=sq + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i) + enddo + pdb(j)=db(1.0 + sq/(2.0*96000.0)) + enddo + + return +end subroutine chkstat diff --git a/qmap/libqmap/decode0.f90 b/qmap/libqmap/decode0.f90 index 7e61369d..55a58dc7 100755 --- a/qmap/libqmap/decode0.f90 +++ b/qmap/libqmap/decode0.f90 @@ -3,26 +3,26 @@ subroutine decode0(dd,ss,savg) use timer_module, only: timer parameter (NSMAX=60*96000) - real*4 dd(2,NSMAX),ss(322,NFFT),savg(NFFT) + real*4 dd(2,NSMAX),ss(400,NFFT),savg(NFFT) real*8 fcenter integer offset integer hist(0:32768) + logical*1 bAlso30 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,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,result(50) + character*64 result + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, & - ndepth,ndiskdat,neme,newdat,nfa,nfb,nfcal,nfshift, & - mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,nmode, & + ndepth,ndiskdat,ntx60,newdat,nfa,nfb,nfcal,nfshift, & + ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, & ndop00,nsave,max_drift,offset,nhsym,mycall,mygrid, & - hiscall,hisgrid,datetime - data neme0/-99/ + hiscall,hisgrid,datetime,junk1,junk2,bAlso30 save nQDecoderDone=0 if(newdat.ne.0) then - nz=96000*nhsym/5.3833 + nz=96000*nhsym*0.15 hist=0 do i=1,nz j1=min(abs(dd(1,i)),32768.0) @@ -41,13 +41,12 @@ subroutine decode0(dd,ss,savg) mycall0=mycall hiscall0=hiscall hisgrid0=hisgrid - neme0=neme call timer('qmapa ',0) - call qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & - mousedf,mousefqso,nagain,nfshift,max_drift,offset, & - nfcal,mycall,hiscall,hisgrid,nfsample,nmode,ndepth, & - datetime,ndop00,fselected) + call qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & + mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, & + nfcal,mycall,hiscall,hisgrid,nfsample,nmode,ndepth, & + datetime,ndop00,fselected,bAlso30,nhsym,NCFOM) call timer('qmapa ',1) return diff --git a/qmap/libqmap/fftbig.f90 b/qmap/libqmap/fftbig.f90 new file mode 100755 index 00000000..b807f6a1 --- /dev/null +++ b/qmap/libqmap/fftbig.f90 @@ -0,0 +1,56 @@ +subroutine fftbig(dd,nmax) + +! Do the full length FFT of complex data stored in array dd(2,nmax). + + use, intrinsic :: iso_c_binding + + use FFTW3 + use timer_module, only: timer + parameter (MAXFFT1=5376000) + real*4 dd(2,nmax) !Input data + complex ca(MAXFFT1) !FFT of input + real*8 df + type(C_PTR) :: plan1 !Pointer to FFTW plan + logical first + common/cacb/ca + equivalence (rfilt,cfilt) + data first/.true./,npatience/0/ + save + + if(nmax.lt.0) go to 900 + + nfft1=MAXFFT1 + if(first) then + nflags=FFTW_ESTIMATE + if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT + if(npatience.eq.2) nflags=FFTW_MEASURE + if(npatience.eq.3) nflags=FFTW_PATIENT + if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE + +! Plan the big FFT just once + call timer('FFTplan ',0) + plan1=fftwf_plan_dft_1d(nfft1,ca,ca,+1,nflags) + call timer('FFTplan ',1) + df=96000.d0/nfft1 + first=.false. + endif + + nz=min(nmax,nfft1) + do i=1,nz + ca(i)=cmplx(dd(1,i),dd(2,i)) + enddo + + if(nmax.lt.nfft1) then + do i=nmax+1,nfft1 + ca(i)=0. + enddo + endif + call timer('FFTbig ',0) + call fftwf_execute_dft(plan1,ca,ca) + call timer('FFTbig ',1) + go to 999 + +900 call fftwf_destroy_plan(plan1) + +999 return +end subroutine fftbig diff --git a/qmap/libqmap/filbig.f90 b/qmap/libqmap/filbig.f90 deleted file mode 100755 index 94a3fa1c..00000000 --- a/qmap/libqmap/filbig.f90 +++ /dev/null @@ -1,123 +0,0 @@ -subroutine filbig(dd,nmax,f0,newdat,nfsample,c4a,n4) - -! Filter and downsample complex data stored in array dd(2,nmax). -! Output is downsampled from 96000 Hz to 1375.125 Hz. - - use timer_module, only: timer - parameter (MAXFFT1=5376000,MAXFFT2=77175) - real*4 dd(2,nmax) !Input data - complex ca(MAXFFT1) !FFT of input - complex c4a(MAXFFT2) !Output data - real*8 df - real halfpulse(8) !Impulse response of filter (one sided) - complex cfilt(MAXFFT2) !Filter (complex; imag = 0) - real rfilt(MAXFFT2) !Filter (real) - integer*8 plan1,plan2,plan3,plan4,plan5 - logical first - include 'fftw3.f' - common/cacb/ca - equivalence (rfilt,cfilt) - data first/.true./,npatience/1/ - data halfpulse/114.97547150,36.57879257,-20.93789101, & - 5.89886379,1.59355187,-2.49138308,0.60910773,-0.04248129/ - save - - if(nmax.lt.0) go to 900 - - nfft1=MAXFFT1 - nfft2=MAXFFT2 - if(nfsample.eq.95238) then - nfft1=5120000 - nfft2=74088 - endif - - if(first) then - nflags=FFTW_ESTIMATE - if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT - if(npatience.eq.2) nflags=FFTW_MEASURE - if(npatience.eq.3) nflags=FFTW_PATIENT - if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE - -! Plan the FFTs just once - call timer('FFTplans ',0) - call sfftw_plan_dft_1d(plan1,nfft1,ca,ca,FFTW_BACKWARD,nflags) - call sfftw_plan_dft_1d(plan3,nfft2,c4a,c4a,FFTW_FORWARD,nflags) - call sfftw_plan_dft_1d(plan5,nfft2,cfilt,cfilt,FFTW_BACKWARD,nflags) - call timer('FFTplans ',1) - -! Convert impulse response to filter function - do i=1,nfft2 - cfilt(i)=0. - enddo - fac=0.00625/nfft1 - cfilt(1)=fac*halfpulse(1) - do i=2,8 - cfilt(i)=fac*halfpulse(i) - cfilt(nfft2+2-i)=fac*halfpulse(i) - enddo - call sfftw_execute(plan5) - - base=cfilt(nfft2/2+1) - do i=1,nfft2 - rfilt(i)=real(cfilt(i))-base - enddo - - df=96000.d0/nfft1 - if(nfsample.eq.95238) df=95238.1d0/nfft1 - first=.false. - endif - -! When new data comes along, we need to compute a new "big FFT" -! If we just have a new f0, continue with the existing ca. - - if(newdat.ne.0 .or. sum(abs(ca)).eq.0.0) then !### Test on ca should be unnecessary? - nz=min(nmax,nfft1) - do i=1,nz - ca(i)=cmplx(dd(1,i),dd(2,i)) - enddo - - if(nmax.lt.nfft1) then - do i=nmax+1,nfft1 - ca(i)=0. - enddo - endif - call timer('FFTbig ',0) - call sfftw_execute(plan1) - call timer('FFTbig ',1) -!### newdat=0 - endif - -! NB: f0 is the frequency at which we want our filter centered. -! i0 is the bin number in ca closest to f0. - - i0=nint(f0/df) + 1 - nh=nfft2/2 - do i=1,nh !Copy data into c4a - j=i0+i-1 !and apply the filter function - if(j.ge.1 .and. j.le.nfft1) then - c4a(i)=rfilt(i)*ca(j) - else - c4a(i)=0. - endif - enddo - do i=nh+1,nfft2 - j=i0+i-1-nfft2 - if(j.lt.1) j=j+nfft1 - c4a(i)=rfilt(i)*ca(j) - enddo - -! Do the short reverse transform, to go back to time domain. - call timer('FFTsmall',0) - call sfftw_execute(plan3) - call timer('FFTsmall',1) - n4=min(nmax/64,nfft2) - go to 999 - -900 call sfftw_destroy_plan(plan1) - call sfftw_destroy_plan(plan2) - call sfftw_destroy_plan(plan3) - call sfftw_destroy_plan(plan4) - call sfftw_destroy_plan(plan5) - -999 return -end subroutine filbig diff --git a/qmap/libqmap/four2a.f90 b/qmap/libqmap/four2a.f90 deleted file mode 100755 index 16a86bc5..00000000 --- a/qmap/libqmap/four2a.f90 +++ /dev/null @@ -1,115 +0,0 @@ -subroutine four2a(a,nfft,ndim,isign,iform) - -! IFORM = 1, 0 or -1, as data is -! complex, real, or the first half of a complex array. Transform -! values are returned in array DATA. They are complex, real, or -! the first half of a complex array, as IFORM = 1, -1 or 0. - -! The transform of a real array (IFORM = 0) dimensioned N(1) by N(2) -! by ... will be returned in the same array, now considered to -! be complex of dimensions N(1)/2+1 by N(2) by .... Note that if -! IFORM = 0 or -1, N(1) must be even, and enough room must be -! reserved. The missing values may be obtained by complex conjugation. - -! The reverse transformation of a half complex array dimensioned -! N(1)/2+1 by N(2) by ..., is accomplished by setting IFORM -! to -1. In the N array, N(1) must be the true N(1), not N(1)/2+1. -! The transform will be real and returned to the input array. - -! This version of four2a makes calls to the FFTW library to do the -! actual computations. - - use fftw3 - parameter (NPMAX=2100) !Max numberf of stored plans - parameter (NSMALL=16384) !Max size of "small" FFTs - complex a(nfft+1) !Array to be transformed - complex aa(NSMALL) !Local copy of "small" a() - integer nn(NPMAX),ns(NPMAX),nf(NPMAX) !Params of stored plans - integer*8 nl(NPMAX),nloc !More params of plans - integer*8 plan(NPMAX) !Pointers to stored plans - logical found_plan - data nplan/0/ !Number of stored plans - common/patience/npatience,nthreads !Patience and threads for FFTW plans - save plan,nplan,nn,ns,nf,nl - - if(nfft.lt.0) go to 999 - - nloc=loc(a) - - found_plan = .false. - !$omp critical(four2a_setup) - do i=1,nplan - if(nfft.eq.nn(i) .and. isign.eq.ns(i) .and. & - iform.eq.nf(i) .and. nloc.eq.nl(i)) then - found_plan = .true. - exit - end if - enddo - - if(i.ge.NPMAX) stop 'Too many FFTW plans requested.' - - if (.not. found_plan) then - nplan=nplan+1 - i=nplan - - nn(i)=nfft - ns(i)=isign - nf(i)=iform - nl(i)=nloc - -! Planning: FFTW_ESTIMATE, FFTW_ESTIMATE_PATIENT, FFTW_MEASURE, -! FFTW_PATIENT, FFTW_EXHAUSTIVE - nflags=FFTW_ESTIMATE - if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT - if(npatience.eq.2) nflags=FFTW_MEASURE - if(npatience.eq.3) nflags=FFTW_PATIENT - if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE - - if(nfft.le.NSMALL) then - jz=nfft - if(iform.eq.0) jz=nfft/2 - aa(1:jz)=a(1:jz) - endif - - !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls - if(isign.eq.-1 .and. iform.eq.1) then - call sfftw_plan_dft_1d(plan(i),nfft,a,a,FFTW_FORWARD,nflags) - else if(isign.eq.1 .and. iform.eq.1) then - call sfftw_plan_dft_1d(plan(i),nfft,a,a,FFTW_BACKWARD,nflags) - else if(isign.eq.-1 .and. iform.eq.0) then - call sfftw_plan_dft_r2c_1d(plan(i),nfft,a,a,nflags) - else if(isign.eq.1 .and. iform.eq.-1) then - call sfftw_plan_dft_c2r_1d(plan(i),nfft,a,a,nflags) - else - stop 'Unsupported request in four2a' - endif - !$omp end critical(fftw) - - if(nfft.le.NSMALL) then - jz=nfft - if(iform.eq.0) jz=nfft/2 - a(1:jz)=aa(1:jz) - endif - end if - !$omp end critical(four2a_setup) - - call sfftw_execute(plan(i)) - return - -999 continue - - !$omp critical(four2a) - do i=1,nplan -! The test is only to silence a compiler warning: - if(ndim.ne.-999) then - !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls - call sfftw_destroy_plan(plan(i)) - !$omp end critical(fftw) - end if - enddo - - nplan=0 - !$omp end critical(four2a) - - return -end subroutine four2a diff --git a/qmap/libqmap/ftninit.f90 b/qmap/libqmap/ftninit.f90 index 7ed2fd16..e126537f 100755 --- a/qmap/libqmap/ftninit.f90 +++ b/qmap/libqmap/ftninit.f90 @@ -3,10 +3,8 @@ subroutine ftninit use timer_impl, only: init_timer !,fini_timer, limtrace use, intrinsic :: iso_c_binding, only: C_NULL_CHAR use FFTW3 -! character*(*) appd character*1 appd character addpfx*8 - character wisfile*256 common/pfxcom/addpfx lu=8 @@ -17,17 +15,6 @@ subroutine ftninit open(12,file=appd//'/all_qmap.txt',status='unknown',position='append') open(17,file=appd//'/red.dat',status='unknown') open(19,file=appd//'/livecq.txt',status='unknown') - open(71,file=appd//'/fort.71',status='unknown') - open(72,file=appd//'/fort.72',status='unknown') - open(73,file=appd//'/fort.73',status='unknown') - -! Import FFTW wisdom, if available: - iret=fftwf_init_threads() !Initialize FFTW threading -! Default to 1 thread, but use nthreads for the big ones - call fftwf_plan_with_nthreads(1) -! Import FFTW wisdom, if available - wisfile=trim(appd)//'/m65_wisdom.dat'// C_NULL_CHAR - iret=fftwf_import_wisdom_from_filename(wisfile) return end subroutine ftninit diff --git a/qmap/libqmap/ftnquit.f90 b/qmap/libqmap/ftnquit.f90 index 5d84d9ec..1a329dee 100755 --- a/qmap/libqmap/ftnquit.f90 +++ b/qmap/libqmap/ftnquit.f90 @@ -2,7 +2,7 @@ subroutine ftnquit ! Destroy the FFTW plans call four2a(a,-1,1,1,1) - call filbig(id,-1,f0,newdat,nfsample,c4a,n4) + call fftbig(id,-1) return end subroutine ftnquit diff --git a/qmap/libqmap/getcand2.f90 b/qmap/libqmap/getcand2.f90 index f0fb1b8a..08b0acc5 100755 --- a/qmap/libqmap/getcand2.f90 +++ b/qmap/libqmap/getcand2.f90 @@ -1,4 +1,5 @@ -subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand) +subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, & + ntol,f0_selected,bAlso30,cand,ncand2) ! Get candidates for Q65 decodes, based on presence of sync tone. @@ -6,15 +7,18 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand) real :: snr !Relative S/N of sync detection real :: f !Freq of sync tone, 0 to 96000 Hz real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s + integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x + integer :: iseq !0 for first half-minute, 1 for second half end type candidate parameter (NFFT=32768) !FFTs done in symspec() parameter (MAX_CANDIDATES=50) type(candidate) :: cand(MAX_CANDIDATES) - real ss(322,NFFT) !Symbol spectra + real ss(400,NFFT) !Symbol spectra real savg0(NFFT),savg(NFFT) !Average spectra over whole Rx sequence integer ipk1(1) !Peak index of local portion of spectrum logical sync_ok !True if sync pattern is present + logical*1 bAlso30 data nseg/16/,npct/40/ savg=savg0 !Save the original spectrum @@ -35,7 +39,7 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand) nguard=5 !Guard range in bins i1=1 i2=NFFT-nbw-nguard - if(nagain.eq.1) then + if(nagain.ge.1) then i1=nint((1000.0*f0_selected-ntol)/df) i2=nint((1000.0*f0_selected+ntol)/df) endif @@ -48,20 +52,65 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand) i0=ipk1(1) + i - 1 !Index of local peak in savg() fpk=0.001*i0*df !Frequency of peak (kHz) ! Check to see if sync tone is present. - call q65_sync(ss,i0,nts_q65,sync_ok,snr_sync,xdt) - if(.not.sync_ok) cycle + ntrperiod=60 + iseq=0 + if(nhsym.ge.200) then + call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) + if(sync_ok) then +! Sync tone is present, we have a candidate for decoding + j=j+1 + cand(j)%f=fpk + cand(j)%xdt=xdt + cand(j)%snr=snr_sync + cand(j)%ntrperiod=ntrperiod + cand(j)%iseq=iseq + ia=max(1,min(i,i0-nguard)) + ib=min(i0+nbw+nguard,32768) + savg(ia:ib)=0. + if(j.ge.MAX_CANDIDATES) exit + endif + endif + + if(.not.bAlso30) cycle + ntrperiod=30 + + if(nhsym.le.200 .and. ntx30a.le.5) then + call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) + if(sync_ok) then +! Sync tone is present, we have a candidate for decoding + j=j+1 + cand(j)%f=fpk + cand(j)%xdt=xdt + cand(j)%snr=snr_sync + cand(j)%ntrperiod=ntrperiod + cand(j)%iseq=iseq + ia=max(1,min(i,i0-nguard)) + ib=min(i0+nbw+nguard,32768) + savg(ia:ib)=0. + if(j.ge.MAX_CANDIDATES) exit + endif + endif + iseq=1 + if(nhsym.ge.330 .and. ntx30b.le.5) then + call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) + if(sync_ok) then ! Sync tone is present, we have a candidate for decoding - j=j+1 - cand(j)%f=fpk - cand(j)%xdt=xdt - cand(j)%snr=snr_sync - ia=max(1,min(i,i0-nguard)) - ib=min(i0+nbw+nguard,32768) - savg(ia:ib)=0. - if(j.ge.MAX_CANDIDATES) exit + j=j+1 + cand(j)%f=fpk + cand(j)%xdt=xdt + cand(j)%snr=snr_sync + cand(j)%ntrperiod=ntrperiod + cand(j)%iseq=iseq + ia=max(1,min(i,i0-nguard)) + ib=min(i0+nbw+nguard,32768) + savg(ia:ib)=0. + if(j.ge.MAX_CANDIDATES) exit + endif + endif + enddo - ncand=j !Total number of candidates found + ncand2=j !Total number of candidates found return end subroutine getcand2 diff --git a/qmap/libqmap/njunk.f90 b/qmap/libqmap/njunk.f90 index 04dfa916..8fa19aca 100755 --- a/qmap/libqmap/njunk.f90 +++ b/qmap/libqmap/njunk.f90 @@ -1 +1 @@ - parameter(NJUNK=41) + parameter(NJUNK=42) diff --git a/qmap/libqmap/q65_sync.f90 b/qmap/libqmap/q65_sync.f90 index dec46f91..3e20d7a8 100755 --- a/qmap/libqmap/q65_sync.f90 +++ b/qmap/libqmap/q65_sync.f90 @@ -1,38 +1,42 @@ -subroutine q65_sync(ss,i0,nts_q65,sync_ok,snr,xdt) +subroutine q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr,xdt) ! Test for presence of Q65 sync tone parameter (NFFT=32768) parameter (LAGMAX=33) - real ss(322,NFFT) !Symbol spectra + real ss(400,NFFT) !Symbol spectra real ccf(0:LAGMAX) !The WSJT "blue curve", peak at DT logical sync_ok - logical first - integer isync(22),ipk(1) + integer isync0(22),isync(22),ipk(1) ! Q65 sync symbols - data isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/ - data first/.true./ - save first,isync + data isync0/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/ - tstep=2048.0/11025.0 !0.185760 s: 0.5*tsym_jt65, 0.3096*tsym_q65 - if(first) then - fac=0.6/tstep !3.230 - do i=1,22 !Expand the Q65 sync stride - isync(i)=nint((isync(i)-1)*fac) + 1 - enddo - first=.false. - endif + sync_ok=.false. +! if(ntrperiod.ne.60) return + + tstep=0.15 !0.5*tsym_Q65-30x, 0.25*tsys_Q65-60x + nfac=4 + if(ntrperiod.eq.30) nfac=2 + do i=1,22 !Expand sync stride for Q65-60x + isync(i)=nfac*(isync0(i)-1) + 1 + enddo m=nts_q65/2 + if(ntrperiod.eq.30) m=nts_q65/4 i1=max(1,i0-m) i2=min(NFFT,i0+m) ccf=0. do lag=0,LAGMAX !Search over range of DT do j=1,22 !Test for Q65 sync - k=isync(j) + lag - ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) & - + sum(ss(k+2,i1:i2)) + k=isync(j) + lag + iseq*200 + if(k.ge.400) cycle + if(ntrperiod.eq.60) then + ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) & + + sum(ss(k+2,i1:i2)) + sum(ss(k+3,i1:i2)) + else + ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) + endif ! Q: Should we use weighted sums, perhaps a Lorentzian peak? enddo enddo @@ -40,16 +44,20 @@ subroutine q65_sync(ss,i0,nts_q65,sync_ok,snr,xdt) ipk=maxloc(ccf) lagbest=ipk(1)-1 xdt=lagbest*tstep - 1.0 + if(ntrperiod.eq.30) xd=xdt+0.6 !Why ??? xsum=0. sq=0. nsum=0 + fpk=0.001*i0*96000.0/32768.0 + 32.0 do i=0,lagmax !Compute ave and rms of "blue curve" if(abs(i-lagbest).gt.2) then xsum=xsum+ccf(i) sq=sq+ccf(i)**2 nsum=nsum+1 endif +! write(40,3040) i,i*tstep-1.0,ccf(i),fpk +!3040 format(i5,3f8.2) enddo ave=xsum/nsum rms=sqrt(sq/nsum - ave*ave) diff --git a/qmap/libqmap/q65b.f90 b/qmap/libqmap/q65b.f90 index 260aebf9..cd41626b 100755 --- a/qmap/libqmap/q65b.f90 +++ b/qmap/libqmap/q65b.f90 @@ -1,6 +1,7 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & - mycall0,hiscall0,hisgrid,mode_q65,f0,fqso,nkhz_center, newdat,nagain, & - max_drift,offset,ndepth,datetime,ndop00,idec) + ntrperiod,iseq,mycall0,hiscall0,hisgrid,mode_q65,f0,fqso,nkhz_center, & + newdat,nagain,bClickDecode,max_drift,offset,ndepth,datetime,nCFOM, & + ndop00,nhsym,idec) ! This routine provides an interface between QMAP and the Q65 decoder ! in WSJT-X. All arguments are input data obtained from the QMAP GUI. @@ -8,28 +9,34 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & ! in common/cacb. Decoded messages are sent back to the GUI. use q65_decode + use wavhdr use timer_module, only: timer parameter (MAXFFT1=5376000) !56*96000 parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16) parameter (NMAX=60*12000) parameter (RAD=57.2957795) + type(hdr) h integer*2 iwave(60*12000) integer offset complex ca(MAXFFT1) !FFT of raw I/Q data from Linrad complex cx(0:MAXFFT2-1),cz(0:MAXFFT2) real*8 fcenter,freq0,freq1 + logical*1 bClickDecode character*12 mycall0,hiscall0 character*12 mycall,hiscall character*6 hisgrid character*4 grid4 - character*60 result - character*20 datetime - common/decodes/ndecodes,ncand,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,result(50) + character*3 csubmode + character*17 fname + character*64 result,ctmp + character*20 datetime,datetime1 + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) common/cacb/ca + data ifile/0/ save - + if(mycall0(1:1).ne.' ') mycall=mycall0 if(hiscall0(1:1).ne.' ') hiscall=hiscall0 if(hisgrid(1:4).ne.' ') grid4=hisgrid(1:4) @@ -37,26 +44,18 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & ! Find best frequency from sync_dat, the "orange sync curve". df3=96000.0/32768.0 ipk=(1000.0*f0-1.0)/df3 + if(nagain.ge.2) ipk = nint(1000.0*(fqso-nkhz_center+48.0)/df3) nfft1=MAXFFT1 nfft2=MAXFFT2 df=96000.0/NFFT1 - if(nfsample.eq.95238) then - nfft1=5120000 - nfft2=322560 - df=96000.0/nfft1 - endif nh=nfft2/2 - f_mouse=1000.0*(fqso+48.0) + mousedf k0=nint((ipk*df3-1000.0)/df) - if(nagain.eq.1) k0=nint((f_mouse-1000.0)/df) - if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900 fac=1.0/nfft2 - cx(0:nfft2-1)=ca(k0:k0+nfft2-1) - cx=fac*cx + cx(0:nfft2-1)=fac*ca(k0:k0+nfft2-1) ! Here cx is frequency-domain data around the selected -! QSO frequency, taken from the full-length FFT computed in filbig(). +! QSO frequency, taken from the full-length FFT computed in fftbig(). ! Values for fsample, nfft1, nfft2, df, and the downsampled data rate ! are as follows: @@ -89,19 +88,65 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & nsubmode=mode_q65-1 nfa=990 !Tight limits around ipk for the wideband decode nfb=1010 - if(nagain.eq.1) then !For nagain=1, use limits of +/- ntol + if(nagain.ge.1) then !For nagain>=1, use limits of +/- ntol nfa=max(100,1000-ntol) nfb=min(2500,1000+ntol) endif nsnr0=-99 !Default snr for no decode + if(iseq.eq.1) iwave(1:360000)=iwave(360001:720000) + + csubmode(1:2)='60' + csubmode(3:3)=char(ichar('A')+nsubmode) + nhhmmss=100*nutc + nutc1=nutc + datetime(12:13)='00' + datetime1=datetime + if(ntrperiod.eq.30) then + csubmode(1:2)='30' + nhhmmss=100*nutc + iseq*30 + nutc1=nhhmmss + if(iseq.eq.1) datetime1(12:13)='30' + endif + + if(nagain.ge.2) then + ifile=ifile+1 + write(fname,1000) ifile +1000 format('000000_',i6.6,'.wav') + open(27,file=fname,status='unknown',access='stream') + if(nagain.eq.2) then + h=default_header(12000,60*12000) + ia=1 + ib=60*12000 + else if(nagain.eq.3) then + h=default_header(12000,30*12000) + ia=1 + ib=30*12000 + else + h=default_header(12000,30*12000) + ia=30*12000 + 1 + ib=60*12000 + endif + write(27) h,iwave(ia:ib) + close(27) + go to 900 + endif + ! NB: Frequency of ipk is now shifted to 1000 Hz. - call map65_mmdec(nutc,iwave,nqd,nsubmode,nfa,nfb,1000,ntol, & - newdat,nagain,max_drift,ndepth,mycall,hiscall,hisgrid) - MHz=fcenter + nagain2=0 + call map65_mmdec(nutc1,iwave,nqd,ntrperiod,nsubmode,nfa,nfb,1000,ntol, & + newdat,nagain2,max_drift,ndepth,mycall,hiscall,hisgrid) + MHz=fcenter freq0=MHz + 0.001d0*ikhz if(nsnr0.gt.-99) then + + do i=1,ndecodes !Check for dupes + i1=index(result(i)(42:),trim(msg0)) +! If this is a dupe, don't save it again: + if(i1.gt.0 .and. (.not.bClickDecode .or. nhsym.eq.390)) go to 800 + enddo + nq65df=nint(1000*(0.001*k0*df+nkhz_center-48.0+1.000-1.27046-ikhz))-nfcal nq65df=nq65df + nfreq0 - 1000 ikhz1=ikhz @@ -110,15 +155,16 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & if(ndf.lt.-500) ikhz1=ikhz + (nq65df-500)/1000 ndf=nq65df - 1000*(ikhz1-ikhz) freq1=freq0 + 0.001d0*(ikhz1-ikhz) - ndecodes=ndecodes+1 frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal fsked=frx - 0.001*ndop00/2.0 - 0.001*offset - write(result(ndecodes),1120) nutc,frx,fsked,xdt0,nsnr0,trim(msg0) -1120 format(i4.4,f9.3,f7.1,f7.2,i5,2x,a) - write(12,1130) datetime,trim(result(ndecodes)(5:)) -1130 format(a11,1x,a) + ctmp=csubmode//' '//trim(msg0) + ndecodes=min(ndecodes+1,50) + write(result(ndecodes),1120) nhhmmss,frx,fsked,xdt0,nsnr0,trim(ctmp) +1120 format(i6.6,f9.3,f7.1,f7.2,i5,2x,a) + write(12,1130) datetime1,trim(result(ndecodes)(7:)) +1130 format(a13,1x,a) result(ndecodes)=trim(result(ndecodes))//char(0) - idec=0 +800 idec=0 endif 900 flush(12) diff --git a/qmap/libqmap/q65c.f90 b/qmap/libqmap/q65c.f90 index e2ac8cc1..42e24900 100755 --- a/qmap/libqmap/q65c.f90 +++ b/qmap/libqmap/q65c.f90 @@ -1,4 +1,4 @@ -subroutine q65c(itimer) +subroutine q65c use timer_module, only: timer use timer_impl, only: fini_timer !, limtrace @@ -10,42 +10,96 @@ subroutine q65c(itimer) parameter (NFFT=32768) include 'njunk.f90' real*8 fcenter + real*4 pdb(4) integer nparams0(NJUNK+3),nparams(NJUNK+3) +! integer values(8) logical first + logical*1 bAlso30 + character*120 fname + character*22 revision character*12 mycall,hiscall character*6 mygrid,hisgrid character*20 datetime - - common/datcom2/dd(2,5760000),ss(322,NFFT),savg(NFFT),nparams0 - + character*64 result + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) + common/datcom2/dd(2,5760000),ss(400,NFFT),savg(NFFT),nparams0 + common/savecom/revision,fname !### REMEMBER that /npar/ is not updated until nparams=nparams0 is executed. ### common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, & - ndepth,ndiskdat,neme,newdat,nfcal,nfshift, & - mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,nmode, & - ndop00,nsave,max_nhsym,mycall,mygrid,hiscall,hisgrid, & - datetime,junk1,junk2 + ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, & + ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, & + ndop00,nsave,nn3,nn4,nhsym,mycall,mygrid,hiscall,hisgrid, & + datetime,junk1,junk2,bAlso30 equivalence (nparams,fcenter) data first/.true./ save first nparams=nparams0 !Copy parameters into common/npar/ - if(itimer.ne.0) then - call timer('decode0 ',101) - call fini_timer - return - endif - - datetime(18:20)=':00' + datetime(12:)='00 ' npatience=1 newdat=1 !Always on ?? -! write(*,3001) 'aa',newdat,nagain,nfa,nfb,ntol,fselected -!3001 format(a2,5i6,f10.3) -! write(*,3001) 'bb',newdat,nagain,nfa,nfb,ntol,fselected + if(ndiskdat.eq.1) then + call chkstat(dd,nhsym,pdb) + if((abs(pdb(1)-pdb(2)).gt.3.0 .and. pdb(1).gt.1.0) .or. & + pdb(1).lt.1.0) ntx30a=20 !Tx 1st half + if((abs(pdb(3)-pdb(4)).gt.3.0 .and. pdb(3).gt.1.0) .or. & + pdb(3).lt.1.0) ntx30b=20 !Tx 2nd half + if(pdb(4).lt.0.04) then + ntx30a=0 !Older 56s files have no Tx + ntx30b=0 !Older 56s files have no Tx + endif + endif + if(ntx30a.gt.5) then + dd(1:2,1:30*96000)=0. + ss(1:200,1:NFFT)=0. + do i=1,NFFT + savg(i)=sum(ss(201:400,i)) + enddo + endif + if(ntx30b.gt.5) then + dd(1:2,30*96000+1:60*96000)=0. + ss(201:400,1:NFFT)=0. + do i=1,NFFT + savg(i)=sum(ss(1:200,i)) + enddo + endif + + if(nhsym.gt.200 .and. ntx30b.gt.5) go to 10 call timer('decode0 ',0) call decode0(dd,ss,savg) call timer('decode0 ',1) +10 continue +! call date_and_time(VALUES=values) +! n60b=values(7) +! nd=n60b-n60 +! if(nd.lt.0) nd=nd+60 +! write(*,3002) nutc,nagain,nhsym,n60,n60b,nd,ntx30a,ntx30b,ndecodes, & +! nsave,revision +!3002 format('A',i5.4,i3,i5,7i4,1x,a22) +! flush(6) + + if(ndiskdat.eq.0) then + if(nhsym.eq.390 .and. & + (nsave.eq.2 .or. (nsave.eq.1 .and. ndecodes.ge.1))) then + call save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, & + nutc,ndop00,ndop58) + endif + endif + return end subroutine q65c + +subroutine all_done + + use timer_module, only: timer + use timer_impl, only: fini_timer + + call timer('decode0 ',101) + call fini_timer + + return +end subroutine all_done diff --git a/qmap/libqmap/qmapa.f90 b/qmap/libqmap/qmapa.f90 index aead1daf..8d4f3381 100755 --- a/qmap/libqmap/qmapa.f90 +++ b/qmap/libqmap/qmapa.f90 @@ -1,6 +1,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & - mousedf,mousefqso,nagain,nfshift,max_drift,offset,nfcal,mycall, & - hiscall,hisgrid,nfsample,nmode,ndepth,datetime,ndop00,fselected) + mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, & + nfcal,mycall,hiscall,hisgrid,nfsample,nBaseSubmode,ndepth, & + datetime,ndop00,fselected,bAlso30,nhsym,nCFOM) ! Processes timf2 data received from Linrad to find and decode Q65 signals. @@ -10,64 +11,109 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & real :: snr !Relative S/N of sync detection real :: f !Freq of sync tone, 0 to 96000 Hz real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s + integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x + integer :: iseq !0 for first half-minute, 1 for second half end type candidate + type good_decode + real :: f !Freq of sync tone, 0 to 96000 Hz + integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x + integer :: iseq !0 for first half-minute, 1 for second half + end type good_decode + parameter (NFFT=32768) !Size of FFTs done in symspec() parameter (MAX_CANDIDATES=50) parameter (MAXMSG=1000) !Size of decoded message list parameter (NSMAX=60*96000) - complex cx(NSMAX/64) !Data at 1378.125 samples/s real dd(2,NSMAX) !I/Q data from Linrad - real ss(322,NFFT) !Symbol spectra + real ss(400,NFFT) !Symbol spectra real savg(NFFT) !Average spectrum - real*8 fcenter !Center RF frequency, MHz + real*8 fcenter !Center RF frequency, MHz + logical*1 bAlso30,bClickDecode character mycall*12,hiscall*12,hisgrid*6 type(candidate) :: cand(MAX_CANDIDATES) - character*60 result + type(good_decode) found(MAX_CANDIDATES) + character*64 result character*20 datetime - common/decodes/ndecodes,ncand,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,result(50) + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) save tsec0=sec_midn() - if(nagain.eq.1) ndepth=3 !Use full depth for click-to-decode + if(nagain.ge.1) ndepth=3 !Use full depth for click-to-decode nkhz_center=nint(1000.0*(fcenter-int(fcenter))) mfa=nfa-nkhz_center+48 mfb=nfb-nkhz_center+48 - mode_q65=nmode/10 + mode_q65=nBaseSubmode nts_q65=2**(mode_q65-1) !Q65 tone separation factor f0_selected=fselected - nkhz_center + 48.0 - call timer('get_cand',0) -! Get a list of decoding candidates - call getcand2(ss,savg,nts_q65,nagain,ntol,f0_selected,cand,ncand) - call timer('get_cand',1) + if(nagain.le.1) then + call timer('get_cand',0) + ! Get a list of decoding candidates + call getcand2(ss,savg,nts_q65,nagain,nhsym,ntx30a,ntx30b,ntol, & + f0_selected,bAlso30,cand,ncand2) + call timer('get_cand',1) + endif nwrite_q65=0 df=96000.0/NFFT !df = 96000/NFFT = 2.930 Hz - if(nfsample.eq.95238) df=95238.1/NFFT ftol=0.010 !Frequency tolerance (kHz) foffset=0.001*(1270 + nfcal) !Offset from sync tone, plus CAL fqso=mousefqso + foffset - 0.5*(nfa+nfb) + nfshift !fqso at baseband (khz) nqd=0 - nagain2=0 + bClickDecode=(nagain.ge.1) - call timer('filbig ',0) - call filbig(dd,NSMAX,f0,newdat,nfsample,cx,n5) !Do the full-length FFT - call timer('filbig ',1) + call timer('fftbig ',0) + call fftbig(dd,NSMAX) !Do the full-length FFT + call timer('fftbig ',1) - do icand=1,ncand !Attempt to decode each candidate + if(nagain.ge.2) then + ncand2=1 + fqso=fselected + endif + + do icand=1,ncand2 !Attempt to decode each candidate + tsec=sec_midn() - tsec0 + if(ndiskdat.eq.0) then + ! No more realtime decode attempts if it's nearly too late, already + if(nhsym.eq.130 .and. tsec.gt.6.0) exit + if(nhsym.eq.200 .and. tsec.gt.10.0) exit + if(nhsym.eq.330 .and. tsec.gt.6.0) exit + if(nhsym.eq.390 .and. tsec.gt.16.0) exit + endif f0=cand(icand)%f - freq=cand(icand)%f+nkhz_center-48.0-1.27046 + ntrperiod=cand(icand)%ntrperiod + iseq=cand(icand)%iseq + + if(nagain.eq.0) then + ! Skip this candidate if we already decoded it. + do j=1,ndecodes + if(abs(f0-found(j)%f).lt.0.005 .and. & + ntrperiod.eq.found(j)%ntrperiod .and. & + iseq.eq.found(j)%iseq) go to 10 + enddo + endif + + mode_q65_tmp=mode_q65 + if(ntrperiod.eq.30) mode_q65_tmp=max(1,mode_q65-1) + freq=f0+nkhz_center-48.0-1.27046 ikhz=nint(freq) idec=-1 call timer('q65b ',0) - call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & - mycall,hiscall,hisgrid,mode_q65,f0,fqso,nkhz_center,newdat, & - nagain2,max_drift,offset,ndepth,datetime,ndop00,idec) + call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & + ntrperiod,iseq,mycall,hiscall,hisgrid,mode_q65_tmp,f0,fqso, & + nkhz_center,newdat,nagain,bClickDecode,max_drift,offset, & + ndepth,datetime,nCFOM,ndop00,nhsym,idec) call timer('q65b ',1) - tsec=sec_midn() - tsec0 - if(tsec.gt.30.0) exit !Don't start another decode attempt after t=30 s. + if(bClickDecode .and. idec.ge.0) exit + if(idec.ge.0) then + ! Save some details on good decodes, to avoid duplicated effort + found(ndecodes)%f=f0 + found(ndecodes)%ntrperiod=ntrperiod + found(ndecodes)%iseq=iseq + end if +10 continue enddo ! icand return diff --git a/qmap/libqmap/read_qm.f90 b/qmap/libqmap/read_qm.f90 new file mode 100755 index 00000000..52479918 --- /dev/null +++ b/qmap/libqmap/read_qm.f90 @@ -0,0 +1,44 @@ +subroutine read_qm(fname,iret) + + include 'njunk.f90' + parameter(NMAX=60*96000,NFFT=32768) + character*(*) fname + character prog_id*24,mycall*12,mygrid*6 + real*8 fcenter + integer nxtra(15) !For possible future additions + integer*1 id1(2,NMAX) + common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT), & + fcenter,nutc,fselected,mousedf,mousefqso,nagain, & + ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, & + ntx30a,ntx30b !... + + open(28,file=trim(fname),status='old',access='stream',err=900) + read(28,end=910) prog_id,mycall,mygrid,fcenter,nutc,ntx30a, & + ntx30b,ndop00,ndop58,ia,ib,fac0,nxtra + iret=3 + if(ib.eq.NMAX/2) iret=1 + if(ia.eq.NMAX/2+1) iret=2 + fac=1.0 + if(fac0.gt.0.0) fac=1.0/fac0 + id1=0 + read(28,end=910) id1(1:2,ia:ib) + dd=0. + dd(1:2,ia:ib)=fac*id1(1:2,ia:ib) !Boost back to previous level + go to 999 + +900 iret=-1; go to 999 +910 iret=-2 + +999 close(28) + +! sq1=0. +! sq2=0. +! NH=NMAX/2 +! do i=1,NMAX +! if(i.le.NH) sq1=sq1 + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i) +! if(i.gt.NH) sq2=sq2 + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i) +! enddo +! print*,'B',sqrt(sq1/NMAX),sqrt(sq2/NMAX) + + return +end subroutine read_qm diff --git a/qmap/libqmap/recvpkt.f90 b/qmap/libqmap/recvpkt.f90 index 0addb2f0..fd5e888f 100755 --- a/qmap/libqmap/recvpkt.f90 +++ b/qmap/libqmap/recvpkt.f90 @@ -1,4 +1,4 @@ -subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8) +subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8,ndb) ! Reformat timf2 data from Linrad and stuff data into r*4 array dd(). @@ -11,11 +11,12 @@ subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8) integer*2 jd(4),kd(2),nblock2 real*4 yd(2) real*8 fcenter - common/datcom/dd(2,5760000),ss(322,NFFT),savg(NFFT),fcenter,nutc, & + common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT),fcenter,nutc, & junk(NJUNK) equivalence (kd,d4) equivalence (jd,d8,yd) + gain=10.0**(0.05*ndb) if(nblock2.eq.-9999) nblock2=-9998 !Silence a compiler warning if(nsam.eq.-1) then ! Move data from the UDP packet buffer into array dd(). @@ -23,15 +24,15 @@ subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8) do i=1,174 !One RF channel, r*4 data k=k+1 d8=buf8(i) - dd(1,k)=yd(1) - dd(2,k)=yd(2) + dd(1,k)=yd(1)*gain + dd(2,k)=yd(2)*gain enddo else if(userx_no.eq.1) then do i=1,348 !One RF channel, i*2 data k=k+1 d4=buf4(i) - dd(1,k)=kd(1) - dd(2,k)=kd(2) + dd(1,k)=kd(1)*gain + dd(2,k)=kd(2)*gain enddo endif else @@ -39,12 +40,12 @@ subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8) do i=1,nsam !One RF channel, r*4 data k=k+1 d4=buf4(i) - dd(1,k)=kd(1) - dd(2,k)=kd(2) + dd(1,k)=kd(1)*gain + dd(2,k)=kd(2)*gain k=k+1 - dd(1,k)=kd(1) - dd(2,k)=kd(2) + dd(1,k)=kd(1)*gain + dd(2,k)=kd(2)*gain enddo endif endif diff --git a/qmap/libqmap/save_qm.f90 b/qmap/libqmap/save_qm.f90 new file mode 100755 index 00000000..9d636755 --- /dev/null +++ b/qmap/libqmap/save_qm.f90 @@ -0,0 +1,63 @@ +subroutine save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, & + nutc,ndop00,ndop58) + + parameter(NMAX=60*96000) + character*120 fname + character*22 revision + character*12 mycall + character*6 mygrid + real*4 dd(2,NMAX) + real*8 fcenter + integer nxtra(15) !For possible future additions + integer*1,allocatable :: id1(:,:) + + ia=1 + ib=NMAX + if(ntx30a.gt.5) ia=NMAX/2+1 + if(ntx30b.gt.5) ib=NMAX/2 + + sq=0. + do i=ia,ib + x=dd(1,i) + y=dd(2,i) + sq=sq + x*x + y*y + enddo + nsum=2*(ib-ia+1) + rms=sqrt(sq/nsum) + + nbad=0 + dmax=0. + fac0=10.0/rms + allocate(id1(1:2,1:NMAX)) + + do i=ia,ib + x=fac0*dd(1,i) + y=fac0*dd(2,i) + ax=abs(x) + ay=abs(y) + dmax=max(dmax,ax,ay) + if(ax.gt.127.0) then + x=0. + nbad=nbad+1 + endif + if(ay.gt.127.0) then + y=0. + nbad=nbad+1 + endif + id1(1,i)=nint(x) + id1(2,i)=nint(y) + enddo + if(ia.gt.30*96000) id1(1:2,1:ia-1)=0 + if(ib.eq.30*96000) id1(1:2,ib+1:60*96000)=0 + + open(29,file=trim(fname),status='unknown',access='stream') + nxtra=0 + write(29) revision//' ',mycall,mygrid,fcenter,nutc,ntx30a,ntx30b, & + ndop00,ndop58,ia,ib,fac0,nxtra !Write header to disk + write(29) id1(1:2,ia:ib) !Write 8-bit data to disk + close(29) + deallocate(id1) + + return +end subroutine save_qm + diff --git a/qmap/libqmap/symspec.f90 b/qmap/libqmap/symspec.f90 index 9244d3b5..b07cfa5b 100755 --- a/qmap/libqmap/symspec.f90 +++ b/qmap/libqmap/symspec.f90 @@ -8,7 +8,7 @@ subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & ! pxdb power in x channel (0-60 dB) ! ssz5a polarized spectrum, for waterfall display ! nkhz integer kHz portion of center frequency, e.g., 125 for 144.125 -! ihsym index number of this half-symbol (1-322) +! ihsym index number of this half-symbol (1-400) ! nzap number of samples zero'ed by noise blanker include 'njunk.f90' @@ -16,9 +16,9 @@ subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & parameter (NFFT=32768) !Length of FFTs real*8 ts,hsym real*8 fcenter - common/datcom/dd(2,5760000),ss(322,NFFT),savg(NFFT),fcenter,nutc, & + common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT),fcenter,nutc, & junk(NJUNK) - real*4 ssz5a(NFFT),w(NFFT),w2a(NFFT),w2b(NFFT) + real*4 ssz5a(NFFT),w(NFFT) complex cx(NFFT) complex cx00(NFFT) complex cx0(0:1023),cx1(0:1023) @@ -26,31 +26,24 @@ subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & data rms/999.0/,k0/99999999/,nadjx/0/,nadjy/0/ save - nfast=1 + hsym=0.15d0*96000.d0 !Samples per Q65-30x half-symbol + npts=2*hsym !Full Q65-30x symbol if(k.gt.5751000) go to 999 - if(k.lt.NFFT) then + if(k.lt.npts) then ihsym=0 go to 999 !Wait for enough samples to start endif if(k0.eq.99999999) then - pi=4.0*atan(1.0) - w2a=0. - w2b=0. - do i=1,NFFT - w(i)=(sin(i*pi/NFFT))**2 !Window for nfast=1 - if(i.lt.17833) w2a(i)=(sin(i*pi/17832.925))**2 !Window a for nfast=2 - j=i-8916 - if(j.gt.0 .and. j.lt.17833) w2b(i)=(sin(j*pi/17832.925))**2 ! b - enddo - w2a=sqrt(2.0)*w2a - w2b=sqrt(2.0)*w2b +! pi=4.0*atan(1.0) +! do i=1,NFFT +! w(i)=(sin(i*pi/NFFT))**2 !Window +! enddo + w=0.7 !Flat window endif - hsym=2048.d0*96000.d0/11025.d0 !Samples per JT65 half-symbol - if(nfsample.eq.95238) hsym=2048.d0*95238.1d0/11025.d0 - if(k.lt.k0) then ts=1.d0 - hsym + ss=0. savg=0. ihsym=0 k1=0 @@ -85,12 +78,9 @@ subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & k1=k1+kstep enddo - npts=NFFT !Samples used in each half-symbol FFT - ts=ts+hsym ja=ts !Index of first sample jb=ja+npts-1 !Last sample - i=0 fac=0.0002 do j=ja,jb !Copy data into cx @@ -99,11 +89,12 @@ subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & i=i+1 cx(i)=fac*cmplx(x1,x2) enddo + cx(npts+1:)=0. if(nzap/178.lt.50 .and. (ndiskdat.eq.0 .or. ihsym.lt.280)) then nsum=nblks*kstep - nzap if(nsum.le.0) nsum=1 - rmsx=sqrt(0.5*px/nsum) + rmsx=sqrt(px/nsum) rms=rmsx endif pxdb=0. @@ -112,31 +103,21 @@ subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & cx00=cx - do mm=1,nfast - ihsym=ihsym+1 - if(nfast.eq.1) then - cx=w*cx00 !Apply window for 2nd forward FFT - else - if(mm.eq.1) then - cx=w2a*cx00 - else - cx=w2b*cx00 - endif - endif - - call four2a(cx,NFFT,1,1,1) !Second forward FFT (X) - - n=min(322,ihsym) - do i=1,NFFT - sx=real(cx(i))**2 + aimag(cx(i))**2 - ss(n,i)=sx ! Pol = 0 - savg(i)=savg(i) + sx - ssz5a(i)=sx - enddo + ihsym=ihsym+1 + cx=w*cx00 !Apply window for 2nd forward FFT + call four2a(cx,NFFT,1,1,1) !Second forward FFT (X) + n=min(400,ihsym) + do i=1,NFFT + sx=real(cx(i))**2 + aimag(cx(i))**2 + ss(n,i)=sx ! Pol = 0 + savg(i)=savg(i) + sx + ssz5a(i)=sx enddo nkhz=nint(1000.d0*(fcenter-int(fcenter))) if(fcenter.eq.0.d0) nkhz=125 +! write(*,3001) hsym,ts,ja,jb,ihsym +!3001 format(2f12.3,3i10) 999 return end subroutine symspec diff --git a/qmap/libqmap/zaptx.f90 b/qmap/libqmap/zaptx.f90 new file mode 100755 index 00000000..6ddbd364 --- /dev/null +++ b/qmap/libqmap/zaptx.f90 @@ -0,0 +1,9 @@ +subroutine zaptx(dd,k0,k) + + parameter(NMAX=60*96000) + real dd(2,NMAX) + + dd(1:2,k0+1:k)=0. + + return +end subroutine zaptx diff --git a/qmap/main.cpp b/qmap/main.cpp index 2241df8f..1b42af24 100755 --- a/qmap/main.cpp +++ b/qmap/main.cpp @@ -16,6 +16,7 @@ extern "C" { void _gfortran_set_args(int argc, char *argv[]); void _gfortran_set_convert(int conv); void ftninit_(void); + void fftbig_(float dd[], int* nfft); } int main(int argc, char *argv[]) @@ -29,7 +30,7 @@ int main(int argc, char *argv[]) // Override programs executable basename as application name. a.setApplicationName ("QMAP"); - a.setApplicationVersion ("0.2"); + a.setApplicationVersion ("0.4"); // switch off as we share an Info.plist file with WSJT-X a.setAttribute (Qt::AA_DontUseNativeMenuBar); MainWindow w; @@ -45,9 +46,9 @@ int main(int argc, char *argv[]) int iform {1}; // free FFT plan resources four2a_ (nullptr, &nfft, &ndim, &isign, &iform, 0); + fftbig_(nullptr, &nfft); } fftwf_forget_wisdom (); fftwf_cleanup (); - return result; } diff --git a/qmap/mainwindow.cpp b/qmap/mainwindow.cpp index 4f33db6c..dadcca03 100755 --- a/qmap/mainwindow.cpp +++ b/qmap/mainwindow.cpp @@ -60,8 +60,9 @@ MainWindow::MainWindow(QWidget *parent) : ui->actionQ65E->setActionGroup(modeGroup2); QActionGroup* saveGroup = new QActionGroup(this); - ui->actionSave_all->setActionGroup(saveGroup); ui->actionNone->setActionGroup(saveGroup); + ui->actionSave_all->setActionGroup(saveGroup); + ui->actionSave_decoded->setActionGroup(saveGroup); setWindowTitle (program_title ()); @@ -71,27 +72,25 @@ MainWindow::MainWindow(QWidget *parent) : createStatusBar(); connect(m_gui_timer, &QTimer::timeout, this, &MainWindow::guiUpdate); - m_waterfallAvg = 1; - m_network = true; + m_waterfallAvg=1; + m_network=true; m_restart=false; m_myCall="K1JT"; m_myGrid="FN20qi"; + m_myCallColor=0; m_saveDir=""; m_azelDir=""; m_loopall=false; m_startAnother=false; m_saveAll=false; - m_onlyEME=false; + m_saveDecoded=false; m_sec0=-1; m_hsym0=-1; m_palette="CuteSDR"; m_nutc0=9999; - m_kb8rq=false; m_NB=false; m_mode="Q65"; - m_fs96000=true; m_udpPort=50004; - m_nsave=0; m_modeQ65=0; m_TRperiod=60; @@ -110,8 +109,7 @@ MainWindow::MainWindow(QWidget *parent) : memset(ipc_wsjtx,0,memSize); //Zero all of shared memory mem_qmap.unlock(); - fftwf_import_wisdom_from_filename (QDir {m_appDir}.absoluteFilePath ("qmap_wisdom.dat").toLocal8Bit ()); - +// fftwf_import_wisdom_from_filename (QDir {m_appDir}.absoluteFilePath ("qmap_wisdom.dat").toLocal8Bit ()); readSettings(); //Restore user's setup params m_pbdecoding_style1="QPushButton{background-color: cyan; \ @@ -134,14 +132,6 @@ MainWindow::MainWindow(QWidget *parent) : if(m_modeQ65==4) on_actionQ65D_triggered(); if(m_modeQ65==5) on_actionQ65E_triggered(); - future1 = new QFuture; - watcher1 = new QFutureWatcher; - connect(watcher1, SIGNAL(finished()),this,SLOT(diskDat())); - - future2 = new QFuture; - watcher2 = new QFutureWatcher; - connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished())); - connect(&watcher3, SIGNAL(finished()),this,SLOT(decoderFinished())); // Assign input device and start input thread @@ -159,6 +149,8 @@ MainWindow::MainWindow(QWidget *parent) : m_wide_graph_window->setTol(m_tol); m_wide_graph_window->setFcal(m_fCal); m_wide_graph_window->setFsample(96000); + QString rev{"QMAP v" + QCoreApplication::applicationVersion() + " " + revision()}; + m_revision=rev; // Create "m_worked", a dictionary of all calls in wsjt.log QFile f("wsjt.log"); @@ -194,14 +186,12 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { writeSettings(); - int itimer=1; - q65c_(&itimer); + all_done_(); if (soundInThread.isRunning()) { soundInThread.quit(); soundInThread.wait(3000); } - fftwf_export_wisdom_to_filename (QDir {m_appDir}.absoluteFilePath ("qmap_wisdom.dat").toLocal8Bit ()); delete ui; } @@ -218,15 +208,13 @@ void MainWindow::writeSettings() SettingsGroup g {&settings, "Common"}; settings.setValue("MyCall",m_myCall); settings.setValue("MyGrid",m_myGrid); - settings.setValue("IDint",m_idInt); settings.setValue("AstroFont",m_astroFont); + settings.setValue("MyCallColor",m_myCallColor); settings.setValue("SaveDir",m_saveDir); settings.setValue("AzElDir",m_azelDir); - settings.setValue("Timeout",m_timeout); settings.setValue("Fcal",m_fCal); settings.setValue("Fadd",m_fAdd); settings.setValue("NetworkInput", m_network); - settings.setValue("FSam96000", m_fs96000); settings.setValue("paInDevice",m_paInDevice); settings.setValue("Scale_dB",m_dB); settings.setValue("UDPport",m_udpPort); @@ -238,16 +226,13 @@ void MainWindow::writeSettings() settings.setValue("nModeQ65",m_modeQ65); settings.setValue("SaveNone",ui->actionNone->isChecked()); settings.setValue("SaveAll",ui->actionSave_all->isChecked()); - settings.setValue("NEME",m_onlyEME); - settings.setValue("KB8RQ",m_kb8rq); + settings.setValue("SaveDecoded",ui->actionSave_decoded->isChecked()); + settings.setValue("ContinuousWaterfall",ui->continuous_waterfall->isChecked()); settings.setValue("NB",m_NB); settings.setValue("NBslider",m_NBslider); - settings.setValue("GainX",(double)m_gainx); - settings.setValue("GainY",(double)m_gainy); - settings.setValue("PhaseX",(double)m_phasex); - settings.setValue("PhaseY",(double)m_phasey); settings.setValue("MaxDrift",ui->sbMaxDrift->value()); settings.setValue("Offset",ui->sbOffset->value()); + settings.setValue("Also30",m_bAlso30); } //---------------------------------------------------------- readSettings() @@ -263,16 +248,14 @@ void MainWindow::readSettings() SettingsGroup g {&settings, "Common"}; m_myCall=settings.value("MyCall","").toString(); m_myGrid=settings.value("MyGrid","").toString(); - m_idInt=settings.value("IDint",0).toInt(); - m_astroFont=settings.value("AstroFont",20).toInt(); + m_astroFont=settings.value("AstroFont",18).toInt(); + m_myCallColor=settings.value("MyCallColor",1).toInt(); m_saveDir=settings.value("SaveDir",m_appDir + "/save").toString(); m_azelDir=settings.value("AzElDir",m_appDir).toString(); - m_timeout=settings.value("Timeout",20).toInt(); m_fCal=settings.value("Fcal",0).toInt(); m_fAdd=settings.value("FAdd",0).toDouble(); soundInThread.setFadd(m_fAdd); m_network = settings.value("NetworkInput",true).toBool(); - m_fs96000 = settings.value("FSam96000",true).toBool(); m_dB = settings.value("Scale_dB",0).toInt(); m_udpPort = settings.value("UDPport",50004).toInt(); soundInThread.setScale(m_dB); @@ -282,7 +265,7 @@ void MainWindow::readSettings() ui->actionLinrad->setChecked(settings.value( "PaletteLinrad",false).toBool()); - m_modeQ65=settings.value("nModeQ65",2).toInt(); + m_modeQ65=settings.value("nModeQ65",3).toInt(); if(m_modeQ65==1) ui->actionQ65A->setChecked(true); if(m_modeQ65==2) ui->actionQ65B->setChecked(true); if(m_modeQ65==3) ui->actionQ65C->setChecked(true); @@ -291,21 +274,29 @@ void MainWindow::readSettings() ui->actionNone->setChecked(settings.value("SaveNone",true).toBool()); ui->actionSave_all->setChecked(settings.value("SaveAll",false).toBool()); + ui->actionSave_decoded->setChecked(settings.value("SaveDecoded",false).toBool()); + ui->continuous_waterfall->setChecked(settings.value("ContinuousWaterfall",false).toBool()); m_saveAll=ui->actionSave_all->isChecked(); - m_onlyEME=settings.value("NEME",false).toBool(); - ui->actionOnly_EME_calls->setChecked(m_onlyEME); - m_kb8rq=settings.value("KB8RQ",false).toBool(); + m_saveDecoded=ui->actionSave_decoded->isChecked(); + if(m_saveAll) { + lab5->setStyleSheet("QLabel{background-color: #ffff00}"); + lab5->setText("Save all"); + } else if(m_saveDecoded) { + lab5->setStyleSheet("QLabel{background-color: #ffff00}"); + lab5->setText("Save decoded"); + } else { + lab5->setStyleSheet(""); + lab5->setText(""); + } m_NB=settings.value("NB",false).toBool(); ui->NBcheckBox->setChecked(m_NB); ui->sbMaxDrift->setValue(settings.value("MaxDrift",0).toInt()); ui->sbOffset->setValue(settings.value("Offset",1500).toInt()); m_NBslider=settings.value("NBslider",40).toInt(); ui->NBslider->setValue(m_NBslider); - m_gainx=settings.value("GainX",1.0).toFloat(); - m_gainy=settings.value("GainY",1.0).toFloat(); - m_phasex=settings.value("PhaseX",0.0).toFloat(); - m_phasey=settings.value("PhaseY",0.0).toFloat(); - + m_bAlso30=settings.value("Also30",true).toBool(); + ui->actionAlso_Q65_30x->setChecked(m_bAlso30); + on_actionAlso_Q65_30x_toggled(m_bAlso30); if(!ui->actionLinrad->isChecked() && !ui->actionCuteSDR->isChecked() && !ui->actionAFMHot->isChecked() && !ui->actionBlue->isChecked()) { on_actionLinrad_triggered(); @@ -319,6 +310,7 @@ void MainWindow::dataSink(int k) static float s[NFFT],splot[NFFT]; static int n=0; static int ihsym=0; + static int ihsym0=0; static int nzap=0; static int ntrz=0; static int nkhz; @@ -327,6 +319,7 @@ void MainWindow::dataSink(int k) static int nsum=0; static int ndiskdat; static int nb; + static int k0=0; static float px=0.0; static uchar lstrong[1024]; static float slimit; @@ -343,7 +336,10 @@ void MainWindow::dataSink(int k) nb=0; if(m_NB) nb=1; nfsample=96000; - if(!m_fs96000) nfsample=95238; + + if(m_bWTransmitting) zaptx_(datcom_.d4, &k0, &k); + k0=k; + symspec_(&k, &ndiskdat, &nb, &m_NBslider, &nfsample, &px, s, &nkhz, &ihsym, &nzap, &slimit, lstrong); @@ -359,6 +355,7 @@ void MainWindow::dataSink(int k) } nsec0=nsec; + if(m_bWTransmitting) px=0.0; QString t; m_pctZap=nzap/178.3; @@ -368,9 +365,9 @@ void MainWindow::dataSink(int k) .arg (m_pctZap, 5, 'f', 1) ); - xSignalMeter->setValue(px); // Update the signal meters + xSignalMeter->setValue(px); // Update the signal meter //Suppress scrolling if WSJT-X is transmitting - if((m_monitoring and ipc_wsjtx[4] != 1) or m_diskData) { + if((m_monitoring and (!m_bWTransmitting or ui->continuous_waterfall->isChecked())) or m_diskData) { m_wide_graph_window->dataSink2(s,nkhz,ihsym,m_diskData,lstrong); } @@ -401,26 +398,26 @@ void MainWindow::dataSink(int k) n=0; } + bool bCallDecoder=false; if(ihsym < m_hsymStop) m_decode_called=false; - - if(ihsym >= m_hsymStop and !m_decode_called) { //Decode at t=56 s (for Q65 and data from disk) - m_decode_called=true; - datcom_.newdat=1; + if(ihsym==m_hsymStop and !m_decode_called) bCallDecoder=true; //Decode at t=58.5 s + if(ihsym==130) bCallDecoder=true; + if(m_bAlso30 and (ihsym==200)) bCallDecoder=true; + if(ihsym==330) bCallDecoder=true; + if(ihsym==ihsym0) bCallDecoder=false; + + ihsym0=ihsym; + if(bCallDecoder) { + if(ihsym==m_hsymStop) m_decode_called=true; datcom_.nagain=0; datcom_.nhsym=ihsym; - QDateTime t = QDateTime::currentDateTimeUtc(); - m_dateTime=t.toString("yymmdd_hhmm"); - decode(); //Start the decoder - if(m_saveAll and !m_diskData and m_nTransmitted<10) { - QString fname=m_saveDir + "/" + t.date().toString("yyMMdd") + "_" + - t.time().toString("hhmm"); - fname += ".iq"; - *future2 = QtConcurrent::run(savetf2, fname, false); - watcher2->setFuture(*future2); + decode(); //Prepare to start the decoder + if(ihsym==m_hsymStop) { + m_nTx30a=0; + m_nTx30b=0; + m_nTx60=0; } - m_nTransmitted=0; } - soundInThread.m_dataSinkBusy=false; } @@ -435,33 +432,29 @@ void MainWindow::on_actionSettings_triggered() DevSetup dlg(this); dlg.m_myCall=m_myCall; dlg.m_myGrid=m_myGrid; - dlg.m_idInt=m_idInt; dlg.m_astroFont=m_astroFont; + dlg.m_myCallColor=m_myCallColor; dlg.m_saveDir=m_saveDir; dlg.m_azelDir=m_azelDir; - dlg.m_timeout=m_timeout; dlg.m_fCal=m_fCal; dlg.m_fAdd=m_fAdd; dlg.m_network=m_network; - dlg.m_fs96000=m_fs96000; dlg.m_udpPort=m_udpPort; dlg.m_dB=m_dB; dlg.initDlg(); if(dlg.exec() == QDialog::Accepted) { m_myCall=dlg.m_myCall; m_myGrid=dlg.m_myGrid; - m_idInt=dlg.m_idInt; m_astroFont=dlg.m_astroFont; + m_myCallColor=dlg.m_myCallColor; if(m_astro_window && m_astro_window->isVisible()) m_astro_window->setFontSize(m_astroFont); ui->actionFind_Delta_Phi->setEnabled(false); m_saveDir=dlg.m_saveDir; m_azelDir=dlg.m_azelDir; - m_timeout=dlg.m_timeout; m_fCal=dlg.m_fCal; m_fAdd=dlg.m_fAdd; soundInThread.setFadd(m_fAdd); m_wide_graph_window->setFcal(m_fCal); - m_fs96000=dlg.m_fs96000; m_network=dlg.m_network; m_udpPort=dlg.m_udpPort; m_dB=dlg.m_dB; @@ -597,9 +590,16 @@ void MainWindow::createStatusBar() //createStatusBar lab4 = new QLabel(""); lab4->setAlignment(Qt::AlignHCenter); - lab4->setMinimumSize(QSize(50,10)); + lab4->setMinimumSize(QSize(80,10)); lab4->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusBar()->addWidget(lab4); + + lab5 = new QLabel(""); + lab5->setAlignment(Qt::AlignHCenter); + lab5->setMinimumSize(QSize(100,10)); + lab5->setFrameStyle(QFrame::Panel | QFrame::Sunken); + lab5->setStyleSheet(""); + statusBar()->addWidget(lab5); } void MainWindow::on_tolSpinBox_valueChanged(int i) //tolSpinBox @@ -646,11 +646,11 @@ void MainWindow::on_actionOpen_triggered() //Open File soundInThread.setMonitoring(m_monitoring); QString fname; fname=QFileDialog::getOpenFileName(this, "Open File", m_path, - "MAP65/QMAP Files (*.iq)"); + "MAP65/QMAP Files (*.iq *.qm)"); if(fname != "") { m_path=fname; int i; - i=fname.indexOf(".iq") - 11; + i=qMax(fname.indexOf(".iq") - 11, fname.indexOf(".qm") - 11); if(i>=0) { lab1->setStyleSheet("QLabel{background-color: #66ff66}"); lab1->setText(" " + fname.mid(i,15) + " "); @@ -658,9 +658,13 @@ void MainWindow::on_actionOpen_triggered() //Open File if(m_monitoring) on_monitorButton_clicked(); m_diskData=true; int dbDgrd=0; - if(m_myCall=="K1JT" and m_idInt<0) dbDgrd=m_idInt; - *future1 = QtConcurrent::run(getfile, fname, false, dbDgrd); - watcher1->setFuture(*future1); + int iret=4; + if(m_path.indexOf(".iq")>0) { + getfile(fname, dbDgrd); + } else { + read_qm_(fname.toLatin1(), &iret, fname.length()); + } + if(iret > 0) diskDat(iret); } } @@ -669,7 +673,11 @@ void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next int i,len; QFileInfo fi(m_path); QStringList list; - list= fi.dir().entryList().filter(".iq"); + if(m_path.indexOf(".iq")>0) { + list= fi.dir().entryList().filter(".iq"); + } else { + list= fi.dir().entryList().filter(".qm"); + } for (i = 0; i < list.size()-1; ++i) { if(i==list.size()-2) m_loopall=false; len=list.at(i).length(); @@ -678,16 +686,20 @@ void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next QString fname=m_path.replace(n-len,len,list.at(i+1)); m_path=fname; int i; - i=fname.indexOf(".iq") - 11; + i=qMax(fname.indexOf(".iq") - 11, fname.indexOf(".qm") - 11); if(i>=0) { lab1->setStyleSheet("QLabel{background-color: #66ff66}"); lab1->setText(" " + fname.mid(i,len) + " "); } m_diskData=true; int dbDgrd=0; - if(m_myCall=="K1JT" and m_idInt<0) dbDgrd=m_idInt; - *future1 = QtConcurrent::run(getfile, fname, false, dbDgrd); - watcher1->setFuture(*future1); + int iret=4; + if(m_path.indexOf(".iq")>0) { + getfile(fname, dbDgrd); + } else { + read_qm_(fname.toLatin1(), &iret, fname.length()); + } + if(iret > 0) diskDat(iret); return; } } @@ -699,41 +711,54 @@ void MainWindow::on_actionDecode_remaining_files_in_directory_triggered() on_actionOpen_next_in_directory_triggered(); } -void MainWindow::diskDat() //diskDat() +void MainWindow::diskDat(int iret) //diskDat() { + int ia=0; + int ib=400; + if(iret==1) ib=202; + m_bDiskDatBusy=true; double hsym; //These may be redundant?? m_diskData=true; datcom_.newdat=1; - hsym=2048.0*96000.0/11025.0; //Samples per JT65 half-symbol - for(int i=0; i<304; i++) { // Do the half-symbol FFTs - int k = i*hsym + 2048.5; + m_nTx30a=datcom_.ntx30a; + m_nTx30b=datcom_.ntx30b; + hsym=0.15*96000.0; //Samples per Q65-30x half-symbol or Q65-60x quarter-symbol + for(int i=ia; i 60*96000) break; dataSink(k); qApp->processEvents(); // Allow the waterfall to update + while(m_decoderBusy) { + qApp->processEvents(); // Wait for an early decode to finish + } } + m_bDiskDatBusy=false; } -void MainWindow::diskWriteFinished() //diskWriteFinished -{ -// qDebug() << "diskWriteFinished"; -} - -void MainWindow::decoderFinished() //diskWriteFinished +void MainWindow::decoderFinished() { m_startAnother=m_loopall; - ui->DecodeButton->setStyleSheet(""); - decodeBusy(false); decodes_.nQDecoderDone=1; + decodes_.kHzRequested=0; if(m_diskData) decodes_.nQDecoderDone=2; mem_qmap.lock(); decodes_.nWDecoderBusy=ipc_wsjtx[3]; //Prevent overwriting values decodes_.nWTransmitting=ipc_wsjtx[4]; //written here by WSJT-X + m_bWTransmitting=decodes_.nWTransmitting>0; memcpy((char*)ipc_wsjtx, &decodes_, sizeof(decodes_)); //Send decodes and flags to WSJT-X mem_qmap.unlock(); QString t1; - t1=t1.asprintf(" %d ",decodes_.ndecodes); + t1=t1.asprintf(" %.1f s %d/%d ", 0.15*datcom2_.nhsym, decodes_.ndecodes, decodes_.ncand); lab4->setText(t1); - QDateTime now=QDateTime::currentDateTimeUtc(); + decodeBusy(false); + + if(m_bDecodeAgain) { + datcom_.nhsym=390; + datcom_.nagain=1; + m_bDecodeAgain=false; + decode(); + } } void MainWindow::on_actionDelete_all_iq_files_in_SaveDir_triggered() @@ -741,7 +766,7 @@ void MainWindow::on_actionDelete_all_iq_files_in_SaveDir_triggered() int i; QString fname; int ret = QMessageBox::warning(this, "Confirm Delete", - "Are you sure you want to delete all *.iq files in\n" + + "Are you sure you want to delete all *.iq and *.qm files in\n" + QDir::toNativeSeparators(m_saveDir) + " ?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if(ret==QMessageBox::Yes) { @@ -752,6 +777,8 @@ void MainWindow::on_actionDelete_all_iq_files_in_SaveDir_triggered() fname=*f; i=(fname.indexOf(".iq")); if(i==11) dir.remove(fname); + i=(fname.indexOf(".qm")); + if(i==11) dir.remove(fname); } } } @@ -759,13 +786,25 @@ void MainWindow::on_actionDelete_all_iq_files_in_SaveDir_triggered() void MainWindow::on_actionNone_triggered() //Save None { m_saveAll=false; + m_saveDecoded=false; + lab5->setStyleSheet(""); + lab5->setText(""); } -// ### Implement "Save Last" here? ### +void MainWindow::on_actionSave_decoded_triggered() +{ + m_saveDecoded=true; + m_saveAll=false; + lab5->setStyleSheet("QLabel{background-color: #ffff00}"); + lab5->setText("Save decoded"); +} -void MainWindow::on_actionSave_all_triggered() //Save All +void MainWindow::on_actionSave_all_triggered() { m_saveAll=true; + m_saveDecoded=false; + lab5->setStyleSheet("QLabel{background-color: #ffff00}"); + lab5->setText("Save all"); } void MainWindow::on_DecodeButton_clicked() //Decode request @@ -773,12 +812,23 @@ void MainWindow::on_DecodeButton_clicked() //Decode request if(!m_decoderBusy) { datcom_.newdat=0; datcom_.nagain=1; + if(m_bAlso30 and m_nTx30a<5) { + datcom_.nhsym=200; //Decode the first half-minute + if(m_nTx30b<5) m_bDecodeAgain=true; //Queue up decoding of the seciond half minute + } decode(); } } void MainWindow::freezeDecode(int n) //freezeDecode() { + if(n==3) { + decodes_.kHzRequested=m_wide_graph_window->QSOfreq(); + mem_qmap.lock(); + ipc_wsjtx[5]=decodes_.kHzRequested; + mem_qmap.unlock(); + return; + } if(n==2) { ui->tolSpinBox->setValue(5); datcom_.ntol=m_tol; @@ -791,17 +841,17 @@ void MainWindow::freezeDecode(int n) //freezeDecode() if(!m_decoderBusy) { datcom_.nagain=1; datcom_.newdat=0; - decode(); + on_DecodeButton_clicked(); } } void MainWindow::decode() //decode() { -//Don't attempt to decode if decoder is already busy, or if we transmitted for 10 s or more. - if(m_decoderBusy or m_nTransmitted>10) return; + if(m_decoderBusy) { + return; //Don't attempt decode if decoder already busy + } + decodeBusy(true); QString fname=" "; - ui->DecodeButton->setStyleSheet(m_pbdecoding_style1); - if(datcom_.nagain==0 && (!m_diskData)) { qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; int imin=ms/60000; @@ -816,24 +866,11 @@ void MainWindow::decode() //decode() datcom_.ndiskdat=0; if(m_diskData) { datcom_.ndiskdat=1; - int i0=m_path.indexOf(".iq"); + int i0=qMax(m_path.indexOf(".iq"),m_path.indexOf(".qm")); if(i0>0) { - // Compute self Doppler using the filename for Date and Time - int nyear=m_path.mid(i0-11,2).toInt()+2000; - int month=m_path.mid(i0-9,2).toInt(); - int nday=m_path.mid(i0-7,2).toInt(); - int nhr=m_path.mid(i0-4,2).toInt(); - int nmin=m_path.mid(i0-2,2).toInt(); - double uth=nhr + nmin/60.0; - int nfreq=(int)datcom_.fcenter; - int ndop00; - astrosub00_(&nyear, &month, &nday, &uth, &nfreq, m_myGrid.toLatin1(),&ndop00,6); - datcom_.ndop00=ndop00; //Send self Doppler to decoder, via datcom fname=m_path.mid(i0-11,11); } } - datcom_.neme=0; - if(ui->actionOnly_EME_calls->isChecked()) datcom_.neme=1; int ispan=int(m_wide_graph_window->fSpan()); if(ispan%2 == 1) ispan++; @@ -846,18 +883,10 @@ void MainWindow::decode() //decode() datcom_.nfb=nfb; datcom_.nfcal=m_fCal; datcom_.nfshift=nfshift; - datcom_.mcall3=0; - if(m_call3Modified) datcom_.mcall3=1; - datcom_.ntimeout=m_timeout; datcom_.ntol=m_tol; - datcom_.nxant=0; m_nutc0=datcom_.nutc; - datcom_.junk_1=0; datcom_.nfsample=96000; - if(!m_fs96000) datcom_.nfsample=95238; - datcom_.nxpol=0; - datcom_.nmode=10*m_modeQ65; - datcom_.nsave=m_nsave; + datcom_.nBaseSubmode=m_modeQ65; datcom_.max_drift=ui->sbMaxDrift->value(); datcom_.offset=ui->sbOffset->value(); datcom_.ndepth=1; @@ -873,24 +902,64 @@ void MainWindow::decode() //decode() } else { memcpy(datcom_.datetime, m_dateTime.toLatin1(), 11); } - datcom_.junk1=1234; //Cecck for these values in m65 + datcom_.ntx30a=m_nTx30a; + datcom_.ntx30b=m_nTx30b; + datcom_.ntx60=m_nTx60; + + datcom_.nsave=0; + if(m_saveDecoded) datcom_.nsave=1; + if(m_saveAll) datcom_.nsave=2; + + datcom_.n60=m_n60; + datcom_.junk1=1234; //Check for these values in m65 datcom_.junk2=5678; + datcom_.bAlso30=m_bAlso30; + datcom_.ndop00=m_dop00; + datcom_.ndop58=m_dop58; char *to = (char*) datcom2_.d4; char *from = (char*) datcom_.d4; - memcpy(to, from, sizeof(datcom_)); - datcom_.nagain=0; + memcpy(to, from, sizeof(datcom_)); //Copy the full datcom_ common block into datcom2_ + datcom_.ndiskdat=0; - m_call3Modified=false; - decodes_.ndecodes=0; + if((!m_bAlso30 and (datcom2_.nhsym==330)) or (m_bAlso30 and (datcom2_.nhsym==130))) { + decodes_.ndecodes=0; //Start the decode cycle with a clean slate + m_fetched=0; + } decodes_.ncand=0; decodes_.nQDecoderDone=0; - m_fetched=0; - int itimer=0; - m_decoder_start_time=QDateTime::currentDateTimeUtc(); - watcher3.setFuture(QtConcurrent::run (std::bind (q65c_, &itimer))); + m_saveFileName="NoSave"; + if(!m_diskData) { + QDateTime t = QDateTime::currentDateTimeUtc(); + m_dateTime=t.toString("yyMMdd_hhmm"); + QDir dir(m_saveDir); + if (!dir.exists()) dir.mkpath("."); + m_saveFileName=m_saveDir + "/" + m_dateTime + ".qm"; + } + + bool bSkipDecode=false; + //No need to call decoder for first half, if we transmitted in the first half: + if((datcom2_.nhsym<=200) and (m_nTx30a>5)) bSkipDecode=true; + //No need to call decoder at 330, if we transmitted in 2nd half: + if((datcom2_.nhsym==330) and (m_nTx30b>5)) bSkipDecode=true; + //No need to call decoder at all, if we transmitted in a 60 s submode. + if(m_nTx60>5) bSkipDecode=true; + + if(bSkipDecode) { + decodeBusy(false); + return; + } + + int len1=m_saveFileName.length(); + int len2=m_revision.length(); + + memcpy(savecom_.revision, m_revision.toLatin1(), len2); + memcpy(savecom_.saveFileName, m_saveFileName.toLatin1(),len1); + + ui->actionExport_wav_file_at_fQSO->setEnabled(m_diskData); + watcher3.setFuture(QtConcurrent::run (q65c_)); decodeBusy(true); } @@ -898,6 +967,7 @@ void MainWindow::on_EraseButton_clicked() { ui->decodedTextBrowser->clear(); lab4->clear(); + m_nline=0; } @@ -905,6 +975,8 @@ void MainWindow::decodeBusy(bool b) //decodeBusy() { m_decoderBusy=b; ui->DecodeButton->setEnabled(!b); + if(!b) ui->DecodeButton->setStyleSheet(""); + if(b) ui->DecodeButton->setStyleSheet(m_pbdecoding_style1); ui->actionOpen->setEnabled(!b); ui->actionOpen_next_in_directory->setEnabled(!b); ui->actionDecode_remaining_files_in_directory->setEnabled(!b); @@ -926,7 +998,7 @@ void MainWindow::guiUpdate() m_wide_graph_window->updateFreqLabel(); - if(m_startAnother) { + if(m_startAnother and !m_bDiskDatBusy) { m_startAnother=false; on_actionOpen_next_in_directory_triggered(); } @@ -937,30 +1009,59 @@ void MainWindow::guiUpdate() QString t=QString::fromLatin1(decodes_.result[m_fetched]); if(m_UTC0!="" and m_UTC0!=t.left(4)) { t1="-"; - ui->decodedTextBrowser->append(t1.repeated(56)); + ui->decodedTextBrowser->append(t1.repeated(60)); + m_nline++; + QTextCursor cursor(ui->decodedTextBrowser->document()->findBlockByLineNumber(m_nline-1)); + QTextBlockFormat f = cursor.blockFormat(); + f.setBackground(QBrush(Qt::white)); + cursor.setBlockFormat(f); } m_UTC0=t.left(4); - ui->decodedTextBrowser->append(t.trimmed()); + t=t.trimmed(); + ui->decodedTextBrowser->append(t); m_fetched++; + m_nline++; + QTextCursor cursor(ui->decodedTextBrowser->document()->findBlockByLineNumber(m_nline-1)); + QTextBlockFormat f = cursor.blockFormat(); + f.setBackground(QBrush(Qt::white)); + if(t.mid(36,2)=="30") f.setBackground(QBrush(Qt::yellow)); + if(t.indexOf(m_myCall)>10 and m_myCallColor==1) f.setBackground(QColor(255,102,102)); + if(t.indexOf(m_myCall)>10 and m_myCallColor==2) f.setBackground(QBrush(Qt::green)); + if(t.indexOf(m_myCall)>10 and m_myCallColor==3) f.setBackground(QBrush(Qt::cyan)); + cursor.setBlockFormat(f); } } + t1=""; t1=t1.asprintf("%.3f",datcom_.fcenter); ui->labFreq->setText(t1); if(nsec != m_sec0) { //Once per second -// qDebug() << "AAA" << nsec << m_fAdd; + static int n60z=99; - int n60=nsec%60; + m_n60=nsec%60; + +// See if WSJT-X is transmitting int itest[5]; mem_qmap.lock(); memcpy(&itest, (char*)ipc_wsjtx, 20); mem_qmap.unlock(); - if(itest[4]==1) m_nTransmitted++; -// qDebug() << "AAA" << n60 << itest[0] << itest[1] << itest[2] << itest[3] << itest[4] -// << m_nTransmitted; - if(n600) { + m_WSJTX_TRperiod=itest[4]; + m_bWTransmitting=true; + if(m_WSJTX_TRperiod==30 and m_n60<30) m_nTx30a++; + if(m_WSJTX_TRperiod==30 and m_n60>=30) m_nTx30b++; + if(m_WSJTX_TRperiod==60) m_nTx60++; + } else { + m_bWTransmitting=false; + } + + if((m_n6030.0) { lab2->setStyleSheet("QLabel{background-color: #ff0000}"); @@ -968,8 +1069,7 @@ void MainWindow::guiUpdate() lab2->setStyleSheet(""); } - - if(m_monitoring) { + if(m_monitoring and !m_bWTransmitting) { lab1->setStyleSheet("QLabel{background-color: #00ff00}"); m_nrx=soundInThread.nrx(); khsym=soundInThread.mhsym(); @@ -988,26 +1088,30 @@ void MainWindow::guiUpdate() lab1->setStyleSheet("QLabel{background-color: #ffc0cb}"); } lab1->setText("Receiving " + t); - } else if (!m_diskData) { + } else if(m_bWTransmitting) { + lab1->setStyleSheet("QLabel{background-color: #ffff00}"); //Yellow + lab1->setText("WSJT-X Transmitting"); + } else if(!m_diskData) { lab1->setStyleSheet(""); lab1->setText(""); } + datcom_.mousefqso=m_wide_graph_window->QSOfreq(); QDateTime t = QDateTime::currentDateTimeUtc(); - int fQSO=m_wide_graph_window->QSOfreq(); - m_astro_window->astroUpdate(t, m_myGrid, m_hisGrid, fQSO, m_setftx, - m_txFreq, m_azelDir, m_xavg); - m_setftx=0; + m_astro_window->astroUpdate(t, m_myGrid, m_azelDir, m_xavg); QString utc = t.date().toString(" yyyy MMM dd \n") + t.time().toString(); ui->labUTC->setText(utc); m_hsym0=khsym; m_sec0=nsec; + if(m_n60==0) m_dop00=datcom_.ndop00; + if(m_n60==58) m_dop58=datcom_.ndop00; } } void MainWindow::on_actionQ65A_triggered() { m_modeQ65=1; + ui->actionAlso_Q65_30x->setText("Also Q65-30A"); lab3->setStyleSheet("QLabel{background-color: #ffb266}"); lab3->setText("Q65-60A"); } @@ -1015,6 +1119,7 @@ void MainWindow::on_actionQ65A_triggered() void MainWindow::on_actionQ65B_triggered() { m_modeQ65=2; + ui->actionAlso_Q65_30x->setText("Also Q65-30A"); lab3->setStyleSheet("QLabel{background-color: #b2ff66}"); lab3->setText("Q65-60B"); } @@ -1022,6 +1127,7 @@ void MainWindow::on_actionQ65B_triggered() void MainWindow::on_actionQ65C_triggered() { m_modeQ65=3; + ui->actionAlso_Q65_30x->setText("Also Q65-30B"); lab3->setStyleSheet("QLabel{background-color: #66ffff}"); lab3->setText("Q65-60C"); } @@ -1029,13 +1135,15 @@ void MainWindow::on_actionQ65C_triggered() void MainWindow::on_actionQ65D_triggered() { m_modeQ65=4; - lab3->setStyleSheet("QLabel{background-color: #b266ff}"); + ui->actionAlso_Q65_30x->setText("Also Q65-30C"); + lab3->setStyleSheet("QLabel{background-color: #d9b3ff}"); lab3->setText("Q65-60D"); } void MainWindow::on_actionQ65E_triggered() { m_modeQ65=5; + ui->actionAlso_Q65_30x->setText("Also Q65-30D"); lab3->setStyleSheet("QLabel{background-color: #ff66ff}"); lab3->setText("Q65-60E"); } @@ -1072,3 +1180,35 @@ void MainWindow::on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered() QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Quick_Start_WSJT-X_2.7_QMAP.pdf"}); } +void MainWindow::on_actionAlso_Q65_30x_toggled(bool b) +{ + m_bAlso30=b; +} + + +void MainWindow::on_sbMaxDrift_valueChanged(int n) +{ + if(n==0) ui->sbMaxDrift->setStyleSheet(""); + if(n==5) ui->sbMaxDrift->setStyleSheet("QSpinBox { background-color: #ffff82; }"); + if(n>=10) ui->sbMaxDrift->setStyleSheet("QSpinBox { background-color: #ffff00; }"); +} + +void MainWindow::on_actionExport_wav_file_at_fQSO_triggered() +{ + datcom_.newdat=0; + datcom_.nagain=2; + decode(); +} + +void MainWindow::on_actionExport_wav_file_at_fQSO_30a_triggered() +{ + datcom_.newdat=0; + datcom_.nagain=3; + decode(); +} + +void MainWindow::on_actionExport_wav_file_at_fQSO_30b_triggered() +{ + datcom_.newdat=0; + datcom_.nagain=4; + decode();} diff --git a/qmap/mainwindow.h b/qmap/mainwindow.h index a5ed28fb..85b6ca2b 100755 --- a/qmap/mainwindow.h +++ b/qmap/mainwindow.h @@ -39,8 +39,7 @@ public slots: void showSoundInError(const QString& errorMsg); void showStatusMessage(const QString& statusMsg); void dataSink(int k); - void diskDat(); - void diskWriteFinished(); + void diskDat(int iret); void decoderFinished(); void freezeDecode(int n); void guiUpdate(); @@ -82,6 +81,14 @@ private slots: void on_actionQ65E_triggered(); void on_actionQuick_Start_Guide_to_Q65_triggered(); void on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered(); + void on_actionAlso_Q65_30x_toggled(bool b); + void on_sbMaxDrift_valueChanged(int arg1); + void on_actionSave_decoded_triggered(); + void on_actionExport_wav_file_at_fQSO_triggered(); + + void on_actionExport_wav_file_at_fQSO_30a_triggered(); + + void on_actionExport_wav_file_at_fQSO_30b_triggered(); private: Ui::MainWindow *ui; @@ -90,16 +97,11 @@ private: QScopedPointer m_astro_window; QScopedPointer m_wide_graph_window; QPointer m_gui_timer; - qint32 m_idInt; qint32 m_waterfallAvg; qint32 m_DF; qint32 m_tol; - qint32 m_QSOfreq0; qint32 m_astroFont; - qint32 m_timeout; qint32 m_fCal; - qint32 m_txFreq; - qint32 m_setftx; qint32 m_sec0; qint32 m_nutc0; qint32 m_nrx; @@ -107,15 +109,20 @@ private: qint32 m_paInDevice; qint32 m_udpPort; qint32 m_NBslider; - qint32 m_nsum; - qint32 m_nsave; qint32 m_TRperiod; qint32 m_modeQ65; qint32 m_dB; qint32 m_fetched=0; - qint32 m_hsymStop=302; - qint32 m_nTransmitted=0; + qint32 m_hsymStop=390; //390*0.15 = 58.5 s + qint32 m_nTx30a=0; + qint32 m_nTx30b=0; + qint32 m_nTx60=0; qint32 m_nDoubleClicked=0; + qint32 m_nline=0; + qint32 m_WSJTX_TRperiod=0; + qint32 m_dop00=0; + qint32 m_dop58=0; + qint32 m_n60; double m_fAdd; double m_xavg; @@ -125,21 +132,20 @@ private: bool m_loopall; bool m_decoderBusy=false; bool m_restart; - bool m_call3Modified; bool m_startAnother; bool m_saveAll; - bool m_onlyEME; - bool m_kb8rq; + bool m_saveDecoded; bool m_NB; - bool m_fs96000; bool m_decode_called=false; + bool m_bAlso30=true; + bool m_bDiskDatBusy=false; + bool m_bWTransmitting=false; + bool m_bDecodeAgain=false; - float m_gainx; - float m_gainy; - float m_phasex; - float m_phasey; float m_pctZap; + int m_myCallColor; + QRect m_wideGraphGeom; QLabel* lab1; // labels in status bar @@ -152,15 +158,8 @@ private: QMessageBox msgBox0; - QFuture* future1; - QFuture* future2; - QFutureWatcher* watcher1; - QFutureWatcher* watcher2; - QFutureWatcher watcher3; //For decoder - QDateTime m_decoder_start_time; - QString m_path; QString m_pbdecoding_style1; QString m_pbmonitor_style; @@ -175,13 +174,12 @@ private: QString m_dateTime; QString m_mode; QString m_UTC0=""; + QString m_revision; + QString m_saveFileName; + QDateTime m_dateTimeSeqStart; //Nominal start time of Rx sequence about to be decoded QHash m_worked; - SignalMeter *xSignalMeter; - SignalMeter *ySignalMeter; - - SoundInThread soundInThread; //Instantiate the audio threads //---------------------------------------------------- private functions @@ -194,7 +192,7 @@ private: }; extern void getfile(QString fname, bool xpol, int idInt); -extern void savetf2(QString fname, bool xpol); +extern void save_iq(QString fname); extern int killbyname(const char* progName); extern "C" { @@ -206,7 +204,18 @@ extern "C" { void astrosub00_ (int* nyear, int* month, int* nday, double* uth, int* nfreq, const char* mygrid, int* ndop00, int len1); - void q65c_(int* itimer); + void q65c_(); + + void all_done_(); + + void zaptx_(float d4[], int* k0, int* k); + + void save_qm_(const char* fname, const char* prog_id, const char* mycall, const char* mygrid, + float d4[], int* ntx30a, int* ntx30b, double* fcenter, int* nutc, + int* dop00, int* dop58, int len1, int len2, int len3, int len4); + + void read_qm_(const char* fname, int* iret, int len); + } #endif // MAINWINDOW_H diff --git a/qmap/mainwindow.ui b/qmap/mainwindow.ui index f668ea22..4bbd3309 100755 --- a/qmap/mainwindow.ui +++ b/qmap/mainwindow.ui @@ -24,8 +24,8 @@ - 640 - 1080 + 16777215 + 16777215 @@ -40,26 +40,6 @@ - - - - - 50 - 0 - - - - &Erase - - - - - - - NB - - - @@ -73,18 +53,12 @@ - - - - - 140 - 0 - - + + - 165 - 60 + 16777215 + 35 @@ -96,14 +70,44 @@ QFrame::Panel - 2023 Feb 02 -01:23:45 + 1296.080 Qt::AlignCenter + + + + false + + + + 0 + 0 + + + + + 80 + 16777215 + + + + 0 + + + 100 + + + 40 + + + Qt::Horizontal + + + @@ -189,27 +193,44 @@ - - - - - 16777215 - 35 - + + + + <html><head/><body><p>Select offset announced by calling station, or use commonly used value for the band in use. Manually set WSJT-X TX and RX offset to same value.</p></body></html> - - - 16 - + + Qt::AlignCenter - - QFrame::Panel + + Hz - - 1296.080 + + Offset - - Qt::AlignCenter + + 500 + + + 2000 + + + 100 + + + 1500 + + + + + + + + 50 + 0 + + + + &Erase @@ -229,6 +250,37 @@ + + + + + 140 + 0 + + + + + 165 + 60 + + + + + 16 + + + + QFrame::Panel + + + 2023 Feb 02 +01:23:45 + + + Qt::AlignCenter + + + @@ -254,41 +306,17 @@ - - - - false - - - - 0 - 0 - - - - - 80 - 16777215 - - - - 0 - - - 100 - - - 40 - - - Qt::Horizontal + + + + NB - Maximum drift rate in units of symbol rate per transmissiion. + Maximum drift rate in units of symbol rate per transmission. Qt::AlignCenter @@ -304,40 +332,12 @@ - - - - <html><head/><body><p>Select offset announced by calling station, or use commonly used value for the band in use. Manually set WSJT-X TX and RX offset to same value.</p></body></html> - - - Qt::AlignCenter - - - Hz - - - Offset - - - 500 - - - 2000 - - - 100 - - - 1500 - - - - + 0 1 @@ -350,31 +350,31 @@ - 620 + 16777215 16777215 - UTC Frx Fsked DT dB Message + UTC Frx Fsked DT dB Q65- Message - + 0 1 - 500 - 100 + 0 + 0 - 610 + 16777215 16777215 @@ -398,11 +398,8 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -hr { height: 1px; border-width: 0; } -li.unchecked::marker { content: "\2610"; } -li.checked::marker { content: "\2612"; } </style></head><body style=" font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> @@ -424,7 +421,7 @@ li.checked::marker { content: "\2612"; } 0 0 640 - 22 + 21 @@ -437,6 +434,9 @@ li.checked::marker { content: "\2612"; } + + + @@ -456,12 +456,15 @@ li.checked::marker { content: "\2612"; } + + Save + @@ -483,6 +486,8 @@ li.checked::marker { content: "\2612"; } + + @@ -506,7 +511,7 @@ li.checked::marker { content: "\2612"; } - About QMAP + About QMAP Ctrl+F1 @@ -558,7 +563,7 @@ li.checked::marker { content: "\2612"; } - Delete all *.iq files in SaveDir + Delete all *.iq and *.qm files in SaveDir @@ -760,7 +765,7 @@ li.checked::marker { content: "\2612"; } true - Q65A + Q65-60A @@ -768,7 +773,7 @@ li.checked::marker { content: "\2612"; } true - Q65B + Q65-60B @@ -779,7 +784,7 @@ li.checked::marker { content: "\2612"; } true - Q65C + Q65-60C @@ -787,7 +792,7 @@ li.checked::marker { content: "\2612"; } true - Q65D + Q65-60D @@ -795,7 +800,7 @@ li.checked::marker { content: "\2612"; } true - Q65E + Q65-60E @@ -803,16 +808,6 @@ li.checked::marker { content: "\2612"; } Quick-Start Guide to Q65 - - - Quick-Start Guide to WSJT-X 2.5.0 and MAP65 3.0 - - - - - Q65 Sensitivity in MAP65 3.0 - - Release Notes @@ -836,6 +831,48 @@ li.checked::marker { content: "\2612"; } Quick-Start Guide to Q65 + + + true + + + Continuous Waterfall + + + + + true + + + true + + + Also Q65-30x + + + + + true + + + Save decoded + + + + + Export .wav file at fQSO (60 s) + + + + + Export .wav file at fQSO (30 s, second part) + + + + + Export .wav file at fQSO (30 s, first part) + + @@ -854,8 +891,8 @@ li.checked::marker { content: "\2612"; } update() - 269 - 255 + 287 + 281 126 diff --git a/qmap/plotter.cpp b/qmap/plotter.cpp index f5c9403c..fc0d31a3 100755 --- a/qmap/plotter.cpp +++ b/qmap/plotter.cpp @@ -602,6 +602,7 @@ void CPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent if(y < h+30) { // Wideband waterfall if(button==1) { setFQSO(x,false); + if(event->modifiers() & Qt::ControlModifier) emit freezeDecode1(3); } if(button==2 and !m_bLockTxRx) { if(x<0) x=0; // x is pixel number diff --git a/qmap/soundin.cpp b/qmap/soundin.cpp index 5ddbde0f..30687f6e 100755 --- a/qmap/soundin.cpp +++ b/qmap/soundin.cpp @@ -15,37 +15,43 @@ extern "C" struct { double d8[60*96000]; //This is "common/datcom/..." in fortran - float ss[322*NFFT]; - float savg[NFFT]; - double fcenter; - int nutc; + float ss[400*NFFT]; + float savg[NFFT]; //Avg spectra at 0,45,90,135 deg pol + double fcenter; //Center freq from Linrad (MHz) + int nutc; //UTC as integer, HHMM float fselected; //Selected frequency for nagain decodes int mousedf; //User-selected DF int mousefqso; //User-selected QSO freq (kHz) int nagain; //1 ==> decode only at fQSO +/- Tol int ndepth; //How much hinted decoding to do? - int ndiskdat; //1 ==> data read from *.tf2 or *.iq file - int neme; //Hinted decoding tries only for EME calls + int ndiskdat; //1 ==> data read from *.iq file + int ntx60; //Number of seconds transmitted in Q65-60x int newdat; //1 ==> new data, must do long FFT int nfa; //Low decode limit (kHz) int nfb; //High decode limit (kHz) int nfcal; //Frequency correction, for calibration (Hz) int nfshift; //Shift of displayed center freq (kHz) - int mcall3; //1 ==> CALL3.TXT has been modified - int ntimeout; //Max for timeouts in Messages and BandMap + int ntx30a; //Number of seconds transmitted in first half minute , Q65-30x + int ntx30b; //Number of seconds transmitted in second half minute, Q65-30x int ntol; //+/- decoding range around fQSO (Hz) - int nxant; //1 ==> add 45 deg to measured pol angle - int junk_1; //Flags to control log files + int junk5; // + int junk4; // 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; //1No longer used + int junk3; // + int nBaseSubmode; //Base submode for Q65-60x (aka m_modeQ65) + int ndop00; //EME Self Doppler int nsave; //Number of s3(64,63) spectra saved + int max_drift; //Maximum Q65 drift: units symbol_rate/TxT + int offset; //Offset in Hz + int nhsym; //Number of available JT65 half-symbols char mycall[12]; char mygrid[6]; char hiscall[12]; char hisgrid[6]; char datetime[20]; + int junk1; //Used to test extent of copy to shared memory + int junk2; + bool bAlso30; //Process for 30-second submode as well as 60-second } datcom_; } @@ -208,12 +214,10 @@ void SoundInThread::inputUDP() // If buffer will not overflow, move data into datcom_ if ((k+iz) <= 60*96000) { int nsam=-1; - recvpkt_(&nsam, &b.iblk, &b.nrx, &k, b.d8, b.d8); + recvpkt_(&nsam, &b.iblk, &b.nrx, &k, b.d8, b.d8, &m_dB); datcom_.fcenter=b.cfreq + m_fAdd; -// qDebug() << "bb" << b.cfreq << m_fAdd << datcom_.fcenter; } - - m_hsym=(k-2048)*11025.0/(2048.0*m_rate); + m_hsym=(k-2048)/14400; //14400 = 0.15 * 96000 if(m_hsym != nhsym0) { if(!m_dataSinkBusy) { m_dataSinkBusy=true; diff --git a/qmap/soundin.h b/qmap/soundin.h index 50417c0b..a2b40933 100755 --- a/qmap/soundin.h +++ b/qmap/soundin.h @@ -67,7 +67,8 @@ private: }; extern "C" { - void recvpkt_(int* nsam, quint16* iblk, qint8* nrx, int* k, double s1[], double s2[]); + void recvpkt_(int* nsam, quint16* iblk, qint8* nrx, int* k, + double s1[], double s2[], int* ndb); } #endif // SOUNDIN_H -- cgit v1.2.3