Experimental drawing of sync state

This commit is contained in:
Jordan Sherer 2020-05-06 11:15:41 -04:00
parent fc40bf74a3
commit 4b36884abb
13 changed files with 108 additions and 61 deletions

View File

@ -197,7 +197,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nftx,newdat,params%nutc,params%nfa,params%nfb, &
params%nexp_decode,params%ndepth,logical(params%nagain), & params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
mycall,mygrid,hiscall,hisgrid) mycall,mygrid,hiscall,hisgrid,logical(params%synconly))
write(*,*) '<DecodeDebug> mode A decode finished' write(*,*) '<DecodeDebug> mode A decode finished'

View File

@ -2,11 +2,11 @@
parameter (NCOSTAS=1) !Which JS8 Costas Arrays to use (1=original, 2=three symmetrical costas) 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 (AZ=12000.0/(1.0*NSPS)*0.64d0) !Dedupe overlap in Hz
parameter (ASTART=0.5) !Start delay in seconds 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 (KK=87) !Information bits (75 + CRC12)
parameter (ND=58) !Data symbols parameter (ND=58) !Data symbols

View File

@ -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, & napwid,lsubtract,nagain,iaptype,mycall12,mygrid6,hiscall12,bcontest, &
sync0,f1,xdt,xbase,apsym,nharderrors,dmin,nbadcrc,ipass,iera,msg37,xsnr) 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*12 mycall12,hiscall12
character*6 mycall6,mygrid6,hiscall6,c1,c2 character*6 mycall6,mygrid6,hiscall6,c1,c2
character*87 cbits character*87 cbits
logical bcontest logical bcontest,synconly
real a(5) real a(5)
real s1(0:7,ND),s2(0:7,NN),s1sort(8*ND) real s1(0:7,ND),s2(0:7,NN),s1sort(8*ND)
real ps(0:7),psl(0:7) real ps(0:7),psl(0:7)
@ -224,6 +224,11 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
return return
endif endif
if(synconly) then
write(*,*) '<DecodeDebug> candidate X ', 'f', f1, 'sync', nsync, 'xdt', xdt
flush(6)
endif
j=0 j=0
do k=1,NN do k=1,NN
if(k.le.7) cycle 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) i3bit=4*decoded(73) + 2*decoded(74) + decoded(75)
if(nbadcrc.eq.0) then if(nbadcrc.eq.0) then
if(synconly) then
write(*,*) '<DecodeDebug> decode X ', 'f1', f1, 'sync', sync, 'xdt', xdt2
flush(6)
return
endif
decoded0=decoded decoded0=decoded
call extractmessage174(decoded,origmsg,ncrcflag) call extractmessage174(decoded,origmsg,ncrcflag)
decoded=decoded0 decoded=decoded0

View File

@ -25,7 +25,7 @@ contains
subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, & subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, &
nutc,nfa,nfb,nexp_decode,ndepth,nagain,lft8apon,lapcqonly,napwid, & nutc,nfa,nfb,nexp_decode,ndepth,nagain,lft8apon,lapcqonly,napwid, &
mycall12,mygrid6,hiscall12,hisgrid6) mycall12,mygrid6,hiscall12,hisgrid6,synconly)
! use wavhdr ! use wavhdr
use timer_module, only: timer use timer_module, only: timer
! type(hdr) h ! type(hdr) h
@ -38,7 +38,7 @@ contains
real candidate(3,NMAXCAND) real candidate(3,NMAXCAND)
real dd(NMAX) real dd(NMAX)
logical, intent(in) :: lft8apon,lapcqonly,nagain logical, intent(in) :: lft8apon,lapcqonly,nagain
logical newdat,lsubtract,ldupe,bcontest logical newdat,lsubtract,ldupe,bcontest,synconly
character*12 mycall12, hiscall12 character*12 mycall12, hiscall12
character*6 mygrid6,hisgrid6 character*6 mygrid6,hisgrid6
integer*2 iwave(NMAX) integer*2 iwave(NMAX)
@ -93,24 +93,31 @@ contains
lsubtract=.false. lsubtract=.false.
endif endif
if(synconly) then
if(NWRITELOG.eq.0) then
write(*,*) '<DecodeDebug> synconly'
flush(6)
endif
endif
call timer('syncjs8 ',0) call timer('syncjs8 ',0)
call syncjs8(dd,icos,ifa,ifb,syncmin,nfqso,s,candidate,ncand,sbase) call syncjs8(dd,icos,ifa,ifb,syncmin,nfqso,s,candidate,ncand,sbase)
call timer('syncjs8 ',1) call timer('syncjs8 ',1)
if(NWRITELOG.eq.1) then !if(NWRITELOG.eq.0) then
write(*,*) '<DecodeDebug>', ncand, "candidates" ! write(*,*) '<DecodeDebug>', ncand, "candidates"
flush(6) ! flush(6)
do icand=1,ncand ! do icand=1,ncand
sync=candidate(3,icand) ! sync=candidate(3,icand)
f1=candidate(1,icand) ! f1=candidate(1,icand)
xdt=candidate(2,icand) ! xdt=candidate(2,icand)
xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz ! xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz
write(*,*) '<DecodeDebug> candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase ! write(*,*) '<DecodeDebug> candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase
flush(6) ! flush(6)
enddo ! enddo
endif !endif
do icand=1,ncand do icand=1,ncand
sync=candidate(3,icand) sync=candidate(3,icand)
@ -124,7 +131,7 @@ contains
endif endif
call timer('js8dec ',0) 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, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, &
hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, &
nbadcrc,iappass,iera,msg37,xsnr) nbadcrc,iappass,iera,msg37,xsnr)

View File

@ -114,7 +114,7 @@ contains
endif endif
call timer('js8dec ',0) 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, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, &
hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, &
nbadcrc,iappass,iera,msg37,xsnr) nbadcrc,iappass,iera,msg37,xsnr)

View File

@ -114,7 +114,7 @@ contains
endif endif
call timer('js8dec ',0) 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, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, &
hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, &
nbadcrc,iappass,iera,msg37,xsnr) nbadcrc,iappass,iera,msg37,xsnr)

View File

@ -114,7 +114,7 @@ contains
endif endif
call timer('js8dec ',0) 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, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, &
hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, &
nbadcrc,iappass,iera,msg37,xsnr) nbadcrc,iappass,iera,msg37,xsnr)

View File

@ -114,7 +114,7 @@ contains
endif endif
call timer('js8dec ',0) 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, & lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, &
hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, & hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, &
nbadcrc,iappass,iera,msg37,xsnr) nbadcrc,iappass,iera,msg37,xsnr)

View File

@ -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; 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; dec_data.params.nsubmodes = 0;
while(!m_decoderQueue.isEmpty()){ while(!m_decoderQueue.isEmpty()){
@ -4872,6 +4873,54 @@ void MainWindow::processDecodedLine(QByteArray t){
bool bAvgMsg=false; bool bAvgMsg=false;
int navg=0; int navg=0;
if(t.indexOf("<DecodeDebug>") >= 0) { if(t.indexOf("<DecodeDebug>") >= 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()); if(JS8_DEBUG_DECODE) qDebug() << "--> busy?" << m_decoderBusy << "lock exists?" << ( QFile{m_config.temp_dir ().absoluteFilePath (".lock")}.exists());
return; return;
} }
@ -4882,7 +4931,6 @@ void MainWindow::processDecodedLine(QByteArray t){
} }
if(t.indexOf("<DecodeFinished>") >= 0) { if(t.indexOf("<DecodeFinished>") >= 0) {
if(m_mode=="QRA64") m_wideGraph->drawRed(0,0);
m_bDecoded = t.mid(16).trimmed().toInt() > 0; m_bDecoded = t.mid(16).trimmed().toInt() > 0;
int mswait=3*1000*m_TRperiod/4; int mswait=3*1000*m_TRperiod/4;
if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period

View File

@ -277,42 +277,22 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
painter2D.drawText(x1-4,y,"73"); 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 update(); //trigger a new paintEvent
m_bScaleOK=true; 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; int x1=XfromFreq(ia);
m_ib=ib; int x2=XfromFreq(ib);
draw(swide,false,true);
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() void CPlotter::replot()

View File

@ -90,7 +90,7 @@ public:
void setReference(bool b) {m_bReference = b;} void setReference(bool b) {m_bReference = b;}
bool Reference() const {return m_bReference;} bool Reference() const {return m_bReference;}
#endif #endif
void drawRed(int ia, int ib, float swide[]); void drawLine(const QColor &color, int ia, int ib);
void setVHF(bool bVHF); void setVHF(bool bVHF);
void setRedFile(QString fRed); void setRedFile(QString fRed);
bool scaleOK () const {return m_bScaleOK;} bool scaleOK () const {return m_bScaleOK;}

View File

@ -244,9 +244,9 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("WaterfallFPS", ui->fpsSpinBox->value()); 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 void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dataSink2

View File

@ -63,7 +63,7 @@ public:
int smoothYellow(); int smoothYellow();
void setRxBand (QString const& band); void setRxBand (QString const& band);
void setWSPRtransmitted(); void setWSPRtransmitted();
void drawRed(int ia, int ib); void drawLine(const QColor &color, int ia, int ib);
void setVHF(bool bVHF); void setVHF(bool bVHF);
void setRedFile(QString fRed); void setRedFile(QString fRed);
void setTurbo(bool turbo); void setTurbo(bool turbo);