diff --git a/commons.h b/commons.h index ca1dfebc4..f89bd8250 100644 --- a/commons.h +++ b/commons.h @@ -13,7 +13,6 @@ extern struct { int ndiskdat; //1 ==> data read from *.wav file int ntrperiod; //TR period (seconds) int nfqso; //User-selected QSO freq (kHz) - int nagain; //1 ==> decode only at fQSO +/- Tol int newdat; //1 ==> new data, must do long FFT int npts8; //npts for c0() array int nfb; //High decode limit (kHz) diff --git a/devsetup.cpp b/devsetup.cpp index 02a8d4e59..3b55a7a9b 100644 --- a/devsetup.cpp +++ b/devsetup.cpp @@ -8,7 +8,7 @@ //----------------------------------------------------------- DevSetup() DevSetup::DevSetup(QWidget *parent) : QDialog(parent) { - ui.setupUi(this); //setup the dialog form + ui.setupUi(this); //setup the dialog form m_restartSoundIn=false; m_restartSoundOut=false; } @@ -30,26 +30,11 @@ void DevSetup::initDlg() char pa_device_name[128]; char pa_device_hostapi[128]; -/* - getDev(&numDevices,hostAPI_DeviceName,minChan,maxChan,minSpeed,maxSpeed); - k=0; - for(id=0; id= minSpeed[id] && 48000 <= maxSpeed[id]) { - m_inDevList[k]=id; - k++; - sprintf(s,"%2d %d %-49s",id,maxChan[id],hostAPI_DeviceName[id]); - QString t(s); - ui.comboBoxSndIn->addItem(t); - valid_devices++; - } - } -*/ - k=0; for(id=0; idmaxInputChannels; - if(nchin>=2) { + if(nchin>0) { m_inDevList[k]=id; k++; sprintf((char*)(pa_device_name),"%s",pdi->name); @@ -68,7 +53,7 @@ void DevSetup::initDlg() p=strstr(pa_device_hostapi,"WDM-KS"); if(p!=NULL) p1=(char*)"WDM-KS"; - sprintf(p2,"%2d %-8s %-39s",id,p1,pa_device_name); + sprintf(p2,"%2d %d %-8s %-39s",id,nchin,p1,pa_device_name); QString t(p2); ui.comboBoxSndIn->addItem(t); } @@ -78,7 +63,7 @@ void DevSetup::initDlg() for(id=0; idmaxOutputChannels; - if(nchout>=2) { + if(nchout>0) { m_outDevList[k]=id; k++; sprintf((char*)(pa_device_name),"%s",pdi->name); @@ -97,7 +82,7 @@ void DevSetup::initDlg() p=strstr(pa_device_hostapi,"WDM-KS"); if(p!=NULL) p1=(char*)"WDM-KS"; - sprintf(p2,"%2d %-8s %-39s",id,p1,pa_device_name); + sprintf(p2,"%2d %d %-8s %-39s",id,nchout,p1,pa_device_name); QString t(p2); ui.comboBoxSndOut->addItem(t); } diff --git a/devsetup.ui b/devsetup.ui index 142b6f39e..70fcffe57 100644 --- a/devsetup.ui +++ b/devsetup.ui @@ -29,7 +29,7 @@ 10 34 421 - 216 + 221 @@ -320,6 +320,13 @@ + + + + Dev Ch API Name + + + diff --git a/getfile.h b/getfile.h index 38283538d..515e02afd 100644 --- a/getfile.h +++ b/getfile.h @@ -6,7 +6,6 @@ #include "commons.h" void getfile(QString fname, int ntrperiod); -void savetf2(QString fname, int ntrperiod); float gran(); int ptt(int* nport, int* ntx, int* iptt); diff --git a/lib/decoder.f90 b/lib/decoder.f90 index f477835ef..e3ee60a15 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -1,8 +1,6 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) -! Decoder for JT9. Can run stand-alone, reading data from *.wav files; -! or as the back end of wsjt-x, with data placed in a shared memory region. - +! Decoder for JT9. ! NB: For unknown reason, ***MUST*** be compiled by g95 with -O0 !!! parameter (NMAX=1800*12000) !Total sample intervals per 30 minutes @@ -15,7 +13,7 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) integer*2 id2 complex c0(NDMAX),c00(NDMAX) common/jt9com/ss0(184,NSMAX),savg(NSMAX),id2(NMAX),nutc0,ndiskdat, & - ntr,nfqso,nagain,newdat,npts80,nfb,ntol,kin,nsynced,ndecoded + ntr,nfqso,newdat,npts80,nfb,ntol,kin,nsynced,ndecoded common/jt9comB/ss(184,NSMAX),c0 logical first data first/.true./ @@ -55,12 +53,10 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) endif if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code### -! Now do the decoding kstep=nsps/2 tstep=kstep/12000.0 -! Get sync, approx freq - call sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) + call sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) ! Get sync, approx freq open(13,file='decoded.txt',status='unknown') rewind 13 @@ -81,7 +77,8 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) if((i.eq.ipk .or. ccfred(i).ge.3.0) .and. f.gt.fgood+10.0*df8) then call spec9(c0,npts8,nsps,f,fpk,xdt,snrdb,i1SoftSymbols) call decode9(i1SoftSymbols,limit,nlim,msg) - snr=10.0*log10(ccfred(i)) - 10.0*log10(2500.0/df3) + 2.0 +! snr=10.0*log10(ccfred(i)) - 10.0*log10(2500.0/df3) + 2.0 + snr=snrdb sync=ccfred(i) - 2.0 if(sync.lt.0.0) sync=0.0 nsync=sync diff --git a/lib/genjt9.f90 b/lib/genjt9.f90 index 34c6ce6e7..8ef9269c0 100644 --- a/lib/genjt9.f90 +++ b/lib/genjt9.f90 @@ -23,6 +23,7 @@ subroutine genjt9(message,msgsent,i4tone) call packmsg(message,i4Msg6BitWords) !Pack message into 12 6-bit bytes call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent + if(i4tone(1).eq.-99) go to 999 call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, convert to 8-bit bytes nsym2=206 call encode232(i1Msg8BitBytes,nsym2,i1EncodedBits) !Encode K=32, r=1/2 @@ -41,5 +42,5 @@ subroutine genjt9(message,msgsent,i4tone) endif enddo - return +999 return end subroutine genjt9 diff --git a/lib/jt9.f90 b/lib/jt9.f90 index 1d3eded63..0451bd7c1 100644 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -19,7 +19,7 @@ program jt9 integer*2 id2 complex c0(NDMAX) common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat, & - ntr,mousefqso,nagain,newdat,nfa,nfb,ntol,kin + ntr,mousefqso,newdat,nfa,nfb,ntol,kin nargs=iargc() if(nargs.lt.1) then diff --git a/lib/jt9a.f90 b/lib/jt9a.f90 index 2f5db5562..2174c23fd 100644 --- a/lib/jt9a.f90 +++ b/lib/jt9a.f90 @@ -74,7 +74,7 @@ subroutine m65c(dd,ss,savg,nparams0) character*12 mycall,hiscall character*6 mygrid,hisgrid character*20 datetime - common/npar/fcenter,nutc,idphi,mousedf,mousefqso,nagain, & + common/npar/fcenter,nutc,idphi,mousedf,mousefqso, & ndepth,ndiskdat,neme,newdat,nfa,nfb,nfcal,nfshift, & mcall3,nkeep,ntol,nxant,nrxlog,nfsample,nxpol,mode65, & mycall,mygrid,hiscall,hisgrid,datetime diff --git a/lib/jt9sync.f90 b/lib/jt9sync.f90 index 28e1d68ea..49f3e1c94 100644 --- a/lib/jt9sync.f90 +++ b/lib/jt9sync.f90 @@ -1,19 +1,11 @@ integer ii(16) !Locations of sync symbols -! data ii/1,6,11,16,21,26,31,39,45,51,57,63,69,75,81,85/ data ii/ 1,2,5,10,16,23,33,35,51,52,55,60,66,73,83,85/ - integer ii2(16) !Locations of sync half-symbols -! data ii2/1,11,21,31,41,51,61,77,89,101,113,125,137,149,161,169/ + integer ii2(16) !Locations of sync half-symbols data ii2/1,3,9,19,31,45,65,69,101,103,109,119,131,145,165,169/ integer isync(85) !Sync vector -! data isync/ & -! 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0, & -! 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0, & -! 0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0, & -! 0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0, & -! 1,0,0,0,1/ data isync/ & 1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0, & 0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, & diff --git a/lib/spec9.f90 b/lib/spec9.f90 index 17ee7ebcb..fd876657d 100644 --- a/lib/spec9.f90 +++ b/lib/spec9.f90 @@ -84,10 +84,9 @@ subroutine spec9(c0,npts8,nsps,fpk0,fpk,xdt,snrdb,i1SoftSymbols) ave=sum/(69*7) ssym=ssym/ave sig=sig/69. - snr=sig/ave df8=1500.0/nsps8 - snrdb=db(snr) - db(2500.0/df8) -! print*,ave,sig,snr,df8,snrdb + t=max(1.0,sig/ave - 1.0) + snrdb=db(t) - db(2500.0/df8) m0=3 ntones=8 diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 7f1791292..7d6ce5ec8 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -33,7 +33,7 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nb,nbslider,pxdb,s,red, & integer*2 id2 complex c0(NDMAX) common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat, & - ntr,mousefqso,nagain,newdat,nfa,nfb,ntol,kin + ntr,mousefqso,newdat,nfa,nfb,ntol,kin data rms/999.0/,k0/99999999/,ntrperiod0/0/,nfft3z/0/ save diff --git a/mainwindow.cpp b/mainwindow.cpp index 5cdf21c9e..0d73fe817 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -86,13 +86,11 @@ MainWindow::MainWindow(QWidget *parent) : m_auto=false; m_waterfallAvg = 1; - m_network = true; m_txFirst=false; m_txMute=false; btxok=false; m_restart=false; m_transmitting=false; - m_killAll=false; m_widebandDecode=false; m_ntx=1; m_myCall="K1JT"; @@ -322,7 +320,7 @@ void MainWindow::readSettings() //-------------------------------------------------------------- dataSink() void MainWindow::dataSink(int k) { - static float s[NSMAX],red[NSMAX],splot[NSMAX]; + static float s[NSMAX],red[NSMAX]; static int n=0; static int ihsym=0; static int nzap=0; @@ -354,7 +352,7 @@ void MainWindow::dataSink(int k) &df3, &ihsym, &nzap, &slimit, lstrong, c0, &npts8); if(ihsym <=0) return; QString t; - m_pctZap=nzap/178.3; + m_pctZap=nzap*100.0/m_nsps; t.sprintf(" Rx noise: %5.1f %5.1f %% ",px,m_pctZap); lab3->setText(t); ui->xThermo->setValue((double)px); //Update the thermometer @@ -362,38 +360,11 @@ void MainWindow::dataSink(int k) g_pWideGraph->dataSink2(s,red,df3,ihsym,m_diskData,lstrong); } - //Average over specified number of spectra - if (n==0) { - for (int i=0; i=m_waterfallAvg) { - for (int i=0; isaveSettings(); - m_killAll=true; qApp->exit(0); // Exit the event loop } @@ -731,7 +701,8 @@ void MainWindow::diskDat() //diskDat() k=(n+1)*kstep; jt9com_.npts8=k/8; dataSink(k); - if(n%10 == 1 or n == m_hsymStop) qApp->processEvents(); //Keep GUI responsive + if(n%10 == 1 or n == m_hsymStop) + qApp->processEvents(); //Keep GUI responsive } } @@ -839,7 +810,6 @@ void MainWindow::on_DecodeButton_clicked() //Decode request { if(!m_decoderBusy) { jt9com_.newdat=0; - jt9com_.nagain=1; decode(); } } @@ -849,7 +819,6 @@ void MainWindow::freezeDecode(int n) //freezeDecode() static int ntol[] = {1,2,5,10,20,50,100,200,500,1000}; if(!m_decoderBusy) { jt9com_.newdat=0; - jt9com_.nagain=1; int i; if(m_mode=="JT9-1") i=4; if(m_mode=="JT9-2") i=4; @@ -869,7 +838,7 @@ void MainWindow::decode() //decode() decodeBusy(true); ui->DecodeButton->setStyleSheet(m_pbdecoding_style1); - if(jt9com_.nagain==0 && (!m_diskData)) { + if(!m_diskData) { qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; int imin=ms/60000; int ihr=imin/60; @@ -927,7 +896,7 @@ void MainWindow::guiUpdate() int nsec=ms/1000; double tsec=0.001*ms; double t2p=fmod(tsec,2*m_TRperiod); - bool bTxTime = t2p >= tx1 && t2p < tx2; + bool bTxTime = (t2p >= tx1) && (t2p < tx2); if(m_auto) { @@ -969,10 +938,10 @@ void MainWindow::guiUpdate() if(m_ntx == 6) ba=ui->tx6->text().toLocal8Bit(); ba2msg(ba,message); - ba2msg(ba,msgsent); +// ba2msg(ba,msgsent); int len1=22; - int len2=22; - genjt9_(message,msgsent,itone,len1,len2); + genjt9_(message,msgsent,itone,len1,len1); + msgsent[22]=0; if(m_restart) { QFile f("wsjtx_tx.log"); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); @@ -989,7 +958,7 @@ void MainWindow::guiUpdate() if(iptt==1 && iptt0==0) nc1=-9; // TxDelay = 0.8 s if(nc1 <= 0) nc1++; if(nc1 == 0) { - ui->xThermo->setValue(0.0); //Set the Thermos to zero + ui->xThermo->setValue(0.0); //Set Thermo to zero m_monitoring=false; soundInThread.setMonitoring(false); btxok=true; @@ -1062,7 +1031,8 @@ void MainWindow::guiUpdate() } m_setftx=0; - QString utc = " " + t.time().toString() + " "; + QString utc = t.date().toString("yyyy MMM dd") + "\n " + + t.time().toString() + " "; ui->labUTC->setText(utc); if(!m_monitoring and !m_diskData) { ui->xThermo->setValue(0.0); @@ -1340,6 +1310,7 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() char message[23]; char msgsent[23]; int len1=22; + int jtone[1]; double samfac=1.0; int nsendingsh=0; int mwave; @@ -1347,7 +1318,8 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() int i1=t.indexOf(" OOO"); QByteArray s=t.toUpper().toLocal8Bit(); ba2msg(s,message); -// gen65_(message,&mode65,&samfac,&nsendingsh,msgsent,iwave,&mwave,len1,len1); + jtone[0]=-99; + genjt9_(message,msgsent,jtone,len1,len1); nsendingsh=0; QPalette p(tx->palette()); if(nsendingsh==1) { diff --git a/mainwindow.h b/mainwindow.h index 150534c26..749c8ad99 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,16 +1,11 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include -#include #include #include -#include #include "soundin.h" #include "soundout.h" #include "commons.h" -#include "sleep.h" - -#define NFFT 32768 //--------------------------------------------------------------- MainWindow namespace Ui { @@ -24,7 +19,6 @@ class MainWindow : public QMainWindow public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); - bool m_network; public slots: void showSoundInError(const QString& errorMsg); @@ -149,7 +143,6 @@ private: bool m_auto; bool m_txMute; bool m_restart; - bool m_killAll; bool m_startAnother; bool m_saveSynced; bool m_saveDecoded; @@ -159,31 +152,22 @@ private: bool m_NB; bool m_call3Modified; bool m_dataAvailable; - char m_decoded[80]; - float m_pctZap; - QRect m_wideGraphGeom; - QLabel* lab1; // labels in status bar QLabel* lab2; QLabel* lab3; QLabel* lab4; QLabel* lab5; QLabel* lab6; - QMessageBox msgBox0; - QFuture* future1; QFuture* future2; QFuture* future3; QFutureWatcher* watcher1; QFutureWatcher* watcher2; QFutureWatcher* watcher3; - - QProcess proc_m65; - QString m_path; QString m_pbdecoding_style1; QString m_pbmonitor_style; diff --git a/mainwindow.ui b/mainwindow.ui index 4fab17f62..4988149ee 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -491,12 +491,12 @@ p, li { white-space: pre-wrap; } 150 - 40 + 60 - 20 + 16 @@ -505,6 +505,9 @@ p, li { white-space: pre-wrap; } 01:23:45 + + Qt::AlignCenter + diff --git a/plotter.cpp b/plotter.cpp index 426a76c87..cf360dc37 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -73,8 +73,6 @@ void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent() void CPlotter::paintEvent(QPaintEvent *) // paintEvent() { - static int x00=-99; - if(m_paintEventBusy) return; m_paintEventBusy=true; QPainter painter(this); diff --git a/soundin.cpp b/soundin.cpp index 11b89de10..c2f167b57 100644 --- a/soundin.cpp +++ b/soundin.cpp @@ -14,7 +14,6 @@ extern struct { int ndiskdat; //1 ==> data read from *.wav file int ntrperiod; //TR period (seconds) int mousefqso; //User-selected QSO freq (kHz) - int nagain; //1 ==> decode only at fQSO +/- Tol int newdat; //1 ==> new data, must do long FFT int npts8; //npts in c0() array int nfb; //High decode limit (kHz) diff --git a/wsjtx.iss b/wsjtx.iss index 9f27a90df..4bb897cc9 100644 --- a/wsjtx.iss +++ b/wsjtx.iss @@ -1,6 +1,6 @@ [Setup] AppName=wsjtx -AppVerName=wsjtx Version 0.2 r2713 +AppVerName=wsjtx Version 0.3 r2717 AppCopyright=Copyright (C) 2001-2012 by Joe Taylor, K1JT DefaultDirName=c:\wsjtx DefaultGroupName=wsjtx