From 4b4a1a2f428bd2ce7e41c13529d799e99d494e49 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 3 Apr 2013 16:44:31 +0000 Subject: [PATCH] First try at changing Tol to fMin and fMax. More work still to be done! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3125 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/decoder.f90 | 3 +- lib/sync9.f90 | 13 +---- mainwindow.cpp | 61 +++++++++---------- mainwindow.h | 6 +- mainwindow.ui | 152 ++++++++++++++++++++++++++++-------------------- plotter.cpp | 48 +++------------ plotter.h | 6 +- widegraph.cpp | 9 +-- widegraph.h | 3 +- 9 files changed, 137 insertions(+), 164 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index dff39771d..52445733c 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -68,7 +68,8 @@ subroutine decoder(ss,c0) tstep=kstep/12000.0 call timer('sync9 ',0) - call sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) !Compute ccfred +! Compute ccfred() + call sync9(ss,nzhsym,tstep,df3,nfa,nfb,ntol,nfqso,ccfred,ia,ib,ipk) call timer('sync9 ',1) ccfok=.false. diff --git a/lib/sync9.f90 b/lib/sync9.f90 index c47ac95c1..18ca5f0d9 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -1,4 +1,4 @@ -subroutine sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest) +subroutine sync9(ss,nzhsym,tstep,df3,nfa,nfb,ntol,nfqso,ccfred,ia,ib,ipkbest) parameter (NSMAX=22000) !Max length of saved spectra real ss(184,NSMAX) @@ -7,15 +7,8 @@ subroutine sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest) ipk=0 ipkbest=0 - ia=1 - ib=min(1000,nint(1000.0/df3)) - - if(ntol.lt.1000) then - ia=nint((nfqso-1000-ntol)/df3) - ib=nint((nfqso-1000+ntol)/df3) - if(ia.lt.1) ia=1 - if(ib.gt.NSMAX) ib=NSMAX - endif + ia=max(1,nint((nfa-1000)/df3)) + ib=min(NSMAX,nint((nfb-1000)/df3)) sbest=0. lag1=-(2.5/tstep + 0.9999) diff --git a/mainwindow.cpp b/mainwindow.cpp index cdc5c70f5..e064975ec 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -161,6 +161,8 @@ MainWindow::MainWindow(QWidget *parent) : m_promptToLog=false; m_blankLine=false; m_insertBlank=false; + m_fMin=1000; + ui->fMinSpinBox->setValue(m_fMin); decodeBusy(false); ui->xThermo->setFillBrush(Qt::green); @@ -190,8 +192,7 @@ MainWindow::MainWindow(QWidget *parent) : if(paerr!=paNoError) { msgBox("Unable to initialize PortAudio."); } - readSettings(); //Restore user's setup params - + readSettings(); //Restore user's setup params if(m_dFreq.length()<=1) { m_dFreq.clear(); for(int i=0; i<16; i++) { @@ -225,6 +226,7 @@ MainWindow::MainWindow(QWidget *parent) : if(m_mode=="JT9-5") on_actionJT9_5_triggered(); if(m_mode=="JT9-10") on_actionJT9_10_triggered(); if(m_mode=="JT9-30") on_actionJT9_30_triggered(); + g_pWideGraph->setRxRange(m_fMin,m_fMax); future1 = new QFuture; watcher1 = new QFutureWatcher; connect(watcher1, SIGNAL(finished()),this,SLOT(diskDat())); @@ -240,11 +242,6 @@ MainWindow::MainWindow(QWidget *parent) : m_monitoring=!m_monitorStartOFF; // Start with Monitoring ON/OFF soundInThread.setMonitoring(m_monitoring); m_diskData=false; - static int ntol[] = {1,2,5,10,20,50,100,200,500}; - for (int i=0; i<10; i++) { - if(ntol[i]==m_tol) ui->tolSlider->setValue(i); - } - g_pWideGraph->setTol(m_tol); // Create "m_worked", a dictionary of all calls in wsjtx.log QFile f("wsjtx.log"); @@ -346,7 +343,6 @@ void MainWindow::writeSettings() settings.setValue("NBslider",m_NBslider); settings.setValue("DialFreq",m_dialFreq); settings.setValue("TxFreq",m_txFreq); - settings.setValue("Tol",m_tol); settings.setValue("InGain",m_inGain); settings.setValue("PSKReporter",m_pskReporter); settings.setValue("After73",m_After73); @@ -430,7 +426,6 @@ void MainWindow::readSettings() m_saveDecoded=ui->actionSave_decoded->isChecked(); m_saveAll=ui->actionSave_all->isChecked(); m_ndepth=settings.value("NDepth",2).toInt(); - m_tol=settings.value("Tol",500).toInt(); m_inGain=settings.value("InGain",0).toInt(); ui->inGain->setValue(m_inGain); m_kb8rq=settings.value("KB8RQ",false).toBool(); @@ -815,14 +810,6 @@ void MainWindow::createStatusBar() //createStatusBar statusBar()->addWidget(lab5); } -void MainWindow::on_tolSlider_valueChanged(int i) //tolSlider -{ - static int ntol[] = {1,2,5,10,20,50,100,200,500}; - m_tol=ntol[i]; - g_pWideGraph->setTol(m_tol); - ui->labTol1->setText("Tolerance: " + QString::number(ntol[i])); -} - void MainWindow::on_actionExit_triggered() //Exit() { OnExit(); @@ -1055,22 +1042,6 @@ void MainWindow::freezeDecode(int n) //freezeDecode() { if(n==1) { bumpFqso(0); - } else { - static int ntol[] = {1,2,5,10,20,50,100,200,500}; - 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; - if(m_mode=="JT9-5") i=3; - if(m_mode=="JT9-10") i=2; - if(m_mode=="JT9-30") i=1; - m_tol=ntol[i]; - g_pWideGraph->setTol(m_tol); - ui->tolSlider->setValue(i); - decode(); - } } } @@ -1093,7 +1064,7 @@ void MainWindow::decode() //decode() jt9com_.nfa=1000; //### temporary ### jt9com_.nfb=2000; - jt9com_.ntol=m_tol; + jt9com_.ntol=10; if(jt9com_.nutc < m_nutc0) m_RxLog |= 1; //Date and Time to all65.txt m_nutc0=jt9com_.nutc; jt9com_.nrxlog=m_RxLog; @@ -2017,6 +1988,8 @@ void MainWindow::on_actionJT9_1_triggered() lab4->setStyleSheet("QLabel{background-color: #ff6ec7}"); lab4->setText(m_mode); ui->actionJT9_1->setChecked(true); + m_fMax=2000; + ui->fMaxSpinBox->setValue(m_fMax); } void MainWindow::on_actionJT9_2_triggered() @@ -2032,6 +2005,8 @@ void MainWindow::on_actionJT9_2_triggered() lab4->setStyleSheet("QLabel{background-color: #ffff00}"); lab4->setText(m_mode); ui->actionJT9_2->setChecked(true); + m_fMax=2000; + ui->fMaxSpinBox->setValue(m_fMax); } void MainWindow::on_actionJT9_5_triggered() @@ -2047,6 +2022,8 @@ void MainWindow::on_actionJT9_5_triggered() lab4->setStyleSheet("QLabel{background-color: #ffa500}"); lab4->setText(m_mode); ui->actionJT9_5->setChecked(true); + m_fMax=1300; + ui->fMaxSpinBox->setValue(m_fMax); } void MainWindow::on_actionJT9_10_triggered() @@ -2062,6 +2039,8 @@ void MainWindow::on_actionJT9_10_triggered() lab4->setStyleSheet("QLabel{background-color: #7fff00}"); lab4->setText(m_mode); ui->actionJT9_10->setChecked(true); + m_fMax=1150; + ui->fMaxSpinBox->setValue(m_fMax); } void MainWindow::on_actionJT9_30_triggered() @@ -2077,6 +2056,8 @@ void MainWindow::on_actionJT9_30_triggered() lab4->setStyleSheet("QLabel{background-color: #97ffff}"); lab4->setText(m_mode); ui->actionJT9_30->setChecked(true); + m_fMax=1050; + ui->fMaxSpinBox->setValue(m_fMax); } void MainWindow::on_NBcheckBox_toggled(bool checked) @@ -2255,3 +2236,15 @@ void MainWindow::on_actionBlank_line_between_decoding_periods_triggered(bool che { m_insertBlank=checked; } + +void MainWindow::on_fMinSpinBox_valueChanged(int n) +{ + m_fMin=n; + g_pWideGraph->setRxRange(m_fMin,m_fMax); +} + +void MainWindow::on_fMaxSpinBox_valueChanged(int n) +{ + m_fMax=n; + g_pWideGraph->setRxRange(m_fMin,m_fMax); +} diff --git a/mainwindow.h b/mainwindow.h index 76ab09a89..e27993ee3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -59,7 +59,6 @@ private slots: void on_actionCuteSDR_triggered(); void on_autoButton_clicked(); void on_stopTxButton_clicked(); - void on_tolSlider_valueChanged(int arg1); void on_stopButton_clicked(); void on_actionOnline_Users_Guide_triggered(); void on_actionWide_Waterfall_triggered(); @@ -132,6 +131,8 @@ private slots: void on_bandComboBox_currentIndexChanged(int index); void on_actionPrompt_to_log_QSO_triggered(bool checked); void on_actionBlank_line_between_decoding_periods_triggered(bool checked); + void on_fMinSpinBox_valueChanged(int n); + void on_fMaxSpinBox_valueChanged(int n); private: Ui::MainWindow *ui; @@ -143,7 +144,8 @@ private: qint32 m_idInt; qint32 m_waterfallAvg; qint32 m_pttMethodIndex; - qint32 m_tol; + qint32 m_fMin; + qint32 m_fMax; qint32 m_QSOfreq0; qint32 m_ntx; qint32 m_pttPort; diff --git a/mainwindow.ui b/mainwindow.ui index 045266bcf..fe2d0e6f4 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -526,71 +526,95 @@ p, li { white-space: pre-wrap; } 1 - - - 0 + + + + 2 + 4 + 100 + 52 + - - 0 - - - - - 6 - - - - - - 0 - 0 - - - - - 30 - 22 - - - - - 100 - 18 - - - - Tolerance: 500 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 5 - - - - - - - - 100 - 16777215 - - - - 8 - - - 8 - - - Qt::Horizontal - - - - - - + + + + + + 0 + 0 + + + + + 30 + 22 + + + + + 100 + 18 + + + + Decode Range + Min Max + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 5 + + + + + + + + + + 0 + 0 + + + + 1000 + + + 2000 + + + 50 + + + + + + + + 0 + 0 + + + + 1000 + + + 2000 + + + 50 + + + 2000 + + + + + + + diff --git a/plotter.cpp b/plotter.cpp index c42b836f9..c89d6c6dc 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -174,7 +174,7 @@ void CPlotter::DrawOverlay() //DrawOverlay() if(m_OverlayPixmap.isNull()) return; if(m_WaterfallPixmap.isNull()) return; int w = m_WaterfallPixmap.width(); - int x,y; + int x,y,x1,x2; // int nHzDiv[11]={0,50,100,200,200,200,500,500,500,500,500}; float pixperdiv; @@ -207,21 +207,6 @@ void CPlotter::DrawOverlay() //DrawOverlay() painter.drawLine(0, y, w, y); } -/* - //draw amplitude values - painter.setPen(Qt::yellow); -// Font.setWeight(QFont::Light); -// painter.setFont(Font); -// int dB = m_MaxdB; - int dB = 50; - for( int i=0; iwidePlot->setTol(n); + ui->widePlot->setRxRange(fMin,fMax); ui->widePlot->DrawOverlay(); ui->widePlot->update(); } -int WideGraph::Tol() -{ - return ui->widePlot->Tol(); -} - void WideGraph::setFcal(int n) { m_fCal=n; diff --git a/widegraph.h b/widegraph.h index 1f3bd2132..f2cd4fbf7 100644 --- a/widegraph.h +++ b/widegraph.h @@ -22,8 +22,7 @@ public: int nStartFreq(); float fSpan(); void saveSettings(); - int Tol(); - void setTol(int n); + void setRxRange(int fMin, int fMax); void setFcal(int n); void setPalette(QString palette); void setFsample(int n);