From 40b0aaaf08663811b61f392e31eb2d969d527e02 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 14 Jul 2012 19:05:40 +0000 Subject: [PATCH] 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 --- libm65/Makefile.MinGW | 21 ++++----- libm65/genmsk.f90 | 99 +++++++++++++++++++++++++++++++++++++++++++ mainwindow.cpp | 3 +- mainwindow.h | 1 + plotter.cpp | 34 ++------------- plotter.h | 4 +- widegraph.cpp | 1 + 7 files changed, 119 insertions(+), 44 deletions(-) create mode 100644 libm65/genmsk.f90 diff --git a/libm65/Makefile.MinGW b/libm65/Makefile.MinGW index 74962438f..e961b1245 100644 --- a/libm65/Makefile.MinGW +++ b/libm65/Makefile.MinGW @@ -17,7 +17,7 @@ CFLAGS = -I. -fbounds-check %.o: %.F90 ${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 \ 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 \ 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 \ - iqcal.o iqfix.o timf2.o s3avg.o genjtms3.o \ - entail.o encode232.o scr258.o analytic.o db.o + iqcal.o iqfix.o timf2.o s3avg.o genjtms3.o analytic.o \ + db.o specjtms.o genmsk.o + libm65.a: $(OBJS1) ar cr libm65.a $(OBJS1) ranlib libm65.a -OBJS3 = ms3.o specjtms.o +OBJS3 = ms3.o 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 -JTMScode.exe: $(OBJS2) libm65.a - $(FC) -o JTMScode.exe $(OBJS2) libm65.a ../libfftw3f_win.a +OBJS2 = JT65code.o +JT65code.exe: $(OBJS2) libm65.a + $(FC) -o JT65code.exe $(OBJS2) libm65.a INCPATH = -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore' \ -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include' \ @@ -65,9 +66,9 @@ OBJS4 = tastro.o astro0.o libm65.a tastro.exe: $(OBJS4) $(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) - $(FC) $(FFLAGS) -o t1.exe $(OBJS5) libm65.a + $(FC) $(FFLAGS) -o t1.exe $(OBJS5) libm65.a ../libfftw3f_win.a \ #astro0.o: ../astro0.f90 # $(FC) -c $(FFLAGS) -o astro0.o ../astro0.f90 diff --git a/libm65/genmsk.f90 b/libm65/genmsk.f90 new file mode 100644 index 000000000..8b469ba0d --- /dev/null +++ b/libm65/genmsk.f90 @@ -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 diff --git a/mainwindow.cpp b/mainwindow.cpp index 3d7a6b4f5..29d7107f9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1187,7 +1187,8 @@ void MainWindow::guiUpdate() ba2msg(ba,message); ba2msg(ba,msgsent); int len1=28; - genjtms3_(message,iwave,&nwave,len1); +// genjtms3_(message,iwave,&nwave,len1); + genmsk_(message,iwave,&nwave,len1); // makepings_(iwave,&nwave); if(m_restart) { QFile f("jtms3_tx.log"); diff --git a/mainwindow.h b/mainwindow.h index f2707662b..f0f4ee9f4 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -237,6 +237,7 @@ extern "C" { //----------------------------------------------------- C and Fortran routines void specjtms_(int* k, float* px, float* pxsmo, float* spk0, float* f0); 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 gen65_(char* msg, int* mode65, double* samfac, int* nsendingsh, diff --git a/plotter.cpp b/plotter.cpp index e914aee4c..776ba18bc 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -130,13 +130,6 @@ void CPlotter::draw(float green[], int ig) //draw() QRect tmp(0,0,w,h); painter2D.fillRect(tmp,Qt::black); 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; for(i=0; i254) y1=254; - m_hist1[y1]++; painter1.setPen(m_ColorTbl[y1]); painter1.drawPoint(kline,h-i); } @@ -161,7 +153,7 @@ void CPlotter::draw(float green[], int ig) //draw() painter2D.setPen(Qt::green); j=0; for(i=0; i 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); + m_plotZero=m_aveGreen-5; return m_plotZero; } diff --git a/plotter.h b/plotter.h index 6f18a47b9..ea8941e8a 100644 --- a/plotter.h +++ b/plotter.h @@ -28,6 +28,7 @@ public: QColor m_ColorTbl[256]; int m_plotZero; int m_plotGain; + qint32 m_waterfallAvg; qint32 m_DF; qint32 m_tol; @@ -77,6 +78,7 @@ private: bool m_2Dspec; bool m_paintAllZoom; double m_CenterFreq; + double m_aveGreen; qint64 m_ZoomStartFreq; qint64 m_FreqOffset; qint32 m_dBStepSize; @@ -85,8 +87,6 @@ private: bool m_dataFromDisk; char m_sutc[5]; qint32 m_line; - qint32 m_hist1[256]; - qint32 m_hist2[256]; qint32 m_z1; qint32 m_z2; qint32 m_nkhz; diff --git a/widegraph.cpp b/widegraph.cpp index 07b488cde..1ce5a9171 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -140,6 +140,7 @@ void WideGraph::on_freqSpanSpinBox_valueChanged(int n) void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n) { m_waterfallAvg = n; + ui->widePlot->m_waterfallAvg = n; } void WideGraph::on_zeroSpinBox_valueChanged(int value)