mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-23 19:25:37 -05:00
Complete the implementation of MSK144 contest mode. Needs testing!
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7393 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
e23ebc48ad
commit
33af88a41b
@ -354,6 +354,7 @@ set (wsjt_FSRCS
|
||||
lib/fil4.f90
|
||||
lib/fil6521.f90
|
||||
lib/filbig.f90
|
||||
lib/fix_contest_msg.f90
|
||||
lib/flat1.f90
|
||||
lib/flat1a.f90
|
||||
lib/flat1b.f90
|
||||
|
31
lib/fix_contest_msg.f90
Normal file
31
lib/fix_contest_msg.f90
Normal file
@ -0,0 +1,31 @@
|
||||
subroutine fix_contest_msg(mycall,mygrid,hiscall,msg)
|
||||
|
||||
! If msg is "mycall hiscall grid1" and distance from mygrid to grid1 is more
|
||||
! thsn 10000 km, change "grid1" to "R grid2" where grid2 is the antipodes
|
||||
! of grid1.
|
||||
|
||||
character*6 mycall,mygrid,hiscall
|
||||
character*22 msg,t
|
||||
character*6 g1,g2
|
||||
logical isgrid
|
||||
|
||||
t=trim(mycall)//' '//trim(hiscall)
|
||||
i0=index(msg,trim(t))
|
||||
if(i0.eq.1) then
|
||||
i1=len(trim(t))+2
|
||||
g1=msg(i1:i1+3)
|
||||
if(isgrid(g1)) then
|
||||
call azdist(mygrid,g1,0.d0,nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter)
|
||||
if(ndkm.gt.10000) then
|
||||
call grid2deg(g1,dlong,dlat)
|
||||
dlong=dlong+180.0
|
||||
if(dlong.gt.180.0) dlong=dlong-360.0
|
||||
dlat=-dlat
|
||||
call deg2grid(dlong,dlat,g2)
|
||||
msg=msg(1:i1-1)//'R '//g2(1:4)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return
|
||||
end subroutine fix_contest_msg
|
@ -78,15 +78,15 @@ subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
endif
|
||||
|
||||
if(bcontest) then
|
||||
i0=index(message,' R ') + 3
|
||||
i0=index(message,' R ') + 3 !Check for ' R ' in message
|
||||
g1=message(i0:i0+3)//' '
|
||||
if(isgrid(g1)) then
|
||||
if(isgrid(g1)) then !Check for ' R grid'
|
||||
call grid2deg(g1,dlong,dlat)
|
||||
dlong=dlong+180.0
|
||||
if(dlong.gt.180.0) dlong=dlong-360.0
|
||||
dlat=-dlat
|
||||
call deg2grid(dlong,dlat,g2)
|
||||
message=message(1:i0-3)//g2(1:4)
|
||||
call deg2grid(dlong,dlat,g2) !g2=antipodes grid
|
||||
message=message(1:i0-3)//g2(1:4) !Send message with g2
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,ingain, &
|
||||
mycall,hiscall,bshmsg,green,s,jh,line1)
|
||||
subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,bcontest, &
|
||||
ingain,mycall,hiscall,bshmsg,green,s,jh,line1,mygrid)
|
||||
|
||||
! Input:
|
||||
! k pointer to the most recent new data
|
||||
@ -18,8 +18,9 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,ingain, &
|
||||
parameter (JZ=703)
|
||||
character*80 line1
|
||||
character*12 mycall,hiscall
|
||||
character*6 mygrid
|
||||
integer*2 id2(0:120*12000-1)
|
||||
logical*1 bmsk144,bshmsg
|
||||
logical*1 bmsk144,bcontest,bshmsg
|
||||
real green(0:JZ-1)
|
||||
real s(0:63,0:JZ-1)
|
||||
real x(512)
|
||||
@ -82,7 +83,7 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,ingain, &
|
||||
tt2=sum(float(abs(id2(k0:k0+3583))))
|
||||
if(tt1.ne.0.0 .and. tt2.ne.0) then
|
||||
call mskrtd(id2(k-7168+1:k),nutc0,tsec,ntol,nrxfreq,ndepth, &
|
||||
mycall,hiscall,bshmsg,line1)
|
||||
mycall,mygrid,hiscall,bshmsg,bcontest,line1)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -17,11 +17,11 @@ program msk144code
|
||||
print*,' '
|
||||
print*,'Examples:'
|
||||
print*,' msk144code "KA1ABC WB9XYZ EN37"'
|
||||
print*,' msk144code "<KA1ABC WB9XYZ> R-03"'
|
||||
print*,' msk144code "<KA1ABC WB9XYZ> R-03"'
|
||||
print*,' msk144code "KA1ABC WB9XYZ R EN37"'
|
||||
go to 999
|
||||
endif
|
||||
|
||||
bcontest=.false.
|
||||
call getarg(1,msg)
|
||||
nmsg=1
|
||||
if(msg(1:2).eq."-t") then
|
||||
@ -29,7 +29,8 @@ program msk144code
|
||||
testmsg(NTEST+2)="<KA1ABC WB9XYZ> R+03"
|
||||
testmsg(NTEST+3)="<KA1ABC WB9XYZ> RRR"
|
||||
testmsg(NTEST+4)="<KA1ABC WB9XYZ> 73"
|
||||
nmsg=NTEST+4
|
||||
testmsg(NTEST+5)="KA1ABC WB9XYZ R EN37"
|
||||
nmsg=NTEST+5
|
||||
endif
|
||||
|
||||
write(*,1010)
|
||||
@ -38,6 +39,9 @@ program msk144code
|
||||
do imsg=1,nmsg
|
||||
if(nmsg.gt.1) msg=testmsg(imsg)
|
||||
call fmtmsg(msg,iz) !To upper case, collapse multiple blanks
|
||||
i1=len(trim(msg))-5
|
||||
bcontest=.false.
|
||||
if(msg(i1:i1+1).eq.'R ') bcontest=.true.
|
||||
ichk=0
|
||||
call genmsk144(msg,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
|
||||
|
@ -13,7 +13,6 @@ program msk144sim
|
||||
integer itone(144) !Message bits
|
||||
integer*1 bcontest
|
||||
data mygrid/"EN50wc"/
|
||||
data bcontest/0/
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.5) then
|
||||
@ -35,7 +34,9 @@ program msk144sim
|
||||
!sig is the peak amplitude of the ping.
|
||||
sig=sqrt(2.0)*10.0**(0.05*snrdb)
|
||||
h=default_header(12000,NMAX)
|
||||
|
||||
i1=len(trim(msg))-5
|
||||
bcontest=.false.
|
||||
if(msg(i1:i1+1).eq.'R ') bcontest=.true.
|
||||
ichk=0
|
||||
call genmsk144(msg,mygrid,ichk,bcontest,msgsent,itone,itype)
|
||||
twopi=8.d0*atan(1.d0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, &
|
||||
bshmsg,line)
|
||||
subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, &
|
||||
bshmsg,bcontest,line)
|
||||
|
||||
! Real-time decoder for MSK144.
|
||||
! Analysis block size = NZ = 7168 samples, t_block = 0.597333 s
|
||||
@ -15,6 +15,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, &
|
||||
character*22 msglast !!! temporary - used for dupechecking
|
||||
character*80 line !Formatted line with UTC dB T Freq Msg
|
||||
character*12 mycall,hiscall
|
||||
character*6 mygrid
|
||||
|
||||
complex cdat(NFFT1) !Analytic signal
|
||||
complex c(NSPM) !Coherently averaged complex data
|
||||
@ -29,7 +30,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, &
|
||||
real pow(8)
|
||||
real xmc(NPATTERNS)
|
||||
|
||||
logical*1 bshmsg
|
||||
logical*1 bshmsg,bcontest
|
||||
logical first
|
||||
data first/.true./
|
||||
data iavpatterns/ &
|
||||
@ -162,6 +163,9 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, &
|
||||
nsnrlast=nsnr
|
||||
if( nsnr .lt. -8 ) nsnr=-8
|
||||
if( nsnr .gt. 24 ) nsnr=24
|
||||
if(bcontest .and. msgreceived(1:1).ne.'<') then
|
||||
call fix_contest_msg(mycall(1:6),mygrid,hiscall(1:6),msgreceived)
|
||||
endif
|
||||
write(line,1020) nutc0,nsnr,tdec,nint(fest),decsym,msgreceived, &
|
||||
navg,char(0)
|
||||
1020 format(i6.6,i4,f5.1,i5,a3,a22,i2,a1)
|
||||
@ -171,3 +175,4 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, &
|
||||
return
|
||||
end subroutine mskrtd
|
||||
|
||||
include 'fix_contest_msg.f90'
|
||||
|
@ -67,8 +67,9 @@ extern "C" {
|
||||
int* minw, float* px, float s[], float* df3, int* nhsym, int* npts8);
|
||||
|
||||
void hspec_(short int d2[], int* k, int* nutc0, int* ntrperiod, int* nrxfreq, int* ntol,
|
||||
bool* bmsk144, int* ingain, char mycall[], char hiscall[], bool* bshmsg,
|
||||
float green[], float s[], int* jh, char line[], int len1, int len2, int len3);
|
||||
bool* bmsk144, bool* bcontest, int* ingain, char mycall[], char hiscall[],
|
||||
bool* bshmsg, float green[], float s[], int* jh, char line[],
|
||||
char mygrid[], int len1, int len2, int len3, int len4);
|
||||
|
||||
void gen4_(char* msg, int* ichk, char* msgsent, int itone[],
|
||||
int* itext, int len1, int len2);
|
||||
@ -1274,7 +1275,6 @@ void MainWindow::fastSink(qint64 frames)
|
||||
if(m_diskData) nutc0=m_UTCdisk;
|
||||
char line[80];
|
||||
bool bmsk144=((m_mode=="MSK144") and (m_monitoring or m_diskData));
|
||||
// bmsk144=bmsk144 && m_config.realTimeDecode();
|
||||
line[0]=0;
|
||||
|
||||
m_RxFreq=ui->RxFreqSpinBox->value ();
|
||||
@ -1283,10 +1283,12 @@ void MainWindow::fastSink(qint64 frames)
|
||||
strncpy(dec_data.params.mycall, (m_config.my_callsign()+" ").toLatin1(),12);
|
||||
QString hisCall {ui->dxCallEntry->text ()};
|
||||
bool bshmsg=ui->cbShMsgs->isChecked();
|
||||
bool bcontest=m_config.contestMode();
|
||||
strncpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), 12);
|
||||
hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&m_RxFreq,&m_Ftol,&bmsk144,&m_inGain,
|
||||
&dec_data.params.mycall[0],&dec_data.params.hiscall[0],&bshmsg,
|
||||
fast_green,fast_s,&fast_jh,&line[0],12,12,80);
|
||||
strncpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(),6);
|
||||
hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&m_RxFreq,&m_Ftol,&bmsk144,&bcontest,
|
||||
&m_inGain,&dec_data.params.mycall[0],&dec_data.params.hiscall[0],&bshmsg,
|
||||
fast_green,fast_s,&fast_jh,&line[0],&dec_data.params.mygrid[0],12,12,80,6);
|
||||
float px = fast_green[fast_jh];
|
||||
QString t;
|
||||
t.sprintf(" Rx noise: %5.1f ",px);
|
||||
@ -3416,8 +3418,8 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl
|
||||
}
|
||||
} else {
|
||||
if(m_mode=="MSK144" and m_config.contestMode()) {
|
||||
m_ntx=4;
|
||||
ui->txrb4->setChecked(true);
|
||||
m_ntx=3;
|
||||
ui->txrb3->setChecked(true);
|
||||
} else {
|
||||
m_ntx=2;
|
||||
ui->txrb2->setChecked(true);
|
||||
@ -3528,21 +3530,31 @@ void MainWindow::genStdMsgs(QString rpt)
|
||||
} else {
|
||||
int n=rpt.toInt();
|
||||
rpt.sprintf("%+2.2d",n);
|
||||
if(m_mode=="MSK144" and m_bShMsgs) {
|
||||
int i=t0.length()-1;
|
||||
t0="<" + t0.mid(0,i) + "> ";
|
||||
if(n<=-2) n=-3;
|
||||
if(n>=-1 and n<=1) n=0;
|
||||
if(n>=2 and n<=4) n=3;
|
||||
if(n>=5 and n<=7) n=6;
|
||||
if(n>=8 and n<=11) n=10;
|
||||
if(n>=12 and n<=14) n=13;
|
||||
if(n>=15) n=16;
|
||||
rpt.sprintf("%+2.2d",n);
|
||||
|
||||
if(m_mode=="MSK144") {
|
||||
if(m_config.contestMode()) {
|
||||
rpt=m_config.my_grid().mid(0,4);
|
||||
}
|
||||
if(m_bShMsgs) {
|
||||
int i=t0.length()-1;
|
||||
t0="<" + t0.mid(0,i) + "> ";
|
||||
if(n<=-2) n=-3;
|
||||
if(n>=-1 and n<=1) n=0;
|
||||
if(n>=2 and n<=4) n=3;
|
||||
if(n>=5 and n<=7) n=6;
|
||||
if(n>=8 and n<=11) n=10;
|
||||
if(n>=12 and n<=14) n=13;
|
||||
if(n>=15) n=16;
|
||||
rpt.sprintf("%+2.2d",n);
|
||||
}
|
||||
}
|
||||
t=t00 + rpt;
|
||||
msgtype(t, ui->tx2);
|
||||
t=t0 + "R" + rpt;
|
||||
if(m_mode=="MSK144" and m_config.contestMode()) {
|
||||
t=t0 + "R " + rpt;
|
||||
} else {
|
||||
t=t0 + "R" + rpt;
|
||||
}
|
||||
msgtype(t, ui->tx3);
|
||||
t=t0 + "RRR";
|
||||
if(m_mode=="JT4" and m_bShMsgs) t="@1500 (RRR)";
|
||||
@ -3779,8 +3791,13 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
|
||||
bool text=false;
|
||||
bool short65=false;
|
||||
if(itype==6) text=true;
|
||||
if(itype==7 and m_config.enable_VHF_features() and (m_mode=="JT65" or m_mode=="MSK144")) short65=true;
|
||||
if(itype==7 and m_config.enable_VHF_features() and
|
||||
(m_mode=="JT65" or m_mode=="MSK144")) short65=true;
|
||||
if(m_mode=="MSK144" and t.mid(0,1)=="<") text=false;
|
||||
if(m_mode=="MSK144" and m_config.contestMode()) {
|
||||
int i0=t.trimmed().length()-7;
|
||||
if(t.mid(i0,3)==" R ") text=false;
|
||||
}
|
||||
QPalette p(tx->palette());
|
||||
if(text) {
|
||||
p.setColor(QPalette::Base,"#ffccff");
|
||||
|
Loading…
Reference in New Issue
Block a user