mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-30 19:58:00 -04:00
------------------------------------------------------------------------ r8060 | k1jt | 2017-09-01 13:51:42 +0100 (Fri, 01 Sep 2017) | 2 lines Add a link to G3WDG doc on using QRA64 for microwave EME. ------------------------------------------------------------------------ r8061 | k1jt | 2017-09-01 17:22:19 +0100 (Fri, 01 Sep 2017) | 1 line Fix a misspelled word. ------------------------------------------------------------------------ r8062 | bsomervi | 2017-09-01 21:10:35 +0100 (Fri, 01 Sep 2017) | 7 lines Rationalize NA contest mode Generic message packing and unpacking routines now understand antipode grid contest messages. These messages are now recognized as standard messages in message response processing and dealt with appropriately when contest mode is selected and applicable (currently FT8 and MSK144 only). ------------------------------------------------------------------------ r8063 | bsomervi | 2017-09-01 21:43:45 +0100 (Fri, 01 Sep 2017) | 1 line Fix issue compiling with Qt older than v5.7 ------------------------------------------------------------------------ r8064 | bsomervi | 2017-09-01 22:29:02 +0100 (Fri, 01 Sep 2017) | 7 lines Fix issues with type 2 compound calls in contest mode Message generation in contest mode now generates the correct Tx3 for type 2 calls. "<type-2> 73" is a free text so needed special handling in message processing. ------------------------------------------------------------------------ r8065 | bsomervi | 2017-09-01 23:22:20 +0100 (Fri, 01 Sep 2017) | 11 lines Improved message generation for type 2 calls in contest mode These attempt to ensure that a prefix is logged by the QSO partner even if the compound call holder user Tx3 to tail-end a QSO. The type 2 message generation options are largely overridden in contest mode as only a few options make sense. Key is that Tx1 may use only the base call when calling split is necessary, this requires that both Tx3 and Tx4 have the full compound call otherwise the QSO partner will never see the full call until it is possibly too late i.e. post logging. ------------------------------------------------------------------------ r8066 | bsomervi | 2017-09-02 00:28:44 +0100 (Sat, 02 Sep 2017) | 5 lines Fix erroneous auto stop critera for auto reply in FT8 We cannot assume that a "DE <dx-call> <anything>" is or is not for us so we must continue calling and risk possible QRM. Calling split avoids this issue. ------------------------------------------------------------------------ git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.8@8067 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
148 lines
4.2 KiB
Fortran
148 lines
4.2 KiB
Fortran
subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
|
! s8 + 48bits + s8 + 80 bits = 144 bits (72ms message duration)
|
|
!
|
|
! Encode an MSK144 message
|
|
! Input:
|
|
! - msg0 requested message to be transmitted
|
|
! - ichk if ichk=1, return only msgsent
|
|
! if ichk.ge.10000, set imsg=ichk-10000 for short msg
|
|
! - msgsent message as it will be decoded
|
|
! - i4tone array of audio tone values, 0 or 1
|
|
! - itype message type
|
|
! 1 = standard message "Call_1 Call_2 Grid/Rpt"
|
|
! 2 = type 1 prefix
|
|
! 3 = type 1 suffix
|
|
! 4 = type 2 prefix
|
|
! 5 = type 2 suffix
|
|
! 6 = free text (up to 13 characters)
|
|
! 7 = short message "<Call_1 Call2> Rpt"
|
|
|
|
use iso_c_binding, only: c_loc,c_size_t
|
|
use packjt
|
|
use hashing
|
|
character*22 msg0
|
|
character*22 message !Message to be generated
|
|
character*22 msgsent !Message as it will be received
|
|
character*6 mygrid
|
|
integer*4 i4Msg6BitWords(13) !72-bit message as 6-bit words
|
|
integer*4 i4tone(144) !
|
|
integer*1, target:: i1Msg8BitBytes(10) !80 bits represented in 10 bytes
|
|
integer*1 codeword(128) !Encoded bits before re-ordering
|
|
integer*1 msgbits(80) !72-bit message + 8-bit hash
|
|
integer*1 bitseq(144) !Tone #s, data and sync (values 0-1)
|
|
integer*1 i1hash(4)
|
|
integer*1 s8(8)
|
|
logical bcontest
|
|
real*8 pp(12)
|
|
real*8 xi(864),xq(864),pi,twopi
|
|
data s8/0,1,1,1,0,0,1,0/
|
|
equivalence (ihash,i1hash)
|
|
logical first
|
|
data first/.true./
|
|
save
|
|
|
|
if(first) then
|
|
first=.false.
|
|
nsym=128
|
|
pi=4.0*atan(1.0)
|
|
twopi=8.*atan(1.0)
|
|
do i=1,12
|
|
pp(i)=sin((i-1)*pi/12)
|
|
enddo
|
|
endif
|
|
|
|
if(msg0(1:1).eq.'@') then !Generate a fixed tone
|
|
read(msg0(2:5),*,end=1,err=1) nfreq !at specified frequency
|
|
go to 2
|
|
1 nfreq=1000
|
|
2 i4tone(1)=nfreq
|
|
else
|
|
message=msg0
|
|
do i=1,22
|
|
if(ichar(message(i:i)).eq.0) then
|
|
message(i:)=' '
|
|
exit
|
|
endif
|
|
enddo
|
|
|
|
do i=1,22 !Strip leading blanks
|
|
if(message(1:1).ne.' ') exit
|
|
message=message(i+1:)
|
|
enddo
|
|
|
|
if(message(1:1).eq.'<') then
|
|
call genmsk40(message,msgsent,ichk,i4tone,itype)
|
|
if(itype.lt.0) go to 999
|
|
i4tone(41)=-40
|
|
go to 999
|
|
endif
|
|
|
|
call packmsg(message,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
|
|
call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
|
|
|
|
if(ichk.eq.1) go to 999
|
|
i4=0
|
|
ik=0
|
|
im=0
|
|
do i=1,12
|
|
nn=i4Msg6BitWords(i)
|
|
do j=1, 6
|
|
ik=ik+1
|
|
i4=i4+i4+iand(1,ishft(nn,j-6))
|
|
i4=iand(i4,255)
|
|
if(ik.eq.8) then
|
|
im=im+1
|
|
i1Msg8BitBytes(im)=i4
|
|
ik=0
|
|
endif
|
|
enddo
|
|
enddo
|
|
|
|
ihash=nhash(c_loc(i1Msg8BitBytes),int(9,c_size_t),146)
|
|
ihash=2*iand(ihash,32767) !Generate the 8-bit hash
|
|
i1Msg8BitBytes(10)=i1hash(1) !CRC to byte 10
|
|
|
|
mbit=0
|
|
do i=1, 10
|
|
i1=i1Msg8BitBytes(i)
|
|
do ibit=1,8
|
|
mbit=mbit+1
|
|
msgbits(mbit)=iand(1,ishft(i1,ibit-8))
|
|
enddo
|
|
enddo
|
|
|
|
call encode_msk144(msgbits,codeword)
|
|
|
|
!Create 144-bit channel vector:
|
|
!8-bit sync word + 48 bits + 8-bit sync word + 80 bits
|
|
bitseq=0
|
|
bitseq(1:8)=s8
|
|
bitseq(9:56)=codeword(1:48)
|
|
bitseq(57:64)=s8
|
|
bitseq(65:144)=codeword(49:128)
|
|
bitseq=2*bitseq-1
|
|
|
|
xq(1:6)=bitseq(1)*pp(7:12) !first bit is mapped to 1st half-symbol on q
|
|
do i=1,71
|
|
is=(i-1)*12+7
|
|
xq(is:is+11)=bitseq(2*i+1)*pp
|
|
enddo
|
|
xq(864-5:864)=bitseq(1)*pp(1:6) !last half symbol
|
|
do i=1,72
|
|
is=(i-1)*12+1
|
|
xi(is:is+11)=bitseq(2*i)*pp
|
|
enddo
|
|
! Map I and Q to tones.
|
|
i4tone=0
|
|
do i=1,72
|
|
i4tone(2*i-1)=(bitseq(2*i)*bitseq(2*i-1)+1)/2;
|
|
i4tone(2*i)=-(bitseq(2*i)*bitseq(mod(2*i,144)+1)-1)/2;
|
|
enddo
|
|
endif
|
|
|
|
! Flip polarity
|
|
i4tone=-i4tone+1
|
|
|
|
999 return
|
|
end subroutine genmsk144
|