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
This commit is contained in:
Joe Taylor 2013-04-03 16:44:31 +00:00
parent 461fdd79aa
commit 7f72925679
9 changed files with 137 additions and 164 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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);
@ -191,7 +193,6 @@ MainWindow::MainWindow(QWidget *parent) :
msgBox("Unable to initialize PortAudio.");
}
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<void>;
watcher1 = new QFutureWatcher<void>;
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);
}

View File

@ -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;

View File

@ -526,18 +526,16 @@ p, li { white-space: pre-wrap; }
<property name="lineWidth">
<number>1</number>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>2</x>
<y>4</y>
<width>100</width>
<height>52</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="labTol1">
<property name="sizePolicy">
@ -559,7 +557,8 @@ p, li { white-space: pre-wrap; }
</size>
</property>
<property name="text">
<string>Tolerance: 500</string>
<string> Decode Range
Min Max</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -570,21 +569,45 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QSlider" name="tolSlider">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="fMinSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1000</number>
</property>
<property name="maximum">
<number>8</number>
<number>2000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="fMaxSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1000</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>8</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<number>2000</number>
</property>
</widget>
</item>
@ -592,6 +615,7 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="7" rowspan="2">
<widget class="QFrame" name="frame">

View File

@ -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; i<VERT_DIVS-1; i++)
{
y = (int)( (float)i*pixperdiv );
painter.drawStaticText(5, y-1, QString::number(dB)+" dB");
dB -= m_dBStepSize;
}
*/
QRect rect0;
QPainter painter0(&m_ScalePixmap);
painter0.initFrom(this);
@ -288,8 +273,8 @@ void CPlotter::DrawOverlay() //DrawOverlay()
painter0.setPen(pen0);
x=XfromFreq(m_fQSO);
painter0.drawLine(x,17,x,30);
int x1=x - m_tol/df;
int x2=x + m_tol/df;
x1=XfromFreq(m_fMin); //Mark the decoding range
x2=XfromFreq(m_fMax);
pen0.setWidth(6);
painter0.drawLine(x1,28,x2,28);
@ -299,20 +284,6 @@ void CPlotter::DrawOverlay() //DrawOverlay()
painter0.drawLine(x,0,x,13);
painter0.drawLine(x,13,x-2,11);
painter0.drawLine(x,13,x+2,11);
/*
df = 12000.0/m_nsps;
int nlabs=df*w/m_freqPerDiv + 1.0;
// m_LowerScalePixmap.fill(Qt::white);
// painter3.drawRect(0, 0, w, 30);
pixperdiv = m_freqPerDiv/df;
for( int i=0; i<10*nlabs; i++) {
x = i*pixperdiv/10;
y=24;
if ((i%10) == 0) y=18;
// painter3.drawLine(x,y,x,30);
}
*/
}
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
@ -380,15 +351,10 @@ int CPlotter::plotWidth(){return m_WaterfallPixmap.width();}
void CPlotter::UpdateOverlay() {DrawOverlay();}
void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;}
void CPlotter::setTol(int n) //setTol()
void CPlotter::setRxRange(int fMin, int fMax)
{
m_tol=n;
DrawOverlay();
}
int CPlotter::Tol() //Tol()
{
return m_tol;
m_fMin=fMin;
m_fMax=fMax;
}
void CPlotter::setBinsPerPixel(int n) // set nbpp

View File

@ -50,8 +50,7 @@ public:
void setNSpan(int n);
void UpdateOverlay();
void setDataFromDisk(bool b);
void setTol(int n);
int Tol();
void setRxRange(int fMin, int fMax);
void setBinsPerPixel(int n);
int binsPerPixel();
void setFQSO(int n, bool bf);
@ -110,9 +109,10 @@ private:
qint32 m_h;
qint32 m_h1;
qint32 m_h2;
qint32 m_tol;
qint32 m_TRperiod;
qint32 m_txFreq;
qint32 m_fMin;
qint32 m_fMax;
private slots:
void mousePressEvent(QMouseEvent *event);

View File

@ -202,18 +202,13 @@ void WideGraph::wideFreezeDecode(int n)
emit freezeDecode2(n);
}
void WideGraph::setTol(int n)
void WideGraph::setRxRange(int fMin, int fMax)
{
ui->widePlot->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;

View File

@ -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);