Code cleanup...

This commit is contained in:
Joe Taylor 2022-12-13 15:27:33 -05:00
parent 8507f6ff46
commit 388f61b45c
3 changed files with 12 additions and 104 deletions

View File

@ -1,6 +1,6 @@
subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
mycall0,hiscall0,hisgrid,mode_q65,f0,fqso,newdat,nagain, &
max_drift,ndop00,idec)
max_drift,ndop00)
! This routine provides an interface between MAP65 and the Q65 decoder
! in WSJT-X. All arguments are input data obtained from the MAP65 GUI.
@ -25,21 +25,16 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
character*12 mycall,hiscall
character*6 hisgrid
character*4 grid4
character*28 msg00
character*80 line
character*1 cmode*2
character*60 result
common/decodes/ndecodes,ncand,result(50)
common/cacb/ca
data nutc00/-1/,msg00/' '/
save
if(newdat.eq.1) nutc00=-1
if(mycall0(1:1).ne.' ') mycall=mycall0
if(hiscall0(1:1).ne.' ') hiscall=hiscall0
if(hisgrid(1:4).ne.' ') grid4=hisgrid(1:4)
! Find best frequency and ipol from sync_dat, the "orange sync curve".
! Find best frequency from sync_dat, the "orange sync curve".
df3=96000.0/32768.0
ifreq=nint((1000.0*f0)/df3)
ia=nint(ifreq-ntol/df3)
@ -47,7 +42,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
ipk1=maxloc(sync(ia:ib)%ccfmax)
ipk=ia+ipk1(1)-1
snr1=sync(ipk)%ccfmax
ipol=1
nfft1=MAXFFT1
nfft2=MAXFFT2
@ -81,7 +75,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
! 96000 5376000 0.017857143 336000 6000.000
! 95238 5120000 0.018601172 322560 5999.994
poldeg=0.
cz(0:MAXFFT2-1)=cx
cz(MAXFFT2)=0.
@ -123,47 +116,22 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
if(nsnr0.gt.-99) then
nq65df=nint(1000*(0.001*k0*df+nkhz_center-48.0+1.000-1.27046-ikhz))-nfcal
nq65df=nq65df + nfreq0 - 1000
npol=nint(poldeg)
ikhz1=ikhz
ndf=nq65df
if(ndf.gt.500) ikhz1=ikhz + (nq65df+500)/1000
if(ndf.lt.-500) ikhz1=ikhz + (nq65df-500)/1000
ndf=nq65df - 1000*(ikhz1-ikhz)
if(nqd.eq.1 .and. abs(nq65df-mousedf).lt.ntol) then
write(line,1020) ikhz1,ndf,npol,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)
endif
! Write to lu 26, for Messages and Band Map windows
cmode=': '
cmode(2:2)=char(ichar('A') + mode_q65-1)
freq1=freq0 + 0.001d0*(ikhz1-ikhz)
! Suppress writing duplicates (same time, decoded message, and frequency)
! to map65_rx.log
if(nutc.ne.nutc00 .or. msg0(1:28).ne.msg00 .or. freq1.ne.freq1_00) then
! Write to file map65_rx.log:
ndecodes=ndecodes+1
nutc00=nutc
msg00=msg0(1:28)
freq1_00=freq1
frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal
fsked=frx - 0.001*ndop00/2.0 - 1.5
write(result(ndecodes),1120) nutc,fsked,xdt0,nsnr0,trim(msg0)
write(12,1120) nutc,fsked,xdt0,nsnr0,trim(msg0)
1120 format(i4.4,f9.3,f7.2,i5,2x,a,i6)
result(ndecodes)=trim(result(ndecodes))//char(0)
endif
ndecodes=ndecodes+1
frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal
fsked=frx - 0.001*ndop00/2.0 - 1.5
write(result(ndecodes),1120) nutc,fsked,xdt0,nsnr0,trim(msg0)
write(12,1120) nutc,fsked,xdt0,nsnr0,trim(msg0)
1120 format(i4.4,f9.3,f7.2,i5,2x,a,i6)
result(ndecodes)=trim(result(ndecodes))//char(0)
endif
900 continue
! close(13)
! close(17)
call flush(6)
idec=-1
read(cq0(2:2),*) idec
900 call flush(6)
return
end subroutine q65b

View File

@ -64,7 +64,7 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
call timer('q65b ',0)
call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
mycall,hiscall,hisgrid,mode_q65,f0,fqso,newdat, &
nagain,max_drift,ndop00,idec)
nagain,max_drift,ndop00)
call timer('q65b ',1)
if(idec.ge.0) candec(icand)=.true.
enddo ! icand

View File

@ -1,60 +0,0 @@
subroutine s3avg(nsave,mode65,nutc,nhz,xdt,npol,ntol,s3,nsum,nkv,decoded)
! Save the current synchronized spectra, s3(64,63), for possible
! decoding of average.
real s3(64,63) !Synchronized spectra for 63 symbols
real s3a(64,63,64) !Saved spectra
real s3b(64,63) !Average spectra
integer iutc(64),ihz(64),ipol(64)
real dt(64)
character*22 decoded
logical ltext,first
data first/.true./
save
if(first) then
iutc=-1
ihz=0
ipol=0
first=.false.
ihzdiff=min(100,ntol)
dtdiff=0.2
endif
do i=1,64
if(nutc.eq.iutc(i) .and. abs(nhz-ihz(i)).lt.ihzdiff) then
nsave=mod(nsave-1+64,64)+1
go to 10
endif
enddo
iutc(nsave)=nutc !Save UTC
ihz(nsave)=nhz !Save freq in Hz
ipol(nsave)=npol !Save pol
dt(nsave)=xdt !Save DT
s3a(1:64,1:63,nsave)=s3 !Save the spectra
10 s3b=0.
do i=1,64 !Accumulate avg spectra
if(iutc(i).lt.0) cycle
if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same sequence
if(abs(nhz-ihz(i)).gt.ihzdiff) cycle !Freq must match
if(abs(xdt-dt(i)).gt.dtdiff) cycle !DT must match
s3b=s3b + s3a(1:64,1:63,i)
nsum=nsum+1
enddo
decoded=' '
if(nsum.ge.2) then !Try decoding the sverage
nadd=mode65*nsum
call extract(s3b,nadd,ncount,nhist,decoded,ltext) !Extract the message
nkv=nsum
if(ncount.lt.0) then
nkv=0
decoded=' '
endif
endif
return
end subroutine s3avg