From 889531fda6b2d09c113b3e752cdace57dfe9a187 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 18 Dec 2023 15:28:44 -0500 Subject: [PATCH] Add optional real-time CFOM to QMAP receiving. --- qmap/astro.cpp | 7 +- qmap/astro.h | 4 + qmap/libqmap/CMakeLists.txt | 1 + qmap/libqmap/cfom.f90 | 30 +++++ qmap/mainwindow.cpp | 22 +++- qmap/mainwindow.h | 3 + qmap/mainwindow.ui | 239 ++++++++++++++++++++---------------- 7 files changed, 195 insertions(+), 111 deletions(-) create mode 100644 qmap/libqmap/cfom.f90 diff --git a/qmap/astro.cpp b/qmap/astro.cpp index 486b793f4..615a4c222 100644 --- a/qmap/astro.cpp +++ b/qmap/astro.cpp @@ -71,7 +71,8 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, &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" @@ -199,3 +200,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 6b574237f..51a0bc1a9 100644 --- a/qmap/astro.h +++ b/qmap/astro.h @@ -17,6 +17,8 @@ public: void astroUpdate(QDateTime t, QString mygrid, QString hisgrid, int fQSO, int nsetftx, int ntxFreq, QString azelDir, double xavg); void setFontSize(int n); + int getSelfDop(); + ~Astro (); private slots: @@ -27,6 +29,8 @@ private: Ui::Astro *ui; QString m_settings_filename; QString m_AzElDir0; + + qint32 m_ndop00=0; }; #endif diff --git a/qmap/libqmap/CMakeLists.txt b/qmap/libqmap/CMakeLists.txt index e0f77a2a7..c24aec1c3 100644 --- a/qmap/libqmap/CMakeLists.txt +++ b/qmap/libqmap/CMakeLists.txt @@ -5,6 +5,7 @@ set (libq65_FSRCS astro.f90 astro0.f90 astrosub.f90 + cfom.f90 chkstat.f90 dcoord.f90 decode0.f90 diff --git a/qmap/libqmap/cfom.f90 b/qmap/libqmap/cfom.f90 new file mode 100644 index 000000000..f3ab7e55d --- /dev/null +++ b/qmap/libqmap/cfom.f90 @@ -0,0 +1,30 @@ +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 + + 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 + w=w*wstep + c=w*cmplx(dd(1,j),dd(2,j)) + dd(1,j)=real(c) + dd(2,j)=aimag(c) + enddo + + return +end subroutine cfom diff --git a/qmap/mainwindow.cpp b/qmap/mainwindow.cpp index f126fa416..f7af98d4c 100644 --- a/qmap/mainwindow.cpp +++ b/qmap/mainwindow.cpp @@ -327,6 +327,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; @@ -344,6 +345,15 @@ void MainWindow::dataSink(int k) if(m_NB) nb=1; nfsample=96000; if(!m_fs96000) nfsample=95238; + + + if(ui->cbCFOM->isChecked()) { + int ndop00=0; + if(m_astro_window) ndop00=m_astro_window->getSelfDop(); + cfom_(datcom_.d4, &k0, &k, &ndop00); + } + k0=k; + symspec_(&k, &ndiskdat, &nb, &m_NBslider, &nfsample, &px, s, &nkhz, &ihsym, &nzap, &slimit, lstrong); @@ -838,9 +848,11 @@ void MainWindow::decode() //decode() 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 + int ndop00=0; + if(ui->cbCFOM->isChecked()) { + astrosub00_(&nyear, &month, &nday, &uth, &nfreq, m_myGrid.toLatin1(),&ndop00,6); + } + datcom_.ndop00=ndop00; //Send self Doppler (or 0, if using CFOM) to decoder fname=m_path.mid(i0-11,11); } } @@ -981,7 +993,9 @@ void MainWindow::guiUpdate() ui->labFreq->setText(t1); if(nsec != m_sec0) { //Once per second -// qDebug() << "AAA" << nsec << m_fAdd; + +// qDebug() << "AAA" << nsec; + static int n60z=99; int n60=nsec%60; int itest[5]; diff --git a/qmap/mainwindow.h b/qmap/mainwindow.h index 715bd2bad..3a5e8faae 100644 --- a/qmap/mainwindow.h +++ b/qmap/mainwindow.h @@ -206,6 +206,9 @@ extern "C" { const char* mygrid, int* ndop00, int len1); void q65c_(int* itimer); + + void cfom_(float d4[], int* k0, int* k, int* ndop0); + } #endif // MAINWINDOW_H diff --git a/qmap/mainwindow.ui b/qmap/mainwindow.ui index 8d089bb68..299eee97f 100644 --- a/qmap/mainwindow.ui +++ b/qmap/mainwindow.ui @@ -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,28 +193,45 @@ - - - - - 16777215 - 35 - - - - - 16 - - - - QFrame::Panel - - - 1296.080 + + + + <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 + + + + + + + + 50 + 0 + + + + &Erase + @@ -229,6 +250,37 @@ + + + + + 140 + 0 + + + + + 165 + 60 + + + + + 16 + + + + QFrame::Panel + + + 2023 Feb 02 +01:23:45 + + + Qt::AlignCenter + + + @@ -254,34 +306,10 @@ - - - - false - - - - 0 - 0 - - - - - 80 - 16777215 - - - - 0 - - - 100 - - - 40 - - - Qt::Horizontal + + + + NB @@ -304,33 +332,32 @@ - - - - <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 - - + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Apply CFOM + + + + @@ -421,7 +448,7 @@ p, li { white-space: pre-wrap; } 0 0 640 - 22 + 21