Make ptt() consistent with the one in WSPR.

Correct a gray-coding flaw in spec9.f90.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2748 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-11-19 16:45:42 +00:00
parent 793053e9aa
commit 91302a3575
4 changed files with 30 additions and 17 deletions

View File

@ -135,7 +135,7 @@ int ptt(int nport, int ntx, int *iptt)
}
if(ntx && (!open)) {
sprintf(s,"COM%d",nport);
sprintf(s,"\\\\.\\COM%d",nport);
hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE) {
@ -159,12 +159,14 @@ int ptt(int nport, int ntx, int *iptt)
*iptt=0;
open=0;
}
/*
if(i3==0) return -(SETRTS);
if(i4==0) return -(CLRRTS);
if(i5==0) return -(SETDTR);
if(i6==0) return -(CLRDTR);
if(i9==0) return -(CLRBREAK);
if(i00==0) return -10;
*/
return 0;
#endif
}

View File

@ -6,7 +6,7 @@ int ptt_(int *nport, int *ntx, int *iptt)
static HANDLE hFile;
static int open=0;
char s[10];
int i3,i4,i5,i6,i9,i00;
int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1;
if(*nport==0) {
*iptt=*ntx;
@ -14,7 +14,7 @@ int ptt_(int *nport, int *ntx, int *iptt)
}
if(*ntx && (!open)) {
sprintf(s,"COM%d",*nport);
sprintf(s,"\\\\.\\COM%d",*nport);
hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE) {
@ -38,11 +38,13 @@ int ptt_(int *nport, int *ntx, int *iptt)
*iptt=0;
open=0;
}
/*
if(i3==0) return 3;
if(i4==0) return 4;
if(i5==0) return 5;
if(i6==0) return 6;
if(i9==0) return 9;
if(i00==0) return 10;
*/
return 0;
}

View File

@ -33,7 +33,7 @@ subroutine spec9(c0,npts8,nsps,fpk0,fpk,xdt,snrdb,i1SoftSymbols)
nsps8=nsps/8
foffset=fpk0
istart=1500
istart=1520
call timer('peakdt9 ',0)
call peakdt9(c1,npts8,nsps8,istart,foffset,idt)
@ -74,7 +74,7 @@ subroutine spec9(c0,npts8,nsps,fpk0,fpk,xdt,snrdb,i1SoftSymbols)
call four2a(c,nfft,1,-1,1)
do i=0,nfft-1
sx(i)=real(c(i))**2 + aimag(c(i))**2
if(i.ge.1 .and. i.le.8) ssym(ig(i-1),k)=sx(i)
if(i.ge.1 .and. i.le.8) ssym(i-1,k)=sx(i)
enddo
enddo
@ -92,6 +92,7 @@ subroutine spec9(c0,npts8,nsps,fpk0,fpk,xdt,snrdb,i1SoftSymbols)
ave=sum/(69*7)
call pctile(sx,nsps8,50,xmed)
ssym=ssym/ave
sig=sig/69.
df8=1500.0/nsps8
t=max(1.0,sig/xmed - 1.0)
@ -101,26 +102,34 @@ subroutine spec9(c0,npts8,nsps,fpk0,fpk,xdt,snrdb,i1SoftSymbols)
ntones=8
k=0
do j=1,69
do m=m0-1,0,-1 !Get bit-wise soft symbols
n=2**m
r1=0.
r2=0.
do i=0,ntones-1
if(iand(i,n).ne.0) then
r1=max(r1,ssym(i,j))
else
r2=max(r2,ssym(i,j))
smax=0.
do i=0,7
if(ssym(i,j).gt.smax) then
smax=ssym(i,j)
ipk=i
endif
enddo
do m=m0-1,0,-1 !Get bit-wise soft symbols
if(m.eq.2) then
r1=max(ssym(4,j),ssym(5,j),ssym(6,j),ssym(7,j))
r0=max(ssym(0,j),ssym(1,j),ssym(2,j),ssym(3,j))
else if(m.eq.1) then
r1=max(ssym(2,j),ssym(3,j),ssym(4,j),ssym(5,j))
r0=max(ssym(0,j),ssym(1,j),ssym(6,j),ssym(7,j))
else
r1=max(ssym(1,j),ssym(2,j),ssym(4,j),ssym(7,j))
r0=max(ssym(0,j),ssym(3,j),ssym(5,j),ssym(6,j))
endif
k=k+1
i4=nint(10.0*(r1-r2))
i4=nint(10.0*(r1-r0))
if(i4.lt.-127) i4=-127
if(i4.gt.127) i4=127
i4=i4+128
i1SoftSymbolsScrambled(k)=i1
enddo
enddo
call interleave9(i1SoftSymbolsScrambled,-1,i1SoftSymbols)
return

View File

@ -1,6 +1,6 @@
[Setup]
AppName=wsjtx
AppVerName=wsjtx Version 0.4 r2731
AppVerName=wsjtx Version 0.4 r2746
AppCopyright=Copyright (C) 2001-2012 by Joe Taylor, K1JT
DefaultDirName=c:\wsjtx
DefaultGroupName=wsjtx