Now configured for MSK -- like JTMS v2, but at 2000 baud.

Implemented AutoZero control.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/jtms3@2518 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-07-14 19:05:40 +00:00
parent 1a3ca1071c
commit 71ddb3fd1e
7 changed files with 119 additions and 44 deletions

View File

@ -17,7 +17,7 @@ CFLAGS = -I. -fbounds-check
%.o: %.F90 %.o: %.F90
${FC} ${FFLAGS} -c $< ${FC} ${FFLAGS} -c $<
all: libm65.a ms3.exe JTMScode.exe all: libm65.a ms3.exe t1.exe
OBJS1 = trimlist.o display.o getdphi.o pctile.o ccf65.o \ OBJS1 = trimlist.o display.o getdphi.o pctile.o ccf65.o \
decode1a.o sort.o filbig.o fil6521.o afc65b.o \ decode1a.o sort.o filbig.o fil6521.o afc65b.o \
@ -31,19 +31,20 @@ OBJS1 = trimlist.o display.o getdphi.o pctile.o ccf65.o \
astro.o tm2.o sun.o moondop.o coord.o tmoonsub.o \ astro.o tm2.o sun.o moondop.o coord.o tmoonsub.o \
geocentric.o moon2.o toxyz.o dot.o dcoord.o f77_wisdom.o \ geocentric.o moon2.o toxyz.o dot.o dcoord.o f77_wisdom.o \
gen65.o chkmsg.o ptt.o astrosub.o astro0.o recvpkt.o symspec.o \ gen65.o chkmsg.o ptt.o astrosub.o astro0.o recvpkt.o symspec.o \
iqcal.o iqfix.o timf2.o s3avg.o genjtms3.o \ iqcal.o iqfix.o timf2.o s3avg.o genjtms3.o analytic.o \
entail.o encode232.o scr258.o analytic.o db.o db.o specjtms.o genmsk.o
libm65.a: $(OBJS1) libm65.a: $(OBJS1)
ar cr libm65.a $(OBJS1) ar cr libm65.a $(OBJS1)
ranlib libm65.a ranlib libm65.a
OBJS3 = ms3.o specjtms.o OBJS3 = ms3.o
ms3.exe: $(OBJS3) libm65.a ms3.exe: $(OBJS3) libm65.a
$(FC) -o ms3.exe $(OBJS3) libm65.a ../libfftw3f_win.a $(FC) -o ms3.exe $(OBJS3) libm65.a ../libfftw3f_win.a \
OBJS2 = JTMScode.o genjtms3a.o fano232.o OBJS2 = JT65code.o
JTMScode.exe: $(OBJS2) libm65.a JT65code.exe: $(OBJS2) libm65.a
$(FC) -o JTMScode.exe $(OBJS2) libm65.a ../libfftw3f_win.a $(FC) -o JT65code.exe $(OBJS2) libm65.a
INCPATH = -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore' \ INCPATH = -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore' \
-I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include' \ -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include' \
@ -65,9 +66,9 @@ OBJS4 = tastro.o astro0.o libm65.a
tastro.exe: $(OBJS4) tastro.exe: $(OBJS4)
$(FC) $(FFLAGS) -o tastro.exe $(OBJS4) libm65.a $(FC) $(FFLAGS) -o tastro.exe $(OBJS4) libm65.a
OBJS5 = t1.o timer.o libm65.a OBJS5 = t1.o genms.o libm65.a
t1.exe: $(OBJS5) t1.exe: $(OBJS5)
$(FC) $(FFLAGS) -o t1.exe $(OBJS5) libm65.a $(FC) $(FFLAGS) -o t1.exe $(OBJS5) libm65.a ../libfftw3f_win.a \
#astro0.o: ../astro0.f90 #astro0.o: ../astro0.f90
# $(FC) -c $(FFLAGS) -o astro0.o ../astro0.f90 # $(FC) -c $(FFLAGS) -o astro0.o ../astro0.f90

99
libm65/genmsk.f90 Normal file
View File

@ -0,0 +1,99 @@
!subroutine genms(msg28,samfac,iwave,cwave,isrch,nwave)
subroutine genmsk(msg28,iwave,nwave)
! Generate a JTMS wavefile.
parameter (NMAX=30*48000) !Max length of wave file
integer*2 iwave(NMAX) !Generated wave file
complex cwave(NMAX) !Alternative for searchms
character*28 msg28 !User message
character*29 msg
character cc*64
integer sent(203)
real*8 dt,phi,f,f0,dfgen,dphi,twopi,foffset,samfac
integer np(9)
data np/5,7,9,11,13,17,19,23,29/ !Permissible message lengths
! 1 2 3 4 5 6
! 0123456789012345678901234567890123456789012345678901234567890123
data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/
!###
samfac=1.d0
isrch=0
!###
msg=msg28//' ' !Extend to 29 characters
do i=28,1,-1 !Find user's message length
if(msg(i:i).ne.' ') go to 1
enddo
1 iz=i+1 !Add one for space at EOM
msglen=iz
if(isrch.ne.0) go to 3
do i=1,9
if(np(i).ge.iz) go to 2
enddo
i=8
2 msglen=np(i)
! Convert message to a bit sequence, 7 bits per character (6 + even parity)
3 sent=0
k=0
do j=1,msglen
if(msg(j:j).eq.' ') then
i=58
go to 5
else
do i=1,64
if(msg(j:j).eq.cc(i:i)) go to 5
enddo
endif
5 m=0
do n=5,0,-1 !Each character gets 6 bits
k=k+1
sent(k)=iand(1,ishft(i-1,-n))
m=m+sent(k)
enddo
k=k+1
sent(k)=iand(m,1) !Insert parity bit
enddo
nsym=k
! Set up necessary constants
twopi=8.d0*atan(1.d0)
nsps=24
dt=1.d0/(samfac*48000.d0)
f0=48000.d0/nsps
dfgen=0.5d0*f0
foffset=1500.d0 - f0
print*,f0,dfgen,foffset
t=0.d0
k=0
phi=0.d0
nrpt=NMAX/(nsym*nsps)
if(isrch.ne.0) nrpt=1
do irpt=1,nrpt
do j=1,nsym
if(sent(j).eq.1) then
f=f0 + 0.5d0*dfgen + foffset
else
f=f0 - 0.5d0*dfgen + foffset
endif
dphi=twopi*f*dt
do i=1,nsps
k=k+1
phi=phi+dphi
if(isrch.eq.0) then
iwave(k)=nint(32767.0*sin(phi))
else
cwave(k)=cmplx(cos(phi),sin(phi))
endif
enddo
enddo
enddo
if(isrch.eq.0) iwave(k+1:)=0
nwave=k
return
end subroutine genmsk

View File

@ -1187,7 +1187,8 @@ void MainWindow::guiUpdate()
ba2msg(ba,message); ba2msg(ba,message);
ba2msg(ba,msgsent); ba2msg(ba,msgsent);
int len1=28; int len1=28;
genjtms3_(message,iwave,&nwave,len1); // genjtms3_(message,iwave,&nwave,len1);
genmsk_(message,iwave,&nwave,len1);
// makepings_(iwave,&nwave); // makepings_(iwave,&nwave);
if(m_restart) { if(m_restart) {
QFile f("jtms3_tx.log"); QFile f("jtms3_tx.log");

View File

@ -237,6 +237,7 @@ extern "C" {
//----------------------------------------------------- C and Fortran routines //----------------------------------------------------- C and Fortran routines
void specjtms_(int* k, float* px, float* pxsmo, float* spk0, float* f0); void specjtms_(int* k, float* px, float* pxsmo, float* spk0, float* f0);
void genjtms3_(char* message, short iwave[], int* nwave, int len1); void genjtms3_(char* message, short iwave[], int* nwave, int len1);
void genmsk_(char* message, short iwave[], int* nwave, int len1);
void makepings_(short iwave[], int* nwave); void makepings_(short iwave[], int* nwave);
void gen65_(char* msg, int* mode65, double* samfac, int* nsendingsh, void gen65_(char* msg, int* mode65, double* samfac, int* nsendingsh,

View File

@ -130,13 +130,6 @@ void CPlotter::draw(float green[], int ig) //draw()
QRect tmp(0,0,w,h); QRect tmp(0,0,w,h);
painter2D.fillRect(tmp,Qt::black); painter2D.fillRect(tmp,Qt::black);
QPoint LineBuf[MAX_SCREENSIZE]; QPoint LineBuf[MAX_SCREENSIZE];
for(i=0; i<256; i++) { //Zero the histograms
m_hist1[i]=0;
m_hist2[i]=0;
}
int kline=mscom_.kline; int kline=mscom_.kline;
for(i=0; i<h; i++) { for(i=0; i<h; i++) {
@ -153,7 +146,6 @@ void CPlotter::draw(float green[], int ig) //draw()
} }
if (y1<0) y1=0; if (y1<0) y1=0;
if (y1>254) y1=254; if (y1>254) y1=254;
m_hist1[y1]++;
painter1.setPen(m_ColorTbl[y1]); painter1.setPen(m_ColorTbl[y1]);
painter1.drawPoint(kline,h-i); painter1.drawPoint(kline,h-i);
} }
@ -161,7 +153,7 @@ void CPlotter::draw(float green[], int ig) //draw()
painter2D.setPen(Qt::green); painter2D.setPen(Qt::green);
j=0; j=0;
for(i=0; i<ig; i++) { for(i=0; i<ig; i++) {
y = green[i]; y=green[i];
painter1.drawPoint(i,0); painter1.drawPoint(i,0);
int y2 = 4*(y-m_plotZero); int y2 = 4*(y-m_plotZero);
if (y2<0) y2=0; if (y2<0) y2=0;
@ -170,6 +162,7 @@ void CPlotter::draw(float green[], int ig) //draw()
LineBuf[j].setY(h-y2); LineBuf[j].setY(h-y2);
j++; j++;
} }
m_aveGreen=0.9*m_aveGreen + 0.1*green[ig];
painter2D.drawPolyline(LineBuf,ig); painter2D.drawPolyline(LineBuf,ig);
update(); //trigger a new paintEvent update(); //trigger a new paintEvent
} }
@ -381,28 +374,7 @@ void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click
int CPlotter::autoZero() //autoZero() int CPlotter::autoZero() //autoZero()
{ {
m_z1=0; m_plotZero=m_aveGreen-5;
m_z2=0;
int sum1=0;
for(int i=0; i<256; i++) {
sum1 += m_hist1[i];
if(sum1 > m_Size.width()/2) {
m_z1=i;
break;
}
}
int sum2=0;
for(int i=0; i<256; i++) {
sum2 += m_hist2[i];
if(sum2 > 16384) {
m_z2=i;
break;
}
}
double gain = pow(10.0,0.05*(m_plotGain+7));
// double dz1 = (m_z1-38)/(5.0*gain);
double dz2 = (m_z2-28)/(5.0*gain);
if(m_z2 < 255) m_plotZero = int(m_plotZero + dz2 + 0.5);
return m_plotZero; return m_plotZero;
} }

View File

@ -28,6 +28,7 @@ public:
QColor m_ColorTbl[256]; QColor m_ColorTbl[256];
int m_plotZero; int m_plotZero;
int m_plotGain; int m_plotGain;
qint32 m_waterfallAvg;
qint32 m_DF; qint32 m_DF;
qint32 m_tol; qint32 m_tol;
@ -77,6 +78,7 @@ private:
bool m_2Dspec; bool m_2Dspec;
bool m_paintAllZoom; bool m_paintAllZoom;
double m_CenterFreq; double m_CenterFreq;
double m_aveGreen;
qint64 m_ZoomStartFreq; qint64 m_ZoomStartFreq;
qint64 m_FreqOffset; qint64 m_FreqOffset;
qint32 m_dBStepSize; qint32 m_dBStepSize;
@ -85,8 +87,6 @@ private:
bool m_dataFromDisk; bool m_dataFromDisk;
char m_sutc[5]; char m_sutc[5];
qint32 m_line; qint32 m_line;
qint32 m_hist1[256];
qint32 m_hist2[256];
qint32 m_z1; qint32 m_z1;
qint32 m_z2; qint32 m_z2;
qint32 m_nkhz; qint32 m_nkhz;

View File

@ -140,6 +140,7 @@ void WideGraph::on_freqSpanSpinBox_valueChanged(int n)
void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n) void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n)
{ {
m_waterfallAvg = n; m_waterfallAvg = n;
ui->widePlot->m_waterfallAvg = n;
} }
void WideGraph::on_zeroSpinBox_valueChanged(int value) void WideGraph::on_zeroSpinBox_valueChanged(int value)