diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 737f7c2..ab20fc6 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -197,7 +197,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nexp_decode,params%ndepth,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & - mycall,mygrid,hiscall,hisgrid) + mycall,mygrid,hiscall,hisgrid,logical(params%synconly)) write(*,*) ' mode A decode finished' diff --git a/lib/js8/js8a_params.f90 b/lib/js8/js8a_params.f90 index 806754e..44db61b 100644 --- a/lib/js8/js8a_params.f90 +++ b/lib/js8/js8a_params.f90 @@ -2,11 +2,11 @@ parameter (NCOSTAS=1) !Which JS8 Costas Arrays to use (1=original, 2=three symmetrical costas) -parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100, JZ=62) ! 50 Hz 6.250 baud 16 wpm -25.0dB (1.0Eb/N0) 12.64s +parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100, JZ=32) ! 50 Hz 6.250 baud 16 wpm -25.0dB (1.0Eb/N0) 12.64s parameter (AZ=12000.0/(1.0*NSPS)*0.64d0) !Dedupe overlap in Hz parameter (ASTART=0.5) !Start delay in seconds -parameter (ASYNCMIN=1.5) !Minimum Sync +parameter (ASYNCMIN=2) !Minimum Sync parameter (KK=87) !Information bits (75 + CRC12) parameter (ND=58) !Data symbols diff --git a/lib/js8/js8dec.f90 b/lib/js8/js8dec.f90 index d98bd70..af73b12 100644 --- a/lib/js8/js8dec.f90 +++ b/lib/js8/js8dec.f90 @@ -1,4 +1,4 @@ -subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & +subroutine js8dec(dd0,icos,newdat,synconly,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & napwid,lsubtract,nagain,iaptype,mycall12,mygrid6,hiscall12,bcontest, & sync0,f1,xdt,xbase,apsym,nharderrors,dmin,nbadcrc,ipass,iera,msg37,xsnr) @@ -14,7 +14,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly character*12 mycall12,hiscall12 character*6 mycall6,mygrid6,hiscall6,c1,c2 character*87 cbits - logical bcontest + logical bcontest,synconly real a(5) real s1(0:7,ND),s2(0:7,NN),s1sort(8*ND) real ps(0:7),psl(0:7) @@ -224,6 +224,11 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly return endif + if(synconly) then + write(*,*) ' candidate X ', 'f', f1, 'sync', nsync, 'xdt', xdt + flush(6) + endif + j=0 do k=1,NN if(k.le.7) cycle @@ -417,6 +422,13 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly i3bit=4*decoded(73) + 2*decoded(74) + decoded(75) if(nbadcrc.eq.0) then + + if(synconly) then + write(*,*) ' decode X ', 'f1', f1, 'sync', sync, 'xdt', xdt2 + flush(6) + return + endif + decoded0=decoded call extractmessage174(decoded,origmsg,ncrcflag) decoded=decoded0 diff --git a/lib/js8a_decode.f90 b/lib/js8a_decode.f90 index 5c67bcb..ce47087 100644 --- a/lib/js8a_decode.f90 +++ b/lib/js8a_decode.f90 @@ -25,7 +25,7 @@ contains subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, & nutc,nfa,nfb,nexp_decode,ndepth,nagain,lft8apon,lapcqonly,napwid, & - mycall12,mygrid6,hiscall12,hisgrid6) + mycall12,mygrid6,hiscall12,hisgrid6,synconly) ! use wavhdr use timer_module, only: timer ! type(hdr) h @@ -38,7 +38,7 @@ contains real candidate(3,NMAXCAND) real dd(NMAX) logical, intent(in) :: lft8apon,lapcqonly,nagain - logical newdat,lsubtract,ldupe,bcontest + logical newdat,lsubtract,ldupe,bcontest,synconly character*12 mycall12, hiscall12 character*6 mygrid6,hisgrid6 integer*2 iwave(NMAX) @@ -93,24 +93,31 @@ contains lsubtract=.false. endif + if(synconly) then + if(NWRITELOG.eq.0) then + write(*,*) ' synconly' + flush(6) + endif + endif + call timer('syncjs8 ',0) call syncjs8(dd,icos,ifa,ifb,syncmin,nfqso,s,candidate,ncand,sbase) call timer('syncjs8 ',1) - if(NWRITELOG.eq.1) then - write(*,*) '', ncand, "candidates" - flush(6) + !if(NWRITELOG.eq.0) then + ! write(*,*) '', ncand, "candidates" + ! flush(6) - do icand=1,ncand - sync=candidate(3,icand) - f1=candidate(1,icand) - xdt=candidate(2,icand) - xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz + ! do icand=1,ncand + ! sync=candidate(3,icand) + ! f1=candidate(1,icand) + ! xdt=candidate(2,icand) + ! xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz - write(*,*) ' candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase - flush(6) - enddo - endif + ! write(*,*) ' candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase + ! flush(6) + ! enddo + !endif do icand=1,ncand sync=candidate(3,icand) @@ -124,7 +131,7 @@ contains endif call timer('js8dec ',0) - call js8dec(dd,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + call js8dec(dd,icos,newdat,synconly,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & nbadcrc,iappass,iera,msg37,xsnr) @@ -137,7 +144,7 @@ contains write(*,*) ' candidate', icand, 'hard', hd, 'nbadcrc', nbadcrc flush(6) endif - + call timer('js8dec ',1) if(nbadcrc.eq.0) then ldupe=.false. diff --git a/lib/js8b_decode.f90 b/lib/js8b_decode.f90 index c3ea4ce..99f1392 100644 --- a/lib/js8b_decode.f90 +++ b/lib/js8b_decode.f90 @@ -114,7 +114,7 @@ contains endif call timer('js8dec ',0) - call js8dec(dd,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + call js8dec(dd,icos,newdat,.false.,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & nbadcrc,iappass,iera,msg37,xsnr) diff --git a/lib/js8c_decode.f90 b/lib/js8c_decode.f90 index af97a74..69377c6 100644 --- a/lib/js8c_decode.f90 +++ b/lib/js8c_decode.f90 @@ -114,7 +114,7 @@ contains endif call timer('js8dec ',0) - call js8dec(dd,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + call js8dec(dd,icos,newdat,.false.,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & nbadcrc,iappass,iera,msg37,xsnr) diff --git a/lib/js8e_decode.f90 b/lib/js8e_decode.f90 index 6a6674d..aa73861 100644 --- a/lib/js8e_decode.f90 +++ b/lib/js8e_decode.f90 @@ -114,7 +114,7 @@ contains endif call timer('js8dec ',0) - call js8dec(dd,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + call js8dec(dd,icos,newdat,.false.,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & nbadcrc,iappass,iera,msg37,xsnr) diff --git a/lib/js8i_decode.f90 b/lib/js8i_decode.f90 index ee161b7..d5d0788 100644 --- a/lib/js8i_decode.f90 +++ b/lib/js8i_decode.f90 @@ -114,7 +114,7 @@ contains endif call timer('js8dec ',0) - call js8dec(dd,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + call js8dec(dd,icos,newdat,.false.,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & nbadcrc,iappass,iera,msg37,xsnr) diff --git a/mainwindow.cpp b/mainwindow.cpp index 9942e08..963e6f7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4461,6 +4461,7 @@ bool MainWindow::decodeProcessQueue(qint32 *pSubmode){ if(JS8_DEBUG_DECODE) qDebug() << "--> decoder skipping at least 1 decode cycle" << "count" << count << "max" << maxDecodes; } + dec_data.params.synconly = true; dec_data.params.nsubmodes = 0; while(!m_decoderQueue.isEmpty()){ @@ -4872,6 +4873,54 @@ void MainWindow::processDecodedLine(QByteArray t){ bool bAvgMsg=false; int navg=0; if(t.indexOf("") >= 0) { + if(t.indexOf("f1") >= 0){ + auto segs = QString(t.trimmed()).split(QRegExp("[\\s\\t]+"), QString::SkipEmptyParts); + if(!segs.isEmpty()){ + auto f1 = QString(segs.at(4)); + auto f = int(f1.toFloat()); + + auto s1 = QString(segs.at(6)); + auto s = int(s1.toFloat()); + + auto xdt1 = QString(segs.at(8)); + auto xdt = int(xdt1.toFloat()); + + if(abs(xdt) <= 1.28){ + //if(s > 7 && s < 10){ + // m_wideGraph->drawLine(QColor(Qt::white), f, f + computeBandwidthForSubmode(m_nSubMode)); + //} else if (s < 15){ + // m_wideGraph->drawLine(QColor(Qt::darkMagenta), f, f + computeBandwidthForSubmode(m_nSubMode)); + //} else { + /* + int secs = DriftingDateTime::currentDateTimeUtc().secsTo(nextTransmitCycle()); + int txtime = computeFramesNeededForDecode(m_nSubMode)/RX_SAMPLE_RATE; + qDebug() << "seconds til transmit" << secs << "time offset" << xdt << "potential drift" << (secs-xdt)*1000; + setDrift((secs+xdt-txtime)*1000); + */ + auto now = QDateTime::currentDateTimeUtc(); + + int n = 0; + int nPos = m_TRperiod - (now.time().second() % m_TRperiod); + int nNeg = (now.time().second() % m_TRperiod) - m_TRperiod; + + if(abs(nNeg) < nPos){ + n = nNeg; + } else { + n = nPos; + } + + + int xdtmin = qMin(n*1000, (int)DriftingDateTime::drift()); + int xdtmax = qMax(n*1000, (int)DriftingDateTime::drift()); + setDrift(xdtmin + (xdtmax-xdtmin)/2); + + m_wideGraph->drawLine(QColor(Qt::red), f, f + computeBandwidthForSubmode(m_nSubMode)); + //} + } + } + } + + if(JS8_DEBUG_DECODE) qDebug() << "--> busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists()); return; } @@ -4882,7 +4931,6 @@ void MainWindow::processDecodedLine(QByteArray t){ } if(t.indexOf("") >= 0) { - if(m_mode=="QRA64") m_wideGraph->drawRed(0,0); m_bDecoded = t.mid(16).trimmed().toInt() > 0; int mswait=3*1000*m_TRperiod/4; if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period diff --git a/plotter.cpp b/plotter.cpp index 231b450..b2e44a7 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -277,42 +277,22 @@ 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(); - } -// m_bDecodeFinished=false; - } - update(); //trigger a new paintEvent m_bScaleOK=true; } -void CPlotter::drawRed(int ia, int ib, float swide[]) +void CPlotter::drawLine(const QColor &color, int ia, int ib) { - m_ia=ia; - m_ib=ib; - draw(swide,false,true); + int x1=XfromFreq(ia); + int x2=XfromFreq(ib); + + QPen pen0(color, 1); + + QPainter painter1(&m_WaterfallPixmap); + painter1.setPen(pen0); + painter1.drawLine(qMin(x1, x2),4,qMax(x1, x2),4); + painter1.drawLine(qMin(x1, x2),0,qMin(x1, x2),9); + painter1.drawLine(qMax(x1, x2),0,qMax(x1, x2),9); } void CPlotter::replot() diff --git a/plotter.h b/plotter.h index 54e6d74..ced70fb 100644 --- a/plotter.h +++ b/plotter.h @@ -90,7 +90,7 @@ public: void setReference(bool b) {m_bReference = b;} bool Reference() const {return m_bReference;} #endif - void drawRed(int ia, int ib, float swide[]); + void drawLine(const QColor &color, int ia, int ib); void setVHF(bool bVHF); void setRedFile(QString fRed); bool scaleOK () const {return m_bScaleOK;} diff --git a/widegraph.cpp b/widegraph.cpp index a897027..d913874 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -244,9 +244,9 @@ void WideGraph::saveSettings() //saveS m_settings->setValue ("WaterfallFPS", ui->fpsSpinBox->value()); } -void WideGraph::drawRed(int ia, int ib) +void WideGraph::drawLine(const QColor &color, int ia, int ib) { - ui->widePlot->drawRed(ia,ib,swide); + ui->widePlot->drawLine(color, ia, ib); } void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dataSink2 diff --git a/widegraph.h b/widegraph.h index 1f2eed9..29768c1 100644 --- a/widegraph.h +++ b/widegraph.h @@ -63,7 +63,7 @@ public: int smoothYellow(); void setRxBand (QString const& band); void setWSPRtransmitted(); - void drawRed(int ia, int ib); + void drawLine(const QColor &color, int ia, int ib); void setVHF(bool bVHF); void setRedFile(QString fRed); void setTurbo(bool turbo);