Produce a warning message if the WSPR .c2 file cannot be written

Thanks to Mike W9MDB for this patch.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7039 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2016-08-29 17:01:38 +00:00
parent 7281664990
commit 81ad76cacc
2 changed files with 11 additions and 9 deletions

View File

@ -1,4 +1,4 @@
subroutine savec2(c2name,ntrseconds,f0m1500)
integer function savec2(c2name,ntrseconds,f0m1500)
! Array c0() has complex samples at 1500 Hz sample rate.
! WSPR-2: downsample by 1/4 to produce c2, centered at 1500 Hz
@ -46,9 +46,10 @@ subroutine savec2(c2name,ntrseconds,f0m1500)
! Write complex time-domain data to disk.
i1=index(c2name,'.c2')
outfile=c2name(i1-11:i1+2)
open(18,file=c2name,status='unknown',access='stream')
write(18) outfile,ntrminutes,f0m1500,c2(0:45000-1)
close(18)
return
end subroutine savec2
open(18,file=c2name,status='unknown',access='stream', iostat=ioerr)
if (ioerr.ne.0) then
write(18) outfile,ntrminutes,f0m1500,c2(0:45000-1)
close(18)
endif
savec2 = ioerr
end function savec2

View File

@ -102,7 +102,7 @@ extern "C" {
int ptt_(int nport, int ntx, int* iptt, int* nopen);
void wspr_downsample_(short int d2[], int* k);
void savec2_(char* fname, int* TR_seconds, double* dial_freq, int len1);
int savec2_(char* fname, int* TR_seconds, double* dial_freq, int len1);
void avecho_( short id2[], int* dop, int* nfrit, int* nqual, float* f1,
float* level, float* sigdb, float* snr, float* dfreq,
@ -1177,7 +1177,8 @@ void MainWindow::dataSink(qint64 frames)
int nsec=120;
int nbfo=1500;
double f0m1500=m_freqNominal/1000000.0 + nbfo - 1500;
savec2_(c2name,&nsec,&f0m1500,len1);
int err = savec2_(c2name,&nsec,&f0m1500,len1);
if (err!=0) MessageBox::warning_message (this, tr ("Error saving c2 file"), c2name);
}
}