From 4596ba05a0c10e348fdc8767ea7e0a3827517ae8 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 15 Mar 2021 17:00:56 -0400 Subject: [PATCH] Fix a problem with plotting the Q65 sync curves for Q65-120x and Q65-300x. --- lib/decoder.f90 | 3 --- lib/qra/q65/q65.f90 | 2 +- widgets/plotter.cpp | 28 ++++++++++++++-------------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 6422cfd96..d1a530092 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -269,8 +269,6 @@ 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', & - status='unknown') if(params%nmode.eq.4) then jz=52*nfsample @@ -289,7 +287,6 @@ subroutine multimode_decoder(ss,id2,params,nfsample) endif npts65=52*12000 - if(params%nmode.eq.164) npts65=54*12000 if(baddata(id2,npts65)) then nsynced=0 ndecoded=0 diff --git a/lib/qra/q65/q65.f90 b/lib/qra/q65/q65.f90 index d7d3c56bb..c39b41768 100644 --- a/lib/qra/q65/q65.f90 +++ b/lib/qra/q65/q65.f90 @@ -580,7 +580,7 @@ subroutine q65_write_red(iz,xdt,ccf2_avg,ccf2) call q65_sync_curve(ccf2,1,iz,rms2) rewind 17 - write(17,1000) xdt + write(17,1000) xdt,minval(ccf2_avg),maxval(ccf2_avg) do i=max(1,nint(nfa/df)),nint(nfb/df) freq=i*df y1=ccf2_avg(i) diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index f24e1249d..557196ca9 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -12,7 +12,7 @@ #include #include -#define MAX_SCREENSIZE 2048 +#define MAX_SCREENSIZE 8192 extern "C" { void flat4_(float swide[], int* iz, int* nflatten); @@ -281,14 +281,14 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed) f.open(m_redFile.toLatin1()); if(f) { int x,y; - float freq,xdt,sync,sync2; - f >> xdt; + float freq,xdt,smin,smax,sync,sync2; + f >> xdt >> smin >> smax; if(f) { for(int i=0; i<99999; i++) { f >> freq >> sync >> sync2; - if(!f or f.eof()) break; + if(!f or f.eof() or k>=MAX_SCREENSIZE or k2>=MAX_SCREENSIZE) break; x=XfromFreq(freq); - if(sync > -99.0 and sync != 0.0) { + if(sync > -99.0 and (smin!=0.0 or smax != 0.0)) { y=m_h2*(0.9 - 0.09*gain2d*sync) - m_plot2dZero - 10; LineBuf2[k2].setX(x); //Red sync curve LineBuf2[k2].setY(y); @@ -303,18 +303,18 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed) f.close(); QPen pen0(Qt::red,2); painter2D.setPen(pen0); - painter2D.drawPolyline(LineBuf2,k2); + if(smin!=0.0 or smax != 0.0) { + painter2D.drawPolyline(LineBuf2,k2); + } pen0.setColor("orange"); painter2D.setPen(pen0); painter2D.drawPolyline(LineBuf3,k); - if(m_bQ65_Sync) { - QString t; - t = t.asprintf("DT = %6.2f",xdt); - painter2D.setPen(Qt::white); - Font.setWeight(QFont::Bold); - painter2D.setFont(Font); - painter2D.drawText(m_w-100,m_h2/2,t); - } + QString t; + t = t.asprintf("DT = %6.2f",xdt); + painter2D.setPen(Qt::white); + Font.setWeight(QFont::Bold); + painter2D.setFont(Font); + painter2D.drawText(m_w-100,m_h2/2,t); } } update(); //trigger a new paintEvent