From d8e98505831c519aeeb21240c1be412f0ac96981 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 29 Apr 2021 17:05:11 -0400 Subject: [PATCH] MAP65 code cleanup. More still needed! --- map65/libm65/decode0.f90 | 8 +++--- map65/libm65/m65.f90 | 8 +++--- map65/libm65/q65b.f90 | 47 +++++++++++++++------------------- map65/libm65/wideband_sync.f90 | 6 +++-- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/map65/libm65/decode0.f90 b/map65/libm65/decode0.f90 index ace3aa00d..c5ee92522 100644 --- a/map65/libm65/decode0.f90 +++ b/map65/libm65/decode0.f90 @@ -19,9 +19,11 @@ subroutine decode0(dd,ss,savg,nstandalone) call timer('decode0 ',0) - call timer('wb_sync ',0) - call wb_sync(ss,savg) - call timer('wb_sync ',1) + if(nxpol.eq.1) then + call timer('wb_sync ',0) + call wb_sync(ss,savg) + call timer('wb_sync ',1) + endif if(newdat.ne.0) then nz=52*96000 diff --git a/map65/libm65/m65.f90 b/map65/libm65/m65.f90 index abef79df9..69ee27d19 100644 --- a/map65/libm65/m65.f90 +++ b/map65/libm65/m65.f90 @@ -3,11 +3,11 @@ program m65 ! Decoder for map65. Can run stand-alone, reading data from *.tf2 files; ! or as the back end of map65, with data placed in a shared memory region. + use wideband_sync use timer_module, only: timer use timer_impl, only: init_timer, fini_timer parameter (NSMAX=60*96000) - parameter (NFFT=32768) parameter (NREAD=2048) integer*2 i2(NREAD) real*8 hsym @@ -77,13 +77,15 @@ program m65 ntol=100 nkeep=10 !??? mousefqso=140 !For IK4WLV in 210220_1814.tf2 - mousedf=79 + mousedf=0 nfcal=0 + nkhz_center=125 if(nxpol.eq.0) then nfa=55 !For KA1GT files nfb=143 - mousefqso=70 !W2HRO signal + mousefqso=69 !W2HRO signal + nkhz_center=100 endif call ftninit('.') diff --git a/map65/libm65/q65b.f90 b/map65/libm65/q65b.f90 index cac729bec..0aa4b39f5 100644 --- a/map65/libm65/q65b.f90 +++ b/map65/libm65/q65b.f90 @@ -19,8 +19,6 @@ subroutine q65b(nutc,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & character*6 hisgrid character*4 grid4 character*80 line - character*37 msg1 - character*3 cq1 character*80 wsjtx_dir common/cacb/ca,cb save @@ -70,17 +68,20 @@ subroutine q65b(nutc,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & ! 96000 5376000 0.017857143 336000 6000.000 ! 95238 5120000 0.018601172 322560 5999.994 + ipol=1 + if(xpol) then ! Get best ipol by referring to the "orange sync curve". - ff=ikhz+0.001*(mousedf+1270.459) !supposed freq of sync tone - ifreq=nint(1000.0*(ff-77.0)*32768.0/96000.0) !Freq index into ss(4,322,32768) - dff=96000.0/32768.0 - ia=nint(ifreq-ntol/dff) - ib=nint(ifreq+ntol/dff) - ipk1=maxloc(sync_dat(ia:ib,2)) - ipk=ia+ipk1(1)-1 - ipol=nint(sync_dat(ipk,4)) - - nsnr1=-99 + nkhz_center=nint(1000.0*(fcenter-int(fcenter))) + ff=ikhz+0.001*(mousedf+1270.459) !supposed freq of sync tone + ifreq=nint(1000.0*(ff-nkhz_center+48)*32768.0/96000.0) !Freq index into ss(4,322,32768) + dff=96000.0/32768.0 + ia=nint(ifreq-ntol/dff) + ib=nint(ifreq+ntol/dff) + ipk1=maxloc(sync_dat(ia:ib,2)) + ipk=ia+ipk1(1)-1 + ipol=nint(sync_dat(ipk,4)) + endif + if(ipol.eq.1) cz(0:MAXFFT2-1)=cx if(ipol.eq.2) cz(0:MAXFFT2-1)=0.707*(cx+cy) if(ipol.eq.3) cz(0:MAXFFT2-1)=cy @@ -106,21 +107,14 @@ subroutine q65b(nutc,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & call map65_mmdec(nutc,iwave,nsubmode,nfa,nfb,nfqso,ntol,newdat,nagain, & mycall,hiscall,hisgrid) call timer('mmdec ',1) - if(nsnr0.gt.nsnr1) then - nsnr1=nsnr0 - xdt1=xdt0 - nfreq1=nfreq0 - msg1=msg0 - cq1=cq0 - ipol1=45*(ipol-1) - endif - nfreq=nfreq1+mousedf-1000 - write(line,1020) ikhz,nfreq,ipol1,nutc,xdt1,nsnr1,msg1(1:27),cq1 -1020 format('!',i3.3,i5,i4,i6.4,f5.1,i5,' : ',a27,a3) - write(*,1100) trim(line) -1100 format(a) + nfreq=nfreq0+mousedf-1000 freq0=144.0 + 0.001*ikhz + if(nsnr0.gt.-99) then + write(line,1020) ikhz,nfreq,45*(ipol-1),nutc,xdt0,nsnr0,msg0(1:27),cq0 +1020 format('!',i3.3,i5,i4,i6.4,f5.1,i5,' : ',a27,a3) + write(*,1100) trim(line) +1100 format(a) ! Should write to lu 26 here, for Messages and Band Map windows ? ! write(26,1014) freq0,nfreq0,0,0,0,xdt0,ipol0,0, & @@ -128,8 +122,9 @@ subroutine q65b(nutc,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & !1014 format(f8.3,i5,3i3,f5.1,i4,i3,i4,i5.4,4x,a22,2x,a1,3x,':',a1) ! Write to file map65_rx.log: - write(21,1110) freq0,nfreq,xdt1,ipol1,nsnr1,nutc,msg1(1:28),cq1 + write(21,1110) freq0,nfreq,xdt0,45*(ipol-1),nsnr0,nutc,msg0(1:28),cq0 1110 format(f8.3,i5,f5.1,2i4,i5.4,2x,a28,': A',2x,a3) + endif 900 close(13) close(14) diff --git a/map65/libm65/wideband_sync.f90 b/map65/libm65/wideband_sync.f90 index 6627ef1da..b68558178 100644 --- a/map65/libm65/wideband_sync.f90 +++ b/map65/libm65/wideband_sync.f90 @@ -2,6 +2,7 @@ module wideband_sync parameter (NFFT=32768) integer isync(22) + integer nkhz_center real sync_dat(NFFT,4) !fkhz, ccfmax, xdt, ipol contains @@ -54,13 +55,14 @@ subroutine wb_sync(ss,savg) enddo !ipol fkhz=0.001*i*df + 125.0 - 48.0 + if(nkhz_center.eq.100) fkhz=fkhz-35.0 !### Why 35 ??? ### xdt=lagbest*tstep-1.0 sync_dat(i,1)=fkhz sync_dat(i,2)=ccfmax sync_dat(i,3)=xdt sync_dat(i,4)=ipolbest -! write(14,3010) i,sync_dat(i,1:3),nint(sync_dat(i,4)) -!3010 format(i6,3f10.3,i5) + write(14,3010) i,sync_dat(i,1:3),nint(sync_dat(i,4)) +3010 format(i6,3f10.3,i5) enddo