mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Code cleanup related to "bcontest". Auto-seq now OK for new NA VHF Contest messages.
This commit is contained in:
parent
c1e71a46ef
commit
14385611be
@ -5,7 +5,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
extern "C" {
|
||||
bool stdmsg_(char const * msg, bool contest_mode, char const * mygrid, fortran_charlen_t, fortran_charlen_t);
|
||||
bool stdmsg_(char const * msg, fortran_charlen_t);
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -40,16 +40,11 @@ DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString
|
||||
// remove DXCC entity and worked B4 status. TODO need a better way to do this
|
||||
message_ = message_.left (eom_pos + 1);
|
||||
}
|
||||
// stdmsg is a fortran routine that packs the text, unpacks it
|
||||
// stdmsg is a Fortran routine that packs the text, unpacks it
|
||||
// and compares the result
|
||||
auto message_c_string = message_.toLocal8Bit ();
|
||||
message_c_string += QByteArray {22 - message_c_string.size (), ' '};
|
||||
auto grid_c_string = my_grid.toLocal8Bit ();
|
||||
grid_c_string += QByteArray {6 - grid_c_string.size (), ' '};
|
||||
is_standard_ = stdmsg_ (message_c_string.constData ()
|
||||
, contest_mode_
|
||||
, grid_c_string.constData ()
|
||||
, 22, 6);
|
||||
message_c_string += QByteArray {37 - message_c_string.size (), ' '};
|
||||
is_standard_ = stdmsg_(message_c_string.constData(),37);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -194,7 +194,6 @@ subroutine pack77(msg0,i3,n3,c77)
|
||||
900 return
|
||||
end subroutine pack77
|
||||
|
||||
|
||||
subroutine unpack77(c77,msg)
|
||||
|
||||
parameter (NSEC=84) !Number of ARRL Sections
|
||||
@ -429,7 +428,7 @@ subroutine unpack77(c77,msg)
|
||||
endif
|
||||
endif
|
||||
|
||||
900 return
|
||||
return
|
||||
end subroutine unpack77
|
||||
|
||||
|
||||
@ -635,7 +634,6 @@ subroutine unpack28(n28_0,c13)
|
||||
900 return
|
||||
end subroutine unpack28
|
||||
|
||||
|
||||
subroutine split77(msg,nwords,nw,w)
|
||||
|
||||
! Convert msg to upper case; collapse multiple blanks; parse into words.
|
||||
@ -654,6 +652,7 @@ subroutine split77(msg,nwords,nw,w)
|
||||
c0=' '
|
||||
w=' '
|
||||
do i=1,iz
|
||||
if(ichar(msg(i:i)).eq.0) msg(i:i)=' '
|
||||
c=msg(i:i) !Single character
|
||||
if(c.eq.' ' .and. c0.eq.' ') cycle !Skip leading/repeated blanks
|
||||
if(c.ne.' ' .and. c0.eq.' ') then
|
||||
|
@ -211,7 +211,7 @@ subroutine extract(s3,nadd,mode65,ntrials,naggressive,ndepth,nflip, &
|
||||
correct(1:63)=tmp(1:63)
|
||||
call interleave63(correct,63,1)
|
||||
call graycode65(correct,63,1)
|
||||
call unpackmsg(dat4,decoded,' ') !Unpack the user message
|
||||
call unpackmsg(dat4,decoded) !Unpack the user message
|
||||
ncount=0
|
||||
if(iand(dat4(10),8).ne.0) ltext=.true.
|
||||
endif
|
||||
|
@ -57,7 +57,7 @@ subroutine extract4(sym0,ncount,decoded)
|
||||
read(c72,1102) data4
|
||||
1102 format(12b6)
|
||||
|
||||
call unpackmsg(data4,decoded,' ')
|
||||
call unpackmsg(data4,decoded)
|
||||
if(decoded(1:6).eq.'000AAA') then
|
||||
! decoded='***WRONG MODE?***'
|
||||
decoded=' '
|
||||
|
@ -11,7 +11,7 @@ subroutine extractmessage77(decoded77,msgreceived)
|
||||
read(cbits,'(12b6)') i4Dec6BitWords
|
||||
read(cbits,'(72x,i5.5)') i5bit
|
||||
if( i5bit .eq. 0 ) then
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived,' ')
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived)
|
||||
endif
|
||||
return
|
||||
end subroutine extractmessage77
|
||||
|
@ -67,7 +67,7 @@ allocate ( rxdata(N), llr(N) )
|
||||
! msg="K1JT K9AN EN50"
|
||||
msg="G4WJS K9AN EN50"
|
||||
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,'') !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
write(*,*) "message sent ",msgsent
|
||||
|
||||
i4=0
|
||||
|
@ -30,7 +30,7 @@ subroutine extractmessage174(decoded,msgreceived,ncrcflag)
|
||||
enddo
|
||||
i4Dec6BitWords(ibyte)=itmp
|
||||
enddo
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived,' ')
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived)
|
||||
ncrcflag=1
|
||||
else
|
||||
msgreceived=' '
|
||||
|
@ -30,7 +30,7 @@ subroutine extractmessage174_91(decoded,msgreceived,ncrcflag)
|
||||
enddo
|
||||
i4Dec6BitWords(ibyte)=itmp
|
||||
enddo
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived,' ')
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived)
|
||||
ncrcflag=1
|
||||
else
|
||||
msgreceived=' '
|
||||
|
@ -22,7 +22,7 @@ subroutine genft8(msg37,mygrid,i3,n3,isync,msgsent37,msgbits77,itone)
|
||||
|
||||
msg=msg37(1:22)
|
||||
call packmsg(msg,i4Msg6BitWords,istdtype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,mygrid) !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
msgsent37(1:22)=msgsent
|
||||
msgsent37(23:37)=' '
|
||||
|
||||
|
@ -68,7 +68,7 @@ allocate ( rxdata(N), llr(N) )
|
||||
msg="K1JT K9AN EN50"
|
||||
! msg="G4WJS K9AN EN50"
|
||||
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,grid) !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
write(*,*) "message sent ",msgsent
|
||||
|
||||
i4=0
|
||||
|
@ -27,7 +27,7 @@ subroutine gen4(msg0,ichk,msgsent,itone,itype)
|
||||
message=msg0
|
||||
call fmtmsg(message,iz)
|
||||
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,' ') !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
if(ichk.ne.0) go to 999
|
||||
call encode4(message,itone) !Encode the information bits
|
||||
i1=index(message,'-')
|
||||
|
@ -45,7 +45,7 @@ subroutine gen65(msg0,ichk,msgsent,itone,itype)
|
||||
if(flip.lt.0.0) ntest=1
|
||||
if(nspecial.eq.0) then
|
||||
call packmsg(message,dgen,itype) !Pack message into 72 bits
|
||||
call unpackmsg(dgen,msgsent,' ') !Unpack to get message sent
|
||||
call unpackmsg(dgen,msgsent) !Unpack to get message sent
|
||||
msgsent(20:22)=cok
|
||||
call fmtmsg(msgsent,iz)
|
||||
if(ichk.ne.0) go to 999 !Return if checking only
|
||||
|
@ -38,7 +38,7 @@ subroutine gen9(msg0,ichk,msgsent,i4tone,itype)
|
||||
enddo
|
||||
|
||||
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,' ') !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
if(ichk.ne.0) go to 999
|
||||
call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, make 8-bit bytes
|
||||
nsym2=206
|
||||
|
@ -1,4 +1,4 @@
|
||||
subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
subroutine genmsk144(msg0,mygrid,ichk,msgsent,i4tone,itype)
|
||||
! s8 + 48bits + s8 + 80 bits = 144 bits (72ms message duration)
|
||||
!
|
||||
! Encode an MSK144 message
|
||||
@ -32,7 +32,6 @@ subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
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/
|
||||
@ -77,8 +76,8 @@ subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
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
|
||||
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
|
||||
if(ichk.eq.1) go to 999
|
||||
i4=0
|
||||
|
@ -38,7 +38,7 @@ subroutine genqra64(msg0,ichk,msgsent,itone,itype)
|
||||
|
||||
call chkmsg(message,cok,nspecial,flip)
|
||||
call packmsg(message,dgen,itype) !Pack message into 72 bits
|
||||
call unpackmsg(dgen,msgsent,' ') !Unpack to get message sent
|
||||
call unpackmsg(dgen,msgsent) !Unpack to get message sent
|
||||
if(ichk.ne.0) go to 999 !Return if checking only
|
||||
call qra64_enc(dgen,sent) !Encode using QRA64
|
||||
|
||||
|
@ -77,7 +77,7 @@ program JT65code
|
||||
call graycode(sent,63,-1,tmp) !Remove Gray code
|
||||
call interleave63(tmp,-1) !Remove interleaving
|
||||
call rs_decode(tmp,era,0,recd,nerr) !Decode the message
|
||||
call unpackmsg(recd,decoded,' ') !Unpack the user message
|
||||
call unpackmsg(recd,decoded) !Unpack the user message
|
||||
if(cok.eq."OOO") decoded(20:22)=cok
|
||||
call fmtmsg(decoded,iz)
|
||||
|
||||
|
@ -84,7 +84,7 @@ subroutine jt9fano(i1SoftSymbols,limit,nlim,msg)
|
||||
enddo
|
||||
call unpackbits(i4DecodedBytes,nbytes,8,i1DecodedBits)
|
||||
call packbits(i1DecodedBits,12,6,i4Decoded6BitWords)
|
||||
call unpackmsg(i4Decoded6BitWords,msg,' ') !Unpack decoded msg
|
||||
call unpackmsg(i4Decoded6BitWords,msg) !Unpack decoded msg
|
||||
if(index(msg,'000AAA ').gt.0) msg=' '
|
||||
endif
|
||||
|
||||
|
@ -54,7 +54,7 @@ allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) )
|
||||
|
||||
msg="K9AN K1JT EN50"
|
||||
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,' ') !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||
write(*,*) "message sent ",msgsent
|
||||
|
||||
i4=0
|
||||
|
@ -534,12 +534,12 @@ subroutine packbits(dbits,nsymd,m0,sym)
|
||||
return
|
||||
end subroutine packmsg
|
||||
|
||||
subroutine unpackmsg(dat,msg,mygrid)
|
||||
subroutine unpackmsg(dat,msg)
|
||||
|
||||
parameter (NBASE=37*36*10*27*27*27)
|
||||
parameter (NGBASE=180*180)
|
||||
integer dat(:)
|
||||
character c1*12,c2*12,grid*4,msg*22,grid6*6,psfx*4,junk2*4,mygrid*6
|
||||
character c1*12,c2*12,grid*4,msg*22,grid6*6,psfx*4,junk2*4
|
||||
logical cqnnn
|
||||
|
||||
cqnnn=.false.
|
||||
|
@ -128,7 +128,7 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
|
||||
10 decoded=' '
|
||||
|
||||
if(irc.ge.0) then
|
||||
call unpackmsg(dat4,decoded,' ') !Unpack the user message
|
||||
call unpackmsg(dat4,decoded) !Unpack the user message
|
||||
call fmtmsg(decoded,iz)
|
||||
if(index(decoded,"000AAA ").ge.1) then
|
||||
! Suppress a certain type of garbage decode.
|
||||
|
@ -45,7 +45,7 @@ program QRA64code
|
||||
|
||||
call qra64_enc(dgen,sent) !Encode using QRA64
|
||||
|
||||
call unpackmsg(dgen,decoded,' ') !Unpack the user message
|
||||
call unpackmsg(dgen,decoded) !Unpack the user message
|
||||
call fmtmsg(decoded,iz)
|
||||
ii=imsg
|
||||
write(*,1020) ii,msg0,decoded,itype,msgtype
|
||||
|
@ -1,11 +1,33 @@
|
||||
function stdmsg(msg0,mygrid)
|
||||
function stdmsg(msg0)
|
||||
|
||||
! Is msg0 a standard "JT-style" message?
|
||||
! Returns .true. if msg0 a standard "JT-style" message
|
||||
|
||||
! itype
|
||||
! 1 Standard 72-bit structured message
|
||||
! 2 Type 1 prefix
|
||||
! 3 Type 1 suffix
|
||||
! 4 Type 2 prefix
|
||||
! 5 Type 2 suffix
|
||||
! 6 Free text
|
||||
! 7 Hashed calls (MSK144 short format)
|
||||
|
||||
! i3.n3
|
||||
! 0.0 Free text
|
||||
! 0.1 DXpeditiion mode
|
||||
! 0.2 EU VHF Contest
|
||||
! 0.3 ARRL Field Day <=16 transmitters
|
||||
! 0.4 ARRL Field Day >16 transmitters
|
||||
! 0.5 telemetry
|
||||
! 0.6
|
||||
! 0.7
|
||||
! 1 Standard 77-bit structured message (optional /R)
|
||||
! 2 EU VHF Contest (optional /P)
|
||||
! 3 ARRL RTTY Contest
|
||||
! 4 Nonstandard calls
|
||||
|
||||
use iso_c_binding, only: c_bool
|
||||
use packjt
|
||||
character*22 msg0,msg1,msg
|
||||
character*6 mygrid
|
||||
character*37 msg0,msg1,msg
|
||||
integer dat(12)
|
||||
logical(c_bool) :: stdmsg
|
||||
|
||||
@ -13,8 +35,13 @@ function stdmsg(msg0,mygrid)
|
||||
i0=index(msg1,' OOO ')
|
||||
if(i0.gt.10) msg1=msg0(1:i0)
|
||||
call packmsg(msg0,dat,itype)
|
||||
call unpackmsg(dat,msg,mygrid)
|
||||
call unpackmsg(dat,msg)
|
||||
msg(23:37)=' '
|
||||
stdmsg=(msg.eq.msg1) .and. (itype.ge.0) .and. itype.ne.6
|
||||
if(.not.stdmsg) then
|
||||
call parse77(msg1,i3,n3)
|
||||
if(i3.gt.0 .or. n3.gt.0) stdmsg=.true.
|
||||
endif
|
||||
|
||||
return
|
||||
end function stdmsg
|
||||
|
@ -294,7 +294,7 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
|
||||
1012 format(9b8.8)
|
||||
read(c72,1014) i4Msg6BitWords
|
||||
1014 format(12b6.6)
|
||||
call unpackmsg(i4Msg6BitWords,decoded,.false.,' ') !Unpack to get msgsent
|
||||
call unpackmsg(i4Msg6BitWords,decoded) !Unpack to get msgsent
|
||||
endif
|
||||
if(decoded.ne.' ') exit
|
||||
enddo
|
||||
|
@ -141,6 +141,8 @@ extern "C" {
|
||||
void foxgen_();
|
||||
|
||||
void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
|
||||
|
||||
bool stdmsg_(char const * msg, char const * mygrid, fortran_charlen_t, fortran_charlen_t);
|
||||
}
|
||||
|
||||
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
|
||||
@ -3067,6 +3069,7 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler
|
||||
if(m_mode=="MSK144" and message.string().indexOf(ui->dxCallEntry->text()+" R ")>0) is_OK=true;
|
||||
|
||||
if (message_words.size () > 2 && (message.isStandardMessage () || (is_73 or is_OK))) {
|
||||
qDebug() << "AA" << m_QSOProgress;
|
||||
auto df = message.frequencyOffset ();
|
||||
auto within_tolerance =
|
||||
(qAbs (ui->RxFreqSpinBox->value () - df) <= int (start_tolerance)
|
||||
@ -3498,6 +3501,11 @@ void MainWindow::guiUpdate()
|
||||
* 6 Free Text
|
||||
* 7 Hashed calls (MSK144 short format)
|
||||
*/
|
||||
|
||||
char grid_rpt[7];
|
||||
bool bstd=stdmsg_(message,grid_rpt,22,6);
|
||||
qDebug() << "cc" << bstd;
|
||||
|
||||
m_isync=1;
|
||||
if(!m_config.bGenerate77() and itype == 6 and (m_i3>0 or m_n3>0)) m_isync=2;
|
||||
if(m_config.bGenerate77()) m_isync=2;
|
||||
@ -4079,7 +4087,7 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
|
||||
return;
|
||||
}
|
||||
DecodedText message {cursor.block().text(), ("MSK144" == m_mode || "FT8" == m_mode) &&
|
||||
ui->cbVHFcontest->isChecked(), m_config.my_grid ()};
|
||||
true /* ui->cbVHFcontest->isChecked() */, m_config.my_grid ()};
|
||||
m_bDoubleClicked = true;
|
||||
processMessage (message, modifiers);
|
||||
}
|
||||
@ -4103,6 +4111,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "bb" << m_QSOProgress;
|
||||
//Skip the rest if no decoded text extracted
|
||||
int frequency = message.frequencyOffset();
|
||||
if (message.isTX()) {
|
||||
@ -4139,6 +4148,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
QString hiscall;
|
||||
QString hisgrid;
|
||||
message.deCallAndGrid(/*out*/hiscall,hisgrid);
|
||||
/*
|
||||
int nWarn=0;
|
||||
QString warnMsg;
|
||||
|
||||
@ -4179,9 +4189,9 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
}
|
||||
m_bCheckedContest=true;
|
||||
}
|
||||
|
||||
*/
|
||||
auto is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size ();
|
||||
if (!is_73 and !message.isStandardMessage() and (nWarn==0)) {
|
||||
if (!is_73 and !message.isStandardMessage() /* and (nWarn==0)*/) {
|
||||
qDebug () << "Not processing message - hiscall:" << hiscall << "hisgrid:" << hisgrid;
|
||||
return;
|
||||
}
|
||||
@ -4255,7 +4265,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
m_QSOProgress = SIGNOFF;
|
||||
} else if((m_QSOProgress >= REPORT
|
||||
|| (m_QSOProgress >= REPLYING && (m_mode=="MSK144" or m_mode=="FT8")
|
||||
&& ui->cbVHFcontest->isChecked())) && r.mid(0,1)=="R") {
|
||||
/*&& ui->cbVHFcontest->isChecked()*/ )) && r.mid(0,1)=="R") {
|
||||
m_ntx=4;
|
||||
m_QSOProgress = ROGERS;
|
||||
ui->txrb4->setChecked(true);
|
||||
@ -4294,7 +4304,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
}
|
||||
else if (!(m_bAutoReply && m_QSOProgress > CALLING)) {
|
||||
if ((message_words.size () > 4 && message_words.at (1).contains (m_baseCall) && message_words.at (4) == "OOO")
|
||||
|| ((m_mode=="MSK144" or m_mode=="FT8") && ui->cbVHFcontest->isChecked())) {
|
||||
|| ((m_mode=="MSK144" or m_mode=="FT8") /* && ui->cbVHFcontest->isChecked() */)) {
|
||||
// EME short code report or MSK144/FT8 contest mode reply, send back Tx3
|
||||
m_ntx = 3;
|
||||
m_QSOProgress = ROGER_REPORT;
|
||||
|
Loading…
Reference in New Issue
Block a user