diff --git a/Modulator.cpp b/Modulator.cpp index c467a4a..b80acc8 100644 --- a/Modulator.cpp +++ b/Modulator.cpp @@ -71,7 +71,7 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, m_toneSpacing = toneSpacing; m_bFastMode=fastMode; m_TRperiod=TRperiod; - unsigned delay_ms = 1920 == m_nsps && 15 == m_period ? 500 : 1000; + unsigned delay_ms = 1920 == m_nsps && 15 == m_period ? 500 : 250; // 1000; // noise generator parameters if (m_addNoise) { diff --git a/commons.h b/commons.h index 20c2ec3..1dd17e8 100644 --- a/commons.h +++ b/commons.h @@ -3,8 +3,24 @@ #define NSMAX 6827 #define NTMAX 300 + #define RX_SAMPLE_RATE 12000 +#define JS8_NUM_SYMBOLS 79 + +#ifndef JS8_80HZ +#define JS8_80HZ 0 +#endif + +#if JS8_80HZ +#define JS8_SYMBOL_SAMPLES 1200 // 480 // 600 // 1200 // 1920 +#define JS8_TX_SECONDS 10 // 5 // 6 // 10 // 15 +#define JS8_SYMBOL_STOP 32 // 12 // 16 // 32 // 50 // ??? no idea why this works... +#else +#define JS8_SYMBOL_SAMPLES 1920 +#define JS8_TX_SECONDS 15 +#define JS8_SYMBOL_STOP 50 +#endif #ifndef TEST_FOX_WAVE_GEN #define TEST_FOX_WAVE_GEN 0 diff --git a/lib/ft8/baseline.f90 b/lib/ft8/baseline.f90 index 035f9ab..3f8ec31 100644 --- a/lib/ft8/baseline.f90 +++ b/lib/ft8/baseline.f90 @@ -5,13 +5,16 @@ subroutine baseline(s,nfa,nfb,sbase) ! Output: sbase(npts) Baseline implicit real*8 (a-h,o-z) - real*4 s(1920) - real*4 sbase(1920) + + include 'ft8_params.f90' + + real*4 s(NSPS) + real*4 sbase(NSPS) real*4 base real*8 x(1000),y(1000),a(5) data nseg/10/,npct/10/ - df=12000.0/3840.0 !3.125 Hz + df=12000.0/(NSPS*2.0d0) !3.125 Hz ia=max(1,nint(nfa/df)) ib=nint(nfb/df) do i=ia,ib diff --git a/lib/ft8/ft8_downsample.f90 b/lib/ft8/ft8_downsample.f90 index f355225..795a794 100644 --- a/lib/ft8/ft8_downsample.f90 +++ b/lib/ft8/ft8_downsample.f90 @@ -1,38 +1,40 @@ subroutine ft8_downsample(dd,newdat,f0,c1) -! Downconvert to complex data sampled at 200 Hz ==> 32 samples/symbol + ! Downconvert to complex data sampled at 200 Hz ==> 32 samples/symbol - parameter (NMAX=15*12000,NSPS=1920) - parameter (NFFT1=192000,NFFT2=3200) !192000/60 = 3200 + include 'ft8_params.f90' + + parameter (NDFFT1=NSPS*NDD, NDFFT2=NDFFT1/NDOWN) ! Downconverted FFT Size - 192000/60 = 3200 logical newdat,first - complex c1(0:NFFT2-1) - complex cx(0:NFFT1/2) - real dd(NMAX),x(NFFT1),taper(0:100) + + complex c1(0:NDFFT2-1) + complex cx(0:NDFFT1/2) + real dd(NMAX),x(NDFFT1),taper(0:NDD) equivalence (x,cx) data first/.true./ save cx,first,taper if(first) then pi=4.0*atan(1.0) - do i=0,100 - taper(i)=0.5*(1.0+cos(i*pi/100)) + do i=0,NDD + taper(i)=0.5*(1.0+cos(i*pi/NDD)) enddo first=.false. endif if(newdat) then -! Data in dd have changed, recompute the long FFT + ! Data in dd have changed, recompute the long FFT x(1:NMAX)=dd - x(NMAX+1:NFFT1)=0. !Zero-pad the x array - call four2a(cx,NFFT1,1,-1,0) !r2c FFT to freq domain + x(NMAX+1:NDFFT1)=0. !Zero-pad the x array + call four2a(cx,NDFFT1,1,-1,0) !r2c FFT to freq domain newdat=.false. endif - df=12000.0/NFFT1 + df=12000.0/NDFFT1 baud=12000.0/NSPS i0=nint(f0/df) ft=f0+8.5*baud - it=min(nint(ft/df),NFFT1/2) + it=min(nint(ft/df),NDFFT1/2) fb=f0-1.5*baud ib=max(1,nint(fb/df)) k=0 @@ -41,11 +43,11 @@ subroutine ft8_downsample(dd,newdat,f0,c1) c1(k)=cx(i) k=k+1 enddo - c1(0:100)=c1(0:100)*taper(100:0:-1) - c1(k-1-100:k-1)=c1(k-1-100:k-1)*taper + c1(0:NDD)=c1(0:NDD)*taper(NDD:0:-1) + c1(k-1-NDD:k-1)=c1(k-1-NDD:k-1)*taper c1=cshift(c1,i0-ib) - call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain - fac=1.0/sqrt(float(NFFT1)*NFFT2) + call four2a(c1,NDFFT2,1,1,1) !c2c FFT back to time domain + fac=1.0/sqrt(float(NDFFT1)*NDFFT2) c1=fac*c1 return diff --git a/lib/ft8/ft8_params.f90 b/lib/ft8/ft8_params.f90 index 858e61e..09f3e5d 100644 --- a/lib/ft8/ft8_params.f90 +++ b/lib/ft8/ft8_params.f90 @@ -1,12 +1,27 @@ ! LDPC (174,87) code + +!parameter (NSPS=480) !Samples per symbol at 12000 S/s +!parameter (NTXDUR=5) !TX Duration in Seconds +!parameter (NDOWNSPS=16) !Downsampled samples per symbol +!parameter (AZ=6.0) !Near dupe sync spacing +!parameter (NDD=136) !Downconverted FFT Bins - 100 Bins + +! parameter (NSPS=480, NTXDUR=5, NDOWNSPS=16, NDD=136) ! 200 Hz +! parameter (NSPS=600, NTXDUR=6, NDOWNSPS=24, NDD=120) ! 160 Hz +! parameter (NSPS=1200, NTXDUR=10, NDOWNSPS=24, NDD=100) ! 80 Hz + parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100) ! 50 Hz +! parameter (NSPS=3840, NTXDUR=30, NDOWNSPS=32, NDD=100) ! 25 Hz + +parameter (JZ=62) !Sync Search Space over +/- 2.5s relative to 0.5s TX start time. +parameter (AZ=12000.0/(1.0*NSPS)*0.64d0) + parameter (KK=87) !Information bits (75 + CRC12) parameter (ND=58) !Data symbols parameter (NS=21) !Sync symbols (3 @ Costas 7x7) parameter (NN=NS+ND) !Total channel symbols (79) -parameter (NSPS=1920) !Samples per symbol at 12000 S/s parameter (NZ=NSPS*NN) !Samples in full 15 s waveform (151,680) -parameter (NMAX=15*12000) !Samples in iwave (180,000) +parameter (NMAX=NTXDUR*12000) !Samples in iwave (180,000) parameter (NFFT1=2*NSPS, NH1=NFFT1/2) !Length of FFTs for symbol spectra parameter (NSTEP=NSPS/4) !Rough time-sync step size parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps) -parameter (NDOWN=60) !Downsample factor +parameter (NDOWN=NSPS/NDOWNSPS) !Downsample factor to 32 samples per symbol diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index 26f2c1a..de6ea2e 100644 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -17,7 +17,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & real ps(0:7),psl(0:7) real bmeta(3*ND),bmetb(3*ND),bmetap(3*ND) real llr(3*ND),llra(3*ND),llr0(3*ND),llr1(3*ND),llrap(3*ND) !Soft symbols - real dd0(15*12000) + real dd0(NMAX) integer*1 decoded(KK),decoded0(KK),apmask(3*ND),cw(3*ND) integer*1 msgbits(KK) integer apsym(KK) @@ -29,8 +29,8 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & integer naptypes(0:5,4) ! (nQSOProgress, decoding pass) maximum of 4 passes for now integer*1, target:: i1hiscall(12) complex cd0(0:3199) - complex ctwk(32) - complex csymb(32) + complex ctwk(NDOWNSPS) + complex csymb(NDOWNSPS) logical first,newdat,lsubtract,lapon,lapcqonly,nagain equivalence (s1,s1sort) data icos7/4,2,5,6,1,3,0/ @@ -104,7 +104,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & delf=ifr*0.5 dphi=twopi*delf*dt2 phi=0.0 - do i=1,32 + do i=1,NDOWNSPS ctwk(i)=cmplx(cos(phi),sin(phi)) phi=mod(phi+dphi,twopi) enddo @@ -124,11 +124,11 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & j=0 do k=1,NN - i1=ibest+(k-1)*32 + i1=ibest+(k-1)*NDOWNSPS csymb=cmplx(0.0,0.0) !if( i1.ge.1 .and. i1+31 .le. NP2 ) csymb=cd0(i1:i1+31) - if( i1.ge.0 .and. i1+31 .le. NP2-1 ) csymb=cd0(i1:i1+31) - call four2a(csymb,32,1,-1,1) + if( i1.ge.0 .and. i1+(NDOWNSPS-1) .le. NP2-1 ) csymb=cd0(i1:i1+(NDOWNSPS-1)) + call four2a(csymb,NDOWNSPS,1,-1,1) s2(0:7,k)=abs(csymb(1:8))/1e3 enddo @@ -146,6 +146,12 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & enddo ! hard sync sum - max is 21 nsync=is1+is2+is3 + + ! debug + !open(99, file="./js8.log", status="old", position="append", action="write") + !write(99,*) ibest, nsync + !close(99) + if(nsync .le. 6) then ! bail out call timer('badnsync', 0) nbadcrc=1 @@ -387,7 +393,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & if(lsubtract) call subtractft8(dd0,itone,f1,xdt2) xsig=0.0 xnoi=0.0 - do i=1,79 + do i=1,NN xsig=xsig+s2(itone(i),i)**2 ios=mod(itone(i)+4,7) xnoi=xnoi+s2(ios,i)**2 diff --git a/lib/ft8/genft8refsig.f90 b/lib/ft8/genft8refsig.f90 index 5bf4885..04c5612 100644 --- a/lib/ft8/genft8refsig.f90 +++ b/lib/ft8/genft8refsig.f90 @@ -1,18 +1,20 @@ subroutine genft8refsig(itone,cref,f0) - complex cref(79*1920) - integer itone(79) + include 'ft8_params.f90' + + complex cref(NN*NSPS) + integer itone(NN) real*8 twopi,phi,dphi,dt,xnsps data twopi/0.d0/ save twopi if( twopi .lt. 0.1 ) twopi=8.d0*atan(1.d0) - xnsps=1920.d0 + xnsps=NSPS*1.0d0 dt=1.d0/12000.d0 phi=0.d0 k=1 - do i=1,79 + do i=1,NN dphi=twopi*(f0*dt+itone(i)/xnsps) - do is=1,1920 + do is=1,NSPS cref(k)=cmplx(cos(phi),sin(phi)) phi=mod(phi+dphi,twopi) k=k+1 diff --git a/lib/ft8/ldpcsim174.f90 b/lib/ft8/ldpcsim174.f90 index 6fbb82e..d4239b4 100644 --- a/lib/ft8/ldpcsim174.f90 +++ b/lib/ft8/ldpcsim174.f90 @@ -3,6 +3,8 @@ program ldpcsim174 use crc use packjt +include 'ft8_params.f90' + character*22 msg,msgsent,msgreceived character*8 arg character*6 grid @@ -75,10 +77,10 @@ allocate ( rxdata(N), llr(N) ) ik=0 im=0 do i=1,12 - nn=i4Msg6BitWords(i) + nna=i4Msg6BitWords(i) do j=1, 6 ik=ik+1 - i4=i4+i4+iand(1,ishft(nn,j-6)) + i4=i4+i4+iand(1,ishft(nna,j-6)) i4=iand(i4,255) if(ik.eq.8) then im=im+1 @@ -214,7 +216,7 @@ do idb = 20,-10,-1 endif endif enddo - baud=12000/1920 + baud=12000.0/NSPS snr2500=db+10.0*log10((baud/2500.0)) pberr=real(nberr)/(real(ntrials*N)) write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,8x,f5.2,8x,e10.3)") db,snr2500,ngood,nue,nbadcrc,ss,pberr diff --git a/lib/ft8/subtractft8.f90 b/lib/ft8/subtractft8.f90 index 1031cf2..f9a1180 100644 --- a/lib/ft8/subtractft8.f90 +++ b/lib/ft8/subtractft8.f90 @@ -9,11 +9,13 @@ subroutine subtractft8(dd,itone,f0,dt) use timer_module, only: timer - parameter (NMAX=15*12000,NFRAME=1920*79) - parameter (NFFT=NMAX,NFILT=1400) + include 'ft8_params.f90' + parameter (NFRAME=NSPS*NN) + parameter (NFFT=NMAX, NFILT=1400) + real*4 dd(NMAX), window(-NFILT/2:NFILT/2) complex cref,camp,cfilt,cw - integer itone(79) + integer itone(NN) logical first data first/.true./ common/heap8/cref(NFRAME),camp(NMAX),cfilt(NMAX),cw(NMAX) diff --git a/lib/ft8/sync8.f90 b/lib/ft8/sync8.f90 index 58bfaa2..815191f 100644 --- a/lib/ft8/sync8.f90 +++ b/lib/ft8/sync8.f90 @@ -1,8 +1,6 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase) include 'ft8_params.f90' -! Search over +/- 2.5s relative to 0.5s TX start time. - parameter (JZ=62) complex cx(0:NH1) real s(NH1,NHSYM) real savg(NH1) @@ -114,7 +112,7 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase) if(i.ge.2) then do j=1,i-1 fdiff=abs(candidate0(1,i))-abs(candidate0(1,j)) - if(abs(fdiff).lt.4.0) then + if(abs(fdiff).lt.AZ) then ! note: this dedupe difference is dependent on symbol spacing if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0. if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0. endif diff --git a/lib/ft8/sync8d.f90 b/lib/ft8/sync8d.f90 index 0cf2069..07aca75 100644 --- a/lib/ft8/sync8d.f90 +++ b/lib/ft8/sync8d.f90 @@ -2,11 +2,13 @@ subroutine sync8d(cd0,i0,ctwk,itwk,sync) ! Compute sync power for a complex, downsampled FT8 signal. - parameter(NP2=2812,NDOWN=60) + include 'ft8_params.f90' + + parameter(NP2=2812) complex cd0(3125) - complex csync(0:6,32) - complex csync2(32) - complex ctwk(32) + complex csync(0:6,NDOWNSPS) + complex csync2(NDOWNSPS) + complex ctwk(NDOWNSPS) complex z1,z2,z3 logical first integer icos7(0:6) @@ -21,12 +23,12 @@ subroutine sync8d(cd0,i0,ctwk,itwk,sync) twopi=8.0*atan(1.0) fs2=12000.0/NDOWN !Sample rate after downsampling dt2=1/fs2 !Corresponding sample interval - taus=32*dt2 !Symbol duration + taus=NDOWNSPS*dt2 !Symbol duration baud=1.0/taus !Keying rate do i=0,6 phi=0.0 dphi=twopi*icos7(i)*baud*dt2 - do j=1,32 + do j=1,NDOWNSPS csync(i,j)=cmplx(cos(phi),sin(phi)) !Waveform for 7x7 Costas array phi=mod(phi+dphi,twopi) enddo @@ -35,18 +37,18 @@ subroutine sync8d(cd0,i0,ctwk,itwk,sync) endif sync=0 - do i=0,6 !Sum over 7 Costas frequencies and - i1=i0+i*32 !three Costas arrays - i2=i1+36*32 - i3=i1+72*32 - csync2=csync(i,1:32) + do i=0,6 !Sum over 7 Costas frequencies and + i1=i0+i*NDOWNSPS !three Costas arrays + i2=i1+36*NDOWNSPS + i3=i1+72*NDOWNSPS + csync2=csync(i,1:NDOWNSPS) if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency z1=0. z2=0. z3=0. - if(i1.ge.1 .and. i1+31.le.NP2) z1=sum(cd0(i1:i1+31)*conjg(csync2)) - if(i2.ge.1 .and. i2+31.le.NP2) z2=sum(cd0(i2:i2+31)*conjg(csync2)) - if(i3.ge.1 .and. i3+31.le.NP2) z3=sum(cd0(i3:i3+31)*conjg(csync2)) + if(i1.ge.1 .and. i1+(NDOWNSPS-1).le.NP2) z1=sum(cd0(i1:i1+(NDOWNSPS-1))*conjg(csync2)) + if(i2.ge.1 .and. i2+(NDOWNSPS-1).le.NP2) z2=sum(cd0(i2:i2+(NDOWNSPS-1))*conjg(csync2)) + if(i3.ge.1 .and. i3+(NDOWNSPS-1).le.NP2) z3=sum(cd0(i3:i3+(NDOWNSPS-1))*conjg(csync2)) sync = sync + p(z1) + p(z2) + p(z3) enddo diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index 932738f..a38565c 100644 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -45,12 +45,12 @@ contains real s(NH1,NHSYM) real sbase(NH1) real candidate(3,200) - real dd(15*12000) + real dd(NMAX) logical, intent(in) :: lft8apon,lapcqonly,nagain logical newdat,lsubtract,ldupe,bcontest character*12 mycall12, hiscall12 character*6 mygrid6,hisgrid6 - integer*2 iwave(15*12000) + integer*2 iwave(NMAX) integer apsym(KK) character datetime*13,message*22,msg37*37 character*22 allmessages(100) @@ -99,11 +99,16 @@ contains call timer('sync8 ',0) call sync8(dd,ifa,ifb,syncmin,nfqso,s,candidate,ncand,sbase) call timer('sync8 ',1) + + !open(99, file="./js8.log", status="old", position="append", action="write") + !write(99,*) ncand, "candidates" + !close(99) + do icand=1,ncand sync=candidate(3,icand) f1=candidate(1,icand) xdt=candidate(2,icand) - xbase=10.0**(0.1*(sbase(nint(f1/3.125))-40.0)) + xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz nsnr0=min(99,nint(10.0*log10(sync) - 25.5)) !### empirical ### call timer('ft8b ',0) call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & diff --git a/mainwindow.cpp b/mainwindow.cpp index c55be1d..9492e0b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2412,7 +2412,7 @@ void MainWindow::fixStop() } else if (m_mode=="FreqCal"){ m_hsymStop=((int(m_TRperiod/0.288))/8)*8; } else if (m_mode=="FT8") { - m_hsymStop=50; + m_hsymStop=JS8_SYMBOL_STOP; } } @@ -2497,6 +2497,7 @@ void MainWindow::dataSink(qint64 frames) m_dialFreqRxWSPR=m_freqNominal; } + //qDebug() << m_ihsym << m_hsymStop; if(m_ihsym == m_hsymStop) { if(m_mode=="Echo") { float snr=0; @@ -4875,7 +4876,7 @@ void MainWindow::guiUpdate() if(m_TRperiod==0) m_TRperiod=60; txDuration=0.0; - if(m_modeTx=="FT8") txDuration=1.0 + NUM_FT8_SYMBOLS*1920/12000.0; // FT8 + if(m_modeTx=="FT8") txDuration=1.0 + JS8_NUM_SYMBOLS * (double)JS8_SYMBOL_SAMPLES/(double)RX_SAMPLE_RATE; // FT8 double tx1=0.0; double tx2=txDuration; @@ -6937,7 +6938,7 @@ void MainWindow::on_actionFT8_triggered() m_nsps=6912; m_FFTSize = m_nsps / 2; Q_EMIT FFTSize (m_FFTSize); - m_hsymStop=50; + m_hsymStop=JS8_SYMBOL_STOP; setup_status_bar (bVHF); m_toneSpacing=0.0; //??? ui->actionFT8->setChecked(true); //??? @@ -6945,7 +6946,7 @@ void MainWindow::on_actionFT8_triggered() m_wideGraph->setModeTx(m_modeTx); VHF_features_enabled(bVHF); ui->cbAutoSeq->setChecked(true); - m_TRperiod=15; + m_TRperiod=JS8_TX_SECONDS; m_fastGraph->hide(); m_wideGraph->show(); ui->decodedTextLabel2->setText(" UTC dB DT Freq Message"); @@ -9045,130 +9046,17 @@ void MainWindow::transmit (double snr) } if (m_modeTx == "FT8") { - toneSpacing=12000.0/1920.0; - if(m_config.x2ToneSpacing()) toneSpacing=2*12000.0/1920.0; - if(m_config.x4ToneSpacing()) toneSpacing=4*12000.0/1920.0; + toneSpacing=(double)RX_SAMPLE_RATE/(double)JS8_SYMBOL_SAMPLES; + //if(m_config.x2ToneSpacing()) toneSpacing=2.0*(double)RX_SAMPLE_RATE/(double)JS8_SYMBOL_SAMPLES; + //if(m_config.x4ToneSpacing()) toneSpacing=4.0*(double)RX_SAMPLE_RATE/(double)JS8_SYMBOL_SAMPLES; if(m_config.bFox() and !m_tune) toneSpacing=-1; if(TEST_FOX_WAVE_GEN && ui->turboButton->isChecked() && !m_tune) toneSpacing=-1; - Q_EMIT sendMessage (NUM_FT8_SYMBOLS, - 1920.0, ui->TxFreqSpinBox->value () - m_XIT, + Q_EMIT sendMessage (JS8_NUM_SYMBOLS, + (double)JS8_SYMBOL_SAMPLES, ui->TxFreqSpinBox->value () - m_XIT, toneSpacing, m_soundOutput, m_config.audio_output_channel (), true, false, snr, m_TRperiod); } - - if (m_modeTx == "QRA64") { - if(m_nSubMode==0) toneSpacing=12000.0/6912.0; - if(m_nSubMode==1) toneSpacing=2*12000.0/6912.0; - if(m_nSubMode==2) toneSpacing=4*12000.0/6912.0; - if(m_nSubMode==3) toneSpacing=8*12000.0/6912.0; - if(m_nSubMode==4) toneSpacing=16*12000.0/6912.0; - Q_EMIT sendMessage (NUM_QRA64_SYMBOLS, - 6912.0, ui->TxFreqSpinBox->value () - m_XIT, - toneSpacing, m_soundOutput, m_config.audio_output_channel (), - true, false, snr, m_TRperiod); - } - - if (m_modeTx == "JT9") { - int nsub=pow(2,m_nSubMode); - int nsps[]={480,240,120,60}; - double sps=m_nsps; - m_toneSpacing=nsub*12000.0/6912.0; - if(m_config.x2ToneSpacing()) m_toneSpacing=2.0*m_toneSpacing; - if(m_config.x4ToneSpacing()) m_toneSpacing=4.0*m_toneSpacing; - bool fastmode=false; - if(m_bFast9 and (m_nSubMode>=4)) { - fastmode=true; - sps=nsps[m_nSubMode-4]; - m_toneSpacing=12000.0/sps; - } - Q_EMIT sendMessage (NUM_JT9_SYMBOLS, sps, - ui->TxFreqSpinBox->value() - m_XIT, m_toneSpacing, - m_soundOutput, m_config.audio_output_channel (), - true, fastmode, snr, m_TRperiod); - } - - if (m_modeTx == "MSK144") { - m_nsps=6; - double f0=1000.0; - if(!m_bFastMode) { - m_nsps=192; - f0=ui->TxFreqSpinBox->value () - m_XIT - 0.5*m_toneSpacing; - } - m_toneSpacing=6000.0/m_nsps; - m_FFTSize = 7 * 512; - Q_EMIT FFTSize (m_FFTSize); - int nsym; - nsym=NUM_MSK144_SYMBOLS; - if(itone[40] < 0) nsym=40; - Q_EMIT sendMessage (nsym, double(m_nsps), f0, m_toneSpacing, - m_soundOutput, m_config.audio_output_channel (), - true, true, snr, m_TRperiod); - } - - if (m_modeTx == "JT4") { - if(m_nSubMode==0) toneSpacing=4.375; - if(m_nSubMode==1) toneSpacing=2*4.375; - if(m_nSubMode==2) toneSpacing=4*4.375; - if(m_nSubMode==3) toneSpacing=9*4.375; - if(m_nSubMode==4) toneSpacing=18*4.375; - if(m_nSubMode==5) toneSpacing=36*4.375; - if(m_nSubMode==6) toneSpacing=72*4.375; - Q_EMIT sendMessage (NUM_JT4_SYMBOLS, - 2520.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT, - toneSpacing, m_soundOutput, m_config.audio_output_channel (), - true, false, snr, m_TRperiod); - } - if (m_mode=="WSPR") { - int nToneSpacing=1; - if(m_config.x2ToneSpacing()) nToneSpacing=2; - if(m_config.x4ToneSpacing()) nToneSpacing=4; - Q_EMIT sendMessage (NUM_WSPR_SYMBOLS, 8192.0, - ui->TxFreqSpinBox->value() - 1.5 * 12000 / 8192, - m_toneSpacing*nToneSpacing, m_soundOutput, - m_config.audio_output_channel(),true, false, snr, - m_TRperiod); - } - if (m_mode=="WSPR-LF") { - Q_EMIT sendMessage (NUM_WSPR_LF_SYMBOLS, 24576.0, - ui->TxFreqSpinBox->value(), - m_toneSpacing, m_soundOutput, - m_config.audio_output_channel(),true, false, snr, - m_TRperiod); - } - if(m_mode=="Echo") { - //??? should use "fastMode = true" here ??? - Q_EMIT sendMessage (27, 1024.0, 1500.0, 0.0, m_soundOutput, - m_config.audio_output_channel(), - false, false, snr, m_TRperiod); - } - - if(m_mode=="ISCAT") { - double sps,f0; - if(m_nSubMode==0) { - sps=512.0*12000.0/11025.0; - toneSpacing=11025.0/512.0; - f0=47*toneSpacing; - } else { - sps=256.0*12000.0/11025.0; - toneSpacing=11025.0/256.0; - f0=13*toneSpacing; - } - Q_EMIT sendMessage (NUM_ISCAT_SYMBOLS, sps, f0, toneSpacing, m_soundOutput, - m_config.audio_output_channel(), - true, true, snr, m_TRperiod); - } - -// In auto-sequencing mode, stop after 5 transmissions of "73" message. - if (m_bFastMode || m_bFast9) { - if (ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isChecked ()) { - if(m_ntx==5) { - m_nTx73 += 1; - } else { - m_nTx73=0; - } - } - } } void MainWindow::on_outAttenuation_valueChanged (int a) @@ -9653,10 +9541,11 @@ void MainWindow::updateTextWordCheckerDisplay(){ } void MainWindow::updateTextStatsDisplay(QString text, int count){ + const double fpm = 60.0/JS8_TX_SECONDS; if(count > 0){ auto words = text.split(" ", QString::SkipEmptyParts).length(); - auto wpm = QString::number(words/(count/4.0), 'f', 1); - auto cpm = QString::number(text.length()/(count/4.0), 'f', 1); + auto wpm = QString::number(words/(count/fpm), 'f', 1); + auto cpm = QString::number(text.length()/(count/fpm), 'f', 1); wpm_label.setText(QString("%1wpm / %2cpm").arg(wpm).arg(cpm)); wpm_label.setVisible(true); } else { @@ -12014,7 +11903,7 @@ void MainWindow::emitTones(){ // emit tone numbers to network QVariantList t; - for(int i = 0; i < NUM_FT8_SYMBOLS; i++){ + for(int i = 0; i < JS8_NUM_SYMBOLS; i++){ t.append(QVariant((int)itone[i])); } diff --git a/mainwindow.h b/mainwindow.h index 79295b7..b62f391 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -57,7 +57,7 @@ #define NUM_ISCAT_SYMBOLS 1291 //30*11025/256 #define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80 #define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync -#define NUM_FT8_SYMBOLS 79 // 12.6 seconds, 15 seconds would be 93.75 symbols + #define NUM_CW_SYMBOLS 250 #define TX_SAMPLE_RATE 48000 #define N_WIDGETS 33 diff --git a/plotter.cpp b/plotter.cpp index e684b1a..8309a04 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -411,9 +411,7 @@ void CPlotter::DrawOverlay() //DrawOverlay() } } - float bw=9.0*12000.0/m_nsps; //JT9 - - if(m_mode=="FT8") bw=7*12000.0/1920.0; //FT8 + float bw=7.0*(double)RX_SAMPLE_RATE/(double)JS8_SYMBOL_SAMPLES; //JS8 painter0.setPen(penGreen);