diff --git a/commons.h b/commons.h index d7ec425..0839428 100644 --- a/commons.h +++ b/commons.h @@ -13,6 +13,7 @@ #define JS8_DECODE_THREAD 1 // use a separate thread for decode process handling #define JS8_ALLOW_EXTENDED 1 // allow extended latin-1 capital charset #define JS8_SAVE_AUDIO 0 // enable the save menu +#define JS8_AUTO_SYNC 0 // enable the experimental auto sync feature #ifdef QT_DEBUG #define JS8_DEBUG_DECODE 0 // emit debug statements for the decode pipeline diff --git a/decodedtext.cpp b/decodedtext.cpp index e37e974..f2e8e0a 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -26,6 +26,7 @@ DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString , isAlt_(false) , bits_{0} , submode_{ string_.mid(column_mode + padding_, 3).trimmed().at(0).cell() - 'A' } + , frame_ { string_.mid (column_qsoText + padding_, 12).trimmed () } { if(message_.length() >= 1) { message_ = message_.left (21).remove (QRegularExpression {"[<>]"}); @@ -71,7 +72,8 @@ DecodedText::DecodedText (QString const& js8callmessage, int bits, int submode): isHeartbeat_(false), isAlt_(false), bits_(bits), - submode_(submode) + submode_(submode), + frame_(js8callmessage) { is_standard_ = QRegularExpression("^(CQ|DE|QRZ)\\s").match(message_).hasMatch(); diff --git a/decodedtext.h b/decodedtext.h index 1eb51af..868e16f 100644 --- a/decodedtext.h +++ b/decodedtext.h @@ -41,6 +41,7 @@ public: bool tryUnpackFastData(); quint8 frameType() const { return frameType_; } + QString frame() const { return frame_; } QString extra() const { return extra_; } QString compoundCall() const { return compound_; } @@ -113,6 +114,7 @@ private: bool is_standard_; int bits_; int submode_; + QString frame_; }; #endif // DECODEDTEXT_H diff --git a/lib/decoder.f90 b/lib/decoder.f90 index b9b9ea8..020e7f9 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -91,7 +91,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) imax=int(NTMAX*12000) if(params%syncStats) then - write(*,*) ' sync start', pos, sz + write(*,*) ' sync start', pos, sz endif if((imax-pos).lt.sz) then @@ -129,7 +129,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) imax=int(NTMAX*12000) if(params%syncStats) then - write(*,*) ' sync start', pos, sz + write(*,*) ' sync start', pos, sz endif if((imax-pos).lt.sz) then @@ -167,7 +167,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) imax=int(NTMAX*12000) if(params%syncStats) then - write(*,*) ' sync start', pos, sz + write(*,*) ' sync start', pos, sz endif if((imax-pos).lt.sz) then @@ -205,7 +205,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) imax=int(NTMAX*12000) if(params%syncStats) then - write(*,*) ' sync start', pos, sz + write(*,*) ' sync start', pos, sz endif if((imax-pos).lt.sz) then @@ -243,7 +243,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) imax=int(NTMAX*12000) if(params%syncStats) then - write(*,*) ' sync start', pos, sz + write(*,*) ' sync start', pos, sz endif if((imax-pos).lt.sz) then diff --git a/lib/js8a_decode.f90 b/lib/js8a_decode.f90 index e3d9cfc..22ddc7b 100644 --- a/lib/js8a_decode.f90 +++ b/lib/js8a_decode.f90 @@ -108,7 +108,7 @@ contains xdt=candidate(2,icand) xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz - if(NWRITELOG.eq.0) then + if(NWRITELOG.eq.1) then write(*,*) ' candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase flush(6) endif diff --git a/mainwindow.cpp b/mainwindow.cpp index 89a5b73..8a4e9a4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1022,6 +1022,11 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, if(!JS8_ENABLE_JS8I){ ui->actionModeJS8Ultra->setVisible(false); } + if(!JS8_AUTO_SYNC){ + ui->actionModeAutoSync->setVisible(false); + ui->actionModeAutoSync->setEnabled(false); + ui->actionModeAutoSync->setChecked(false); + } // prep prepareMonitorControls(); @@ -4284,6 +4289,11 @@ bool MainWindow::decode(qint32 k){ return false; } + if(m_decoderBusyStartTime.isValid() && m_decoderBusyStartTime.msecsTo(QDateTime::currentDateTimeUtc()) < 1000){ + if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused for 1000 ms after last decode start"; + return false; + } + int threshold = m_nSubMode == Varicode::JS8CallSlow ? 4000 : 2000; // two seconds if(isInDecodeDelayThreshold(threshold)){ if(JS8_DEBUG_DECODE) qDebug() << "--> decoder paused for" << threshold << "ms after transmit stop"; @@ -4491,7 +4501,7 @@ bool MainWindow::decodeEnqueueReadyExperiment(qint32 k, qint32 /*k0*/){ bool everySecond = ui->actionModeAutoSync->isChecked(); // do we need to process alternate positions? - bool skipAlt = true; + bool skipAlt = false; foreach(auto submode, submodes.keys()){ // skip if multi is disabled and this mode is not the current submode @@ -4542,7 +4552,10 @@ bool MainWindow::decodeEnqueueReadyExperiment(qint32 k, qint32 /*k0*/){ // keep track of last decode position m_lastDecodeStartMap[submode] = k; } - else if(incrementedBy >= oneSecondSamples && (cycleFramesReady >= cycleFramesNeeded || cycleFramesReady < oneSecondSamples)){ + else if( + (incrementedBy >= 2*oneSecondSamples && cycleFramesReady >= cycleFramesNeeded ) || + (incrementedBy >= oneSecondSamples && cycleFramesReady < 1.25*oneSecondSamples) + ){ DecodeParams d; d.submode = submode; d.start = cycle*cycleFrames; @@ -5209,7 +5222,7 @@ void MainWindow::readFromStdout(QProcess * proc) //r } void MainWindow::processDecodedLine(QByteArray t){ - qDebug() << "JS8: " << QString(t); + if(JS8_DEBUG_DECODE) qDebug() << "JS8: " << QString(t); bool bAvgMsg=false; int navg=0; @@ -5217,7 +5230,7 @@ void MainWindow::processDecodedLine(QByteArray t){ static QList driftQueue; static qint32 syncStart = -1; - if(t.indexOf(" sync start") >= 0){ + if(t.indexOf(" sync start") >= 0){ auto segs = QString(t.trimmed()).split(QRegExp("[\\s\\t]+"), QString::SkipEmptyParts); if(segs.isEmpty()){ return; @@ -5414,9 +5427,8 @@ void MainWindow::processDecodedLine(QByteArray t){ // frames are also valid if they pass our dupe check (haven't seen the same frame in the past 1/2 decode period) - auto frame = decodedtext.message(); auto frameOffset = decodedtext.frequencyOffset(); - auto frameDedupeKey = QString("%1:%2").arg(decodedtext.submode()).arg(frame); + auto frameDedupeKey = QString("%1:%2").arg(decodedtext.submode()).arg(decodedtext.frame()); if(m_messageDupeCache.contains(frameDedupeKey)){ auto cached = m_messageDupeCache.value(frameDedupeKey); diff --git a/mainwindow.h b/mainwindow.h index ef3b302..1fdc867 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -616,7 +616,7 @@ private: bool m_loopall; bool m_decoderBusy; QString m_decoderBusyBand; - QMap m_lastDecodeStartMap; + QMap m_lastDecodeStartMap; // submode, decode k start position Radio::Frequency m_decoderBusyFreq; QDateTime m_decoderBusyStartTime; bool m_auto;