diff --git a/lib/decoder.f90 b/lib/decoder.f90
index 6499ac673..3c5aad72b 100644
--- a/lib/decoder.f90
+++ b/lib/decoder.f90
@@ -200,6 +200,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
if(params%nmode.eq.66) then !NB: JT65 = 65, Q65 = 66.
! We're in Q65 mode
+ open(17,file=trim(temp_dir)//'/red.dat',status='unknown')
call timer('dec_q65 ',0)
call my_q65%decode(q65_decoded,id2,params%nutc,params%ntr, &
params%nsubmode,params%nfqso,params%ntol,params%ndepth, &
diff --git a/lib/q65_sync.f90 b/lib/q65_sync.f90
index 2d042802d..8e5481d73 100644
--- a/lib/q65_sync.f90
+++ b/lib/q65_sync.f90
@@ -151,11 +151,12 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, &
f0=nfqso + (ipk-1)*df
xdt=jpk*dtstep
imsg_best=imsg
+ ccf1=ccf(-ia:ia,jpk)
endif
enddo ! imsg
- ia=i0+ipk-64
- ib=ia+LL-1
+ i1=i0+ipk-64
+ i2=i1+LL-1
j=j0+jpk-7
n=0
do k=1,85
@@ -164,7 +165,7 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, &
cycle
endif
n=n+1
- if(j.ge.1 .and. j.le.jz) s3(-64:LL-65,n)=s1(ia:ib,j)
+ if(j.ge.1 .and. j.le.jz) s3(-64:LL-65,n)=s1(i1:i2,j)
enddo
nsubmode=0
@@ -191,7 +192,12 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, &
! irc,trim(decoded)
!3055 format(i6,i3,6f8.2,i5,2x,a)
! close(55)
- go to 900
+ base=(sum(ccf1(-ia:-ia+9)) + sum(ccf1(ia-9:ia)))/20.0
+ ccf1=ccf1-base
+ smax=maxval(ccf1)
+ if(smax.gt.10.0) ccf1=10.0*ccf1/smax
+ go to 200
+! go to 900
endif
enddo
@@ -214,31 +220,44 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, &
ijpk=maxloc(ccf)
ipk=ijpk(1)-ia-1
jpk=ijpk(2)-53-1
+
f0=nfqso + ipk*df
xdt=jpk*dtstep
sq=0.
nsq=0
- do j=lag1,lag2
- if(abs(j-jpk).gt.6) then
- sq=sq + ccf(ipk,j)**2
- nsq=nsq+1
- endif
+ do i=-ia,ia
+ do j=lag1,lag2
+ if(abs(j-jpk).gt.8 .and. abs(i-ipk).gt.ia/2) then
+ sq=sq + ccf(i,j)**2
+ nsq=nsq+1
+ endif
+ enddo
enddo
rms=sqrt(sq/nsq)
smax=ccf(ipk,jpk)
snr1=smax/rms
- call zplot_q65(ccf(-ia:ia,lag1:lag2),ia,lag1,lag2,rms,dtstep,ntol,emedelay)
+ ccf1=ccf(-ia:ia,jpk)/rms
+ if(snr1.gt.10.0) ccf1=(10.0/snr1)*ccf1
+
+200 do i=-ia,ia
+ freq=nfqso + i*df
+ write(17,1100) freq,ccf1(i)
+1100 format(2f10.3)
+ enddo
+ close(17)
+ if(ia.le.60) call zplot_q65(ccf(-ia:ia,lag1:lag2),ia,lag1,lag2, &
+ rms,dtstep,ntol,smax,emedelay)
900 return
end subroutine q65_sync
-subroutine zplot_q65(ccf,ia,lag1,lag2,rms,dtstep,ntol,emedelay)
+subroutine zplot_q65(ccf,ia,lag1,lag2,rms,dtstep,ntol,smax,emedelay)
real ccf(-ia:ia,lag1:lag2)
- character*1 line(70),mark(0:6)
- character*35 blanks
+ character*1 line(130),mark(0:6)
+ character*60 blanks
data mark/' ',' ','.','-','+','X','#'/
- data blanks/' '/
+ data blanks/' '/
! open(35,file='ccf.dat',status='unknown',access='stream')
! write(35) ia,lag1,lag2,rms,dtstep
@@ -246,14 +265,16 @@ subroutine zplot_q65(ccf,ia,lag1,lag2,rms,dtstep,ntol,emedelay)
! close(35)
open(34,file='ccf.txt',status='unknown')
write(34,1000) -ntol,blanks(1:ia-2),0,blanks(1:ia-2),ntol
-1000 format(5x,i3,a,i1,a,i3)
+1000 format(4x,i4,a,i1,a,i3)
+ fac=1.0
+ if(smax/rms.gt.7.0) fac=7.0*rms/smax
k=0
do j=lag2,lag1,-1
t=j*dtstep
if(emedelay.eq.0.0 .and. abs(t).gt.1.0) cycle
do i=-ia,ia
k=i+ia+2
- n=ccf(i,j)/rms
+ n=fac*ccf(i,j)/rms
if(n.lt.0) n=0
if(n.gt.6) n=6
line(k)=mark(n)
@@ -261,7 +282,7 @@ subroutine zplot_q65(ccf,ia,lag1,lag2,rms,dtstep,ntol,emedelay)
line(1)='|'
line(k+1)='|'
write(34,1010) t,line(1:k+1)
-1010 format(f5.2,1x,72a1)
+1010 format(f5.2,1x,132a1)
enddo
close(34)
diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 1f9ed0198..b10a25a39 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -3305,7 +3305,7 @@ void MainWindow::to_jt9(qint32 n, qint32 istart, qint32 idone)
void MainWindow::decodeDone ()
{
if(m_mode!="FT8" or dec_data.params.nzhsym==50) m_nDecodes=0;
- if(m_mode=="QRA64") m_wideGraph->drawRed(0,0);
+ if(m_mode=="QRA64" or m_mode=="Q65") m_wideGraph->drawRed(0,0);
if(m_mode=="Q65" and m_msgAvgWidget!=NULL) {
if(m_msgAvgWidget->isVisible()) {
@@ -6442,7 +6442,8 @@ void MainWindow::on_actionQ65_triggered()
//### ui->sbSubmode->setMaximum(4);
ui->sbSubmode->setMaximum(7);
ui->sbSubmode->setValue(m_nSubMode);
- m_wideGraph->setMode(m_mode);
+ QString fname {QDir::toNativeSeparators(m_config.temp_dir().absoluteFilePath ("red.dat"))};
+ m_wideGraph->setRedFile(fname);
m_wideGraph->setMode(m_mode);
m_wideGraph->setModeTx(m_modeTx);
m_wideGraph->setPeriod(m_TRperiod,6912);
diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp
index 2f774f5b6..a225581fd 100644
--- a/widgets/plotter.cpp
+++ b/widgets/plotter.cpp
@@ -224,7 +224,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
if(i==iz-1) {
painter2D.drawPolyline(LineBuf,j);
- if(m_mode=="QRA64") {
+ if(m_mode=="QRA64" or m_mode=="Q65") {
painter2D.setPen(Qt::red);
painter2D.drawPolyline(LineBuf2,ktop);
}
@@ -269,33 +269,28 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
painter2D.drawText(x1-4,y,"73");
}
- if(bRed) {
- std::ifstream f;
- f.open(m_redFile.toLatin1());
- if(f) {
- int x,y;
- float freq,sync;
- float slimit=6.0;
- QPen pen0(Qt::red,1);
- painter1.setPen(pen0);
- for(int i=0; i<99999; i++) {
- f >> 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();
+ if(bRed and m_bQ65_Sync) {
+ int k=0;
+ std::ifstream f;
+ f.open(m_redFile.toLatin1());
+ if(f) {
+ int x,y;
+ float freq,sync;
+ for(int i=0; i<99999; i++) {
+ f >> freq >> sync;
+ if(f.eof()) break;
+ x=XfromFreq(freq);
+ y=m_h2*(0.9 - 0.09*gain2d*sync) - m_plot2dZero;
+ LineBuf2[k].setX(x);
+ LineBuf2[k].setY(y);
+ k++;
}
-// m_bDecodeFinished=false;
+ f.close();
+ QPen pen0(Qt::red,2);
+ painter2D.setPen(pen0);
+ painter2D.drawPolyline(LineBuf2,k);
}
-
+ }
update(); //trigger a new paintEvent
m_bScaleOK=true;
}
diff --git a/widgets/plotter.h b/widgets/plotter.h
index ac13b5408..1aeacf811 100644
--- a/widgets/plotter.h
+++ b/widgets/plotter.h
@@ -80,6 +80,8 @@ public:
void setRxBand(QString band);
void setReference(bool b) {m_bReference = b;}
bool Reference() const {return m_bReference;}
+ void setQ65_Sync(bool b) {m_bQ65_Sync = b;}
+ bool Q65_Sync() const {return m_bQ65_Sync;}
void drawRed(int ia, int ib, float swide[]);
void setVHF(bool bVHF);
void setRedFile(QString fRed);
@@ -113,6 +115,7 @@ private:
bool m_bLinearAvg;
bool m_bReference;
bool m_bReference0;
+ bool m_bQ65_Sync;
bool m_bVHF;
bool m_bSingleDecode;
diff --git a/widgets/widegraph.cpp b/widgets/widegraph.cpp
index a369f6296..75064f776 100644
--- a/widgets/widegraph.cpp
+++ b/widgets/widegraph.cpp
@@ -75,10 +75,12 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui->widePlot->setCumulative(m_settings->value("Cumulative",true).toBool());
ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool());
ui->widePlot->setReference(m_settings->value("Reference",false).toBool());
+ ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool());
if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0);
if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1);
if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2);
if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3);
+ if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4);
int nbpp=m_settings->value("BinsPerPixel",2).toInt();
ui->widePlot->setBinsPerPixel(nbpp);
ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
@@ -135,6 +137,7 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("Cumulative", ui->widePlot->cumulative());
m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg());
m_settings->setValue ("Reference", ui->widePlot->Reference());
+ m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync());
m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ());
m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
@@ -321,6 +324,7 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
ui->widePlot->setCumulative(false);
ui->widePlot->setLinearAvg(false);
ui->widePlot->setReference(false);
+ ui->widePlot->setQ65_Sync(false);
ui->smoSpinBox->setEnabled(false);
switch (index)
{
@@ -337,6 +341,9 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
case 3: // Reference
ui->widePlot->setReference(true);
break;
+ case 4:
+ ui->widePlot->setQ65_Sync(true);
+ break;
}
replot();
}
@@ -480,7 +487,7 @@ void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
ui->widePlot->setPlot2dGain(value);
if(ui->widePlot->scaleOK ()) {
ui->widePlot->draw(swide,false,false);
- if(m_mode=="QRA64") ui->widePlot->draw(swide,false,true);
+ if(m_mode=="QRA64" or m_mode=="Q65") ui->widePlot->draw(swide,false,true);
}
}
@@ -489,7 +496,7 @@ void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2
ui->widePlot->setPlot2dZero(value);
if(ui->widePlot->scaleOK ()) {
ui->widePlot->draw(swide,false,false);
- if(m_mode=="QRA64") ui->widePlot->draw(swide,false,true);
+ if(m_mode=="QRA64" or m_mode=="Q65") ui->widePlot->draw(swide,false,true);
}
}
diff --git a/widgets/widegraph.ui b/widgets/widegraph.ui
index b0165e040..d78757444 100644
--- a/widgets/widegraph.ui
+++ b/widgets/widegraph.ui
@@ -335,6 +335,11 @@
Reference
+ -
+
+ Q65_Sync
+
+
-