Merge branch 'release-2.5.0' of bitbucket.org:k1jt/wsjtx into release-2.5.0

This commit is contained in:
Joe Taylor 2021-08-25 10:05:25 -04:00
commit 419ccc8dab
9 changed files with 36 additions and 47 deletions

View File

@ -443,7 +443,7 @@ void EqualizationToolsDialog::impl::plot_current ()
plot_.graph (3)->rescaleValueAxis ();
QFileInfo refspec_file_info {data_directory_.absoluteFilePath ("refspec.dat")};
std::ifstream refspec_file (refspec_file_info.absoluteFilePath ().toLatin1 ().constData (), std::ifstream::in);
std::ifstream refspec_file (refspec_file_info.absoluteFilePath ().toLocal8Bit ().constData (), std::ifstream::in);
unsigned n;
if (refspec_file >> amp_poly_low_ >> amp_poly_high_ >> n)
{
@ -499,7 +499,7 @@ void EqualizationToolsDialog::impl::plot_phase ()
, "Phase Coefficient Files (*.pcoeff)");
if (!phase_file_name.size ()) return;
std::ifstream phase_file (phase_file_name.toLatin1 ().constData (), std::ifstream::in);
std::ifstream phase_file (phase_file_name.toLocal8Bit ().constData (), std::ifstream::in);
int n;
float chi;
float rmsdiff;

View File

@ -12,8 +12,8 @@ subroutine calibrate(data_dir,iz,a,b,rms,sigmaa,sigmab,irc)
real*8 fd(NZ),deltaf(NZ),r(NZ),rmsd(NZ)
integer nn(NZ)
infile=trim(data_dir)//'fmt.all'
outfile=trim(data_dir)//'fcal2.out'
infile=trim(data_dir)//'/'//'fmt.all'
outfile=trim(data_dir)//'/'//'fcal2.out'
open(10,file=trim(infile),status='old',err=996)
open(12,file=trim(outfile),status='unknown',err=997)

View File

@ -20,7 +20,7 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144, &
parameter (JZ=703)
character*80 line1
character*512 datadir
character*(*) datadir
character*12 mycall,hiscall
integer*2 id2(0:120*12000-1)
logical*1 bmsk144,bshmsg,btrain,bswl

View File

@ -9,7 +9,7 @@ subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall, &
character*8 date
character*10 time
character*5 zone
character*512 datadir
character*(*) datadir
complex cframe(864)
complex cross(864)
@ -191,9 +191,7 @@ subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall, &
write(pcoeff_filename,'(i2.2,i2.2,i2.2,"_",i2.2,i2.2,i2.2)') &
values(1)-2000,values(2),values(3),values(5),values(6),values(7)
pcoeff_filename=trim(trained_dxcall)//"_"//trim(pcoeff_filename)//".pcoeff"
l1=index(datadir,char(0))-1
datadir(l1+1:l1+1)="/"
pcoeff_filename=datadir(1:l1+1)//trim(pcoeff_filename)
pcoeff_filename=datadir//'/'//trim(pcoeff_filename)
!write(*,*) 'trained - writing coefficients to: ',pcoeff_filename
open(17,file=pcoeff_filename,status='new')
write(17,'(i4,2f10.2,3i5,5e25.16)') navg,sqrt(chisqr),rmsdiff,NFREQLOW,NFREQHIGH,nterms,a

View File

@ -19,7 +19,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, &
character*80 line !Formatted line with UTC dB T Freq Msg
character*12 mycall,hiscall
character*37 recent_shmsgs(NSHMEM)
character*512 datadir
character*(*) datadir
complex cdat(NFFT1) !Analytic signal
complex c(NSPM) !Coherently averaged complex data

View File

@ -677,6 +677,7 @@ unsigned long writec2file(char *c2filename, int trmin, double freq
}
nwrite = fwrite(buffer, sizeof(float), 2*45000, fp);
free(buffer);
fclose(fp);
if( nwrite == 2*45000 ) {
return nwrite;
} else {

View File

@ -18,7 +18,7 @@ void getfile(QString fname, bool xpol, int dbDgrd)
memset(id,0,2*npts);
char name[80];
strcpy(name,fname.toLatin1());
strcpy(name,fname.toLocal8Bit());
FILE* fp=fopen(name,"rb");
if(fp != NULL) {
@ -61,7 +61,7 @@ void savetf2(QString fname, bool xpol)
qint16* buf=(qint16*)malloc(2*npts);
char name[80];
strcpy(name,fname.toLatin1());
strcpy(name,fname.toLocal8Bit());
FILE* fp=fopen(name,"wb");
if(fp != NULL) {

View File

@ -118,8 +118,8 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const
&azmoondx, &elmoondx, &ntsky, &m_dop, &m_dop00, &ramoon, &decmoon,
&dgrd, &poloffset, &xnr, &techo, &width1, &width2,
bTx,
AzElFileName.toLatin1().data(),
jpleph.toLatin1().data());
AzElFileName.toLocal8Bit ().constData (),
jpleph.toLocal8Bit ().constData ());
if(!hisgrid.size ()) {
azmoondx=0.0;
@ -229,7 +229,7 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const
&dgrd, &poloffset, &xnr, &techo, &width1, &width2,
bTx,
nullptr, // don't overwrite azel.dat
jpleph.toLatin1().data());
jpleph.toLocal8Bit ().constData ());
FrequencyDelta offset {0};
switch (m_DopplerMethod)
{

View File

@ -98,7 +98,8 @@ extern "C" {
void hspec_(short int d2[], int* k, int* nutc0, int* ntrperiod, int* nrxfreq, int* ntol,
bool* bmsk144, bool* btrain, double const pcoeffs[], int* ingain,
char mycall[], char hiscall[], bool* bshmsg, bool* bswl, char ddir[], float green[],
char const * mycall, char const * hiscall, bool* bshmsg, bool* bswl,
char const * ddir, float green[],
float s[], int* jh, float *pxmax, float *rmsNoGain, char line[],
fortran_charlen_t, fortran_charlen_t, fortran_charlen_t, fortran_charlen_t);
@ -150,7 +151,7 @@ extern "C" {
void wspr_downsample_(short int d2[], int* k);
int savec2_(char* fname, int* TR_seconds, double* dial_freq, fortran_charlen_t);
int savec2_(char const * fname, int* TR_seconds, double* dial_freq, fortran_charlen_t);
void avecho_( short id2[], int* dop, int* nfrit, int* nqual, float* f1,
float* level, float* sigdb, float* snr, float* dfreq,
@ -171,7 +172,7 @@ extern "C" {
void fix_contest_msg_(char* MyGrid, char* msg, fortran_charlen_t, fortran_charlen_t);
void calibrate_(char data_dir[], int* iz, double* a, double* b, double* rms,
void calibrate_(char const * data_dir, int* iz, double* a, double* b, double* rms,
double* sigmaa, double* sigmab, int* irc, fortran_charlen_t);
void foxgen_();
@ -919,9 +920,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
proc_jt9.start(QDir::toNativeSeparators (m_appDir) + QDir::separator () +
"jt9", jt9_args, QIODevice::ReadWrite | QIODevice::Unbuffered);
QString fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))};
QByteArray cfname=fname.toLocal8Bit();
fftwf_import_wisdom_from_filename(cfname);
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))};
fftwf_import_wisdom_from_filename (fname.toLocal8Bit ());
m_ntx = 6;
ui->txrb6->setChecked(true);
@ -1075,9 +1075,8 @@ void MainWindow::on_the_minute ()
MainWindow::~MainWindow()
{
m_astroWidget.reset ();
QString fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))};
QByteArray cfname=fname.toLocal8Bit();
fftwf_export_wisdom_to_filename(cfname);
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))};
fftwf_export_wisdom_to_filename (fname.toLocal8Bit ());
m_audioThread.quit ();
m_audioThread.wait ();
remove_child_from_event_filter (this);
@ -1428,10 +1427,7 @@ void MainWindow::dataSink(qint64 frames)
static float s[NSMAX];
char line[80];
int k(frames);
QString fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat"))};
QByteArray bafname = fname.toLatin1();
const char *c_fname = bafname.data();
int len=fname.length();
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat")).toLocal8Bit ()};
if(m_diskData) {
dec_data.params.ndiskdat=1;
@ -1443,7 +1439,7 @@ void MainWindow::dataSink(qint64 frames)
m_bUseRef=m_wideGraph->useRef();
if(!m_diskData) {
refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bClearRefSpec,&m_bRefSpec,
&m_bUseRef,c_fname,len);
&m_bUseRef, fname.constData (), fname.size ());
}
m_bClearRefSpec=false;
@ -1598,14 +1594,11 @@ void MainWindow::dataSink(qint64 frames)
this, m_fnameWE, &dec_data.d2[0], samples, m_config.my_callsign(),
m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid)));
if (m_mode=="WSPR") {
QString c2name_string {m_fnameWE + ".c2"};
int len1=c2name_string.length();
char c2name[80];
strcpy(c2name,c2name_string.toLatin1 ().constData ());
auto c2name {(m_fnameWE + ".c2").toLocal8Bit ()};
int nsec=120;
int nbfo=1500;
double f0m1500=m_freqNominal/1000000.0 + nbfo - 1500;
int err = savec2_(c2name,&nsec,&f0m1500,len1);
int err = savec2_(c2name.constData (),&nsec,&f0m1500, c2name.size ());
if (err!=0) MessageBox::warning_message (this, tr ("Error saving c2 file"), c2name);
}
}
@ -1721,17 +1714,14 @@ void MainWindow::fastSink(qint64 frames)
// ::memcpy(dec_data.params.hiscall,(Radio::base_callsign (hisCall) + " ").toLatin1 ().constData (), sizeof dec_data.params.hiscall);
::memcpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), sizeof dec_data.params.hiscall);
::memcpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(), sizeof dec_data.params.mygrid);
QString dataDir;
dataDir = m_config.writeable_data_dir ().absolutePath ();
char ddir[512];
::strncpy(ddir,dataDir.toLatin1(), sizeof (ddir) - 1);
auto data_dir {m_config.writeable_data_dir ().absolutePath ().toLocal8Bit ()};
float pxmax = 0;
float rmsNoGain = 0;
int ftol = ui->sbFtol->value ();
hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&RxFreq,&ftol,&bmsk144,
&m_bTrain,m_phaseEqCoefficients.constData(),&m_inGain,&dec_data.params.mycall[0],
&dec_data.params.hiscall[0],&bshmsg,&bswl,
&ddir[0],fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],12,12,512,80);
data_dir.constData (),fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],12,12,data_dir.size (),80);
float px = fast_green[fast_jh];
QString t;
t = t.asprintf(" Rx noise: %5.1f ",px);
@ -1891,7 +1881,10 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
ui->actionEnable_AP_JT65->setVisible(false);
ui->actionAuto_Clear_Avg->setVisible(false);
}
if(m_config.special_op_id()!=nContest0) ui->tx1->setEnabled(true);
if(m_config.special_op_id()!=nContest0) {
ui->tx1->setEnabled(true);
ui->txb1->setEnabled(true);
}
chkFT4();
if(SpecOp::EU_VHF==m_config.special_op_id() and m_config.my_grid().size()<6) {
MessageBox::information_message (this,
@ -2540,16 +2533,13 @@ void MainWindow::on_actionFast_Graph_triggered()
void MainWindow::on_actionSolve_FreqCal_triggered()
{
QString dpath{QDir::toNativeSeparators(m_config.writeable_data_dir().absolutePath()+"/")};
char data_dir[512];
int len=dpath.length();
auto data_dir {QDir::toNativeSeparators(m_config.writeable_data_dir().absolutePath()).toLocal8Bit ()};
int iz,irc;
double a,b,rms,sigmaa,sigmab;
strncpy(data_dir,dpath.toLatin1(),len);
calibrate_(data_dir,&iz,&a,&b,&rms,&sigmaa,&sigmab,&irc,len);
calibrate_(data_dir.constData (),&iz,&a,&b,&rms,&sigmaa,&sigmab,&irc,data_dir.size ());
QString t2;
if(irc==-1) t2="Cannot open " + dpath + "fmt.all";
if(irc==-2) t2="Cannot open " + dpath + "fcal2.out";
if(irc==-1) t2="Cannot open " + data_dir + "/fmt.all";
if(irc==-2) t2="Cannot open " + data_dir + "/fcal2.out";
if(irc==-3) t2="Insufficient data in fmt.all";
if(irc==-4) t2 = tr ("Invalid data in fmt.all at line %1").arg (iz);
if(irc>0 or rms>1.0) t2="Check fmt.all for possible bad data.";