diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index 7dd541a13..1ee37f5c1 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -22,7 +22,7 @@ subroutine hash10(n10,c13) if(n10.lt.1 .or. n10.gt.1024) return if(len(trim(calls10(n10))).gt.0) then c13=calls10(n10) - c13='<'//trim(c13)//'>'//' ' + c13='<'//trim(c13)//'>' endif return @@ -36,7 +36,7 @@ subroutine hash12(n12,c13) if(n12.lt.1 .or. n12.gt.4096) return if(len(trim(calls12(n12))).gt.0) then c13=calls12(n12) - c13='<'//trim(c13)//'>'//' ' + c13='<'//trim(c13)//'>' endif return @@ -51,7 +51,7 @@ subroutine hash22(n22,c13) do i=1,nzhash if(ihash22(i).eq.n22) then c13=calls22(i) - c13='<'//trim(c13)//'>'//' ' + c13='<'//trim(c13)//'>' go to 900 endif enddo @@ -146,7 +146,7 @@ subroutine pack77(msg0,i3,n3,c77) ! Check 0.5 (telemetry) 5 i0=index(msg,' ') - c18=msg(1:i0-1)//' ' + c18=msg(1:i0-1) c18=adjustr(c18) ntel=-99 read(c18,1005,err=6) ntel @@ -206,7 +206,7 @@ subroutine unpack77(c77,nrx,msg,unpk77_success) character*3 csec(NSEC) character*38 c integer hashmy10,hashmy12,hashmy22,hashdx10,hashdx12,hashdx22 - logical unpk28_success,unpk77_success,first + logical unpk28_success,unpk77_success logical dxcall13_set,mycall13_set data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/ @@ -288,10 +288,10 @@ subroutine unpack77(c77,nrx,msg,unpk77_success) call hash10(n10,call_3) if(nrx.eq.1 .and. & dxcall13_set .and. & - hashdx10.eq.n10) call_3='<'//trim(dxcall13)//'>'//' ' + hashdx10.eq.n10) call_3='<'//trim(dxcall13)//'>' if(nrx.eq.0 .and. & mycall13_set .and. & - n10.eq.hashmy10) call_3='<'//trim(mycall13)//'>'//' ' + n10.eq.hashmy10) call_3='<'//trim(mycall13)//'>' msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)//' '//crpt else if(i3.eq.0 .and. n3.eq.2) then ! 0.2 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 70 EU VHF contest @@ -300,7 +300,7 @@ subroutine unpack77(c77,nrx,msg,unpk77_success) call unpack28(n28a,call_1,unpk28_success) if(.not.unpk28_success .or. n28a.le.2) unpk77_success=.false. nrs=52+irpt - if(ip.eq.1) call_1=trim(call_1)//'/P'//' ' + if(ip.eq.1) call_1=trim(call_1)//'/P' write(cexch,1022) nrs,iserial 1022 format(i2,i4.4) n=igrid6 @@ -470,18 +470,18 @@ subroutine unpack77(c77,nrx,msg,unpk77_success) if(nrx.eq.1 .and. & dxcall13_set .and. mycall13_set .and. & call_2.eq.dxcall13 .and. & - n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>'//' ' + n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>' if(nrx.eq.1 .and. & mycall13_set .and. & index(call_1,'<...>').gt.0 .and. & - n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>'//' ' + n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>' else ! 12 bit hash for DE call - call_1=adjustl(c11)//' ' + call_1=adjustl(c11) call_2=call_3 call add_call_to_recent_calls(call_1) if(nrx.eq.0 .and. & mycall13_set .and. & - n12.eq.hashmy12) call_2='<'//trim(mycall13)//'>'//' ' + n12.eq.hashmy12) call_2='<'//trim(mycall13)//'>' endif if(icq.eq.0) then if(nrpt.eq.0) msg=trim(call_1)//' '//trim(call_2) @@ -559,7 +559,7 @@ subroutine pack28(c13,n28) go to 900 endif if(nlet.ge.1 .and. nlet.le.4 .and. nnum.eq.0) then - c4=c13(4:n)//' ' + c4=c13(4:n) c4=adjustr(c4) m=0 do i=1,4 @@ -578,7 +578,7 @@ subroutine pack28(c13,n28) if(c13(1:1).eq.'<')then call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table i2=index(c13,'>') - c13=c13(2:i2-1)//' ' + c13=c13(2:i2-1) n22=ihashcall(c13,22) n28=NTOKENS + n22 go to 900 @@ -693,7 +693,7 @@ subroutine unpack28(n28_0,c13,success) i5=n/27 i6=n-27*i5 c13=c1(i1+1:i1+1)//c2(i2+1:i2+1)//c3(i3+1:i3+1)//c4(i4+1:i4+1)// & - c4(i5+1:i5+1)//c4(i6+1:i6+1)//' ' + c4(i5+1:i5+1)//c4(i6+1:i6+1) c13=adjustl(c13) 900 i0=index(c13,' ') @@ -785,7 +785,7 @@ subroutine pack77_01(nwords,w,i3,n3,c77) call pack28(w(3),n28b) call save_hash_call(w(4),n10,n12,n22) i2=index(w(4),'>') - c13=w(4)(2:i2-1)//' ' + c13=w(4)(2:i2-1) n10=ihashcall(c13,10) write(c77,1010) n28a,n28b,n10,n5,n3,i3 1010 format(2b28.28,b10.10,b5.5,2b3.3) @@ -820,13 +820,14 @@ subroutine pack77_02(nwords,w,i3,n3,c77) ! Type 0.2: PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 70 EU VHF contest i3=0 n3=2 - ip=0 - c13=w(1) - i=index(w(1),'/P') + i=index(w(1)//' ','/P ') if(i.ge.4) then ip=1 - c13=w(1)(1:i-1)//' ' - endif + c13=w(1)(1:i-1) + else + ip=0 + c13=w(1) + end if call pack28(c13,n28a) ir=0 if(w(2)(1:2).eq.'R ') ir=1 @@ -967,22 +968,24 @@ subroutine pack77_1(nwords,w,i3,n3,c77) ! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg ! 2 PA3XYZ/P GM4ABC/P R JO22 28 1 28 1 1 15 74 EU VHF contest -10 if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. & - w(3)(1:2).eq.'R ')) then +10 i1psuffix=index(w(1)//' ' ,'/P ') + i2psuffix=index(w(2)//' ','/P ') + if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. & + w(3)(1:2).eq.'R ')) then n3=0 i3=1 !Type 1: Standard message, possibly with "/R" - if(index(w(1),'/P').ge.4 .or. index(w(2),'/P').ge.4) i3=2 !Type 2, with "/P" + if (i1psuffix.ge.4.or.i2psuffix.ge.4) i3=2 !Type 2, with "/P" endif - c13=bcall_1//' ' + c13=bcall_1 if(c13(1:3).eq.'CQ_' .or. w(1)(1:1).eq.'<') c13=w(1) call pack28(c13,n28a) - c13=bcall_2//' ' + c13=bcall_2 if(w(2)(1:1).eq.'<') c13=w(2) call pack28(c13,n28b) ipa=0 ipb=0 - if(index(w(1),'/P').ge.4 .or. index(w(1),'/R').ge.4) ipa=1 - if(index(w(2),'/P').ge.4 .or. index(w(2),'/R').ge.4) ipb=1 + if(i1psuffix.ge.4.or.index(w(1)//' ','/R ').ge.4) ipa=1 + if(i2psuffix.ge.4.or.index(w(2)//' ','/R ').ge.4) ipb=1 grid4=w(nwords)(1:4) if(is_grid4(grid4)) then @@ -1097,10 +1100,8 @@ subroutine pack77_4(nwords,w,i3,n3,c77) if(nwords.eq.2 .or. nwords.eq.3) then call_1=w(1) if(call_1(1:1).eq.'<') call_1=w(1)(2:len(trim(w(1)))-1) - call_1=call_1//' ' call_2=w(2) if(call_2(1:1).eq.'<') call_2=w(2)(2:len(trim(w(2)))-1) - call_2=call_2//' ' call chkcall(call_1,bcall_1,ok1) call chkcall(call_2,bcall_2,ok2) icq=0 diff --git a/lib/ft8/ft8apset.f90 b/lib/ft8/ft8apset.f90 index 15eddd057..56a18c4fe 100644 --- a/lib/ft8/ft8apset.f90 +++ b/lib/ft8/ft8apset.f90 @@ -1,22 +1,21 @@ subroutine ft8apset(mycall12,hiscall12,apsym) use packjt77 character*77 c77 - character*37 msg + character*37 msg,msgchk character*12 mycall12,hiscall12,hiscall integer apsym(58) - logical nohiscall + logical nohiscall,unpk77_success - if(len(trim(mycall12)).eq.0) then - apsym=0 - apsym(1)=99 - apsym(30)=99 - return - endif + apsym=0 + apsym(1)=99 + apsym(30)=99 + + if(len(trim(mycall12)).lt.3) return nohiscall=.false. hiscall=hiscall12 - if(len(trim(hiscall)).eq.0) then - hiscall="K9ABC" + if(len(trim(hiscall)).lt.3) then + hiscall=mycall12 ! use mycall for dummy hiscall - mycall won't be hashed. nohiscall=.true. endif @@ -24,12 +23,9 @@ subroutine ft8apset(mycall12,hiscall12,apsym) ! msg=trim(mycall12)//' '//trim(hiscall)//' RRR' call pack77(msg,i3,n3,c77) - if(i3.ne.1) then - apsym=0 - apsym(1)=99 - apsym(30)=99 - return - endif + call unpack77(c77,1,msgchk,unpk77_success) + + if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_success) return read(c77,'(58i1)',err=1) apsym(1:58) apsym=2*apsym-1 diff --git a/lib/wsprd/wsprd.c b/lib/wsprd/wsprd.c index b95356df4..3fb15f5af 100644 --- a/lib/wsprd/wsprd.c +++ b/lib/wsprd/wsprd.c @@ -1254,7 +1254,7 @@ int main(int argc, char *argv[]) not_decoded=1; int osd_decode=0; int ib=1, blocksize; - int n1,n2; + int n1,n2,n3,nadd,nu,ntype; while( ib <= nblocksize && not_decoded ) { blocksize=ib; idt=0; ii=0; @@ -1311,17 +1311,23 @@ int main(int argc, char *argv[]) unpack50(message,&n1,&n2); if( !unpackcall(n1,callsign) ) break; callsign[12]=0; - ihash=nhash(callsign,strlen(callsign),(uint32_t)146); - int ntype = (n2&127) - 64; - if(strncmp(hashtab+ihash*13,callsign,13)==0 - && (ntype >= 0) && (ntype <= 62) ) { - int nu = ntype%10; - if( nu == 0 || nu == 3 || nu == 7 ) { + ntype = (n2&127) - 64; + if( (ntype >= 0) && (ntype <= 62) ) { + nu = ntype%10; + if( !(nu == 0 || nu == 3 || nu == 7) ) { + nadd=nu; + if( nu > 3 ) nadd=nu-3; + if( nu > 7 ) nadd=nu-7; + n3=n2/128+32768*(nadd-1); + if( !unpackpfx(n3,callsign) ) break; + } + ihash=nhash(callsign,strlen(callsign),(uint32_t)146); + if(strncmp(hashtab+ihash*13,callsign,13)==0) { not_decoded=0; osd_decode =1; break; } - } + } } } diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 4f7f4dc8b..bb0089d95 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3173,8 +3173,8 @@ void MainWindow::readFromStdout() //readFromStdout QString grid; decodedtext.deCallAndGrid(/*out*/deCall,grid); { - QString t=Radio::base_callsign(ui->dxCallEntry->text()); - if((t==deCall or t=="") and rpt!="") m_rptRcvd=rpt; + auto t = Radio::base_callsign (ui->dxCallEntry->text ()); + if ((t == deCall || ui->dxCallEntry->text () == deCall || !t.size ()) && rpt.size ()) m_rptRcvd = rpt; } // extract details and send to PSKreporter int nsec=QDateTime::currentMSecsSinceEpoch()/1000-m_secBandChanged;