diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 57e5b8674..ea80eae59 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -11,6 +11,7 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) real*4 ccfred(NSMAX) integer*1 i1SoftSymbols(207) integer*2 id2 + integer ii(1) complex c0(NDMAX),c00(NDMAX) common/jt9com/ss0(184,NSMAX),savg(NSMAX),id2(NMAX),nutc0,ndiskdat, & ntr,nfqso,newdat,npts80,nfb,ntol,kin,nsynced,ndecoded @@ -86,38 +87,43 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) fgood=0. df8=1500.0/(nsps/8) sbest=0. - do i=ia,ib - f=(i-1)*df3 - if((i.eq.ipk .or. ccfred(i).ge.3.0) .and. f.gt.fgood+10.0*df8) then - call timer('spec9 ',0) - call spec9(c0,npts8,nsps,f,fpk,xdt,snr,i1SoftSymbols) - call timer('spec9 ',1) - call timer('decode9 ',0) - call decode9(i1SoftSymbols,limit,nlim,msg) - call timer('decode9 ',1) - sync=ccfred(i) - 2.0 - if(sync.lt.0.0) sync=0.0 - nsync=sync - if(nsync.gt.10) nsync=10 - nsnr=nint(snr) - drift=0.0 +10 continue + ii=maxloc(ccfred(ia:ib)) + i=ii(1) + ia - 1 + f=(i-1)*df3 - if(ccfred(i).gt.sbest .and. fgood.eq.0.0) then - sbest=ccfred(i) - write(line,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift - if(nsync.gt.0) nsynced=1 - endif + if((i.eq.ipk .or. ccfred(i).ge.3.0) .and. abs(f-fgood).gt.10.0*df8) then + call timer('spec9 ',0) + call spec9(c0,npts8,nsps,f,fpk,xdt,snr,i1SoftSymbols) + call timer('spec9 ',1) - if(msg.ne.' ') then - write(13,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg - write(14,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg - fgood=f - nsynced=1 - ndecoded=1 - endif + call timer('decode9 ',0) + call decode9(i1SoftSymbols,limit,nlim,msg) + call timer('decode9 ',1) + sync=ccfred(i) - 2.0 + if(sync.lt.0.0) sync=0.0 + nsync=sync + if(nsync.gt.10) nsync=10 + nsnr=nint(snr) + drift=0.0 + + if(ccfred(i).gt.sbest .and. fgood.eq.0.0) then + sbest=ccfred(i) + write(line,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift + if(nsync.gt.0) nsynced=1 endif - enddo + + if(msg.ne.' ') then + write(13,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg + write(14,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg + fgood=f + nsynced=1 + ndecoded=1 + endif + endif + ccfred(i-10:i+10)=0. + if(maxval(ccfred(ia:ib)).gt.3.0) go to 10 if(fgood.eq.0.0) then write(13,1020) line diff --git a/lib/jt9code.f90 b/lib/jt9code.f90 new file mode 100644 index 000000000..85c861248 --- /dev/null +++ b/lib/jt9code.f90 @@ -0,0 +1,35 @@ +program jt9code + +! Generate simulated data for testing of WSJT-X + + parameter (NMAX=1800*12000) + character msg*22,msg0*22,decoded*22 + + integer*4 i4tone(85) !Channel symbols (values 0-8) + integer*4 i4data(69) + integer*4 i4DataSymNoGray(69) !Data Symbols, values 0-7 + integer*1 i1ScrambledBits(207) !Unpacked bits, scrambled order + integer*1 i1Bits(207) !Encoded information-carrying bits + integer*1 i1SoftSymbols(207) + integer*1 i1 + equivalence (i1,i4) + include 'jt9sync.f90' + common/acom/dat(NMAX),iwave(NMAX) + + nargs=iargc() + if(nargs.ne.1) then + print*,'Usage: jt9code "message"' + go to 999 + endif + + call getarg(1,msg0) + write(*,1000) msg0 +1000 format('Message:',3x,a22) + msg=msg0 + call genjt9(msg,decoded,i4tone) !Encode message into tone #s + write(*,1002) i4tone +1002 format('Channel symbols:'/(30i2)) + write(*,1004) decoded +1004 format('Decoded message:',1x,a22) + +999 end program jt9code diff --git a/lib/packmsg.f b/lib/packmsg.f index 1a1b488d2..bc1a6424e 100644 --- a/lib/packmsg.f +++ b/lib/packmsg.f @@ -7,17 +7,23 @@ character*12 c1,c2 character*4 c3 character*6 grid6 -c character*3 dxcc !Where is DXCC implemented? logical text1,text2,text3 C Convert all letters to upper case do i=1,22 if(msg(i:i).ge.'a' .and. msg(i:i).le.'z') + msg(i:i)= char(ichar(msg(i:i))+ichar('A')-ichar('a')) + if(msg(i:i).ne.' ') iz=i + enddo + do iter=1,5 !Collapse multiple blanks into one + ib2=index(msg(1:iz),' ') + if(ib2.lt.1) go to 5 + msg=msg(1:ib2)//msg(ib2+2:) + iz=iz-1 enddo C See if it's a CQ message - if(msg(1:3).eq.'CQ ') then + 5 if(msg(1:3).eq.'CQ ') then i=3 C ... and if so, does it have a reply frequency? if(msg(4:4).ge.'0' .and. msg(4:4).le.'9' .and. diff --git a/lib/peakdt9.f90 b/lib/peakdt9.f90 index 2aabc3f95..af4c81f8b 100644 --- a/lib/peakdt9.f90 +++ b/lib/peakdt9.f90 @@ -11,7 +11,14 @@ subroutine peakdt9(c0,npts8,nsps8,istart,foffset,idtpk) f0=foffset dphi=twopi*f0/1500.0 - do idt=-idtmax,idtmax + + idtstep=4 + if(idtmax.lt.30) idtstep=2 + if(idtmax.lt.15) idtstep=1 + idt1=-idtmax + idt2=idtmax + +10 do idt=idt1,idt2,idtstep i0=istart + 0.0625*nsps8*idt sum=0. do j=1,16 @@ -32,5 +39,12 @@ subroutine peakdt9(c0,npts8,nsps8,istart,foffset,idtpk) endif enddo + if(idtstep.gt.1) then + idtstep=1 + idt1=idtpk-1 + idt2=idtpk+1 + go to 10 + endif + return end subroutine peakdt9 diff --git a/lib/redsync.f90 b/lib/redsync.f90 index 1f0216b4f..43994c880 100644 --- a/lib/redsync.f90 +++ b/lib/redsync.f90 @@ -31,6 +31,7 @@ subroutine redsync(ss,ntrperiod,ihsym,iz,red) smax=0. do i=1,iz ! red(i)=0.3*db(red(i)) + red(i)=sqrt(red(i)) smax=max(smax,red(i)) enddo h=10. diff --git a/mainwindow.cpp b/mainwindow.cpp index 885a272cd..0679c75f8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1133,16 +1133,17 @@ void MainWindow::doubleClickOnCall(QString hiscall, bool ctrl) ui->dxCallEntry->setText(hiscall); QString t = ui->decodedTextBrowser->toPlainText(); //Full contents int i2=ui->decodedTextBrowser->textCursor().position(); - int i3=t.mid(i2,99).indexOf("\n")-1; //points to last char of line - QString t1 = t.mid(0,i3); //contents up to \n on selected line + QString t1 = t.mid(0,i2); //contents up to \n on selected line int i1=t1.lastIndexOf("\n") + 1; //points to first char of line - QString t2 = t1.mid(i1,i3-i1); //selected line + QString t2 = t1.mid(i1,i2-i1); //selected line int n = 60*t2.mid(0,2).toInt() + t2.mid(2,2).toInt(); int nmod=n%(m_TRperiod/30); m_txFirst=(nmod!=0); ui->txFirstCheckBox->setChecked(m_txFirst); QString rpt=t2.mid(10,3); if(rpt.indexOf(" ")==0) rpt=rpt.mid(1,2); + if(rpt.toInt()>-1) rpt="-01"; + if(rpt.toInt()<-50) rpt="-50"; if(ctrl) { int i4=t.mid(i2,20).indexOf(" "); QString hisgrid=t.mid(i2,20).mid(i4+1,4);