From b495531f7872c2f440191cc61e75cfeb65c1b68b Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 2 Mar 2024 09:36:19 -0500 Subject: [PATCH] Separate sfox_assemble.f90 from foxgen2.f90. --- CMakeLists.txt | 1 + lib/superfox/foxgen2.f90 | 74 +++------------------------------- lib/superfox/sfox_assemble.f90 | 71 ++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 69 deletions(-) create mode 100644 lib/superfox/sfox_assemble.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 030488fa8..6cdcfcb45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -429,6 +429,7 @@ set (wsjt_FSRCS lib/ft8/foxfilt.f90 lib/ft8/foxgen.f90 lib/superfox/foxgen2.f90 + lib/superfox/sfox_assemble.f90 lib/ft8/foxgen_wrap.f90 lib/freqcal.f90 lib/ft8/ft8apset.f90 diff --git a/lib/superfox/foxgen2.f90 b/lib/superfox/foxgen2.f90 index c77a2b492..1fc06580e 100644 --- a/lib/superfox/foxgen2.f90 +++ b/lib/superfox/foxgen2.f90 @@ -1,7 +1,11 @@ subroutine foxgen2(nslots,cmsg) +! Called from foxgen() when it's time to encode a SuperFox message and +! generate the waveform to be transmitted. We need to parse the old-style +! Fox messages and extract the necessary pieces. + use packjt77 - character*40 cmsg(5) + character*40 cmsg(5) !Old-style Fox messages are here character*37 msg character*22 sfmsg character*12 mycall @@ -70,71 +74,3 @@ subroutine foxgen2(nslots,cmsg) return end subroutine foxgen2 - -subroutine sfox_assemble(ntype,k,msg,mycall0,mygrid0) - - character*22 msg - character*22 msg0,msg1,msg2(10),msg3(5) - character*12 mycall0,mycall - character*4 mygrid0,mygrid - integer ntype !Message type: 0 Free Text - ! 1 CQ MyCall MyGrid - ! 2 Call_1 MyCall RR73 - ! 3 Call_1 MyCall rpt - integer nmsg(0:3) !Number of messages of type ntype - data nmsg/0,0,0,0/,nbits/0/,ntx/0/ - save -! save mycall,mygrid,nmsg,nbits,ntx - - if(mycall0(1:1).ne.' ') mycall=mycall0 - if(mygrid0(1:1).ne.' ') mygrid=mygrid0 - if(k.le.10) then - if(ntype.eq.0) then - if(nbits.le.262) then - nmsg(ntype)=nmsg(ntype)+1 - nbits=nbits+71 - msg0=msg - endif - else if(ntype.eq.1) then - if(nbits.le.290) then - nmsg(ntype)=nmsg(ntype)+1 - nbits=nbits+43 - msg1=msg - endif - else if(ntype.eq.2) then - if(nbits.le.305) then - nmsg(ntype)=nmsg(ntype)+1 - nbits=nbits+28 - j=nmsg(ntype) - msg2(j)=msg - endif - else - if(nbits.le.300) then - nmsg(ntype)=nmsg(ntype)+1 - nbits=nbits+33 - j=nmsg(ntype) - msg3(j)=msg - endif - endif - return - endif - - if(k.ge.11) then - ntx=ntx+1 !Transmission number - write(*,3002) ntx,ntype,nmsg(0:3),nbits -3002 format(i3,i5,2x,4i3,i6) - if(nmsg(0).ge.1) write(*,3010) ntx,msg0 -3010 format(i3,2x,a22) - if(nmsg(1).ge.1) write(*,3010) ntx,msg1 - do i=1,nmsg(2) - write(*,3010) ntx,msg2(i) - enddo - do i=1,nmsg(3) - write(*,3010) ntx,msg3(i) - enddo - nmsg=0 - nbits=0 - endif - - return -end subroutine sfox_assemble diff --git a/lib/superfox/sfox_assemble.f90 b/lib/superfox/sfox_assemble.f90 new file mode 100644 index 000000000..0ecbb3de4 --- /dev/null +++ b/lib/superfox/sfox_assemble.f90 @@ -0,0 +1,71 @@ +subroutine sfox_assemble(ntype,k,msg,mycall0,mygrid0) + +! In subsequent calls, assemble all necessary information for a SuperFox +! transmission. + + character*22 msg + character*22 msg0,msg1,msg2(10),msg3(5) + character*12 mycall0,mycall + character*4 mygrid0,mygrid + integer ntype !Message type: 0 Free Text + ! 1 CQ MyCall MyGrid + ! 2 Call_1 MyCall RR73 + ! 3 Call_1 MyCall rpt + integer nmsg(0:3) !Number of messages of type ntype + data nmsg/0,0,0,0/,nbits/0/,ntx/0/ + save + + if(mycall0(1:1).ne.' ') mycall=mycall0 + if(mygrid0(1:1).ne.' ') mygrid=mygrid0 + if(k.le.10) then + if(ntype.eq.0) then + if(nbits.le.191) then !Enough room for a free text message? + nmsg(ntype)=nmsg(ntype)+1 + nbits=nbits+142 + msg0=msg + endif + else if(ntype.eq.1) then + if(nbits.le.290) then + nmsg(ntype)=nmsg(ntype)+1 + nbits=nbits+43 + msg1=msg + endif + else if(ntype.eq.2) then + if(nbits.le.305) then + nmsg(ntype)=nmsg(ntype)+1 + nbits=nbits+28 + j=nmsg(ntype) + msg2(j)=msg + endif + else + if(nbits.le.300) then + nmsg(ntype)=nmsg(ntype)+1 + nbits=nbits+33 + j=nmsg(ntype) + msg3(j)=msg + endif + endif + return + endif + + if(k.ge.11) then +! All necessary pieces are in place. Now encode the SuperFox message and +! generate the waveform to be transmitted. + ntx=ntx+1 !Transmission number + write(*,3002) ntx,ntype,nmsg(0:3),nbits +3002 format(i3,i5,2x,4i3,i6) + if(nmsg(0).ge.1) write(*,3010) ntx,msg0 +3010 format(i3,2x,a22) + if(nmsg(1).ge.1) write(*,3010) ntx,msg1 + do i=1,nmsg(2) + write(*,3010) ntx,msg2(i) + enddo + do i=1,nmsg(3) + write(*,3010) ntx,msg3(i) + enddo + nmsg=0 + nbits=0 + endif + + return +end subroutine sfox_assemble