diff --git a/lib/decoder.f90 b/lib/decoder.f90 index ac4df6c..9bba25d 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -71,13 +71,14 @@ subroutine multimode_decoder(ss,id2,params,nfsample) nfox=0 endif - trydecode=.false. + write(*,1012) params%nsubmode, params%nsubmodes +1012 format('',2i4) if(params%nmode.eq.8 .and. (params%nsubmode.eq.4 .or. iand(params%nsubmodes, 8).eq.8)) then ! We're in JS8 mode E call timer('decjs8e ',0) newdat=params%newdat - trydecode=.true. + write(*,*) ' mode E decode started' ! copy the relevant frames for decoding pos = max(0,params%kposE) @@ -90,6 +91,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nexp_decode,params%ndepth,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & mycall,mygrid,hiscall,hisgrid) + + write(*,*) ' mode E decode finished' + call timer('decjs8e ',1) endif @@ -97,7 +101,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) ! We're in JS8 mode C call timer('decjs8c ',0) newdat=params%newdat - trydecode=.true. + write(*,*) ' mode C decode started' ! copy the relevant frames for decoding pos = max(0,params%kposC) @@ -110,6 +114,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nexp_decode,params%ndepth,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & mycall,mygrid,hiscall,hisgrid) + + write(*,*) ' mode C decode finished' + call timer('decjs8c ',1) endif @@ -117,7 +124,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) ! We're in JS8 mode B call timer('decjs8b ',0) newdat=params%newdat - trydecode=.true. + write(*,*) ' mode B decode started' ! copy the relevant frames for decoding pos = max(0,params%kposB) @@ -130,6 +137,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nexp_decode,params%ndepth,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & mycall,mygrid,hiscall,hisgrid) + + write(*,*) ' mode B decode finished' + call timer('decjs8b ',1) endif @@ -137,7 +147,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) ! We're in JS8 mode A call timer('decjs8a ',0) newdat=params%newdat - trydecode=.true. + write(*,*) ' mode A decode started' ! copy the relevant frames for decoding pos = max(0,params%kposA) @@ -150,16 +160,19 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nexp_decode,params%ndepth,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & mycall,mygrid,hiscall,hisgrid) + + write(*,*) ' mode A decode finished' + call timer('decjs8a ',1) endif - if(trydecode) go to 800 + write(*,*) ' finished' + call flush(6) -!$call omp_set_dynamic(.true.) - -800 ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded + my_js8e%decoded - write(*,1010) nsynced,ndecoded -1010 format('',2i4) + ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded + my_js8e%decoded + call sleep_msec(3000) + write(*,1010) ndecoded +1010 format('',i4) call flush(6) return diff --git a/mainwindow.cpp b/mainwindow.cpp index ee0dc93..d7140ed 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1604,9 +1604,6 @@ void MainWindow::initDecoderSubprocess(){ if(JS8_DEBUG_DECODE) qDebug() << "decoder subprocess starting..."; auto proc = new QProcess(this); - proc->setProcessEnvironment (env); - proc->start(QDir::toNativeSeparators (m_appDir) + QDir::separator () + - "js8", js8_args, QIODevice::ReadWrite | QIODevice::Unbuffered); connect(proc, &QProcess::readyReadStandardOutput, this, [this, proc](){ @@ -1620,9 +1617,28 @@ void MainWindow::initDecoderSubprocess(){ connect(proc, static_cast (&QProcess::finished), [this, proc] (int exitCode, QProcess::ExitStatus status) { + proc->deleteLater(); + proc->thread()->quit(); subProcessFailed (proc, exitCode, status); }); + proc->setProcessEnvironment (env); + proc->start(QDir::toNativeSeparators (m_appDir) + QDir::separator () + + "js8", js8_args, QIODevice::ReadWrite | QIODevice::Unbuffered); + + // create a process watcher looking for stdout read... + // seems like we're starving the event loop or something? + // auto watcher = new QTimer(proc); + // watcher->setInterval(500); + // connect(watcher, &QTimer::timeout, this, + // [this, proc](){ + // if(proc->canReadLine()){ + // if(JS8_DEBUG_DECODE) qDebug() << "decode process watcher intercepted readline"; + // readFromStdout(proc); + // } + // }); + // watcher->start(); + // kill the previous proc and set the new one m_valid = false; { @@ -4371,8 +4387,8 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){ dec_data.params.nmode=8; dec_data.params.lft8apon = false; dec_data.params.napwid=50; - dec_data.params.ntrperiod=period; //m_TRperiod; - dec_data.params.nsubmode=submode; // m_nSubMode; + dec_data.params.ntrperiod=-1; // not needed + dec_data.params.nsubmode=-1; // not needed dec_data.params.minw=0; dec_data.params.nclearave=m_nclearave; @@ -4660,6 +4676,7 @@ QList generateOffsets(int minOffset, int maxOffset){ void MainWindow::readFromStdout(QProcess * proc) //readFromStdout { if(!proc || proc->state() == QProcess::NotRunning){ + qDebug() << "proc not running"; return; } @@ -4669,9 +4686,19 @@ void MainWindow::readFromStdout(QProcess * proc) //r bool bAvgMsg=false; int navg=0; + if(t.indexOf("") >= 0) { + if(JS8_DEBUG_DECODE) qDebug() << "--> busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists()); + return; + } + + if(t.indexOf("") >= 0) { + if(JS8_DEBUG_DECODE) qDebug() << "--> busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists()); + return; + } + if(t.indexOf("") >= 0) { if(m_mode=="QRA64") m_wideGraph->drawRed(0,0); - m_bDecoded = t.mid(20).trimmed().toInt() > 0; + m_bDecoded = t.mid(16).trimmed().toInt() > 0; int mswait=3*1000*m_TRperiod/4; if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period decodeDone();