Save and restore CFOM-adjusted data in *.iq files.

This commit is contained in:
Joe Taylor 2023-12-18 16:34:44 -05:00
parent 889531fda6
commit 2fb711401f
5 changed files with 22 additions and 9 deletions

View File

@ -25,7 +25,6 @@ void getfile(QString fname, bool xpol, int dbDgrd)
if(fp != NULL) {
auto n = fread(&datcom_.fcenter,sizeof(datcom_.fcenter),1,fp);
n = fread(id,2,npts,fp);
Q_UNUSED (n);
int j=0;
if(dbDgrd<0) {
@ -39,6 +38,12 @@ void getfile(QString fname, bool xpol, int dbDgrd)
datcom_.d4[j++]=(float)id[i+1];
}
}
n = fread(datcom_.mygrid,sizeof(datcom_.mygrid),1,fp);
short int one=0;
fread(&one,2,1,fp);
Q_UNUSED(n);
// if(n>0) qDebug() << "bb" << datcom_.mygrid << one;
fclose(fp);
datcom_.ndiskdat=1;
@ -52,10 +57,10 @@ void getfile(QString fname, bool xpol, int dbDgrd)
}
}
void savetf2(QString fname, bool xpol)
void save_iq(QString fname, bool bCFOM)
{
int npts=2*60*96000;
if(xpol) npts=2*npts;
if(bCFOM) npts=2*npts;
qint16* buf=(qint16*)malloc(2*npts);
char name[80];
@ -70,6 +75,11 @@ void savetf2(QString fname, bool xpol)
buf[i+1]=(qint16)datcom_.d4[j++];
}
fwrite(buf,2,npts,fp);
if(bCFOM) {
fwrite(&datcom_.mygrid,sizeof(datcom_.mygrid),1,fp);
short int one=1;
fwrite(&one,2,1,fp);
}
fclose(fp);
}
free(buf);

View File

@ -6,7 +6,7 @@
#include "commons.h"
void getfile(QString fname, bool xpol, int dbDgrd);
void savetf2(QString fname, bool xpol);
void save_iq(QString fname, bool bCFOM);
float gran();
#endif // GETFILE_H

View File

@ -248,6 +248,7 @@ void MainWindow::writeSettings()
settings.setValue("MaxDrift",ui->sbMaxDrift->value());
settings.setValue("Offset",ui->sbOffset->value());
settings.setValue("Also30",m_bAlso30);
settings.setValue("CFOM",ui->cbCFOM->isChecked());
}
//---------------------------------------------------------- readSettings()
@ -306,6 +307,7 @@ void MainWindow::readSettings()
m_bAlso30=settings.value("Also30",false).toBool();
ui->actionAlso_Q65_30x->setChecked(m_bAlso30);
on_actionAlso_Q65_30x_toggled(m_bAlso30);
ui->cbCFOM->setChecked(settings.value("CFOM",false).toBool());
if(!ui->actionLinrad->isChecked() && !ui->actionCuteSDR->isChecked() &&
!ui->actionAFMHot->isChecked() && !ui->actionBlue->isChecked()) {
on_actionLinrad_triggered();
@ -424,13 +426,14 @@ void MainWindow::dataSink(int k)
QDateTime t = QDateTime::currentDateTimeUtc();
m_dateTime=t.toString("yyMMdd_hhmm");
decode(); //Start the decoder
if(m_saveAll and !m_diskData and (m_nTx30<5 and m_nTx60<10)) {
if(m_saveAll and !m_diskData and (m_nTx30<5 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 += ".iq";
*future2 = QtConcurrent::run(savetf2, fname, false);
bool bCFOM=ui->cbCFOM->isChecked();
*future2 = QtConcurrent::run(save_iq, fname, bCFOM);
watcher2->setFuture(*future2);
}
m_nTx30=0;

View File

@ -193,7 +193,7 @@ private:
};
extern void getfile(QString fname, bool xpol, int idInt);
extern void savetf2(QString fname, bool xpol);
extern void save_iq(QString fname, bool xpol);
extern int killbyname(const char* progName);
extern "C" {

View File

@ -344,7 +344,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>10</width>
<height>20</height>
</size>
</property>
@ -353,7 +353,7 @@
<item>
<widget class="QCheckBox" name="cbCFOM">
<property name="text">
<string>Apply CFOM</string>
<string>Apply Rx CFOM</string>
</property>
</widget>
</item>