diff --git a/lib/decoder.f90 b/lib/decoder.f90 index b5e83701f..cb3f9fc35 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -88,7 +88,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) if(params%nmode.eq.4 .or. params%nmode.eq.65) open(14,file=trim(temp_dir)// & '/avemsg.txt',status='unknown') if(params%nmode.eq.164) open(17,file=trim(temp_dir)//'/red.dat', & - access='stream',status='unknown') + status='unknown') if(params%nmode.eq.4) then jz=52*nfsample diff --git a/lib/sync64.f90 b/lib/sync64.f90 index 806af8bc8..d927af9c9 100644 --- a/lib/sync64.f90 +++ b/lib/sync64.f90 @@ -117,8 +117,8 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & enddo s0a=s0a+2.0 - write(17) ia,ib,s0a(ia:ib) !Save data for red curve - close(17) +! write(17) ia,ib,s0a(ia:ib) !Save data for red curve +! close(17) nskip=50 call lorentzian(s0a(ia+nskip:ib-nskip),iz-2*nskip,a) @@ -137,18 +137,29 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & rms2=sqrt(sq/40.0) sync2=10.0*log10(a(2)/rms2) -! do i=1,iz-2*nskip -! x=i -! z=(x-a(3))/(0.5*a(4)) -! yfit=a(1) -! if(abs(z).lt.3.0) then -! d=1.0 + z*z -! yfit=a(1) + a(2)*(1.0/d - 0.1) -! endif -! j=i+ia+49 -! write(76,1110) j*df3,s0a(j),yfit -!1110 format(3f10.3) -! enddo + slimit=6.0 + rewind 17 + write(17,1110) 0.0,0.0 + rewind 17 +! rewind 76 + do i=2,iz-2*nskip-1,3 + x=i + z=(x-a(3))/(0.5*a(4)) + yfit=a(1) + if(abs(z).lt.3.0) then + d=1.0 + z*z + yfit=a(1) + a(2)*(1.0/d - 0.1) + endif + j=i+ia+49 + freq=j*df3 + ss=(s0a(j-1)+s0a(j)+s0a(j+1))/3.0 + if(ss.gt.slimit) write(17,1110) freq,ss +1110 format(3f10.3) +! write(76,1110) freq,ss,yfit + enddo + flush(17) + close(17) +! flush(76) return end subroutine sync64 diff --git a/mainwindow.cpp b/mainwindow.cpp index 0b75ba90f..96830556d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2554,6 +2554,8 @@ void MainWindow::readFromStdout() //readFromStdout bool bAvgMsg=false; int navg=0; if(t.indexOf("") >= 0) { + if(m_mode=="QRA64") m_wideGraph->drawRed(0,0); + /* if(m_mode=="QRA64") { char name[512]; QString fname=m_config.temp_dir ().absoluteFilePath ("red.dat"); @@ -2570,6 +2572,7 @@ void MainWindow::readFromStdout() //readFromStdout } } + */ m_bDecoded = t.mid (20).trimmed ().toInt () > 0; if(!m_diskData) killFileTimer.start (3*1000*m_TRperiod/4); //Kill in 45 s decodeDone (); @@ -4401,7 +4404,8 @@ void MainWindow::on_actionQRA64_triggered() ui->sbSubmode->setValue(m_nSubMode); ui->actionInclude_averaging->setEnabled(false); ui->actionInclude_correlation->setEnabled(false); - + QString fname {QDir::toNativeSeparators(m_config.temp_dir ().absoluteFilePath ("red.dat"))}; + m_wideGraph->setRedFile(fname); QFile f(m_appDir + "/old_qra_sync"); if(f.exists() and !m_bQRAsyncWarned) { MessageBox::warning_message (this, tr ("*** WARNING *** "), diff --git a/plotter.cpp b/plotter.cpp index b25478ce4..b8cbce5cf 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -3,6 +3,8 @@ #include #include "commons.h" #include "moc_plotter.cpp" +#include +#include #define MAX_SCREENSIZE 2048 @@ -131,39 +133,6 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed) m_fMax=FreqfromX(iz); m_line++; - if(m_mode=="QRA64" and bRed) { - double df_qra64=4000.0/(7*2304); - int j0,j1; - int k=0; - float smax,y3max=0; - float y3[MAX_SCREENSIZE]; - for(int i=1; ismax) smax=dec_data.sred[jj]; - } - y3[i]=smax; - if(smax>y3max)y3max=smax; - } - float fac=0.8/qMax(y3max,10.0f); - for(int i=1; i=m_ia*df_qra64 and FreqfromX(i)> freq >> sync; + if(f.eof()) break; + x=XfromFreq(freq); + y=(sync-slimit)*3.0; + if(y>0) { + if(y>15.0) y=15.0; + if(x>=0 and x<=m_w) { + painter1.setPen(pen0); + painter1.drawLine(x,0,x,y); + } + } + } + f.close(); + } +// m_bDecodeFinished=false; + } + update(); //trigger a new paintEvent m_bScaleOK=true; } @@ -732,3 +729,8 @@ void CPlotter::setVHF(bool bVHF) { m_bVHF=bVHF; } + +void CPlotter::setRedFile(QString fRed) +{ + m_redFile=fRed; +} diff --git a/plotter.h b/plotter.h index 678106ddb..ecf829f9f 100644 --- a/plotter.h +++ b/plotter.h @@ -84,6 +84,7 @@ public: bool Reference() const {return m_bReference;} void drawRed(int ia, int ib, float swide[]); void setVHF(bool bVHF); + void setRedFile(QString fRed); signals: void freezeDecode1(int n); @@ -133,6 +134,7 @@ private: QString m_mode; QString m_modeTx; QString m_rxBand; + QString m_redFile; bool m_Running; bool m_paintEventBusy; diff --git a/widegraph.cpp b/widegraph.cpp index 513cb856f..b19ad3cb7 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -551,3 +551,8 @@ void WideGraph::on_sbPercent2dPlot_valueChanged(int n) m_Percent2DScreen=n; ui->widePlot->SetPercent2DScreen(n); } + +void WideGraph::setRedFile(QString fRed) +{ + ui->widePlot->setRedFile(fRed); +} diff --git a/widegraph.h b/widegraph.h index 3e15d14b9..ca7fb9cf8 100644 --- a/widegraph.h +++ b/widegraph.h @@ -48,6 +48,7 @@ public: void setWSPRtransmitted(); void drawRed(int ia, int ib); void setVHF(bool bVHF); + void setRedFile(QString fRed); signals: void freezeDecode2(int n);