From d1289e23f368556e20eb123729d09bf185934693 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 11 Dec 2012 18:50:07 +0000 Subject: [PATCH] Implemented "CQ DX " by disguising it as callsign "CQ9DX ". git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2791 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/genjt9.f90 | 10 ++++------ lib/jt9code.f90 | 8 ++++++-- lib/packmsg.f90 | 4 +++- lib/unpackmsg.f90 | 5 ++++- mainwindow.cpp | 10 ++++++---- mainwindow.h | 3 ++- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/lib/genjt9.f90 b/lib/genjt9.f90 index 2ee65782b..25be708d0 100644 --- a/lib/genjt9.f90 +++ b/lib/genjt9.f90 @@ -1,4 +1,4 @@ -subroutine genjt9(msg0,msgsent,i4tone) +subroutine genjt9(msg0,ichk,msgsent,i4tone,itext) ! Encodes a JT9 message and returns msgsent, the message as it will ! be decoded, and an integer array i4tone(85) of 9-FSK tone values @@ -32,12 +32,10 @@ subroutine genjt9(msg0,msgsent,i4tone) enddo call packmsg(message,i4Msg6BitWords,text) !Pack message into 12 6-bit bytes + itext=0 + if(text) itext=1 call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent - if(i4tone(1).eq.-99) then - i4tone(2)=0 - if(text) i4tone(2)=1 - go to 999 - endif + if(ichk.ne.0) go to 999 call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, convert to 8-bit bytes nsym2=206 call encode232(i1Msg8BitBytes,nsym2,i1EncodedBits) !Encode K=32, r=1/2 diff --git a/lib/jt9code.f90 b/lib/jt9code.f90 index 85c861248..70c008e51 100644 --- a/lib/jt9code.f90 +++ b/lib/jt9code.f90 @@ -26,10 +26,14 @@ program jt9code write(*,1000) msg0 1000 format('Message:',3x,a22) msg=msg0 - call genjt9(msg,decoded,i4tone) !Encode message into tone #s + ichk=0 + itext=0 + call genjt9(msg,ichk,decoded,i4tone,itext) !Encode message into tone #s write(*,1002) i4tone 1002 format('Channel symbols:'/(30i2)) - write(*,1004) decoded + if(itext.eq.0) write(*,1004) decoded 1004 format('Decoded message:',1x,a22) + if(itext.ne.0) write(*,1005) decoded +1005 format('Decoded message:',1x,a22,3x,'(free text)') 999 end program jt9code diff --git a/lib/packmsg.f90 b/lib/packmsg.f90 index 509e4679c..6c7619bd0 100644 --- a/lib/packmsg.f90 +++ b/lib/packmsg.f90 @@ -24,8 +24,10 @@ subroutine packmsg(msg,dat,text) iz=iz-1 enddo +5 if(msg(1:6).eq.'CQ DX ') msg(3:3)='9' + ! See if it's a CQ message -5 if(msg(1:3).eq.'CQ ') then + if(msg(1:3).eq.'CQ ') then i=3 ! ... and if so, does it have a reply frequency? if(msg(4:4).ge.'0' .and. msg(4:4).le.'9' .and. & diff --git a/lib/unpackmsg.f90 b/lib/unpackmsg.f90 index 8b9c5fad8..3cc2d8df3 100644 --- a/lib/unpackmsg.f90 +++ b/lib/unpackmsg.f90 @@ -96,5 +96,8 @@ subroutine unpackmsg(dat,msg) msg(j:j)=' ' endif -100 return +100 continue + if(msg(1:6).eq.'CQ9DX ') msg(3:3)=' ' + + return end subroutine unpackmsg diff --git a/mainwindow.cpp b/mainwindow.cpp index 2f27999e2..a258381c2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1061,7 +1061,8 @@ void MainWindow::guiUpdate() ba2msg(ba,message); // ba2msg(ba,msgsent); int len1=22; - genjt9_(message,msgsent,itone,len1,len1); + int ichk=0,itext=0; + genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1); msgsent[22]=0; lab5->setText("Last Tx: " + QString::fromAscii(msgsent)); if(m_restart) { @@ -1457,14 +1458,15 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() char msgsent[23]; int len1=22; int jtone[85]; + t=t.toUpper(); QByteArray s=t.toUpper().toLocal8Bit(); ba2msg(s,message); - jtone[0]=-99; - genjt9_(message,msgsent,jtone,len1,len1); + int ichk=1,itext=0; + genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1); msgsent[22]=0; bool text=false; - if(jtone[1]==1) text=true; + if(itext!=0) text=true; QString t1; t1.fromAscii(msgsent); if(text) t1=t1.mid(0,13); diff --git a/mainwindow.h b/mainwindow.h index 6e87ba2a5..98c5aa7b0 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -233,7 +233,8 @@ void symspec_(int* k, int* ntrperiod, int* nsps, int* ingain, int* nb, float* df3, int* nhsym, int* nzap, float* slimit, uchar lstrong[], int* npts8); -void genjt9_(char* msg, char* msgsent, int itone[], int len1, int len2); +void genjt9_(char* msg, int* ichk, char* msgsent, int itone[], + int* itext, int len1, int len2); //void decoder_(int* ntrperiod, int* ndepth, int* mRxLog, float c0[]); }