If Monitor was OFF at start of band_changed(), return it to OFF when this function returns.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7306 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-11-13 20:28:53 +00:00
parent 9c19649b3d
commit 8e1378bce3
6 changed files with 64 additions and 53 deletions

View File

@ -99,7 +99,7 @@ contains
if(nsubmode.ge.100) then if(nsubmode.ge.100) then
! This is QRA64 mode ! This is QRA64 mode
mode64=2**(nsubmode-100) mode64=2**(nsubmode-100)
call qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall,hiscall, & call qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall,hiscall, &
hisgrid,sync,nsnr,dtx,nfreq,decoded,nft) hisgrid,sync,nsnr,dtx,nfreq,decoded,nft)
if (associated(this%callback)) then if (associated(this%callback)) then
ndrift=0 ndrift=0

View File

@ -39,6 +39,7 @@ program qra64sim
call getarg(7,arg) call getarg(7,arg)
read(arg,*) snrdb read(arg,*) snrdb
if(mode64.ge.8) nsigs=1
rms=100. rms=100.
fsample=12000.d0 !Sample rate (Hz) fsample=12000.d0 !Sample rate (Hz)
dt=1.d0/fsample !Sample interval (s) dt=1.d0/fsample !Sample interval (s)
@ -69,6 +70,7 @@ program qra64sim
do isig=1,nsigs !Generate requested number of sigs do isig=1,nsigs !Generate requested number of sigs
if(mod(nsigs,2).eq.0) f0=1500.0 + dfsig*(isig-0.5-nsigs/2) if(mod(nsigs,2).eq.0) f0=1500.0 + dfsig*(isig-0.5-nsigs/2)
if(mod(nsigs,2).eq.1) f0=1500.0 + dfsig*(isig-(nsigs+1)/2) if(mod(nsigs,2).eq.1) f0=1500.0 + dfsig*(isig-(nsigs+1)/2)
if(mode64.ge.8) f0=700.0
xsnr=snrdb xsnr=snrdb
if(snrdb.eq.0.0) xsnr=-20 - isig if(snrdb.eq.0.0) xsnr=-20 - isig

View File

@ -1,15 +1,15 @@
subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, &
hisgrid_6,sync,nsnr,dtx,nfreq,decoded,nft) hisgrid_6,sync,nsnr,dtx,nfreq,decoded,nft)
use packjt use packjt
parameter (NFFT=2*6912,NZ=5760,NMAX=60*12000,LN=1152*63) parameter (NMAX=60*12000,LN=1152*63)
character decoded*22 character decoded*22
character*12 mycall_12,hiscall_12 character*12 mycall_12,hiscall_12
character*6 mycall,hiscall,hisgrid_6 character*6 mycall,hiscall,hisgrid_6
character*4 hisgrid character*4 hisgrid
logical ltext logical ltext
complex c00(0:360000) !Complex spectrum of dd() complex c00(0:720000) !Complex spectrum of dd()
complex c0(0:360000) !Complex spectrum of dd() complex c0(0:720000) !Complex data for dd()
! integer*8 count0,count1,clkfreq ! integer*8 count0,count1,clkfreq
real a(3) real a(3)
real dd(NMAX) !Raw data sampled at 12000 Hz real dd(NMAX) !Raw data sampled at 12000 Hz
@ -30,8 +30,7 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, &
call packcall(hiscall,nc2,ltext) call packcall(hiscall,nc2,ltext)
call packgrid(hisgrid,ng2,ltext) call packgrid(hisgrid,ng2,ltext)
nSubmode=nint(log(float(mode64)/log(2.0))) nSubmode=nint(log(float(mode64)/log(2.0)))
b90=1.0 nFadingModel=1
nFadingModel=0
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then
do naptype=0,5 do naptype=0,5
call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, & call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, &
@ -42,18 +41,32 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, &
ng2z=ng2 ng2z=ng2
endif endif
maxf1=5 maxf1=0
call sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snr1,c00) call sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snr1,c00)
npts2=npts/2
!###
! dtx=0.
! f0=1500.0
! jpk=6000
! kpk=0
! if(mode64.ge.8) f0=700.0
!###
itz=10
if(mode64.eq.4) itz=9
if(mode64.eq.2) itz=7
if(mode64.eq.1) itz=5
npts2=216000
naptype=4 naptype=4
LL=64*(mode64+2) LL=64*(mode64+2)
NN=63 NN=63
! do itry0=1,3 do itry0=1,7
do itry0=1,1 ! do itry0=1,1
idf0=itry0/2 idf0=itry0/2
if(mod(itry0,2).eq.0) idf0=-idf0 if(mod(itry0,2).eq.0) idf0=-idf0
a(1)=-(f0+0.248*(idf0-0.33*kpk)) ! a(1)=-(f0+0.248*(idf0-0.33*kpk))
a(1)=-(f0+1.736*(idf0-0.33*kpk))
nfreq=nint(-a(1)) nfreq=nint(-a(1))
a(3)=0. a(3)=0.
! do itry1=1,3 ! do itry1=1,3
@ -61,19 +74,18 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, &
idf1=itry1/2 idf1=itry1/2
if(mod(itry1,2).eq.0) idf1=-idf1 if(mod(itry1,2).eq.0) idf1=-idf1
a(2)=-0.67*(idf1 + 0.67*kpk) a(2)=-0.67*(idf1 + 0.67*kpk)
call twkfreq(c00,c0,npts2,4000.0,a) call twkfreq(c00,c0,npts2,6000.0,a)
call spec64(c0,npts2,mode64,jpk,s3a,LL,NN) call spec64(c0,npts2,mode64,jpk,s3a,LL,NN)
ircmin=99 ircmin=99
do iter=0,10 do iter=itz,0,-1
b90=1.728**iter b90=1.728**iter
s3(1:LL*NN)=s3a(1:LL*NN) s3(1:LL*NN)=s3a(1:LL*NN)
call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, & call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, &
nFadingModel,dat4,snr2,irc) nFadingModel,dat4,snr2,irc)
if(irc.ge.0) write(*,3333) iter,idf0,-a(1),b90,irc
3333 format(i2,i3,2f8.1,i3)
if(abs(snr2).gt.30.) snr2=-30.0 if(abs(snr2).gt.30.) snr2=-30.0
if(irc.eq.0) go to 10 ! if(irc.eq.0) go to 10
! write(*,3001) iter,b90,snr2,irc
! write(72,3001) iter,b90,snr2,irc
!3001 format(i2,2f7.1,i4)
if(irc.ge.0 .and. irc.le.ircmin) then if(irc.ge.0 .and. irc.le.ircmin) then
dat4x=dat4 dat4x=dat4
b90x=b90 b90x=b90
@ -97,12 +109,7 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, &
else else
snr2=0. snr2=0.
endif endif
! write(78,3900) nutc,snr1,snr2,dtx,nfreq,kpk,idf0,idf1,irc,decoded ! if(irc.ge.0) go to 900
!3900 format(i4.4,2f6.1,f6.2,i5,4i3,1x,a22)
! flush(78)
! write(*,3006) idf0,idf1,nfreq,jpk,kpk,irc,decoded
!3006 format(2i4,i6,i7,2i4,2x,a22)
if(irc.ge.0) go to 900
enddo enddo
enddo enddo
900 continue 900 continue

View File

@ -1,31 +1,30 @@
subroutine spec64(c0,npts2,mode64,jpk,s3,LL,NN) subroutine spec64(c0,npts2,mode64,jpk,s3,LL,NN)
parameter (NSPS=2304) !Samples per symbol at 4000 Hz parameter (NSPS=3456) !Samples per symbol at 6000 Hz
complex c0(0:360000) !Complex spectrum of dd() complex c0(0:360000) !Complex spectrum of dd()
complex cs(0:NSPS-1) !Complex symbol spectrum complex cs(0:NSPS-1) !Complex symbol spectrum
real s3(LL,NN) !Synchronized symbol spectra real s3(LL,NN) !Synchronized symbol spectra
nfft6=nsps nfft6=nsps
fac=1.0/nfft6
do j=1,63 do j=1,63
jj=j+7 !Skip first Costas array jj=j+7 !Skip first Costas array
if(j.ge.32) jj=j+14 !Skip middle Costas array if(j.ge.32) jj=j+14 !Skip middle Costas array
ja=jpk + (jj-1)*nfft6 ja=jpk + (jj-1)*nfft6
jb=ja+nfft6-1 jb=ja+nfft6-1
cs(0:nfft6-1)=c0(ja:jb) cs(0:nfft6-1)=fac*c0(ja:jb)
call four2a(cs,nfft6,1,-1,1) call four2a(cs,nfft6,1,-1,1)
smax=0.
do ii=1,LL do ii=1,LL
i=ii-65 i=ii-65
if(i.lt.0) i=i+nfft6 if(i.lt.0) i=i+nfft6
s3(ii,j)=real(cs(i))**2 + aimag(cs(i))**2 s3(ii,j)=real(cs(i))**2 + aimag(cs(i))**2
if(s3(ii,j).gt.smax) then
smax=s3(ii,j)
ipk=ii-65
endif
enddo enddo
enddo enddo
! df=4000.0/nfft6
! do i=1,LL
! freq=(i-65)*df
! write(73,3002) i-65,freq,(1.e-6*s3(i,j),j=1,5)
!3002 format(i5,6f10.3)
! enddo
return return
end subroutine spec64 end subroutine spec64

View File

@ -1,7 +1,8 @@
subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0) subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, &
snrdb,c0)
parameter (NMAX=60*12000) !Max size of raw data at 12000 Hz parameter (NMAX=60*12000) !Max size of raw data at 12000 Hz
parameter (NSPS=2304) !Samples per symbol at 4000 Hz parameter (NSPS=3456) !Samples per symbol at 6000 Hz
parameter (NSPC=7*NSPS) !Samples per Costas array parameter (NSPC=7*NSPS) !Samples per Costas array
real dd(NMAX) !Raw data real dd(NMAX) !Raw data
real s1(0:NSPC-1) !Power spectrum of Costas 1 real s1(0:NSPC-1) !Power spectrum of Costas 1
@ -14,7 +15,7 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
integer icos7(0:6) !Costas 7x7 tones integer icos7(0:6) !Costas 7x7 tones
integer ipk0(1) integer ipk0(1)
complex cc(0:NSPC-1) !Costas waveform complex cc(0:NSPC-1) !Costas waveform
complex c0(0:360000) !Complex spectrum of dd() complex c0(0:720000) !Complex spectrum of dd()
complex c1(0:NSPC-1) !Complex spectrum of Costas 1 complex c1(0:NSPC-1) !Complex spectrum of Costas 1
complex c2(0:NSPC-1) !Complex spectrum of Costas 2 complex c2(0:NSPC-1) !Complex spectrum of Costas 2
complex c3(0:NSPC-1) !Complex spectrum of Costas 3 complex c3(0:NSPC-1) !Complex spectrum of Costas 3
@ -31,8 +32,8 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
k=-1 k=-1
phi=0. phi=0.
do j=0,6 !Compute complex Costas waveform do j=0,6 !Compute complex Costas waveform
dphi=twopi*nsync*icos7(j)*dfgen/4000.0 dphi=twopi*nsync*icos7(j)*dfgen/6000.0
do i=1,2304 do i=1,NSPS
phi=phi + dphi phi=phi + dphi
if(phi.gt.twopi) phi=phi-twopi if(phi.gt.twopi) phi=phi-twopi
k=k+1 k=k+1
@ -42,20 +43,20 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
mode64z=mode64 mode64z=mode64
endif endif
npts0=54*12000
nfft1=672000 nfft1=672000
nfft2=nfft1/3 nfft2=nfft1/2
df1=12000.0/nfft1 df1=12000.0/nfft1
fac=2.0/nfft1 fac=2.0/nfft1
do i=0,nfft1/2 !Load real data into c0 c0(0:npts-1)=fac*dd(1:npts)
c0(i)=fac*cmplx(dd(1+2*i),dd(2+2*i)) c0(npts:nfft1)=0.
enddo call four2a(c0,nfft1,1,-1,1) !Forward c2c FFT
call four2a(c0,nfft1,1,-1,0) !Forward r2c FFT c0(nfft2/2+1:nfft2)=0.
c0(0)=0.5*c0(0)
call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT; c0 is analytic sig call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT; c0 is analytic sig
npts2=npts0/3 !Downsampled complex data length npts2=npts/2 !Downsampled complex data length
nfft3=NSPC nfft3=NSPC
nh3=nfft3/2 nh3=nfft3/2
df3=4000.0/nfft3 df3=6000.0/nfft3
fa=max(nf1,nfqso-ntol) fa=max(nf1,nfqso-ntol)
fb=min(nf2,nfqso+ntol) fb=min(nf2,nfqso+ntol)
ia=max(maxf1,nint(fa/df3)) ia=max(maxf1,nint(fa/df3))
@ -64,7 +65,7 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
snr=0. snr=0.
jpk=0 jpk=0
ja=0 ja=0
jb=6*4000 jb=6*6000
jstep=200 jstep=200
ka=-maxf1 ka=-maxf1
kb=maxf1 kb=maxf1
@ -72,8 +73,8 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
kpk=0 kpk=0
do iter=1,2 do iter=1,2
do j1=ja,jb,jstep do j1=ja,jb,jstep
j2=j1 + 39*2304 j2=j1 + 39*NSPS
j3=j1 + 77*2304 j3=j1 + 77*NSPS
c1=1.e-4*c0(j1:j1+NSPC-1) * conjg(cc) c1=1.e-4*c0(j1:j1+NSPC-1) * conjg(cc)
call four2a(c1,nfft3,1,-1,1) call four2a(c1,nfft3,1,-1,1)
c2=1.e-4*c0(j2:j2+NSPC-1) * conjg(cc) c2=1.e-4*c0(j2:j2+NSPC-1) * conjg(cc)
@ -95,7 +96,7 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
s0b(:ia-1)=0. s0b(:ia-1)=0.
s0b(ib+1:)=0. s0b(ib+1:)=0.
nadd=(7*mode64)/2 nadd=(7*mode64)/2
if(mod(nadd,2).eq.1) nadd=nadd+1 !Make nadd odd if(mod(nadd,2).eq.0) nadd=nadd+1 !Make nadd odd
if(nadd.ge.3) call smo(s0b(ia:ib),iz,s0(ia:ib),nadd) if(nadd.ge.3) call smo(s0b(ia:ib),iz,s0(ia:ib),nadd)
call smo121(s0(ia:ib),iz) call smo121(s0(ia:ib),iz)
nskip=max(14,2*mode64) nskip=max(14,2*mode64)
@ -105,7 +106,7 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0)
jpk=j1 jpk=j1
s0a=s0/rms s0a=s0/rms
snr=s snr=s
dtx=jpk/4000.0 - 1.0 dtx=jpk/6000.0 - 1.0
ipk0=maxloc(s0(ia:ib)) ipk0=maxloc(s0(ia:ib))
ipk=ipk0(1) ipk=ipk0(1)
f0=(ipk+ia-1)*df3 f0=(ipk+ia-1)*df3

View File

@ -4534,6 +4534,7 @@ void MainWindow::on_bandComboBox_activated (int index)
void MainWindow::band_changed (Frequency f) void MainWindow::band_changed (Frequency f)
{ {
bool monitor_off=!m_monitoring;
// Set the attenuation value if options are checked // Set the attenuation value if options are checked
QString curBand = ui->bandComboBox->currentText(); QString curBand = ui->bandComboBox->currentText();
if (m_config.pwrBandTxMemory() && !m_tune) { if (m_config.pwrBandTxMemory() && !m_tune) {
@ -4576,6 +4577,7 @@ void MainWindow::band_changed (Frequency f)
if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal); if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal);
setRig (); setRig ();
setXIT (ui->TxFreqSpinBox->value ()); setXIT (ui->TxFreqSpinBox->value ());
if(monitor_off) monitor(false);
} }
} }