From af9f7b21c0404eab42fd4a793acb1bc67ee7e0a4 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 17 Jun 2020 10:56:18 -0400 Subject: [PATCH] Starting to implement FST280 decoder. Make Rx sequences behave as desired. --- CMakeLists.txt | 1 + lib/decoder.f90 | 13 +++++++++++++ widgets/mainwindow.cpp | 41 ++++++++++++++--------------------------- widgets/mainwindow.ui | 4 ++-- wsjtx.pro | 1 + 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95ef7d9c5..f8986e5c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -369,6 +369,7 @@ set (wsjt_FSRCS lib/jt65_mod.f90 lib/ft8_decode.f90 lib/ft4_decode.f90 + lib/fst280_decode.f90 lib/jt9_decode.f90 lib/options.f90 lib/packjt.f90 diff --git a/lib/decoder.f90 b/lib/decoder.f90 index c7b3585b5..61ff4163d 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -8,6 +8,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) use jt9_decode use ft8_decode use ft4_decode + use fst280_decode include 'jt9com.f90' include 'timer_common.inc' @@ -32,6 +33,10 @@ subroutine multimode_decoder(ss,id2,params,nfsample) integer :: decoded end type counting_ft4_decoder + type, extends(fst280_decoder) :: counting_fst280_decoder + integer :: decoded + end type counting_fst280_decoder + real ss(184,NSMAX) logical baddata,newdat65,newdat9,single_decode,bVHF,bad0,newdat,ex integer*2 id2(NTMAX*12000) @@ -48,6 +53,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) type(counting_jt9_decoder) :: my_jt9 type(counting_ft8_decoder) :: my_ft8 type(counting_ft4_decoder) :: my_ft4 + type(counting_fst280_decoder) :: my_fst280 !cast C character arrays to Fortran character strings datetime=transfer(params%datetime, datetime) @@ -62,6 +68,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) my_jt9%decoded = 0 my_ft8%decoded = 0 my_ft4%decoded = 0 + my_fst280%decoded = 0 ! For testing only: return Rx messages stored in a file as decodes inquire(file='rx_messages.txt',exist=ex) @@ -180,6 +187,12 @@ subroutine multimode_decoder(ss,id2,params,nfsample) go to 800 endif + if(params%nmode.eq.280) then +! We're in FST280/FST280W mode + print*,'FST280/FST280W' + go to 800 + endif + rms=sqrt(dot_product(float(id2(300000:310000)), & float(id2(300000:310000)))/10000.0) if(rms.lt.2.0) go to 800 diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 935866bb3..1b1b2a685 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1336,7 +1336,13 @@ void MainWindow::fixStop() m_hsymStop=50; } else if (m_mode=="FT4") { m_hsymStop=21; -} + } else if(m_mode=="FST280" or m_mode=="FST280W") { + if(m_TRperiod==15) m_hsymStop=51; + if(m_TRperiod==30) m_hsymStop=95; + if(m_TRperiod==60) m_hsymStop=205; + if(m_TRperiod==120) m_hsymStop=414; + if(m_TRperiod==300) m_hsymStop=1036; + } } //-------------------------------------------------------------- dataSink() @@ -1368,7 +1374,6 @@ void MainWindow::dataSink(qint64 frames) // Get power, spectrum, and ihsym int trmin=m_TRperiod/60.0; -// int k (frames - 1); dec_data.params.nfa=m_wideGraph->nStartFreq(); dec_data.params.nfb=m_wideGraph->Fmax(); int nsps=m_nsps; @@ -1388,6 +1393,7 @@ void MainWindow::dataSink(qint64 frames) if(m_mode=="MSK144") return; fixStop(); + qDebug() << "aa" << m_hsymStop << m_ihsym << m_TRperiod; if (m_mode == "FreqCal" // only calculate after 1st chunk, also skip chunk where rig // changed frequency @@ -1485,9 +1491,9 @@ void MainWindow::dataSink(qint64 frames) m_dateTime = now.toString ("yyyy-MMM-dd hh:mm"); if(!m_mode.startsWith ("WSPR")) decode(); //Start decoder if(m_mode=="FT8" and !m_diskData and (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2)) return; - if(!m_diskData and (m_saveAll or m_saveDecoded or m_mode=="WSPR")) { //Always save unless "Save None"; may delete later - if(m_mode=="FT8" or m_mode=="FT4") { +// if(m_mode=="FT8" or m_mode=="FT4") { + if(m_TRperiod < 60) { int n=fmod(double(now.time().second()),m_TRperiod); if(n<(m_TRperiod/2)) n=n+m_TRperiod; auto const& period_start=now.addSecs(-n); @@ -1516,7 +1522,6 @@ void MainWindow::dataSink(qint64 frames) if (err!=0) MessageBox::warning_message (this, tr ("Error saving c2 file"), c2name); } } - if(m_mode.startsWith ("WSPR")) { QStringList t2; QStringList depth_args; @@ -2861,13 +2866,6 @@ void MainWindow::decode() //decode() if( m_dateTimeLastTX.isValid () ) { qint64 isecs_since_tx = m_dateTimeLastTX.secsTo(now); dec_data.params.lapcqonly= (isecs_since_tx > 300); -// QTextStream(stdout) << "last tx " << isecs_since_tx -// #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) -// << Qt::endl -// #else -// << endl -// #endif -// ; } else { m_dateTimeLastTX = now.addSecs(-900); dec_data.params.lapcqonly=true; @@ -2875,7 +2873,6 @@ void MainWindow::decode() //decode() if( m_diskData ) { dec_data.params.lapcqonly=false; } - m_msec0=QDateTime::currentMSecsSinceEpoch(); if(!m_dataAvailable or m_TRperiod==0.0) return; ui->DecodeButton->setChecked (true); @@ -2961,6 +2958,7 @@ void MainWindow::decode() //decode() dec_data.params.nmode=5; m_BestCQpriority=""; } + if(m_mode=="FST280") dec_data.params.nmode=280; dec_data.params.ntrperiod=m_TRperiod; dec_data.params.nsubmode=m_nSubMode; if(m_mode=="QRA64") dec_data.params.nsubmode=100 + m_nSubMode; @@ -3036,18 +3034,6 @@ void MainWindow::decode() //decode() mem_jt9->lock (); memcpy(to, from, qMin(mem_jt9->size(), size)); mem_jt9->unlock (); - -/* - auto now = QDateTime::currentDateTimeUtc(); - double tsec = fmod(double(now.toMSecsSinceEpoch()),86400000.0)/1000.0; - double tseq = fmod(double(now.toMSecsSinceEpoch()),1000.0*m_TRperiod)/1000.0; - if(tseq < 0.5*m_TRperiod) tseq+= m_TRperiod; - if(m_ihsym==m_earlyDecode) qDebug() << ""; - QString t; - t = t.asprintf("aa release_jt9 %11.3f %5d %5d %7.3f ",tsec,m_ihsym,m_ihsym,tseq); - qDebug().noquote() << t << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz"); -*/ - to_jt9(m_ihsym,1,-1); //Send m_ihsym to jt9[.exe] and start decoding decodeBusy(true); } @@ -4676,7 +4662,6 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie if(SpecOp::EU_VHF==m_config.special_op_id() and message_words.at(1).contains(m_baseCall) and (!message_words.at(2).contains(qso_partner_base_call)) and (!m_bDoubleClicked)) { -// qDebug() << "aa" << "Ignoring:" << message.string().mid(24); return; } @@ -5806,6 +5791,7 @@ void MainWindow::displayWidgets(qint64 n) void MainWindow::on_actionFST280_triggered() { + on_actionJT65_triggered(); m_mode="FST280"; m_modeTx="FST280"; ui->actionFST280->setChecked(true); @@ -5818,6 +5804,7 @@ void MainWindow::on_actionFST280_triggered() ui->sbTR->setMinimum(15); ui->sbTR->setMaximum(300); ui->sbSubmode->setMaximum(3); + on_sbTR_valueChanged(ui->sbTR->value()); statusChanged(); } @@ -7404,7 +7391,7 @@ void::MainWindow::VHF_features_enabled(bool b) void MainWindow::on_sbTR_valueChanged(int value) { // if(!m_bFastMode and n>m_nSubMode) m_MinW=m_nSubMode; - if(m_bFastMode or m_mode=="FreqCal") { + if(m_bFastMode or m_mode=="FreqCal" or m_mode=="FST280" or m_mode=="FST280W") { m_TRperiod = value; m_fastGraph->setTRPeriod (value); m_modulator->setTRPeriod (value); // TODO - not thread safe diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index ccce59e4c..9b07c7714 100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -1039,7 +1039,7 @@ QPushButton[state="ok"] { - 1 + 0 @@ -1608,7 +1608,7 @@ When not checked you can view the calibration results. QTabWidget::Triangular - 1 + 2 diff --git a/wsjtx.pro b/wsjtx.pro index 3248fefd7..02a69d33c 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -53,6 +53,7 @@ include(item_delegates/item_delegates.pri) include(logbook/logbook.pri) include(widgets/widgets.pri) include(Decoder/decodedtext.pri) +include(Detector/Detector.pri) SOURCES += \ Radio.cpp NetworkServerLookup.cpp revision_utils.cpp \