From 642540ff8f6c1704953acc5f61b87fb6cd71e79b Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Wed, 12 Sep 2018 15:06:26 -0500 Subject: [PATCH] unpack77 now returns logical variable unpk77_success, which will be .false. if there is something obviously wrong with the message. Still to do: set the flag if the unpacked message contains CQ in an implausible place. --- lib/77bit/packjt77.f90 | 11 ++++++++--- lib/fsk4hf/ldpcsim174_91.f90 | 3 ++- lib/ft8/ft8b_2.f90 | 6 +++--- lib/ft8/genft8_174_91.f90 | 3 ++- lib/genmsk_128_90.f90 | 4 ++-- lib/ldpcsim128_90.f90 | 5 +++-- lib/msk144decodeframe.f90 | 4 ++-- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index 5735a33a3..553f1a01b 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -194,7 +194,7 @@ subroutine pack77(msg0,i3,n3,c77) 900 return end subroutine pack77 -subroutine unpack77(c77,msg) +subroutine unpack77(c77,msg,unpk77_success) parameter (NSEC=84) !Number of ARRL Sections parameter (NUSCAN=65) !Number of US states and Canadian provinces @@ -211,6 +211,7 @@ subroutine unpack77(c77,msg) character*4 grid4,cserial character*3 csec(NSEC) character*38 c + logical unpk77_success data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/ data csec/ & @@ -232,10 +233,13 @@ subroutine unpack77(c77,msg) "NB ","NS ","QC ","ON ","MB ","SK ","AB ","BC ","NWT","NF ", & "LB ","NU ","VT ","PEI","DC "/ + unpk77_success=.true. + ! Check for bad data do i=1,77 if(c77(i:i).ne.'0' .and. c77(i:i).ne.'1') then - msg='QUIRK 2' + msg='failed unpack' + unpk77_success=.false. return endif enddo @@ -297,9 +301,10 @@ subroutine unpack77(c77,msg) else if(i3.eq.0 .and. (n3.eq.3 .or. n3.eq.4)) then ! 0.3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day - ! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day +! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day read(c77,1030) n28a,n28b,ir,intx,nclass,isec 1030 format(2b28,b1,b4,b3,b7) + if(isec.gt.NSEC .or. isec.lt.1) unpk77_success=.false. if(isec.gt.NSEC) isec=NSEC !### Check range for other params? ### if(isec.lt.1) isec=1 !### Flag these so they aren't printed? ### call unpack28(n28a,call_1) diff --git a/lib/fsk4hf/ldpcsim174_91.f90 b/lib/fsk4hf/ldpcsim174_91.f90 index ec948dfac..752adc2d8 100644 --- a/lib/fsk4hf/ldpcsim174_91.f90 +++ b/lib/fsk4hf/ldpcsim174_91.f90 @@ -14,6 +14,7 @@ integer*1 msgbits(77) integer*1 message77(77) integer*1 apmask(N), cw(N) integer nerrtot(0:N),nerrdec(0:N) +logical unpk77_success real*8, allocatable :: rxdata(:) real, allocatable :: llr(:) @@ -51,7 +52,7 @@ allocate ( rxdata(N), llr(N) ) i3=0 n3=1 call pack77(msg,i3,n3,c77) !Pack into 12 6-bit bytes - call unpack77(c77,msgsent) !Unpack to get msgsent + call unpack77(c77,msgsent,unpk77_success) !Unpack to get msgsent write(*,*) "message sent ",msgsent read(c77,'(77i1)') msgbits(1:77) diff --git a/lib/ft8/ft8b_2.f90 b/lib/ft8/ft8b_2.f90 index d755f6914..5db727168 100644 --- a/lib/ft8/ft8b_2.f90 +++ b/lib/ft8/ft8b_2.f90 @@ -36,7 +36,7 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & complex ctwk(32) complex csymb(32) complex cs(0:7,NN) - logical first,newdat,lsubtract,lapon,lapcqonly,nagain + logical first,newdat,lsubtract,lapon,lapcqonly,nagain,unpk77_success data icos7/3,1,4,0,6,5,2/ ! Flipped w.r.t. original FT8 sync array data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/ data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/ @@ -321,8 +321,8 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & if(i3.gt.4 .or. (i3.eq.0.and.n3.gt.5)) then cycle endif - call unpack77(c77,msg37) - if(index(msg37,'QU1RK').gt.0) then + call unpack77(c77,msg37,unpk77_success) + if(.not.unpk77_success) then cycle endif nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message. diff --git a/lib/ft8/genft8_174_91.f90 b/lib/ft8/genft8_174_91.f90 index f7529f4b3..d56187d6c 100644 --- a/lib/ft8/genft8_174_91.f90 +++ b/lib/ft8/genft8_174_91.f90 @@ -10,11 +10,12 @@ subroutine genft8_174_91(msg,i3,n3,msgsent,msgbits,itone) integer itone(79) integer icos7(0:6) integer graymap(0:7) + logical unpk77_success data icos7/3,1,4,0,6,5,2/ !Costas 7x7 tone pattern data graymap/0,1,3,2,5,6,4,7/ call pack77(msg,i3,n3,c77) - call unpack77(c77,msgsent) + call unpack77(c77,msgsent,unpk77_success) read(c77,'(77i1)',err=1) msgbits go to 2 diff --git a/lib/genmsk_128_90.f90 b/lib/genmsk_128_90.f90 index a0979cc50..f1e82f683 100644 --- a/lib/genmsk_128_90.f90 +++ b/lib/genmsk_128_90.f90 @@ -32,7 +32,7 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype) real*8 xi(864),xq(864),pi,twopi data s8/0,1,1,1,0,0,1,0/ equivalence (ihash,i1hash) - logical first + logical first,unpk77_success data first/.true./ save @@ -73,7 +73,7 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype) endif call pack77(message,i3,n3,c77) - call unpack77(c77,msgsent) !Unpack to get msgsent + call unpack77(c77,msgsent,unpk77_success) !Unpack to get msgsent if(ichk.eq.1) go to 999 read(c77,"(77i1)") msgbits call encode_128_90(msgbits,codeword) diff --git a/lib/ldpcsim128_90.f90 b/lib/ldpcsim128_90.f90 index ebe759806..05b424b7e 100644 --- a/lib/ldpcsim128_90.f90 +++ b/lib/ldpcsim128_90.f90 @@ -14,6 +14,7 @@ program ldpcsim128_90 integer*1 msgbits(77) integer*4 i4Msg6BitWords(13) integer nerrtot(0:N),nerrdec(0:N) + logical unpk77_success real*8 rxdata(N), rxavgd(N) real llr(N) @@ -47,7 +48,7 @@ program ldpcsim128_90 i3=0 n3=1 call pack77(msg,i3,n3,c77) - call unpack77(c77,msgsent) + call unpack77(c77,msgsent,unpk77_success) read(c77,'(77i1)') msgbits write(*,*) "message sent ",msgsent @@ -107,7 +108,7 @@ program ldpcsim128_90 ! If the decoder finds a valid codeword, nharderrors will be .ge. 0. if( nharderrors .ge. 0 ) then write(c77,'(77i1)') message77 - call unpack77(c77,msgreceived) + call unpack77(c77,msgreceived,unpk77_success) nhw=count(cw.ne.codeword) if(nhw.eq.0) then ! this is a good decode ngood=ngood+1 diff --git a/lib/msk144decodeframe.f90 b/lib/msk144decodeframe.f90 index d6651e711..4fcb2cfe9 100644 --- a/lib/msk144decodeframe.f90 +++ b/lib/msk144decodeframe.f90 @@ -15,7 +15,7 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecen real pp(12) real softbits(144) real llr(128) - logical first + logical first,unpk77_success data first/.true./ data s8/0,1,1,1,0,0,1,0/ save first,cb,fs,pi,twopi,dt,s8,pp @@ -101,7 +101,7 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecen if( nharderror .ge. 0 .and. nharderror .lt. 18 ) then nsuccess=1 write(c77,'(77i1)') decoded77 - call unpack77(c77,msgreceived) + call unpack77(c77,msgreceived,unpk77_success) endif return