Merge branch 'feat-ft2' of bitbucket.org:k1jt/wsjtx into feat-ft2

This commit is contained in:
Steve Franke 2019-01-21 19:33:51 -06:00
commit 7b7857cd77
16 changed files with 330 additions and 53 deletions

View File

@ -510,6 +510,8 @@ set (wsjt_FSRCS
lib/mskrtd.f90 lib/mskrtd.f90
lib/fsk4hf/ft4sim.f90 lib/fsk4hf/ft4sim.f90
lib/fsk4hf/ft4d.f90 lib/fsk4hf/ft4d.f90
lib/ft2/cdatetime.f90
lib/ft2/ft2_decode.f90
lib/77bit/my_hash.f90 lib/77bit/my_hash.f90
lib/wsprd/osdwspr.f90 lib/wsprd/osdwspr.f90
lib/ft8/osd174_91.f90 lib/ft8/osd174_91.f90
@ -551,6 +553,7 @@ set (wsjt_FSRCS
lib/sync64.f90 lib/sync64.f90
lib/sync65.f90 lib/sync65.f90
lib/fsk4hf/getcandidates2.f90 lib/fsk4hf/getcandidates2.f90
lib/ft2/getcandidates2a.f90
lib/ft8/sync8.f90 lib/ft8/sync8.f90
lib/ft8/sync8d.f90 lib/ft8/sync8d.f90
lib/sync9.f90 lib/sync9.f90

View File

@ -47,14 +47,13 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol,
SoundOutput * stream, Channel channel, SoundOutput * stream, Channel channel,
bool synchronize, bool fastMode, double dBSNR, int TRperiod) bool synchronize, bool fastMode, double dBSNR, int TRperiod)
{ {
// qDebug() << "Mod AA" << symbolsLength << framesPerSymbol << frequency
// << toneSpacing << synchronize << fastMode << dBSNR << TRperiod;
Q_ASSERT (stream); Q_ASSERT (stream);
// Time according to this computer which becomes our base time // Time according to this computer which becomes our base time
qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000; qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000;
if (m_state != Idle) if(m_state != Idle) stop ();
{
stop ();
}
m_quickClose = false; m_quickClose = false;
@ -92,6 +91,14 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol,
if (synchronize && !m_tuning && !m_bFastMode) { if (synchronize && !m_tuning && !m_bFastMode) {
m_silentFrames = m_ic + m_frameRate / (1000 / delay_ms) - (mstr * (m_frameRate / 1000)); m_silentFrames = m_ic + m_frameRate / (1000 / delay_ms) - (mstr * (m_frameRate / 1000));
} }
if(symbolsLength==144 and framesPerSymbol==160 and toneSpacing==60) {
//### FT2 params
delay_ms=100;
mstr=1947;
m_ic=0;
m_silentFrames=0;
}
// qDebug() << "Mod AB" << delay_ms << mstr << m_ic << m_silentFrames;
initialize (QIODevice::ReadOnly, channel); initialize (QIODevice::ReadOnly, channel);
Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ? Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ?
@ -170,7 +177,8 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
case Active: case Active:
{ {
unsigned int isym=0; unsigned int isym=0;
// qDebug() << "Mod A" << m_toneSpacing << m_ic; // qDebug() << "Mod A" << m_toneSpacing << m_frequency << m_nsps
// << m_ic << m_symbolsLength << icw[0];
if(!m_tuning) isym=m_ic/(4.0*m_nsps); // Actual fsample=48000 if(!m_tuning) isym=m_ic/(4.0*m_nsps); // Actual fsample=48000
bool slowCwId=((isym >= m_symbolsLength) && (icw[0] > 0)) && (!m_bFastMode); bool slowCwId=((isym >= m_symbolsLength) && (icw[0] > 0)) && (!m_bFastMode);
if(m_TRperiod==3) slowCwId=false; if(m_TRperiod==3) slowCwId=false;
@ -289,6 +297,8 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
if (m_ic > i1) m_amp = 0.0; if (m_ic > i1) m_amp = 0.0;
sample=qRound(m_amp*qSin(m_phi)); sample=qRound(m_amp*qSin(m_phi));
//Here's where we transmit from a precomputed wave[] array:
if(m_toneSpacing < 0) sample=qRound(m_amp*foxcom_.wave[m_ic]); if(m_toneSpacing < 0) sample=qRound(m_amp*foxcom_.wave[m_ic]);
// if(m_ic < 100) qDebug() << "Mod C" << m_ic << m_amp << foxcom_.wave[m_ic] << sample; // if(m_ic < 100) qDebug() << "Mod C" << m_ic << m_amp << foxcom_.wave[m_ic] << sample;

6
lib/ft2/cdatetime.f90 Normal file
View File

@ -0,0 +1,6 @@
character*17 function cdatetime()
character cdate*8,ctime*10
call date_and_time(cdate,ctime)
cdatetime=cdate(3:8)//'_'//ctime
return
end function cdatetime

View File

@ -6,7 +6,20 @@ program ft2
logical allok logical allok
character*20 pttport character*20 pttport
character*8 arg character*8 arg
! integer*2 iwave2(30000) character*80 fname
integer*2 id2(30000)
open(12,file='all_ft2.txt',status='unknown',position='append')
nargs=iargc()
if(nargs.eq.1) then
call getarg(1,fname)
open(10,file=fname,status='old',access='stream')
read(10) id2(1:22) !Read (and ignore) the header
read(10) id2 !Read the Rx data
close(10)
call ft2_decode(fname(1:17),nfqso,id2,ndecodes,mycall,hiscall,nrx)
go to 999
endif
allok=.true. allok=.true.
! Get home-station details ! Get home-station details
@ -26,13 +39,13 @@ program ft2
call padevsub(idevin,idevout) call padevsub(idevin,idevout)
if(idevin.ne.ndevin .or. idevout.ne.ndevout) allok=.false. if(idevin.ne.ndevin .or. idevout.ne.ndevout) allok=.false.
i1=0 i1=0
i1=ptt(nport,1,1,iptt)
i1=ptt(nport,1,0,iptt) i1=ptt(nport,1,0,iptt)
if(i1.lt.0 .and. nport.ne.0) allok=.false. if(i1.lt.0 .and. nport.ne.0) allok=.false.
if(.not.allok) then if(.not.allok) then
write(*,"('Please fix setup error(s) and restart.')") write(*,"('Please fix setup error(s) and restart.')")
go to 999 go to 999
endif endif
open(12,file='all_ft2.txt',status='unknown',position='append')
nright=1 nright=1
iwrite=0 iwrite=0
@ -52,7 +65,6 @@ program ft2
QSO_in_progress=.false. QSO_in_progress=.false.
ntxed=0 ntxed=0
nargs=iargc()
if(nargs.eq.3) then if(nargs.eq.3) then
call getarg(1,txmsg) call getarg(1,txmsg)
call getarg(2,arg) call getarg(2,arg)
@ -67,7 +79,7 @@ program ft2
! Start the audio streams ! Start the audio streams
ierr=ft2audio(idevin,idevout,npabuf,nright,y1,y2,NRING,iwrite,itx, & ierr=ft2audio(idevin,idevout,npabuf,nright,y1,y2,NRING,iwrite,itx, &
iwave,nwave,nfsample,nTxOK,nTransmitting,ngo) iwave,nwave+3*1152,nfsample,nTxOK,nTransmitting,ngo)
if(ierr.ne.0) then if(ierr.ne.0) then
print*,'Error',ierr,' starting audio input and/or output.' print*,'Error',ierr,' starting audio input and/or output.'
endif endif
@ -76,13 +88,15 @@ program ft2
subroutine update(total_time,ic1,ic2) subroutine update(total_time,ic1,ic2)
use wavhdr
type(hdr) h
real*8 total_time real*8 total_time
integer*8 count0,count1,clkfreq integer*8 count0,count1,clkfreq
integer ptt integer ptt
integer*2 id(30000) integer*2 id(30000)
logical transmitted,level logical transmitted,level,ok
character*70 line character*70 line
character cdatetime*17 character cdatetime*17,fname*17,mode*8,band*6
include 'gcom1.f90' include 'gcom1.f90'
data nt0/-1/,transmitted/.false./,snr/-99.0/ data nt0/-1/,transmitted/.false./,snr/-99.0/
data level/.false./ data level/.false./
@ -157,9 +171,39 @@ subroutine update(total_time,ic1,ic2)
call ft2_decode(cdatetime(),nfqso,id,ndecodes,mycall,hiscall,nrx) call ft2_decode(cdatetime(),nfqso,id,ndecodes,mycall,hiscall,nrx)
call system_clock(count1,clkfreq) call system_clock(count1,clkfreq)
! tdecode=float(count1-count0)/float(clkfreq) ! tdecode=float(count1-count0)/float(clkfreq)
! write(*,3001) trun
!3001 format(f10.3)
if(ndecodes.ge.1) then
fMHz=7.074
mode='FT2'
nsubmode=1
ntrperiod=0
h=default_header(12000,30000)
k=0
do i=1,250
sq=0
do n=1,120
k=k+1
x=id(k)
sq=sq + x*x
enddo
write(43,3043) i,0.01*i,1.e-4*sq
3043 format(i7,f12.6,f12.3)
enddo
call set_wsjtx_wav_params(fMHz,mode,nsubmode,ntrperiod,id)
band=""
mode=""
nsubmode=-1
ntrperiod=-1
call get_wsjtx_wav_params(id,band,mode,nsubmode,ntrperiod,ok)
! write(*,1010) band,ntrperiod,mode,char(ichar('A')-1+id(3))
!1010 format('Band: ',a6,' T/R period:',i4,' Mode: ',a8,1x,a1)
fname=cdatetime()
fname(14:17)='.wav'
open(13,file=fname,status='unknown',access='stream')
write(13) h,id
close(13)
endif
if(autoseq .and.nrx.eq.2) QSO_in_progress=.true. if(autoseq .and.nrx.eq.2) QSO_in_progress=.true.
if(autoseq .and. QSO_in_progress .and. nrx.ge.1 .and. nrx.le.4) then if(autoseq .and. QSO_in_progress .and. nrx.ge.1 .and. nrx.le.4) then
lrx(nrx)=.true. lrx(nrx)=.true.
@ -220,6 +264,7 @@ subroutine transmit(nfunc,ftx,iptt)
if(nfunc.eq.4) txmsg=trim(hiscall)//' '//trim(mycall)//' RR73' if(nfunc.eq.4) txmsg=trim(hiscall)//' '//trim(mycall)//' RR73'
if(nfunc.eq.5) txmsg='TNX 73 GL' if(nfunc.eq.5) txmsg='TNX 73 GL'
call ft2_iwave(txmsg,ftx,snrdb,iwave) call ft2_iwave(txmsg,ftx,snrdb,iwave)
iwave(23041:)=0
i1=ptt(nport,1,1,iptt) i1=ptt(nport,1,1,iptt)
ntxok=1 ntxok=1
n=len(trim(txmsg)) n=len(trim(txmsg))

View File

@ -1,13 +1,14 @@
subroutine ft2_decode(cdatetime,nfqso,iwave,ndecodes,mycall,hiscall,nrx) subroutine ft2_decode(cdatetime0,nfqso,iwave,ndecodes,mycall,hiscall,nrx,line)
use crc use crc
use packjt77 use packjt77
include 'ft2_params.f90' include 'ft2_params.f90'
character message*37,c77*77 character message*37,c77*77
character*61 line
character*37 decodes(100) character*37 decodes(100)
character*120 data_dir character*120 data_dir
character*17 cdatetime character*17 cdatetime0,cdatetime
character*6 mycall,hiscall character*6 mycall,hiscall,hhmmss
complex c2(0:NMAX/16-1) !Complex waveform complex c2(0:NMAX/16-1) !Complex waveform
complex cb(0:NMAX/16-1) complex cb(0:NMAX/16-1)
complex cd(0:144*10-1) !Complex waveform complex cd(0:144*10-1) !Complex waveform
@ -30,6 +31,7 @@ subroutine ft2_decode(cdatetime,nfqso,iwave,ndecodes,mycall,hiscall,nrx)
logical unpk77_success logical unpk77_success
data s16/0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0/ data s16/0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0/
hhmmss=cdatetime0(8:13)
fs=12000.0/NDOWN !Sample rate fs=12000.0/NDOWN !Sample rate
dt=1/fs !Sample interval after downsample (s) dt=1/fs !Sample interval after downsample (s)
tt=NSPS*dt !Duration of "itone" symbols (s) tt=NSPS*dt !Duration of "itone" symbols (s)
@ -63,7 +65,7 @@ subroutine ft2_decode(cdatetime,nfqso,iwave,ndecodes,mycall,hiscall,nrx)
syncmin=0.2 syncmin=0.2
maxcand=100 maxcand=100
nfqso=-1 nfqso=-1
call getcandidates2(iwave,fa,fb,maxcand,savg,candidate,ncand) call getcandidates2a(iwave,fa,fb,maxcand,savg,candidate,ncand)
ndecodes=0 ndecodes=0
do icand=1,ncand do icand=1,ncand
f0=candidate(1,icand) f0=candidate(1,icand)
@ -191,11 +193,15 @@ subroutine ft2_decode(cdatetime,nfqso,iwave,ndecodes,mycall,hiscall,nrx)
xsnr=db(sybest*sybest) - 115.0 !### Rough estimate of S/N ### xsnr=db(sybest*sybest) - 115.0 !### Rough estimate of S/N ###
nsnr=nint(xsnr) nsnr=nint(xsnr)
freq=f0+dfbest freq=f0+dfbest
write(*,1000) cdatetime,nsnr,ibest/750.0,nint(freq),message, & write(line,1000) hhmmss,nsnr,ibest/750.0,nint(freq),message
1000 format(a6,i4,f5.2,i5,' + ',1x,a37)
open(24,file='all_ft2.txt',status='unknown',position='append')
write(24,1002) cdatetime0,nsnr,ibest/750.0,nint(freq),message, &
nseq,nharderror,nhardmin nseq,nharderror,nhardmin
write(12,1000) cdatetime,nsnr,ibest/750.0,nint(freq),message, & if(hhmmss.eq.' ') write(*,1002) cdatetime0,nsnr, &
nseq,nharderror,nhardmin ibest/750.0,nint(freq),message,nseq,nharderror,nhardmin
1000 format(a17,i4,f6.2,i5,' Rx ',a37,3i5) 1002 format(a17,i4,f6.2,i5,' Rx ',a37,3i5)
close(24)
!### Temporary: assume most recent decoded message conveys "hiscall". !### Temporary: assume most recent decoded message conveys "hiscall".
i0=index(message,' ') i0=index(message,' ')
@ -290,4 +296,3 @@ subroutine ft2_downsample(iwave,f0,c)
c=c1(0:NMAX/16-1) c=c1(0:NMAX/16-1)
return return
end subroutine ft2_downsample end subroutine ft2_downsample

View File

@ -1,6 +1,7 @@
gcc -c ft2audio.c gcc -c ft2audio.c
gcc -c ptt.c gcc -c ptt.c
gfortran -c ../77bit/packjt77.f90 gfortran -c ../77bit/packjt77.f90
gfortran -c ../wavhdr.f90
gfortran -c ../crc.f90 gfortran -c ../crc.f90
gfortran -o ft2 -fbounds-check -fno-second-underscore -ffpe-trap=invalid,zero -Wall -Wno-conversion -Wno-character-truncation ft2.f90 ft2_iwave.f90 ft2_decode.f90 getcandidates2.f90 ft2audio.o ptt.o libwsjt_fort.a libwsjt_cxx.a libportaudio.a ../libfftw3f_win.a -lwinmm gfortran -o ft2 -fbounds-check -fno-second-underscore -ffpe-trap=invalid,zero -Wall -Wno-conversion -Wno-character-truncation ft2.f90 ft2_iwave.f90 ft2_decode.f90 getcandidates2.f90 ft2audio.o ptt.o /JTSDK/wsjtx-output/qt55/2.1.0/Release/build/libwsjt_fort.a /JTSDK/wsjtx-output/qt55/2.1.0/Release/build/libwsjt_cxx.a libportaudio.a ../libfftw3f_win.a -lwinmm
rm *.o *.mod rm *.o *.mod

View File

@ -29,6 +29,6 @@ character*4 mygrid
character*3 exch character*3 exch
character*37 txmsg character*37 txmsg
common/gcom1/snrdb,ndevin,ndevout,iwrite,itx,ngo,nTransmitting,nTxOK,nport, & common/gcom1/snrdb,ndevin,ndevout,iwrite,itx,ngo,nTransmitting,nTxOK,nport, &
ntxed,tx_once, y1(NRING),y2(NRING),iwave(NTZ),ltx(5),lrx(5),autoseq, & ntxed,tx_once,y1(NRING),y2(NRING),iwave(NTZ+3*1152),ltx(5),lrx(5), &
QSO_in_progress,mycall,hiscall,hiscall_next,mygrid,exch,txmsg autoseq,QSO_in_progress,mycall,hiscall,hiscall_next,mygrid,exch,txmsg

View File

@ -1,4 +1,4 @@
subroutine getcandidates2(id,fa,fb,maxcand,savg,candidate,ncand) subroutine getcandidates2a(id,fa,fb,maxcand,savg,candidate,ncand)
! For now, hardwired to find the largest peak in the average spectrum ! For now, hardwired to find the largest peak in the average spectrum
@ -61,4 +61,4 @@ subroutine getcandidates2(id,fa,fb,maxcand,savg,candidate,ncand)
endif endif
return return
end subroutine getcandidates2 end subroutine getcandidates2a

Binary file not shown.

View File

@ -37,17 +37,17 @@ module wavhdr
subroutine set_wsjtx_wav_params(fMHz,mode,nsubmode,ntrperiod,id2) subroutine set_wsjtx_wav_params(fMHz,mode,nsubmode,ntrperiod,id2)
parameter (NBANDS=23,NMODES=11) parameter (NBANDS=23,NMODES=13)
character*8 mode,modes(NMODES) character*8 mode,modes(NMODES)
integer*2 id2(4) integer*2 id2(4)
integer iperiod(7) integer iperiod(8)
real fband(NBANDS) real fband(NBANDS)
data fband/0.137,0.474,1.8,3.5,5.1,7.0,10.14,14.0,18.1,21.0,24.9, & data fband/0.137,0.474,1.8,3.5,5.1,7.0,10.14,14.0,18.1,21.0,24.9, &
28.0,50.0,144.0,222.0,432.0,902.0,1296.0,2304.0,3400.0, & 28.0,50.0,144.0,222.0,432.0,902.0,1296.0,2304.0,3400.0, &
5760.0,10368.0,24048.0/ 5760.0,10368.0,24048.0/
data modes/'Echo','FSK441','ISCAT','JT4','JT65','JT6M','JT9', & data modes/'Echo','FSK441','ISCAT','JT4','JT65','JT6M','JT9', &
'JT9+JT65','JTMS','JTMSK','WSPR'/ 'JT9+JT65','JTMS','JTMSK','WSPR','FT8','FT2'/
data iperiod/5,10,15,30,60,120,900/ data iperiod/5,10,15,30,60,120,900,0/
dmin=1.e30 dmin=1.e30
iband=0 iband=0
@ -64,7 +64,7 @@ module wavhdr
enddo enddo
ip=0 ip=0
do i=1,7 do i=1,8
if(ntrperiod.eq.iperiod(i)) ip=i if(ntrperiod.eq.iperiod(i)) ip=i
enddo enddo
@ -78,15 +78,15 @@ module wavhdr
subroutine get_wsjtx_wav_params(id2,band,mode,nsubmode,ntrperiod,ok) subroutine get_wsjtx_wav_params(id2,band,mode,nsubmode,ntrperiod,ok)
parameter (NBANDS=23,NMODES=11) parameter (NBANDS=23,NMODES=13)
character*8 mode,modes(NMODES) character*8 mode,modes(NMODES)
character*6 band,bands(NBANDS) character*6 band,bands(NBANDS)
integer*2 id2(4) integer*2 id2(4)
integer iperiod(7) integer iperiod(8)
logical ok logical ok
data modes/'Echo','FSK441','ISCAT','JT4','JT65','JT6M','JT9', & data modes/'Echo','FSK441','ISCAT','JT4','JT65','JT6M','JT9', &
'JT9+JT65','JTMS','JTMSK','WSPR'/ 'JT9+JT65','JTMS','JTMSK','WSPR','FT8','FT2'/
data iperiod/5,10,15,30,60,120,900/ data iperiod/5,10,15,30,60,120,900,0/
data bands/'2190m','630m','160m','80m','60m','40m','30m','20m', & data bands/'2190m','630m','160m','80m','60m','40m','30m','20m', &
'17m','15m','12m','10m','6m','2m','1.25m','70cm','33cm', & '17m','15m','12m','10m','6m','2m','1.25m','70cm','33cm', &
'23cm','13cm','9cm','6cm','3cm','1.25cm'/ '23cm','13cm','9cm','6cm','3cm','1.25cm'/
@ -95,7 +95,7 @@ module wavhdr
if(id2(1).lt.1 .or. id2(1).gt.NBANDS) ok=.false. if(id2(1).lt.1 .or. id2(1).gt.NBANDS) ok=.false.
if(id2(2).lt.1 .or. id2(2).gt.NMODES) ok=.false. if(id2(2).lt.1 .or. id2(2).gt.NMODES) ok=.false.
if(id2(3).lt.1 .or. id2(3).gt.8) ok=.false. if(id2(3).lt.1 .or. id2(3).gt.8) ok=.false.
if(id2(4).lt.1 .or. id2(4).gt.7) ok=.false. if(id2(4).lt.1 .or. id2(4).gt.8) ok=.false.
if(ok) then if(ok) then
band=bands(id2(1)) band=bands(id2(1))

View File

@ -23,7 +23,8 @@ namespace
"MSK144", "MSK144",
"QRA64", "QRA64",
"FreqCal", "FreqCal",
"FT8" "FT8",
"FT2"
}; };
std::size_t constexpr mode_names_size = sizeof (mode_names) / sizeof (mode_names[0]); std::size_t constexpr mode_names_size = sizeof (mode_names) / sizeof (mode_names[0]);
} }

View File

@ -49,6 +49,7 @@ public:
QRA64, QRA64,
FreqCal, FreqCal,
FT8, FT8,
FT2,
MODES_END_SENTINAL_AND_COUNT // this must be last MODES_END_SENTINAL_AND_COUNT // this must be last
}; };
Q_ENUM (Mode) Q_ENUM (Mode)

View File

@ -455,6 +455,7 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,bool bFastMode) void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,bool bFastMode)
{ {
QString t1=" @ "; QString t1=" @ ";
if(modeTx=="FT2") t1=" + ";
if(modeTx=="FT8") t1=" ~ "; if(modeTx=="FT8") t1=" ~ ";
if(modeTx=="JT4") t1=" $ "; if(modeTx=="JT4") t1=" $ ";
if(modeTx=="JT65") t1=" # "; if(modeTx=="JT65") t1=" # ";

View File

@ -99,6 +99,9 @@ extern "C" {
void genft8_(char* msg, int* i3, int* n3, char* msgsent, char ft8msgbits[], void genft8_(char* msg, int* i3, int* n3, char* msgsent, char ft8msgbits[],
int itone[], fortran_charlen_t, fortran_charlen_t); int itone[], fortran_charlen_t, fortran_charlen_t);
void genft2_(char* msg, int* ichk, char* msgsent, int itone[], int* itype,
fortran_charlen_t, fortran_charlen_t);
void gen4_(char* msg, int* ichk, char* msgsent, int itone[], void gen4_(char* msg, int* ichk, char* msgsent, int itone[],
int* itext, fortran_charlen_t, fortran_charlen_t); int* itext, fortran_charlen_t, fortran_charlen_t);
@ -159,6 +162,10 @@ extern "C" {
void plotsave_(float swide[], int* m_w , int* m_h1, int* irow); void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
void chkcall_(char* w, char* basc_call, bool cok, int len1, int len2); void chkcall_(char* w, char* basc_call, bool cok, int len1, int len2);
void ft2_decode_(char* cdatetime, int* nfqso, short int id[], int* ndecodes,
char* mycall6, char* hiscall6, int* nrx, char* line,
int len1, int len2, int len3, int len4);
} }
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
@ -544,6 +551,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
on_EraseButton_clicked (); on_EraseButton_clicked ();
QActionGroup* modeGroup = new QActionGroup(this); QActionGroup* modeGroup = new QActionGroup(this);
ui->actionFT2->setActionGroup(modeGroup);
ui->actionFT8->setActionGroup(modeGroup); ui->actionFT8->setActionGroup(modeGroup);
ui->actionJT9->setActionGroup(modeGroup); ui->actionJT9->setActionGroup(modeGroup);
ui->actionJT65->setActionGroup(modeGroup); ui->actionJT65->setActionGroup(modeGroup);
@ -874,6 +882,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
if(m_bFast9) m_bFastMode=true; if(m_bFast9) m_bFastMode=true;
ui->cbFast9->setChecked(m_bFast9 or m_bFastMode); ui->cbFast9->setChecked(m_bFast9 or m_bFastMode);
if(m_mode=="FT2") on_actionFT2_triggered();
if(m_mode=="FT8") on_actionFT8_triggered(); if(m_mode=="FT8") on_actionFT8_triggered();
if(m_mode=="JT4") on_actionJT4_triggered(); if(m_mode=="JT4") on_actionJT4_triggered();
if(m_mode=="JT9") on_actionJT9_triggered(); if(m_mode=="JT9") on_actionJT9_triggered();
@ -1345,7 +1354,8 @@ void MainWindow::dataSink(qint64 frames)
if(m_monitoring || m_diskData) { if(m_monitoring || m_diskData) {
m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData); m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData);
} }
if(m_mode=="MSK144") return; if(m_mode=="FT2") ft2Data(k);
if(m_mode=="MSK144" or m_mode=="FT2") return;
fixStop(); fixStop();
if (m_mode == "FreqCal" if (m_mode == "FreqCal"
@ -1546,7 +1556,6 @@ void MainWindow::fastSink(qint64 frames)
{ {
int k (frames); int k (frames);
bool decodeNow=false; bool decodeNow=false;
if(k < m_k0) { //New sequence ? if(k < m_k0) { //New sequence ?
memcpy(fast_green2,fast_green,4*703); //Copy fast_green[] to fast_green2[] memcpy(fast_green2,fast_green,4*703); //Copy fast_green[] to fast_green2[]
memcpy(fast_s2,fast_s,4*703*64); //Copy fast_s[] into fast_s2[] memcpy(fast_s2,fast_s,4*703*64); //Copy fast_s[] into fast_s2[]
@ -1877,6 +1886,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
break; break;
case Qt::Key_F1: case Qt::Key_F1:
if(bAltF1F5) { if(bAltF1F5) {
if(m_mode=="FT2") {
ft2_tx(6);
return;
}
auto_tx_mode(true); auto_tx_mode(true);
on_txb6_clicked(); on_txb6_clicked();
return; return;
@ -1886,6 +1899,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
} }
case Qt::Key_F2: case Qt::Key_F2:
if(bAltF1F5) { if(bAltF1F5) {
if(m_mode=="FT2") {
ft2_tx(2);
return;
}
auto_tx_mode(true); auto_tx_mode(true);
on_txb2_clicked(); on_txb2_clicked();
return; return;
@ -1895,6 +1912,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
} }
case Qt::Key_F3: case Qt::Key_F3:
if(bAltF1F5) { if(bAltF1F5) {
if(m_mode=="FT2") {
ft2_tx(3);
return;
}
auto_tx_mode(true); auto_tx_mode(true);
on_txb3_clicked(); on_txb3_clicked();
return; return;
@ -1904,6 +1925,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
} }
case Qt::Key_F4: case Qt::Key_F4:
if(bAltF1F5) { if(bAltF1F5) {
if(m_mode=="FT2") {
ft2_tx(4);
return;
}
auto_tx_mode(true); auto_tx_mode(true);
on_txb4_clicked(); on_txb4_clicked();
return; return;
@ -1914,6 +1939,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
} }
case Qt::Key_F5: case Qt::Key_F5:
if(bAltF1F5) { if(bAltF1F5) {
if(m_mode=="FT2") {
ft2_tx(5);
return;
}
auto_tx_mode(true); auto_tx_mode(true);
on_txb5_clicked(); on_txb5_clicked();
return; return;
@ -3366,7 +3395,7 @@ void MainWindow::guiUpdate()
double tx1=0.0; double tx1=0.0;
double tx2=txDuration; double tx2=txDuration;
if(m_mode=="FT8") icw[0]=0; //No CW ID in FT8 mode if(m_mode=="FT8" or m_mode=="FT2") icw[0]=0; //No CW ID in FT2 or FT8 mode
if((icw[0]>0) and (!m_bFast9)) tx2 += icw[0]*2560.0/48000.0; //Full length including CW ID if((icw[0]>0) and (!m_bFast9)) tx2 += icw[0]*2560.0/48000.0; //Full length including CW ID
if(tx2>m_TRperiod) tx2=m_TRperiod; if(tx2>m_TRperiod) tx2=m_TRperiod;
@ -3776,21 +3805,22 @@ void MainWindow::guiUpdate()
} }
} }
if (g_iptt == 1 && m_iptt0 == 0) if (g_iptt == 1 && m_iptt0 == 0) {
{ auto const& current_message = QString::fromLatin1 (msgsent);
auto const& current_message = QString::fromLatin1 (msgsent); if(m_config.watchdog () && !m_mode.startsWith ("WSPR")
if(m_config.watchdog () && !m_mode.startsWith ("WSPR") && current_message != m_msgSent0) {
&& current_message != m_msgSent0) { tx_watchdog (false); // in case we are auto sequencing
tx_watchdog (false); // in case we are auto sequencing m_msgSent0 = current_message;
m_msgSent0 = current_message; }
}
if(m_mode!="FT2") {
if(!m_tune) write_all("Tx",m_currentMessage); if(!m_tune) write_all("Tx",m_currentMessage);
if (m_config.TX_messages () && !m_tune && SpecOp::FOX!=m_config.special_op_id()) { if (m_config.TX_messages () && !m_tune && SpecOp::FOX!=m_config.special_op_id()) {
ui->decodedTextBrowser2->displayTransmittedText(current_message, m_modeTx, ui->decodedTextBrowser2->displayTransmittedText(current_message, m_modeTx,
ui->TxFreqSpinBox->value(),m_bFastMode); ui->TxFreqSpinBox->value(),m_bFastMode);
} }
}
switch (m_ntx) switch (m_ntx)
{ {
@ -3836,6 +3866,7 @@ void MainWindow::guiUpdate()
//Once per second: //Once per second:
if(nsec != m_sec0) { if(nsec != m_sec0) {
// qDebug() << "cc onesec" << g_iptt << m_iptt0;
// if((!m_msgAvgWidget or (m_msgAvgWidget and !m_msgAvgWidget->isVisible())) // if((!m_msgAvgWidget or (m_msgAvgWidget and !m_msgAvgWidget->isVisible()))
// and (SpecOp::NONE < m_config.special_op_id()) and (SpecOp::HOUND > m_config.special_op_id())) on_actionFox_Log_triggered(); // and (SpecOp::NONE < m_config.special_op_id()) and (SpecOp::HOUND > m_config.special_op_id())) on_actionFox_Log_triggered();
if(m_freqNominal!=0 and m_freqNominal<50000000 and m_config.enable_VHF_features()) { if(m_freqNominal!=0 and m_freqNominal<50000000 and m_config.enable_VHF_features()) {
@ -5497,6 +5528,52 @@ void MainWindow::displayWidgets(qint64 n)
genStdMsgs (m_rpt, true); genStdMsgs (m_rpt, true);
} }
void MainWindow::on_actionFT2_triggered()
{
m_mode="FT2";
m_modeTx="FT2";
m_TRperiod=2147483647;
bool bVHF=m_config.enable_VHF_features();
m_bFast9=false;
m_bFastMode=false;
WSPR_config(false);
switch_mode (Modes::FT2);
m_nsps=6912;
m_FFTSize = m_nsps/2;
Q_EMIT FFTSize (m_FFTSize);
m_hsymStop=50;
setup_status_bar (bVHF);
m_toneSpacing=0.8*75.0; //???
ui->actionFT2->setChecked(true); //???
m_wideGraph->setMode(m_mode);
m_wideGraph->setModeTx(m_modeTx);
VHF_features_enabled(bVHF);
ui->cbAutoSeq->setChecked(false);
m_fastGraph->hide();
m_wideGraph->show();
ui->decodedTextLabel2->setText(" UTC dB DT Freq Message");
m_wideGraph->setPeriod(m_TRperiod,m_nsps);
m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
ui->label_7->setText("Rx Frequency");
ui->label_6->setText("Band Activity");
ui->decodedTextLabel->setText( " UTC dB DT Freq Message");
displayWidgets(nWidgets("111010000100111000010000100110001"));
ui->txrb2->setEnabled(true);
ui->txrb4->setEnabled(true);
ui->txrb5->setEnabled(true);
ui->txrb6->setEnabled(true);
ui->txb2->setEnabled(true);
ui->txb4->setEnabled(true);
ui->txb5->setEnabled(true);
ui->txb6->setEnabled(true);
ui->txFirstCheckBox->setEnabled(true);
ui->cbAutoSeq->setEnabled(true);
ui->labDXped->setVisible(false);
ui->labDXped->setText("");
statusChanged();
}
void MainWindow::on_actionFT8_triggered() void MainWindow::on_actionFT8_triggered()
{ {
m_mode="FT8"; m_mode="FT8";
@ -5599,8 +5676,6 @@ void MainWindow::on_actionFT8_triggered()
statusChanged(); statusChanged();
} }
void MainWindow::on_actionJT4_triggered() void MainWindow::on_actionJT4_triggered()
{ {
m_mode="JT4"; m_mode="JT4";
@ -6764,6 +6839,15 @@ void MainWindow::transmit (double snr)
true, false, snr, m_TRperiod); true, false, snr, m_TRperiod);
} }
if (m_modeTx == "FT2") {
toneSpacing=0.8*12000.0/160.0;
// if(SpecOp::FOX==m_config.special_op_id() and !m_tune) toneSpacing=-1;
Q_EMIT sendMessage (NUM_FT2_SYMBOLS,
160.0, ui->TxFreqSpinBox->value() - m_XIT,
toneSpacing, m_soundOutput, m_config.audio_output_channel (),
true, false, snr, 2);
}
if (m_modeTx == "QRA64") { if (m_modeTx == "QRA64") {
if(m_nSubMode==0) toneSpacing=12000.0/6912.0; if(m_nSubMode==0) toneSpacing=12000.0/6912.0;
if(m_nSubMode==1) toneSpacing=2*12000.0/6912.0; if(m_nSubMode==1) toneSpacing=2*12000.0/6912.0;
@ -8499,3 +8583,109 @@ void MainWindow::write_all(QString txRx, QString message)
MessageBox::warning_message(this, tr ("Log File Error"), message2); }); MessageBox::warning_message(this, tr ("Log File Error"), message2); });
} }
} }
void MainWindow::ft2Data(int k)
{
static int nhsec0=-1;
short id[30000];
int nhsec=k/6000;
if(nhsec==nhsec0) return;
//Process FT2 data at 0.5 s intervals
int j=k/6000;
j=6000*j-30000;
if(j<0) j+=NRING;
for(int i=0; i<30000; i++) {
id[i]=dec_data.d2[j];
j++;
if(j>=NRING) j=j-NRING;
}
if(k>=NRING) {
//Wrap the ring buffer pointer
k=k-NRING;
dec_data.params.kin=k;
}
auto time = QDateTime::currentDateTimeUtc ();
QString t=time.toString("yyMMdd_hhmmss.sss");
QByteArray ba=time.toString("yyMMdd_hhmmss.sss").toLatin1();
char* cdatetime=ba.data();
char mycall6[] ="K1JT ";
char hiscall6[]="K9AN ";
char line[61];
int nfqso=1500;
int ndecodes=0;
int nrx=-1;
ft2_decode_(cdatetime,&nfqso,id,&ndecodes,mycall6,hiscall6,&nrx,&line[0],
17,6,6,61);
line[60]=0;
if(ndecodes>0) {
QString sline{QString::fromLatin1(line)};
DecodedText decodedtext {sline.replace(QChar::LineFeed,"")};
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_mode,
m_config.DXCC(),m_logBook,m_currentBand,m_config.ppfx());
}
nhsec0=nhsec;
}
void MainWindow::ft2_tx(int ntx)
{
if(g_iptt!=0) return; //Alreadt transmitting?
static char message[38];
static char msgsent[38];
QByteArray ba;
m_ntx=ntx;
if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit();
if(m_ntx == 2) ba=ui->tx2->text().toLocal8Bit();
if(m_ntx == 3) ba=ui->tx3->text().toLocal8Bit();
if(m_ntx == 4) ba=ui->tx4->text().toLocal8Bit();
if(m_ntx == 5) ba=ui->tx5->currentText().toLocal8Bit();
if(m_ntx == 6) ba=ui->tx6->text().toLocal8Bit();
if(m_ntx == 7) ba=ui->genMsg->text().toLocal8Bit();
if(m_ntx == 8) ba=ui->freeTextMsg->currentText().toLocal8Bit();
ba2msg(ba,message);
int ichk=0;
int itype=-1;
genft2_(message, &ichk, msgsent, const_cast<int *>(itone), &itype, 37, 37);
msgsent[37]=0;
m_currentMessage = QString::fromLatin1(msgsent);
on_txb6_clicked();
auto_tx_mode(true);
icw[0]=0;
g_iptt = 1;
setRig ();
setXIT (ui->TxFreqSpinBox->value ());
Q_EMIT m_config.transceiver_ptt (true); //Assert the PTT
m_tx_when_ready = true;
if (g_iptt == 1 && m_iptt0 == 0) {
auto const& current_message = QString::fromLatin1 (msgsent);
write_all("Tx",m_currentMessage);
if (m_config.TX_messages () && !m_tune && SpecOp::FOX!=m_config.special_op_id()) {
ui->decodedTextBrowser2->displayTransmittedText(current_message, m_modeTx,
ui->TxFreqSpinBox->value(),m_bFastMode);
}
switch (m_ntx)
{
case 1: m_QSOProgress = REPLYING; break;
case 2: m_QSOProgress = REPORT; break;
case 3: m_QSOProgress = ROGER_REPORT; break;
case 4: m_QSOProgress = ROGERS; break;
case 5: m_QSOProgress = SIGNOFF; break;
case 6: m_QSOProgress = CALLING; break;
default: break; // determined elsewhere
}
m_transmitting = true;
transmitDisplay (true);
statusUpdate ();
}
if(!m_btxok && m_btxok0 && g_iptt==1) stopTx();
// if(!m_bTxTime and !m_tune) m_btxok=false; //Time to stop transmitting
}

View File

@ -46,9 +46,11 @@
#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80 #define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80
#define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync #define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync
#define NUM_FT8_SYMBOLS 79 #define NUM_FT8_SYMBOLS 79
#define NUM_FT2_SYMBOLS 144
#define NUM_CW_SYMBOLS 250 #define NUM_CW_SYMBOLS 250
#define TX_SAMPLE_RATE 48000 #define TX_SAMPLE_RATE 48000
#define N_WIDGETS 33 #define N_WIDGETS 33
#define NRING 3456000
extern int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols extern int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
@ -200,6 +202,7 @@ private slots:
void on_actionJT65_triggered(); void on_actionJT65_triggered();
void on_actionJT9_JT65_triggered(); void on_actionJT9_JT65_triggered();
void on_actionJT4_triggered(); void on_actionJT4_triggered();
void on_actionFT2_triggered();
void on_actionFT8_triggered(); void on_actionFT8_triggered();
void on_TxFreqSpinBox_valueChanged(int arg1); void on_TxFreqSpinBox_valueChanged(int arg1);
void on_actionSave_decoded_triggered(); void on_actionSave_decoded_triggered();
@ -309,6 +312,8 @@ private slots:
void on_comboBoxHoundSort_activated (int index); void on_comboBoxHoundSort_activated (int index);
void not_GA_warning_message (); void not_GA_warning_message ();
void checkMSK144ContestType(); void checkMSK144ContestType();
void ft2Data(int k);
void ft2_tx(int ntx);
int setTxMsg(int n); int setTxMsg(int n);
bool stdCall(QString const& w); bool stdCall(QString const& w);

View File

@ -2705,6 +2705,7 @@ list. The list can be maintained in Settings (F2).</string>
<property name="title"> <property name="title">
<string>Mode</string> <string>Mode</string>
</property> </property>
<addaction name="actionFT2"/>
<addaction name="actionFT8"/> <addaction name="actionFT8"/>
<addaction name="actionJT4"/> <addaction name="actionJT4"/>
<addaction name="actionJT9"/> <addaction name="actionJT9"/>
@ -3338,6 +3339,14 @@ list. The list can be maintained in Settings (F2).</string>
<string>Erase WSPR hashtable</string> <string>Erase WSPR hashtable</string>
</property> </property>
</action> </action>
<action name="actionFT2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>FT2</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>