From dd9bdc6d1f3325f51feb750a8259f649c2eee113 Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Fri, 5 Oct 2018 20:56:22 -0500 Subject: [PATCH] Fix bug that prevented generation of MSK144 Sh messages with extended callsign. Change all MSK144 Sh code to use 12-char mycall and hiscall and 37-char messages. Hash full extended callsigns (not just base call) and print full callsigns, e.g. RRR --- lib/genmsk40.f90 | 2 +- lib/genmsk_128_90.f90 | 18 ++++++++++++------ lib/msk40decodeframe.f90 | 6 +++--- lib/msk40spd.f90 | 4 ++-- lib/mskrtd.f90 | 8 +++----- lib/update_hasharray.f90 | 6 +++--- mainwindow.cpp | 15 +++++++++------ 7 files changed, 33 insertions(+), 26 deletions(-) diff --git a/lib/genmsk40.f90 b/lib/genmsk40.f90 index 80411819f..4177cbc2e 100644 --- a/lib/genmsk40.f90 +++ b/lib/genmsk40.f90 @@ -29,7 +29,7 @@ subroutine genmsk40(msg,msgsent,ichk,itone,itype) 10 irpt=i !Report index, 0-15 if(ichk.lt.10000) then hashmsg=msg(2:i1-1) - call hash(hashmsg,22,ihash) + call hash(hashmsg,37,ihash) ihash=iand(ihash,4095) !12-bit hash ig=16*ihash + irpt !4-bit report else diff --git a/lib/genmsk_128_90.f90 b/lib/genmsk_128_90.f90 index 7ced79f29..bfd175db3 100644 --- a/lib/genmsk_128_90.f90 +++ b/lib/genmsk_128_90.f90 @@ -46,6 +46,7 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype) enddo endif + message(1:37)=' ' itype=1 if(msg0(1:1).eq.'@') then !Generate a fixed tone read(msg0(2:5),*,end=1,err=1) nfreq !at specified frequency @@ -54,23 +55,28 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype) 2 i4tone(1)=nfreq else message=msg0 + do i=1, 37 if(ichar(message(i:i)).eq.0) then - message(i:)=' ' + message(i:37)=' ' exit endif enddo - do i=1,37 !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 + i2=index(message,'>') + i1=0 + if(i2.gt.0) i1=index(message(1:i2),' ') + if(i1.gt.0) then + call genmsk40(message,msgsent,ichk,i4tone,itype) + if(itype.lt.0) go to 999 + i4tone(41)=-40 + go to 999 + endif endif i3=-1 diff --git a/lib/msk40decodeframe.f90 b/lib/msk40decodeframe.f90 index 51c9346a8..2023412ec 100644 --- a/lib/msk40decodeframe.f90 +++ b/lib/msk40decodeframe.f90 @@ -5,8 +5,8 @@ subroutine msk40decodeframe(c,mycall,hiscall,xsnr,bswl,nhasharray, & parameter (NSPM=240) character*4 rpt(0:15) - character*6 mycall,hiscall,mycall0,hiscall0 - character*22 hashmsg,msgreceived + character*12 mycall,hiscall,mycall0,hiscall0 + character*37 hashmsg,msgreceived complex cb(42) complex cfac,cca complex c(NSPM) @@ -59,7 +59,7 @@ subroutine msk40decodeframe(c,mycall,hiscall,xsnr,bswl,nhasharray, & hashmsg=trim(mycall)//' '//trim(hiscall) if( hashmsg .ne. ' ' .and. hiscall .ne. '' ) then ! protect against blank mycall/hiscall call fmtmsg(hashmsg,iz) - call hash(hashmsg,22,ihash) + call hash(hashmsg,37,ihash) ihash=iand(ihash,4095) else ihash=9999 ! so that it can never match a received hash diff --git a/lib/msk40spd.f90 b/lib/msk40spd.f90 index 337bc8cc8..63532ae94 100644 --- a/lib/msk40spd.f90 +++ b/lib/msk40spd.f90 @@ -6,8 +6,8 @@ subroutine msk40spd(cbig,n,ntol,mycall,hiscall,bswl,nhasharray, & use timer_module, only: timer parameter (NSPM=240, MAXSTEPS=150, NFFT=NSPM, MAXCAND=5, NPATTERNS=6) - character*6 mycall,hiscall - character*22 msgreceived + character*12 mycall,hiscall + character*37 msgreceived complex cbig(n) complex cdat(3*NSPM) !Analytic signal complex c(NSPM) diff --git a/lib/mskrtd.f90 b/lib/mskrtd.f90 index d3fdada63..abb5f766d 100644 --- a/lib/mskrtd.f90 +++ b/lib/mskrtd.f90 @@ -15,8 +15,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & character*4 decsym !"&" for mskspd or "^" for long averages character*37 msgreceived !Decoded message - character*22 msgrx22 !Sh messages are returned as 22chars - character*37 msglast,msglastswl !Used for dupechecking + character*37 msglast,msglastswl !Used for dupechecking character*80 line !Formatted line with UTC dB T Freq Msg character*12 mycall,hiscall character*6 mygrid @@ -119,9 +118,8 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & call msk144spd(cdat,np,ntol,ndecodesuccess,msgreceived,fc,fest,tdec,navg,ct, & softbits) if(ndecodesuccess.eq.0 .and. (bshmsg.or.bswl)) then - call msk40spd(cdat,np,ntol,mycall(1:6),hiscall(1:6),bswl,nhasharray, & - ndecodesuccess,msgrx22,fc,fest,tdec,navg) - if( ndecodesuccess .ge. 1 ) msgreceived=msgrx22//' ' + call msk40spd(cdat,np,ntol,mycall,hiscall,bswl,nhasharray, & + ndecodesuccess,msgreceived,fc,fest,tdec,navg) endif if( ndecodesuccess .ge. 1 ) then tdec=tsec+tdec diff --git a/lib/update_hasharray.f90 b/lib/update_hasharray.f90 index 4ccbba51c..baf50329f 100644 --- a/lib/update_hasharray.f90 +++ b/lib/update_hasharray.f90 @@ -1,7 +1,7 @@ subroutine update_hasharray(nhasharray) use packjt77 - character*22 hashmsg + character*37 hashmsg integer nhasharray(MAXRECENT,MAXRECENT) nhasharray=-1 @@ -10,12 +10,12 @@ subroutine update_hasharray(nhasharray) if( recent_calls(i)(1:1) .ne. ' ' .and. recent_calls(j)(1:1) .ne. ' ' ) then hashmsg=trim(recent_calls(i))//' '//trim(recent_calls(j)) call fmtmsg(hashmsg,iz) - call hash(hashmsg,22,ihash) + call hash(hashmsg,37,ihash) ihash=iand(ihash,4095) nhasharray(i,j)=ihash hashmsg=trim(recent_calls(j))//' '//trim(recent_calls(i)) call fmtmsg(hashmsg,iz) - call hash(hashmsg,22,ihash) + call hash(hashmsg,37,ihash) ihash=iand(ihash,4095) nhasharray(j,i)=ihash endif diff --git a/mainwindow.cpp b/mainwindow.cpp index 2a77a8813..765f1db61 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1510,11 +1510,13 @@ void MainWindow::fastSink(qint64 frames) int RxFreq=ui->RxFreqSpinBox->value (); int nTRpDepth=m_TRperiod + 1000*(m_ndepth & 3); qint64 ms0 = QDateTime::currentMSecsSinceEpoch(); - strncpy(dec_data.params.mycall, (m_baseCall+" ").toLatin1(),12); +// strncpy(dec_data.params.mycall, (m_baseCall+" ").toLatin1(),12); + strncpy(dec_data.params.mycall,(m_config.my_callsign () + " ").toLatin1(),12); QString hisCall {ui->dxCallEntry->text ()}; bool bshmsg=ui->cbShMsgs->isChecked(); bool bswl=ui->cbSWL->isChecked(); - strncpy(dec_data.params.hiscall,(Radio::base_callsign (hisCall) + " ").toLatin1 ().constData (), 12); +// strncpy(dec_data.params.hiscall,(Radio::base_callsign (hisCall) + " ").toLatin1 ().constData (), 12); + strncpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), 12); strncpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(),6); QString dataDir; dataDir = m_config.writeable_data_dir ().absolutePath (); @@ -4708,6 +4710,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional) (!bMyCall or !bHisCall or m_config.bGenerate77()); QString t0=hisBase + " " + m_baseCall + " "; + QString t0s=hisCall + " " + my_callsign + " "; QString t0a,t0b; if(b77) { if(bHisCall and bMyCall) t0=hisCall + " " + my_callsign + " "; @@ -4763,8 +4766,8 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional) } if(m_mode=="MSK144" and m_bShMsgs) { - int i=t0.length()-1; - t0="<" + t0.mid(0,i) + "> "; + int i=t0s.length()-1; + t0="<" + t0s.mid(0,i) + "> "; if(!m_config.bNA_VHF_Contest()) { if(n<=-2) n=-3; if(n>=-1 and n<=1) n=0; @@ -4790,7 +4793,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional) } t=t0 + (m_send_RR73 ? "RR73" : "RRR"); - if(m_mode=="MSK144" or m_mode=="FT8") { + if((m_mode=="MSK144" and !m_bShMsgs) or m_mode=="FT8") { if(!bHisCall and bMyCall) t=hisCall + " <" + my_callsign + "> " + (m_send_RR73 ? "RR73" : "RRR"); if(bHisCall and !bMyCall) t="<" + hisCall + "> " + my_callsign + " " + (m_send_RR73 ? "RR73" : "RRR"); } @@ -4798,7 +4801,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional) msgtype(t, ui->tx4); t=t0 + "73"; - if(m_mode=="MSK144" or m_mode=="FT8") { + if((m_mode=="MSK144" and !m_bShMsgs) or m_mode=="FT8") { if(!bHisCall and bMyCall) t=hisCall + " <" + my_callsign + "> 73"; if(bHisCall and !bMyCall) t="<" + hisCall + "> " + my_callsign + " 73"; }