Clean up compiler warnings.

Better definition of "red()" for waterfall plot.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2729 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-11-14 17:02:54 +00:00
parent 76b44470e1
commit 70ef47f821
10 changed files with 15 additions and 80 deletions

View File

@ -22,7 +22,7 @@ void getfile(QString fname, int ntrperiod)
if(fp != NULL) { if(fp != NULL) {
// Read (and ignore) a 44-byte WAV header; then read data // Read (and ignore) a 44-byte WAV header; then read data
fread(jt9com_.d2,1,44,fp); fread(jt9com_.d2,1,44,fp);
int nrd=fread(jt9com_.d2,2,npts,fp); fread(jt9com_.d2,2,npts,fp);
fclose(fp); fclose(fp);
jt9com_.newdat=1; jt9com_.newdat=1;
} }

View File

@ -110,8 +110,8 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00)
endif endif
if(msg.ne.' ') then if(msg.ne.' ') then
write(13,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,width,msg write(13,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg
write(14,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,width,msg write(14,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg
fgood=f fgood=f
nsynced=1 nsynced=1
ndecoded=1 ndecoded=1

View File

@ -1,6 +1,5 @@
subroutine n2grid(n,grid) subroutine n2grid(n,grid)
character*4 grid character*4 grid
character*1 c1,c2
if(n.gt.-31 .or. n.lt.-70) stop 'Error in n2grid' if(n.gt.-31 .or. n.lt.-70) stop 'Error in n2grid'
i=-(n+31) !NB: 0 <= i <= 39 i=-(n+31) !NB: 0 <= i <= 39

View File

@ -15,29 +15,19 @@ subroutine redsync(ss,ntrperiod,ihsym,iz,red)
smax=0. smax=0.
do lag=-lagmax,lagmax do lag=-lagmax,lagmax
sig=0. sig=0.
ns=0
ref=0.
nr=0
do j=1,16 do j=1,16
k=ii2(j)+lag k=ii2(j)+lag
if(k.ge.1 .and. k.le.ihsym) then if(k.ge.5 .and. k.le.ihsym) then
sig=sig + ss(k,i) sig=sig + ss(k,i) - 0.5*(ss(k-2,i)+ss(k-4,i))
ns=ns+1
endif endif
do n=k+2,k+8,2
if(n.ge.1 .and. n.le.ihsym) then
ref=ref + ss(n,i)
nr=nr+1
endif
enddo
enddo enddo
s=0. if(sig.gt.smax) smax=sig
if(ref.gt.0.0) s=(sig/ns)/(ref/nr)
if(s.gt.smax) smax=s
enddo enddo
! red(i)=db(smax)
red(i)=smax red(i)=smax
enddo enddo
call pctile(red,iz,50,xmed)
if(xmed.le.0.0) xmed=1.0
red=red/xmed
return return
end subroutine redsync end subroutine redsync

View File

@ -58,7 +58,6 @@ subroutine spec9(c0,npts8,nsps,fpk0,fpk,xdt,snrdb,i1SoftSymbols)
if(isync(j).eq.1) cycle if(isync(j).eq.1) cycle
k=k+1 k=k+1
ia=(j-1)*nsps8 + istart ia=(j-1)*nsps8 + istart
ib=ia+nsps8-1
! c(0:nfft-1)=c1(ia:ib) ! c(0:nfft-1)=c1(ia:ib)
do i=0,nfft-1 do i=0,nfft-1

View File

@ -33,14 +33,12 @@ subroutine sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest)
if(sum.gt.smax) then if(sum.gt.smax) then
smax=sum smax=sum
ipk=i ipk=i
lagpk=lag
endif endif
enddo enddo
ccfred(i)=smax !Best at this freq, over all lags ccfred(i)=smax !Best at this freq, over all lags
if(smax.gt.sbest) then if(smax.gt.sbest) then
sbest=smax sbest=smax
ipkbest=ipk ipkbest=ipk
lagpkbest=lagpk
endif endif
enddo enddo

View File

@ -35,7 +35,6 @@ subroutine timf2(x0,k,nfft,nwindow,nb,peaklimit,x1, &
equivalence (x,cx),(xw,cxw),(xs,cxs) equivalence (x,cx),(xw,cxw),(xs,cxs)
data first/.true./ data first/.true./
data k0/99999999/ data k0/99999999/
! save w,xsov,xwov,s,ntc,ntot,nh,kstep,fac,first,k0
save save
if(first) then if(first) then
@ -44,8 +43,6 @@ subroutine timf2(x0,k,nfft,nwindow,nb,peaklimit,x1, &
w(i)=(sin(i*pi/nfft))**2 w(i)=(sin(i*pi/nfft))**2
enddo enddo
s=0. s=0.
ntc=0
ntot=0
nh=nfft/2 nh=nfft/2
kstep=nfft kstep=nfft
if(nwindow.eq.2) kstep=nh if(nwindow.eq.2) kstep=nh
@ -66,30 +63,12 @@ subroutine timf2(x0,k,nfft,nwindow,nb,peaklimit,x1, &
cxt(0:nh)=cx(0:nh) cxt(0:nh)=cx(0:nh)
! Identify frequencies with strong signals. ! Identify frequencies with strong signals.
!###
do i=0,nh do i=0,nh
p=real(cxt(i))**2 + aimag(cxt(i))**2 p=real(cxt(i))**2 + aimag(cxt(i))**2
s(i)=p s(i)=p
enddo enddo
ave=sum(s(0:nh))/nh ave=sum(s(0:nh))/nh
lstrong(0:nh)=s(0:nh).gt.10.0*ave lstrong(0:nh)=s(0:nh).gt.10.0*ave
!###
! ntot=ntot+1
! if(mod(ntot,128).eq.5) then
! call pctile(s,nh,50,xmedian)
! slimit=faclim*xmedian
! endif
! if(ntc.lt.12000/nfft) ntc=ntc+1
! uu=1.0/ntc
! smax=0.
! do i=0,nh
! p=real(cxt(i))**2 + aimag(cxt(i))**2
! s(i)=(1.0-uu)*s(i) + uu*p
! lstrong(i)=(s(i).gt.slimit)
! if(s(i).gt.smax) smax=s(i)
! enddo
nsigs=0 nsigs=0
lprev=.false. lprev=.false.

View File

@ -321,13 +321,8 @@ void MainWindow::readSettings()
void MainWindow::dataSink(int k) void MainWindow::dataSink(int k)
{ {
static float s[NSMAX],red[NSMAX]; static float s[NSMAX],red[NSMAX];
static int n=0;
static int ihsym=0; static int ihsym=0;
static int nzap=0; static int nzap=0;
static int ntr0=0;
static int nkhz;
static int ndiskdat;
static int nadj=0;
static int nb; static int nb;
static int trmin; static int trmin;
static int npts8; static int npts8;
@ -337,10 +332,8 @@ void MainWindow::dataSink(int k)
static float slimit; static float slimit;
if(m_diskData) { if(m_diskData) {
ndiskdat=1;
jt9com_.ndiskdat=1; jt9com_.ndiskdat=1;
} else { } else {
ndiskdat=0;
jt9com_.ndiskdat=0; jt9com_.ndiskdat=0;
} }
@ -658,7 +651,6 @@ void MainWindow::on_actionOpen_triggered() //Open File
} }
on_stopButton_clicked(); on_stopButton_clicked();
m_diskData=true; m_diskData=true;
int dbDgrd=0;
*future1 = QtConcurrent::run(getfile, fname, m_TRperiod); *future1 = QtConcurrent::run(getfile, fname, m_TRperiod);
watcher1->setFuture(*future1); // call diskDat() when done watcher1->setFuture(*future1); // call diskDat() when done
} }
@ -684,8 +676,6 @@ void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next
lab1->setText(" " + fname.mid(i,len) + " "); lab1->setText(" " + fname.mid(i,len) + " ");
} }
m_diskData=true; m_diskData=true;
int dbDgrd=0;
if(m_myCall=="K1JT" and m_idInt<0) dbDgrd=m_idInt;
*future1 = QtConcurrent::run(getfile, fname, m_TRperiod); *future1 = QtConcurrent::run(getfile, fname, m_TRperiod);
watcher1->setFuture(*future1); watcher1->setFuture(*future1);
return; return;
@ -1289,7 +1279,7 @@ void MainWindow::on_addButton_clicked() //Add button
out << newEntry + "\n"; out << newEntry + "\n";
if(s.mid(0,6)=="ZZZZZZ") { if(s.mid(0,6)=="ZZZZZZ") {
out << s + "\n"; out << s + "\n";
exit; // exit; //Statement has no effect!
} }
m_call3Modified=true; m_call3Modified=true;
} else if(hc==hc2) { } else if(hc==hc2) {
@ -1327,9 +1317,7 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
char msgsent[23]; char msgsent[23];
int len1=22; int len1=22;
int jtone[1]; int jtone[1];
double samfac=1.0;
int nsendingsh=0; int nsendingsh=0;
int mwave;
t=t.toUpper(); t=t.toUpper();
int i1=t.indexOf(" OOO"); int i1=t.indexOf(" OOO");
QByteArray s=t.toUpper().toLocal8Bit(); QByteArray s=t.toUpper().toLocal8Bit();

View File

@ -124,9 +124,10 @@ void CPlotter::draw(float swide[], float red[], int i0) //draw()
m_hist1[y1]++; m_hist1[y1]++;
painter1.setPen(m_ColorTbl[y1]); painter1.setPen(m_ColorTbl[y1]);
painter1.drawPoint(i,0); painter1.drawPoint(i,0);
y2=0;
if(m_bCurrent) y2 = gain*y + 30; if(m_bCurrent) y2 = gain*y + 30;
if(m_bCumulative) y2=3*gain*10.0*log10(jt9com_.savg[i]); if(m_bCumulative) y2=3*gain*10.0*log10(jt9com_.savg[i]);
if(m_bJT9Sync) y2=7*gain*red[i] - 30; if(m_bJT9Sync) y2=0.1*gain*red[i] - 20;
if(strong != strong0 or i==m_w-1) { if(strong != strong0 or i==m_w-1) {
painter2D.drawPolyline(LineBuf,j); painter2D.drawPolyline(LineBuf,j);
j=0; j=0;
@ -153,7 +154,7 @@ void CPlotter::draw(float swide[], float red[], int i0) //draw()
void CPlotter::UTCstr() void CPlotter::UTCstr()
{ {
int ihr,imin,isec; int ihr,imin;
if(jt9com_.ndiskdat != 0) { if(jt9com_.ndiskdat != 0) {
ihr=jt9com_.nutc/100; ihr=jt9com_.nutc/100;
imin=jt9com_.nutc % 100; imin=jt9com_.nutc % 100;
@ -164,8 +165,6 @@ void CPlotter::UTCstr()
imin=imin % 60; imin=imin % 60;
imin=imin - (imin % (m_TRperiod/60)); imin=imin - (imin % (m_TRperiod/60));
} }
if(isec<30) isec=0;
if(isec>=30) isec=30;
sprintf(m_sutc,"%2.2d:%2.2d",ihr,imin); sprintf(m_sutc,"%2.2d:%2.2d",ihr,imin);
} }
@ -175,7 +174,7 @@ void CPlotter::DrawOverlay() //DrawOverlay()
if(m_WaterfallPixmap.isNull()) return; if(m_WaterfallPixmap.isNull()) return;
int w = m_WaterfallPixmap.width(); int w = m_WaterfallPixmap.width();
int x,y; int x,y;
int nHzDiv[11]={0,50,100,200,200,200,500,500,500,500,500}; // int nHzDiv[11]={0,50,100,200,200,200,500,500,500,500,500};
float pixperdiv; float pixperdiv;
QRect rect; QRect rect;
@ -311,8 +310,6 @@ void CPlotter::DrawOverlay() //DrawOverlay()
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
{ {
float freq; float freq;
int i,j;
for(int i=0; i<=m_hdivs; i++) { for(int i=0; i<=m_hdivs; i++) {
freq = m_StartFreq + i*m_freqPerDiv; freq = m_StartFreq + i*m_freqPerDiv;
m_HDivText[i].setNum((int)freq); m_HDivText[i].setNum((int)freq);
@ -430,7 +427,6 @@ void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click
{ {
// int h = (m_Size.height()-60)/2; // int h = (m_Size.height()-60)/2;
int x=event->x(); int x=event->x();
int y=event->y();
setFQSO(x,false); setFQSO(x,false);
emit freezeDecode1(2); //### ??? emit freezeDecode1(2); //### ???
} }

View File

@ -87,13 +87,8 @@ void WideGraph::dataSink2(float s[], float red[], float df3, int ihsym,
{ {
static float splot[NSMAX]; static float splot[NSMAX];
static float swide[2048]; static float swide[2048];
float smax;
// double df;
int nbpp = ui->widePlot->binsPerPixel(); int nbpp = ui->widePlot->binsPerPixel();
static int n=0; static int n=0;
static int nkhz0=-999;
// df = 12000.0/m_nsps;
//Average spectra over specified number, m_waterfallAvg //Average spectra over specified number, m_waterfallAvg
if (n==0) { if (n==0) {
@ -110,20 +105,11 @@ void WideGraph::dataSink2(float s[], float red[], float df3, int ihsym,
splot[i] /= n; //Normalize the average splot[i] /= n; //Normalize the average
n=0; n=0;
int w=ui->widePlot->plotWidth(); // int w=ui->widePlot->plotWidth();
int i0=0; //### int i0=0; //###
int i=i0; int i=i0;
int jz=1000.0/df3; int jz=1000.0/df3;
for (int j=0; j<jz; j++) { for (int j=0; j<jz; j++) {
/*
smax=0;
for (int k=0; k<nbpp; k++) {
if(splot[i]>smax) smax=splot[i];
i++;
}
swide[j]=smax;
*/
float sum=0; float sum=0;
for (int k=0; k<nbpp; k++) { for (int k=0; k<nbpp; k++) {
i++; i++;