diff --git a/lib/decoder.f90 b/lib/decoder.f90 index ebcba23fa..f5f228c89 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -9,6 +9,7 @@ subroutine decoder(ntrSeconds,nRxLog,c0) parameter (NDMAX=1800*1500) !Sample intervals at 1500 Hz rate parameter (NSMAX=22000) !Max length of saved spectra character*22 msg + character*33 line real*4 ccfred(NSMAX) integer*1 i1SoftSymbols(207) integer*2 id2 @@ -46,19 +47,10 @@ subroutine decoder(ntrSeconds,nRxLog,c0) tstep=kstep/12000.0 ! Get sync, approx freq - call sync9(ss,tstep,df3,ntol,nfqso,sync,snr,fpk0,ccfred) - call spec9(c0,npts8,nsps,fpk0,fpk,xdt,i1SoftSymbols) - call decode9(i1SoftSymbols,msg) + call sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) - nsync=sync - nsnr=nint(snr) - width=0.0 open(13,file='decoded.txt',status='unknown') rewind 13 - write(13,1010) nutc,nsync,nsnr,xdt,1000.0+fpk,width,msg -1010 format(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22) - call flush(13) - close(13) if(first) then open(14,file='wsjtx_rx.log',status='unknown',position='append') first=.false. @@ -67,8 +59,48 @@ subroutine decoder(ntrSeconds,nRxLog,c0) if(iand(nRxLog,1).ne.0) then ! Write date and time to lu 14 endif - write(14,1010) nutc,nsync,nsnr,xdt,1000.0+fpk,width,msg + + fgood=0. + df8=1500.0/(nsps/8) + sbest=0. + do i=ia,ib + f=(i-1)*df3 + if((i.eq.ipk .or. ccfred(i).ge.10.0) .and. f.gt.fgood+10.0*df8) then + call spec9(c0,npts8,nsps,f,fpk,xdt,i1SoftSymbols) + call decode9(i1SoftSymbols,msg) + call pctile(ccfred(ia),ib-ia+1,50,xmed) + + snr=10.0*log10(ccfred(i)/xmed) - 10.0*log10(2500.0/df3) + 2.0 + sync=ccfred(i)/xmed - 2.0 + if(sync.lt.0.0) sync=0.0 + nsync=sync + if(nsync.gt.10) nsync=10 + nsnr=nint(snr) + width=0.0 + + if(ccfred(i).gt.sbest .and. fgood.eq.0.0) then + sbest=ccfred(i) + write(line,1010) nutc,nsync,nsnr,xdt,1000.0+fpk,width + endif + + if(msg.ne.' ') then + write(13,1010) nutc,nsync,nsnr,xdt,1000.0+fpk,width,msg +1010 format(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22) + write(14,1010) nutc,nsync,nsnr,xdt,1000.0+fpk,width,msg + fgood=f + endif + endif + enddo + + if(fgood.eq.0.0) then + write(13,1020) line + write(14,1020) line +1020 format(a33) + endif + + call flush(13) call flush(14) + close(13) return end subroutine decoder diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 37729dd97..c9c1596a2 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -135,13 +135,15 @@ subroutine symspec(k,ntrperiod,nsps,nb,nbslider,pxdb,s,red, & 999 continue -! call pctile(s,iz,50,xmed0) - ave0=sum(s(1:iz))/iz - fac0=1.0/max(ave0,0.006) + call pctile(s,iz,50,xmed0) + fac0=1.0/max(xmed0,0.006) +! ave0=sum(s(1:iz))/iz +! fac0=1.0/max(ave0,0.006) s(1:iz)=fac0*s(1:iz) -! call pctile(ssum,iz,50,xmed1) - ave1=sum(ssum(1:iz))/iz - fac1=1.0/max(ave1,0.006*ihsym) + call pctile(ssum,iz,50,xmed1) + fac1=1.0/max(xmed1,0.006*ihsym) +! ave1=sum(ssum(1:iz))/iz +! fac1=1.0/max(ave1,0.006*ihsym) savg(1:iz)=fac1*ssum(1:iz) call redsync(ss,ntrperiod,ihsym,iz,red) diff --git a/lib/sync9.f90 b/lib/sync9.f90 index edc1d6eb0..f3eedb715 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -1,4 +1,4 @@ -subroutine sync9(ss,tstep,df3,ntol,nfqso,sync,snr,fpk,ccfred) +subroutine sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest) parameter (NSMAX=22000) !Max length of saved spectra real ss(184,NSMAX) @@ -27,7 +27,8 @@ subroutine sync9(ss,tstep,df3,ntol,nfqso,sync,snr,fpk,ccfred) sum=0. do j=1,16 k=ii2(j) + lag - if(k.ge.1) sum=sum + ss(k,i) +! if(k.ge.1) sum=sum + ss(k,i) + if(k.ge.1) sum=sum + ss(k,i) - 0.5*(ss(k+2,i)+ss(k+4,i)) enddo if(sum.gt.smax) then smax=sum @@ -43,27 +44,5 @@ subroutine sync9(ss,tstep,df3,ntol,nfqso,sync,snr,fpk,ccfred) endif enddo - sum=0. - nsum=0 - do i=ia,ib - if(abs(i-ipkbest).ge.4) then - sum=sum+ccfred(i) - nsum=nsum+1 - endif - enddo - ave=sum/nsum - snr=10.0*log10(sbest/ave) - 10.0*log10(2500.0/df3) + 2.0 - sync=sbest/ave - 1.0 - if(sync.lt.0.0) sync=0.0 - if(sync.gt.10.0) sync=10.0 - fpk=(ipkbest-1)*df3 - -! rewind 71 -! do j=1,184 -! write(71,3001) j,ss(j,ipkbest) -!3001 format(i5,f12.6) -! enddo -! call flush(71) - return end subroutine sync9 diff --git a/mainwindow.cpp b/mainwindow.cpp index 231302636..08a10b7da 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//--------------------------------------------------------------- MainWindow +//---------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h" diff --git a/plotter.cpp b/plotter.cpp index 279defafa..5fda181be 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -323,10 +323,10 @@ void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs int CPlotter::XfromFreq(float f) //XfromFreq() { - float w = m_WaterfallPixmap.width(); - int x = (int) w * (f - m_StartFreq)/m_fSpan; +// float w = m_WaterfallPixmap.width(); + int x = (int) m_w * (f - m_StartFreq)/m_fSpan; if(x<0 ) return 0; - if(x>(int)w) return m_WaterfallPixmap.width(); + if(x>m_w) return m_w; return x; } @@ -397,7 +397,7 @@ int CPlotter::binsPerPixel() // get nbpp void CPlotter::setFQSO(int x, bool bf) //setFQSO() { if(bf) { - m_fQSO=x; // x is freq in kHz + m_fQSO=x; // x is freq in Hz m_xClick=XfromFreq(m_fQSO); } else { if(x<0) x=0; // x is pixel number diff --git a/plotter.h b/plotter.h index dc1e2d1a4..0e05145ae 100644 --- a/plotter.h +++ b/plotter.h @@ -38,6 +38,7 @@ public: qint32 m_DF; qint32 m_tol; qint32 m_fCal; + qint32 m_w; void draw(float sw[], float red[], int i0); //Update the waterfall void SetRunningState(bool running); @@ -112,7 +113,6 @@ private: qint32 m_freqPerDiv; qint32 m_nsps; qint32 m_Percent2DScreen; - qint32 m_w; qint32 m_h; qint32 m_h1; qint32 m_h2; diff --git a/widegraph.cpp b/widegraph.cpp index 6e0a19226..ba9161151 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -32,6 +32,7 @@ WideGraph::WideGraph(QWidget *parent) : ui->gainSpinBox->setValue(ui->widePlot->getPlotGain()); int n = settings.value("FreqSpan",1).toInt(); int w = settings.value("PlotWidth",1000).toInt(); + ui->widePlot->m_w=w; ui->freqSpanSpinBox->setValue(n); ui->widePlot->setNSpan(n); // int nbpp = n * 32768.0/(w*96.0) + 0.5; @@ -48,10 +49,11 @@ WideGraph::WideGraph(QWidget *parent) : ui->rbJT9Sync->setChecked(ui->widePlot->m_bJT9Sync); int nbpp=settings.value("BinsPerPixel",1).toInt(); ui->widePlot->setBinsPerPixel(nbpp); + m_qsoFreq=settings.value("QSOfreq",1010).toInt(); + ui->widePlot->setFQSO(m_qsoFreq,true); settings.endGroup(); } - WideGraph::~WideGraph() { saveSettings(); @@ -76,6 +78,7 @@ void WideGraph::saveSettings() settings.setValue("Cumulative",ui->widePlot->m_bCumulative); settings.setValue("JT9Sync",ui->widePlot->m_bJT9Sync); settings.setValue("BinsPerPixel",ui->widePlot->binsPerPixel()); + settings.setValue("QSOfreq",ui->widePlot->fQSO()); settings.endGroup(); } diff --git a/wsjtx.iss b/wsjtx.iss index 9b5fd3e94..933a72e2a 100644 --- a/wsjtx.iss +++ b/wsjtx.iss @@ -1,6 +1,6 @@ [Setup] AppName=wsjtx -AppVerName=wsjtx Version 0.1 r2692 +AppVerName=wsjtx Version 0.1 r2695 AppCopyright=Copyright (C) 2001-2012 by Joe Taylor, K1JT DefaultDirName=c:\wsjtx DefaultGroupName=wsjtx