More cleaning out unneeded files, and fixing Makefile.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@330 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-01-09 17:08:45 +00:00
parent 1006c6b236
commit 67fb087b7d
9 changed files with 48 additions and 587 deletions

View File

@ -22,7 +22,7 @@ SRCS2F90 = a2d.f90 astro0.f90 audio_init.f90 azdist0.f90 \
SRCS2F77 = wsjt1.f avesp2.f bzap.f \
stdecode.f indexx.f s2shape.f flat2.f gen65.f chkmsg.f \
gentone.f \
set.f flatten.f db.f pctile.f sort.f ssort.f ps.f smooth.f ping.f \
set.f flatten.f db.f pctile.f sort.f ssort.f ps.f smooth.f \
peakup.f sync.f detect.f avemsg65.f decode65.f demod64a.f \
encode65.f extract.f flat1.f four2.f gencw.f getpfx1.f \
getpfx2.f getsnr.f graycode.f grid2k.f interleave63.f k2grid.f \

80
gencw.f
View File

@ -1,80 +0,0 @@
subroutine gencw(msg,wpm,freqcw,samfac,TRPeriod,iwave,nwave)
parameter (NMAX=150*11025)
character msg*22,word12*22,word3*22
integer*2 iwave(NMAX)
integer TRPeriod
integer*1 idat(5000),idat1(460),idat2(200)
real*8 dt,t,twopi,pha,dpha,tdit,samfac
data twopi/6.283185307d0/
nwords=0
do i=2,22
if(msg(i-1:i).eq.' ') go to 10
if(msg(i:i).eq.' ') then
nwords=nwords+1
j=j0
j0=i+1
endif
enddo
10 ntype=1 !Call1+Call2, CQ+Call
word12=msg
if(nwords.eq.3) then
word3=msg(j:j0-1)
word12(j-1:)=' '
ntype=3 !BC+RO, BC+RRR, BC+73
if(word3.eq.'OOO') ntype=2 !BC+OOO
endif
tdit=1.2d0/wpm !Key-down dit time, seconds
call morse(word12,idat1,nmax1) !Encode part 1 of msg
t1=tdit*nmax1 !Time for part1, once
nrpt1=TRPeriod/t1 !Repetitions of part 1
if(ntype.eq.2) nrpt1=0.75*TRPeriod/t1
if(ntype.eq.3) nrpt1=1
t1=nrpt1*t1 !Total time for part 1
nrpt2=0
t2=0.
if(ntype.ge.2) then
call morse(word3,idat2,nmax2) !Encode part 2
t2=tdit*nmax2 !Time for part 2, once
nrpt2=(TRPeriod-t1)/t2 !Repetitions of part 2
t2=nrpt2*t2 !Total time for part 2
endif
j=0
do n=1,nrpt1
do i=1,nmax1
j=j+1
idat(j)=idat1(i)
enddo
enddo
do n=1,nrpt2
do i=1,nmax2
j=j+1
idat(j)=idat2(i)
enddo
enddo
dt=1.d0/(11025.d0*samfac)
nwave=j*tdit/dt
pha=0.
dpha=twopi*freqcw*dt
t=0.
s=0.
u=wpm/(11025*0.03)
do i=1,nwave
t=t+dt
pha=pha+dpha
j=t/tdit + 1
! iwave(i)=0
! if(idat(j).ne.0) iwave(i)=nint(32767.d0*sin(pha))
s=s + u*(idat(j)-s)
iwave(i)=nint(s*32767.d0*sin(pha))
enddo
return
end
include 'gencwid.f'

119
jtaudio.c
View File

@ -62,74 +62,6 @@ void GetSystemTime(SYSTEMTIME *st){
}
#endif
// Input callback routine:
static int SoundIn( void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
{
paTestData *data = (paTestData*)userData;
short *in = (short*)inputBuffer;
unsigned int i;
static int n0;
static int ia=0;
static int ib=0;
static int ic=0;
static int TxOKz=0;
static int ncall=0;
static int nsec0=0;
static double stime0=86400.0;
int nsec;
double stime;
SYSTEMTIME st;
// Get System time
GetSystemTime(&st);
nsec = (int) (st.Hour*3600.0 + st.Minute*60.0 + st.Second);
stime = nsec + st.Millisecond*0.001 + *data->ndsec*0.1;
*data->Tsec = stime;
nsec=(int)stime;
ncall++;
// NB: inputBufferAdcTime and currentTime do not work properly.
/*
if(nsec!=nsec0) {
printf("%f %f %f %f\n",stime,timeInfo->inputBufferAdcTime,
timeInfo->currentTime,timeInfo->outputBufferDacTime);
}
*/
// if((inputBuffer==NULL) & (ncall>2) & (stime>stime0)) {
if((statusFlags!=0) & (ncall>2) & (stime>stime0)) {
if(*data->ndebug)
printf("Status flags %d at Tsec = %7.1f s, DT = %7.1f\n",
statusFlags,stime,stime-stime0);
stime0=stime;
}
if((statusFlags&1)==0) {
//increment buffer pointers only if data available
ia=*data->iwrite;
ib=*data->ibuf;
ib++; //Increment ibuf
if(ib>1024) ib=1;
*data->ibuf=ib;
data->tbuf[ib-1]=stime;
for(i=0; i<framesPerBuffer; i++) {
data->y1[ia] = (*in++);
data->y2[ia] = (*in++);
ia++;
}
}
if(ia >= data->nbuflen) ia=0; //Wrap buffer pointer if necessary
*data->iwrite = ia; //Save buffer pointer
fivehz_(); //Call fortran routine
nsec0=nsec;
return 0;
}
// Output callback routine:
static int SoundOut( void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
@ -201,11 +133,8 @@ int jtaudio_(int *ndevin, int *ndevout, short y1[], short y2[],
double tbuf[], int *ibuf, int *ndsec)
{
paTestData data;
PaStream *instream;
PaStream *outstream;
PaStreamParameters inputParameters;
PaStreamParameters outputParameters;
// PaStreamInfo *streamInfo;
int nfs,ndin,ndout;
PaError err1,err2,err2a,err3,err3a;
@ -239,27 +168,7 @@ int jtaudio_(int *ndevin, int *ndevout, short y1[], short y2[],
ndin=*ndevin;
ndout=*ndevout;
dnfs=(double)nfs;
printf("Opening device %d for input, %d for output.\n",ndin,ndout);
inputParameters.device=*ndevin;
inputParameters.channelCount=2;
inputParameters.sampleFormat=paInt16;
inputParameters.suggestedLatency=1.0;
inputParameters.hostApiSpecificStreamInfo=NULL;
err2=Pa_OpenStream(
&instream, //address of stream
&inputParameters,
NULL,
dnfs, //Sample rate
2048, //Frames per buffer
paNoFlag,
SoundIn, //Callback routine
&data); //address of data structure
if(err2) {
printf("Error opening Audio stream for input.\n");
printf("%s\n",Pa_GetErrorText(err2));
goto error;
}
printf("Opening device %d for output.\n",ndout);
outputParameters.device=*ndevout;
outputParameters.channelCount=2;
@ -281,12 +190,6 @@ int jtaudio_(int *ndevin, int *ndevout, short y1[], short y2[],
goto error;
}
err3=Pa_StartStream(instream); //Start input stream
if(err3) {
printf("Error starting input Audio stream\n");
printf("%s\n",Pa_GetErrorText(err3));
goto error;
}
err3a=Pa_StartStream(outstream); //Start output stream
if(err3a) {
printf("Error starting output Audio stream\n");
@ -294,25 +197,21 @@ int jtaudio_(int *ndevin, int *ndevout, short y1[], short y2[],
goto error;
}
printf("Audio streams running normally.\n******************************************************************\n");
printf("Audio output stream running normally.\n******************************************************************\n");
while(Pa_IsStreamActive(instream)) {
while(Pa_IsStreamActive(outstream)) {
if(*ngo==0) goto StopStream;
// printf("CPU: %f\n",Pa_GetStreamCpuLoad(stream));
Pa_Sleep(200);
}
StopStream:
Pa_AbortStream(instream); // Abort stream
Pa_CloseStream(instream); // Close stream, we're done.
Pa_AbortStream(outstream); // Abort stream
Pa_CloseStream(outstream); // Close stream, we're done.
Pa_Terminate();
return(0);
error:
printf("%d %d %f %d %d %d %d %d\n",ndin,ndout,dnfs,err1,
err2,err2a,err3,err3a);
printf("%d %f %d %d %d\n",ndout,dnfs,err1,err2a,err3a);
Pa_Terminate();
return(1);
}
@ -329,16 +228,6 @@ int padevsub_(int *numdev, int *ndefin, int *ndefout,
Pa_Initialize();
/*
n=Pa_GetHostApiCount();
printf("HostAPI Type #Devices \n");
for(i=0; i<n; i++) {
hostapi=Pa_GetHostApiInfo(i);
printf(" %3d %2d %3d %s\n",i,hostapi->type,
hostapi->deviceCount,hostapi->name);
}
*/
// numDevices = Pa_CountDevices();
numDevices = Pa_GetDeviceCount();
*numdev=numDevices;

View File

@ -79,7 +79,6 @@ nosh441=IntVar()
noshjt65=IntVar()
nsked=IntVar()
setseq=IntVar()
ShOK=IntVar()
slabel="Sync "
textheight=7
tx6alt=""
@ -108,7 +107,6 @@ def restart():
#------------------------------------------------------ restart2
def restart2():
Audio.gcom2.shok=ShOK.get()
Audio.gcom2.nrestart=1
#------------------------------------------------------ toggle_freeze
@ -491,8 +489,6 @@ def ModeJT65():
cbfreeze.configure(state=NORMAL)
cbafc.configure(state=NORMAL)
sked.configure(state=NORMAL)
report.configure(state=DISABLED)
shmsg.configure(state=DISABLED)
graph2.configure(bg='#66FFFF')
itol=4
inctol()
@ -748,16 +744,6 @@ def decdsec(event):
ldsec.configure(text='Dsec '+str(0.1*idsec),bg=bg)
Audio.gcom1.ndsec=idsec
#------------------------------------------------------ toggle_shift
def toggle_shift(event):
Audio.gcom2.nadd5=1-Audio.gcom2.nadd5
if Audio.gcom2.nadd5:
bg='red'
lshift.configure(text='Shift 5.0',bg=bg)
else:
bg='white'
lshift.configure(text='Shift 0.0',bg=bg)
#------------------------------------------------------ erase
def erase(event=NONE):
graph1.delete(ALL)
@ -1102,7 +1088,7 @@ def bandmap(event=NONE):
#------------------------------------------------------ update
def update():
global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \
global root_geom,isec0,naz,nel,ndmiles,ndkm,nopen, \
im,pim,cmap0,isync,isync_save,idsec,first,itol,txsnrdb,tx6alt,\
bm_geom
@ -1158,13 +1144,6 @@ def update():
Audio.gcom2.ndecoding=4
Audio.gcom2.nagain=1
g.freeze_decode=0
n=int(20.0*log10(g.rms/770.0+0.01))
t="Rx noise:%3d dB" % (n,)
if n>=-10 and n<=10:
msg4.configure(text=t,bg='gray85')
else:
msg4.configure(text=t,bg='red')
t=g.ftnstr(Audio.gcom2.decodedfile)
# i=t.rfind(".")
@ -1176,23 +1155,21 @@ def update():
g.mode=mode.get()
first=0
samfac_in=Audio.gcom1.mfsample/110250.0
samfac_out=Audio.gcom1.mfsample2/110250.0
xin=1
xout=1
try:
xin=samfac_in/options.samfacin.get()
xout=samfac_out/options.samfacout.get()
if xin<0.999 or xin>1.001 or xout<0.999 or xout>1.001:
lab8.configure(text="%6.4f %6.4f" \
% (options.samfacin.get(),options.samfacout.get()), \
if xout<0.999 or xout>1.001:
lab8.configure(text="%6.4f" \
% (options.samfacout.get()), \
fg='black',bg='red')
else:
lab8.configure(fg='gray85',bg='gray85')
except:
pass
msg1.configure(text="%6.4f %6.4f" % (samfac_in,samfac_out))
msg1.configure(text="%6.4f" % (samfac_out))
msg2.configure(text=mode.get())
t="Freeze DF:%4d" % (int(Audio.gcom2.mousedf),)
if abs(int(Audio.gcom2.mousedf))>600:
@ -1202,9 +1179,6 @@ def update():
bdecode.configure(bg='gray85',activebackground='gray95')
if Audio.gcom2.ndecoding: #Set button bg=light_blue while decoding
bdecode.configure(bg='#66FFFF',activebackground='#66FFFF')
msg5.configure(text="TR Period: %d s" % (Audio.gcom1.trperiod,), \
bg='gray85')
tx1.configure(bg='white')
tx2.configure(bg='white')
tx3.configure(bg='white')
@ -1289,7 +1263,6 @@ def update():
# Save some parameters
g.mode=mode.get()
g.report=report.get()
Audio.gcom1.txfirst=TxFirst.get()
try:
Audio.gcom1.samfacin=options.samfacin.get()
@ -1309,7 +1282,6 @@ def update():
tx=(tx1,tx2,tx3,tx4,tx5,tx6)
Audio.gcom2.txmsg=(tx[ntx.get()-1].get()+' ')[:28]
Audio.gcom2.mode=(mode.get()+' ')[:6]
Audio.gcom2.shok=ShOK.get()
Audio.gcom2.nsave=nsave.get()
Audio.gcom2.nzap=nzap.get()
Audio.gcom2.ndebug=ndebug.get()
@ -1420,21 +1392,19 @@ modemenu.add_radiobutton(label = 'JT65C', variable=mode, command = ModeJT65C, \
#------------------------------------------------------ Decode menu
decodebutton = Menubutton(mbar, text = 'Decode')
decodebutton.pack(side = LEFT)
decodemenu = Menu(decodebutton, tearoff=1)
decodemenu = Menu(decodebutton, tearoff=0)
decodebutton['menu'] = decodemenu
decodemenu.JT65=Menu(decodemenu,tearoff=0)
decodemenu.JT65.add_checkbutton(label='Only EME calls',variable=neme)
decodemenu.JT65.add_checkbutton(label='No Shorthands if Tx 1',variable=noshjt65)
decodemenu.JT65.add_separator()
decodemenu.JT65.add_radiobutton(label = 'No Deep Search',
decodemenu.add_checkbutton(label='Only EME calls',variable=neme)
decodemenu.add_checkbutton(label='No Shorthands if Tx 1',variable=noshjt65)
decodemenu.add_separator()
decodemenu.add_radiobutton(label = 'No Deep Search',
variable=ndepth, value=0)
decodemenu.JT65.add_radiobutton(label = 'Normal Deep Search',
decodemenu.add_radiobutton(label = 'Normal Deep Search',
variable=ndepth, value=1)
decodemenu.JT65.add_radiobutton(label = 'Aggressive Deep Search',
decodemenu.add_radiobutton(label = 'Aggressive Deep Search',
variable=ndepth, value=2)
decodemenu.JT65.add_radiobutton(label ='Include Average in Aggressive Deep Search',
decodemenu.add_radiobutton(label ='Include Average in Aggressive Deep Search',
variable=ndepth, value=3)
decodemenu.add_cascade(label = 'JT65',menu=decodemenu.JT65)
#------------------------------------------------------ Save menu
savebutton = Menubutton(mbar, text = 'Save')
@ -1459,6 +1429,7 @@ bandmenu.add_radiobutton(label = '144', variable=nfreq,value=144)
bandmenu.add_radiobutton(label = '222', variable=nfreq,value=222)
bandmenu.add_radiobutton(label = '432', variable=nfreq,value=432)
bandmenu.add_radiobutton(label = '1296', variable=nfreq,value=1296)
bandmenu.add_radiobutton(label = '2304', variable=nfreq,value=2304)
nfreq.set(144)
#------------------------------------------------------ Help menu
helpbutton = Menubutton(mbar, text = 'Help')
@ -1651,8 +1622,6 @@ bAdd=Button(f5a, text='Add',command=addtodb,padx=1,pady=1)
bAdd.grid(column=2,row=1,sticky='EW',padx=4)
labAz=Label(f5a,text='Az 257 El 15',width=11)
labAz.grid(column=1,row=2)
labHotAB=Label(f5a,bg='#FFCCFF',text='HotA: 247')
labHotAB.grid(column=0,row=2,sticky='EW',padx=4,pady=3)
labDist=Label(f5a,text='16753 km')
labDist.grid(column=2,row=2)
@ -1690,11 +1659,8 @@ Button(f5b,text='Defaults',command=defaults,padx=1,pady=1).grid(column=0,
row=3,sticky='EW')
ldsec=Label(f5b, bg='white', fg='black', text='Dsec 0.0', width=8, relief=RIDGE)
ldsec.grid(column=0,row=4,ipadx=3,padx=2,pady=5,sticky='EW')
lshift=Label(f5b, bg='white', fg='black', text='Shift 0.0', width=8, relief=RIDGE)
lshift.grid(column=1,row=4,ipadx=3,padx=2,pady=5,sticky='EW')
Widget.bind(ldsec,'<Button-1>',incdsec)
Widget.bind(ldsec,'<Button-3>',decdsec)
Widget.bind(lshift,'<Button-1>',toggle_shift)
f5b.pack(side=LEFT,expand=0,fill=BOTH)
@ -1702,13 +1668,6 @@ f5b.pack(side=LEFT,expand=0,fill=BOTH)
f5c=Frame(iframe5,bd=2,relief=GROOVE)
txfirst=Checkbutton(f5c,text='Tx First',justify=RIGHT,variable=TxFirst)
f5c2=Frame(f5c,bd=0)
labreport=Label(f5c2,text='Rpt',width=4)
report=Entry(f5c2, width=4)
report.insert(0,'26')
labreport.pack(side=RIGHT,expand=1,fill=BOTH)
report.pack(side=RIGHT,expand=1,fill=BOTH)
shmsg=Checkbutton(f5c,text='Sh Msg',justify=RIGHT,variable=ShOK,
command=restart2)
sked=Checkbutton(f5c,text='Sked',justify=RIGHT,variable=nsked)
genmsg=Button(f5c,text='GenStdMsgs',underline=0,command=GenStdMsgs,
padx=1,pady=1)
@ -1718,7 +1677,6 @@ auto.focus_set()
txfirst.grid(column=0,row=0,sticky='W',padx=4)
f5c2.grid(column=0,row=1,sticky='W',padx=4)
shmsg.grid(column=0,row=2,sticky='W',padx=4)
sked.grid(column=0,row=3,sticky='W',padx=4)
genmsg.grid(column=0,row=4,sticky='W',padx=4)
auto.grid(column=0,row=5,sticky='EW',padx=4)
@ -1774,14 +1732,14 @@ iframe5.pack(expand=1, fill=X, padx=4)
iframe6 = Frame(frame, bd=1, relief=SUNKEN)
msg1=Message(iframe6, text=' ', width=300,relief=SUNKEN)
msg1.pack(side=LEFT, fill=X, padx=1)
msg2=Message(iframe6, text='Message #2', width=300,relief=SUNKEN)
msg2=Message(iframe6, text="Message #2", width=300,relief=SUNKEN)
msg2.pack(side=LEFT, fill=X, padx=1)
msg3=Message(iframe6,width=300,relief=SUNKEN)
msg3.pack(side=LEFT, fill=X, padx=1)
msg4=Message(iframe6, text='Message #4', width=300,relief=SUNKEN)
msg4.pack(side=LEFT, fill=X, padx=1)
msg5=Message(iframe6, text='Message #5', width=300,relief=SUNKEN)
msg5.pack(side=LEFT, fill=X, padx=1)
#msg4=Message(iframe6, text="", width=300,relief=SUNKEN)
#msg4.pack(side=LEFT, fill=X, padx=1)
#msg5=Message(iframe6, text="", width=300,relief=SUNKEN)
#msg5.pack(side=LEFT, fill=X, padx=1)
msg7=Message(iframe6, text=' ', width=300,relief=SUNKEN)
msg7.pack(side=RIGHT, fill=X, padx=1)
iframe6.pack(expand=1, fill=X, padx=4)
@ -1891,10 +1849,6 @@ try:
elif key == 'KB8RQ': kb8rq.set(value)
elif key == 'K2TXB': k2txb.set(value)
elif key == 'SetSeq': setseq.set(value)
elif key == 'Report':
report.delete(0,99)
report.insert(0,value)
elif key == 'ShOK': ShOK.set(value)
elif key == 'Nsave': nsave.set(value)
elif key == 'Band': nfreq.set(value)
elif key == 'Sync': isync=int(value)
@ -1982,8 +1936,6 @@ f.write("TxFirst " + str(TxFirst.get()) + "\n")
f.write("KB8RQ " + str(kb8rq.get()) + "\n")
f.write("K2TXB " + str(k2txb.get()) + "\n")
f.write("SetSeq " + str(setseq.get()) + "\n")
f.write("Report " + g.report + "\n")
f.write("ShOK " + str(ShOK.get()) + "\n")
f.write("Nsave " + str(nsave.get()) + "\n")
f.write("Band " + str(nfreq.get()) + "\n")
f.write("Sync " + str(isync) + "\n")

41
ping.f
View File

@ -1,41 +0,0 @@
subroutine ping(s,nz,dtbuf,slim,wmin,pingdat,nping)
C Detect pings and make note of their start time, duration, and peak strength.
real*4 s(nz)
real*4 pingdat(3,100)
logical inside
nping=0
peak=0.
inside=.false.
c### sdown=slim-1.0
snrlim=10.0**(0.1*slim) - 1.0
sdown=10.0*log10(0.25*snrlim+1.0)
do i=2,nz
if(s(i).ge.slim .and. .not.inside) then
i0=i
tstart=i0*dtbuf
inside=.true.
peak=0.
endif
if(inside .and. s(i).gt.peak) then
peak=s(i)
endif
if(inside .and. (s(i).lt.sdown .or. i.eq.nz)) then
if(i.gt.i0) then
if(dtbuf*(i-i0).ge.wmin) then
if(nping.le.99) nping=nping+1
pingdat(1,nping)=tstart
pingdat(2,nping)=dtbuf*(i-i0)
pingdat(3,nping)=peak
endif
inside=.false.
peak=0.
endif
endif
enddo
return
end

View File

@ -1,50 +0,0 @@
subroutine s2shape(s2,nchan,nz,tbest)
C Prepare s2(nchan,nz) for plotting as waterfall.
real s2(nchan,nz)
common/fcom/s(3100),indx(3100)
C Find average of active spectral region, over the whole file.
sum=0.
do i=1,44
do j=1,nz/4
k=indx(j)
sum=sum+s2(i+8,k)
enddo
enddo
ave=sum/(44*nz)
C Subtract the average and normalize.
do i=1,64
do j=1,nz
s2(i,j)=s2(i,j)/ave - 1.0
enddo
enddo
nzz=nz
nxmax=500 !Was 494, then 385
if(nz.lt.nxmax) go to 900
! fac=float(nz)/nxmax
! nadd=fac + 0.999999
! nzz=nxmax
nadd=3
nzz=nz/3
do i=1,64
do k=1,nzz
sum=0.
! j=(k-1)*fac
j=(k-1)*nadd
do n=1,nadd
sum=sum+s2(i,j+n)
enddo
s2(i,k)=sum/nadd
enddo
enddo
900 s2(1,1)=nzz
s2(2,1)=tbest
return
end

View File

@ -1,105 +0,0 @@
subroutine stdecode(s2,nchan,nz,sigma,dtbuf,df,stlim0,
+ DFTolerance,cfile6,pick,istart)
C Search for and decode single-tone messages.
real s2(nchan,nz)
integer DFTolerance
logical pick
character cfile6*6,msg3*3
character*90 line
common/ccom/nline,tping(100),line(100)
NSPD=25 !Change if FSK110 is implemented
LTone=2
NBaud=11025/NSPD
stlim=stlim0
if(pick) stlim=stlim0-1.0
iwidth=1
ts0=-1.0
dt=1.0/11025.0
C In each time slice, find largest peak between LTone*NBaud-DFTolerance and
C (LTone+3)*NBaud+DFTolerance.
ia=(LTone*NBaud-DFTolerance)/df - 5.0
ib=((LTone+3)*NBaud+DFTolerance)/df - 4.0
do j=1,nz
smax=0.
do i=ia,ib !Get the spectral peak
if(s2(i,j).gt.smax) then
smax=s2(i,j)
ipk=i
endif
enddo
peak=dB(smax/sigma) - 14.0 !Empirical
C constant should be dB(43/2500) = -17.6 dB?
if(peak.gt.stlim) then
C To minimize false ST decodings from QRN and MT pings, find the
C second best peak (excluding points around the first peak).
smax2=0.
do i=ia,ib
if((abs(i-ipk).gt.iwidth) .and. s2(i,j).gt.smax2) then
smax2=s2(i,j)
endif
enddo
C Larger values of ratlim make it more likely to report ST decodings.
ratlim=0.18
if(stlim.lt.-2.5) ratlim=0.20
if(stlim.lt.-3.5) ratlim=0.22
if(stlim.lt.-4.5) ratlim=0.24
if(pick) ratlim=0.27 !Fine tuning here...
if(smax2/smax.gt.ratlim) goto 20
call peakup(s2(ipk-1,j),s2(ipk,j),s2(ipk+1,j),dx)
freq=(ipk+5+dx)*df
tstart=j*dtbuf + dt*(istart-1)
mswidth=20
nwidth=0
nstrength=0
n=nint(freq/NBaud)
noffset=freq-n*NBaud
if((noffset.lt.-DFTolerance) .or.
+ (noffset.gt.DFTolerance)) goto 20
C The numbers 2 and 5 depend on Ltone:
if(n.lt.2 .or. n.gt.5) goto 20
C OK, this detection has survived all tests. Save it for output
C (uness perhaps it is redundant).
if(n.eq.LTone) msg3='R26'
if(n.eq.LTone+1) msg3='R27'
if(n.eq.LTone+2) msg3='RRR'
if(n.eq.LTone+3) msg3='73'
C Now check for redundant detections. (Not sure, now, why I chose
C the time span 0.11 s.)
if(tstart-ts0.gt.0.11) then
peak0=0. !If time diff>0.11s, start fresh
else
if(peak.le.peak0) goto 20
nline=nline-1 !Delete previous, this one's better
peak0=peak !Save best peak
endif
C OK, we want to output this one. Save the information.
if(nline.le.99) nline=nline+1
ts0=tstart
tping(nline)=tstart
nst=(int(smax/smax2)-4)/2 + 1
if(nst.lt.1) nst=1
if(nst.gt.3) nst=3
write(line(nline),1050) cfile6,tstart,mswidth,int(peak),
+ nwidth,nstrength,noffset,msg3,nst
1050 format(a6,f5.1,i5,i3,1x,2i1,i5,1x,a3,40x,i3)
endif
20 continue
enddo
return
end

87
sync.f
View File

@ -1,87 +0,0 @@
subroutine sync(y1,y2,y3,y4,npts,jpk,baud,bauderr)
C Input data are in the y# arrays: detected sigs in four tone-channels,
C before decimation by NSPD.
parameter (NSPD=25)
real y1(npts)
real y2(npts)
real y3(npts)
real y4(npts)
real zf(NSPD)
real tmp1
real tmp2
complex csum
integer nsum(NSPD)
real z(65538) !Ready for FSK110
complex cz(0:32768)
equivalence (z,cz)
data twopi/6.283185307/
do i=1,NSPD
zf(i)=0.0
nsum(i)=0
enddo
do i=1,npts
a1=max(y1(i),y2(i),y3(i),y4(i)) !Find the largest one
if(a1.eq.y1(i)) then !Now find 2nd largest
a2=max(y2(i),y3(i),y4(i))
else if(a1.eq.y2(i)) then
a2=max(y1(i),y3(i),y4(i))
else if(a1.eq.y3(i)) then
a2=max(y1(i),y2(i),y4(i))
else
a2=max(y1(i),y2(i),y3(i))
endif
z(i)=1.e-6*(a1-a2) !Subtract 2nd from 1st
j=mod(i-1,NSPD)+1
zf(j)=zf(j)+z(i)
nsum(j)=nsum(j)+1
enddo
n=log(float(npts))/log(2.0)
nfft=2**(n+1)
call zero(z(npts+1),nfft-npts)
call xfft(z,nfft)
C Now find the apparent baud rate.
df=11025.0/nfft
zmax=0.
ia=391.0/df !Was 341/df
ib=491.0/df !Was 541/df
do i=ia,ib
z(i)=real(cz(i))**2 + aimag(cz(i))**2
if(z(i).gt.zmax) then
zmax=z(i)
baud=df*i
endif
enddo
C Find phase of signal at 441 Hz.
csum=0.
do j=1,NSPD
pha=j*twopi/NSPD
csum=csum+zf(j)*cmplx(cos(pha),-sin(pha))
enddo
tmp1=aimag(csum)
tmp2=real(csum)
pha=-atan2(tmp1,tmp2)
jpk=nint(NSPD*pha/twopi)
if(jpk.lt.1) jpk=jpk+NSPD
C The following is nearly equivalent to the above. I don't know which
C (if either) is better.
c zfmax=-1.e30
c do j=1,NSPD
c if(zf(j).gt.zfmax) then
c zfmax=zf(j)
c jpk2=j
c endif
c enddo
bauderr=(baud-11025.0/NSPD)/df !Baud rate error, in bins
return
end

65
wsjt1.F
View File

@ -76,7 +76,6 @@
close(16)
4 if(jz.gt.655360) jz=655360
if(mode.eq.4 .and. jz.gt.330750) jz=330750 !### Fix this!
sum=0.
do j=1,jz !Convert raw data from i*2 to real, remove DC
@ -116,15 +115,6 @@ C Intentionally degrade SNR by -nclip dB.
enddo
endif
if(mode.ne.2 .and. nzap.ne.0) then
nfrz=NFreeze
if(mode.eq.1) nfrz=0
if(jz.gt.100000) call avesp2(dat,jz,2,mode,nfrz,MouseDF,
+ DFTolerance,fzap)
nadd=1
call bzap(dat,jz,nadd,mode,fzap)
endif
sq=0.
do j=1,jz !Compute power level for whole array
sq=sq + dat(j)**2
@ -162,43 +152,36 @@ C Intentionally degrade SNR by -nclip dB.
tbest=0.
NsyncOK=0
! If we're in JT65 mode, call the decode65 routines.
if(mode.eq.2) then
! if(rmspower.gt.34000.0) go to 900 !Reject very noisy data
! Only JT65 mode is supported.
! Check for a JT65 shorthand message
nstest=0
if(ntx2.ne.1) call short65(dat,jz,NFreeze,MouseDF,
+ DFTolerance,mode65,nspecial,nstest,dfsh,iderrsh,
+ idriftsh,snrsh,ss1,ss2,nwsh,idfsh)
nstest=0
if(ntx2.ne.1) call short65(dat,jz,NFreeze,MouseDF,
+ DFTolerance,mode65,nspecial,nstest,dfsh,iderrsh,
+ idriftsh,snrsh,ss1,ss2,nwsh,idfsh)
! Lowpass filter and decimate by 2
call lpf1(dat,jz,jz2,MouseDF,MouseDF2)
idf=mousedf-mousedf2
jz=jz2
nadd=1
fzap(1)=0.
if(nzap.eq.1) call avesp2(dat,jz,nadd,mode,NFreeze,MouseDF2,
call lpf1(dat,jz,jz2,MouseDF,MouseDF2)
idf=mousedf-mousedf2
jz=jz2
nadd=1
fzap(1)=0.
if(nzap.eq.1) call avesp2(dat,jz,nadd,mode,NFreeze,MouseDF2,
+ DFTolerance,fzap)
if(nzap.eq.1.and.nstest.eq.0) call bzap(dat,jz,nadd,mode,fzap)
if(nzap.eq.1.and.nstest.eq.0) call bzap(dat,jz,nadd,mode,fzap)
i=index(MyCall,char(0))
if(i.le.0) i=index(MyCall,' ')
mycall=MyCall(1:i-1)//' '
i=index(HisCall,char(0))
if(i.le.0) i=index(HisCall,' ')
hiscall=HisCall(1:i-1)//' '
i=index(MyCall,char(0))
if(i.le.0) i=index(MyCall,' ')
mycall=MyCall(1:i-1)//' '
i=index(HisCall,char(0))
if(i.le.0) i=index(HisCall,' ')
hiscall=HisCall(1:i-1)//' '
! Offset data by about 1 s.
if(jz.ge.126*2048) call wsjt65(dat(4097),jz-4096,cfile6,
+ NClearAve,MinSigdB,DFTolerance,NFreeze,NAFC,mode65,Nseg,
+ MouseDF2,NAgain,ndepth,neme,nsked,idf,idfsh,
+ mycall,hiscall,hisgrid,lumsg,lcum,nspecial,ndf,
+ nstest,dfsh,snrsh,
+ NSyncOK,ccf,psavg,ndiag,nwsh)
goto 900
endif
800 continue
call s2shape(s2,nchan,nz,tbest)
if(jz.ge.126*2048) call wsjt65(dat(4097),jz-4096,cfile6,
+ NClearAve,MinSigdB,DFTolerance,NFreeze,NAFC,mode65,Nseg,
+ MouseDF2,NAgain,ndepth,neme,nsked,idf,idfsh,
+ mycall,hiscall,hisgrid,lumsg,lcum,nspecial,ndf,
+ nstest,dfsh,snrsh,
+ NSyncOK,ccf,psavg,ndiag,nwsh)
900 LDecoded = ((NSyncOK.gt.0) .or. npkept.gt.0)
end file 11