WIP toward moving save_qm to the decoder thread.

This commit is contained in:
Joe Taylor 2024-01-15 13:10:41 -05:00
parent f7e16671ab
commit ff39abab58
6 changed files with 47 additions and 37 deletions

View File

@ -26,13 +26,13 @@ extern struct { //This is "common/datcom/..." in Fortran
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 junk5; //
int n60; //nsecs%60
int junk4; //
int nfsample; //Input sample rate
int junk3; //
int nBaseSubmode; //Base submode for Q65-60x (aka m_modeQ65)
int ndop00; //EME Self Doppler
int nsave; //no longer used
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
@ -67,13 +67,13 @@ extern struct { //This is "common/datcom/..." in Fortran
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 junk5; //
int n60; //nsecs%60
int junk4; //
int nfsample; //Input sample rate
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 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

View File

@ -14,8 +14,8 @@ subroutine decode0(dd,ss,savg)
common/decodes/ndecodes,ncand,nQDecoderDone,nWDecoderBusy, &
nWTransmitting,result(50)
common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, &
ndepth,ndiskdat,ntx60,newdat,nfa,nfb,nfcal,nfshift, &
ntx30a,ntx30b,ntol,nxant,nCFOM,nfsample,nxpol,nmode, &
ndepth,ndiskdat,ntx60,newdat,nfa,nfb,nfcal,nfshift, &
ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,nxpol,nmode, &
ndop00,nsave,max_drift,offset,nhsym,mycall,mygrid, &
hiscall,hisgrid,datetime,junk1,junk2,bAlso30
save
@ -49,5 +49,9 @@ subroutine decode0(dd,ss,savg)
datetime,ndop00,fselected,bAlso30,nhsym,NCFOM)
call timer('qmapa ',1)
write(*,3001) n60,datetime(1:11),nutc,newdat,nsave,ntx30a,ntx30b,ndecodes
3001 format('A',i3,1x,a11,i6.4,5i5)
return
end subroutine decode0

View File

@ -23,7 +23,7 @@ subroutine q65c(itimer)
!### REMEMBER that /npar/ is not updated until nparams=nparams0 is executed. ###
common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, &
ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, &
ntx30a,ntx30b,ntol,nxant,nCFOM,nfsample,nxpol,nmode, &
ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,nxpol,nmode, &
ndop00,nsave,nn3,nn4,nhsym,mycall,mygrid,hiscall,hisgrid, &
datetime,junk1,junk2,bAlso30
equivalence (nparams,fcenter)

View File

@ -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[])
@ -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;
}

View File

@ -149,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");
@ -184,7 +186,8 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
writeSettings();
q65c_(&m_one);
int one=1;
q65c_(&one);
if (soundInThread.isRunning()) {
soundInThread.quit();
@ -406,22 +409,7 @@ void MainWindow::dataSink(int k)
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 or (m_saveDecoded and decodes_.ndecodes>0)) and !m_diskData and
m_nTx60<10 and ihsym==m_hsymStop) {
QDir dir(m_saveDir);
if (!dir.exists()) dir.mkpath(".");
QString fname=m_saveDir + "/" + t.date().toString("yyMMdd") + "_" +
t.time().toString("hhmm");
fname += ".qm";
QString t{"QMAP v" + QCoreApplication::applicationVersion() + " " + revision()};
save_qm_(fname.toLatin1(), t.toLatin1(), m_myCall.toLatin1(), m_myGrid.toLatin1(),
datcom2_.d4, &datcom2_.ntx30a, &datcom2_.ntx30b, &datcom2_.fcenter,
&datcom2_.nutc, &m_dop00, &m_dop58,
fname.length(), t.length(), m_myCall.length(), m_myGrid.length());
}
if(ihsym==m_hsymStop) {
m_nTx30a=0;
m_nTx30b=0;
@ -867,7 +855,7 @@ 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) {
fname=m_path.mid(i0-11,11);
}
@ -906,6 +894,10 @@ void MainWindow::decode() //decode()
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;
@ -923,13 +915,25 @@ void MainWindow::decode() //decode()
decodes_.ncand=0;
decodes_.nQDecoderDone=0;
//No need to call decoder for first half, if we transmitted in the first half:
QString saveFileName="NoSave";
if(!m_diskData) {
QDateTime t = QDateTime::currentDateTimeUtc();
m_dateTime=t.toString("yyMMdd_hhmm");
QDir dir(m_saveDir);
if (!dir.exists()) dir.mkpath(".");
saveFileName=m_saveDir + "/" + m_dateTime + ".qm";
}
qDebug() << "aa" << m_n60 << datcom_.nhsym << m_revision << saveFileName;
//No need to call decoder for first half, if we transmitted in the first half:
if((datcom_.nhsym<=200) and (m_nTx30a>5)) return;
//No need to call decoder in second half, if we transmitted in that half:
//No need to call decoder in second half, if we transmitted in that half:
if((datcom_.nhsym>200) and (m_nTx30b>5)) return;
watcher3.setFuture(QtConcurrent::run (std::bind (q65c_, &m_zero)));
int zero=0;
watcher3.setFuture(QtConcurrent::run (std::bind (q65c_, &zero)));
decodeBusy(true);
}
@ -1007,7 +1011,7 @@ void MainWindow::guiUpdate()
if(nsec != m_sec0) { //Once per second
static int n60z=99;
int n60=nsec%60;
m_n60=nsec%60;
// See if WSJT-X is transmitting
int itest[5];
@ -1017,19 +1021,19 @@ void MainWindow::guiUpdate()
if(itest[4]>0) {
m_WSJTX_TRperiod=itest[4];
m_bWTransmitting=true;
if(m_WSJTX_TRperiod==30 and n60<30) m_nTx30a++;
if(m_WSJTX_TRperiod==30 and n60>=30) m_nTx30b++;
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((n60<n60z) and !m_diskData) {
if((m_n60<n60z) and !m_diskData) {
m_nTx30a=0;
m_nTx30b=0;
m_nTx60=0;
}
n60z=n60;
n60z=m_n60;
if(m_pctZap>30.0) {
lab2->setStyleSheet("QLabel{background-color: #ff0000}");
@ -1072,8 +1076,8 @@ void MainWindow::guiUpdate()
ui->labUTC->setText(utc);
m_hsym0=khsym;
m_sec0=nsec;
if(n60==0) m_dop00=datcom_.ndop00;
if(n60==58) m_dop58=datcom_.ndop00;
if(m_n60==0) m_dop00=datcom_.ndop00;
if(m_n60==58) m_dop58=datcom_.ndop00;
}
}

View File

@ -118,8 +118,7 @@ private:
qint32 m_WSJTX_TRperiod=0;
qint32 m_dop00=0;
qint32 m_dop58=0;
qint32 m_zero=0;
qint32 m_one=1;
qint32 m_n60;
double m_fAdd;
double m_xavg;
@ -171,6 +170,8 @@ private:
QString m_dateTime;
QString m_mode;
QString m_UTC0="";
QString m_revision;
QDateTime m_dateTimeSeqStart; //Nominal start time of Rx sequence about to be decoded
QHash<QString,bool> m_worked;
SignalMeter *xSignalMeter;