Skip to content

Commit

Permalink
User settabel SSB Stepsize
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichloose committed Jan 11, 2021
1 parent 898eb24 commit 109a031
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/applications/gqrx/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent)
connect(uiDockRxOpt, SIGNAL(fmEmphSelected(double)), this, SLOT(setFmEmph(double)));
connect(uiDockRxOpt, SIGNAL(amDcrToggled(bool)), this, SLOT(setAmDcr(bool)));
connect(uiDockRxOpt, SIGNAL(cwOffsetChanged(int)), this, SLOT(setCwOffset(int)));
connect(uiDockRxOpt, SIGNAL(ssbStepsChanged(int)), this, SLOT(setSbSteps(int)));
connect(uiDockRxOpt, SIGNAL(amSyncDcrToggled(bool)), this, SLOT(setAmSyncDcr(bool)));
connect(uiDockRxOpt, SIGNAL(amSyncPllBwSelected(float)), this, SLOT(setAmSyncPllBw(float)));
connect(uiDockRxOpt, SIGNAL(agcToggled(bool)), this, SLOT(setAgcOn(bool)));
Expand Down Expand Up @@ -1064,6 +1065,7 @@ void MainWindow::selectDemod(const QString& strModulation)
void MainWindow::selectDemod(int mode_idx)
{
double cwofs = 0.0;
int ssbstep = 50;
int filter_preset = uiDockRxOpt->currentFilter();
int flo=0, fhi=0, click_res=100;
bool rds_enabled;
Expand Down Expand Up @@ -1150,17 +1152,19 @@ void MainWindow::selectDemod(int mode_idx)
case DockRxOpt::MODE_LSB:
/* LSB */
rx->set_demod(receiver::RX_DEMOD_SSB);
ssbstep = uiDockRxOpt->getSbSteps();
ui->plotter->setDemodRanges(-40000, -100, -5000, 0, false);
uiDockAudio->setFftRange(0,3000);
click_res = 100;
click_res = ssbstep;
break;

case DockRxOpt::MODE_USB:
/* USB */
rx->set_demod(receiver::RX_DEMOD_SSB);
ssbstep = uiDockRxOpt->getSbSteps();
ui->plotter->setDemodRanges(0, 5000, 100, 40000, false);
uiDockAudio->setFftRange(0,3000);
click_res = 100;
click_res = ssbstep;
break;

case DockRxOpt::MODE_CWL:
Expand Down Expand Up @@ -1246,6 +1250,12 @@ void MainWindow::setCwOffset(int offset)
rx->set_cw_offset(offset);
}

void MainWindow::setSbSteps(int click_res)
{
ui->plotter->setClickResolution(click_res);
ui->plotter->setFilterClickResolution(click_res);
}

/**
* @brief AM-Sync DCR status changed (slot).
* @param enabled Whether DCR is enabled or not.
Expand Down
1 change: 1 addition & 0 deletions src/applications/gqrx/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ private slots:
void setFmEmph(double tau);
void setAmDcr(bool enabled);
void setCwOffset(int offset);
void setSbSteps(int click_res);
void setAmSyncDcr(bool enabled);
void setAmSyncPllBw(float pll_bw);
void setAgcOn(bool agc_on);
Expand Down
15 changes: 15 additions & 0 deletions src/qtgui/demod_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ int CDemodOptions::getCwOffset(void) const
return ui->cwOffsetSpin->value();
}

void CDemodOptions::setSbSteps(int offset)
{
ui->SSB_Steps->setValue(offset);
}

int CDemodOptions::getSbSteps(void) const
{
return ui->SSB_Steps->value();
}

void CDemodOptions::setMaxDev(float max_dev)
{
ui->maxdevSelector->setCurrentIndex(maxdev_to_index(max_dev));
Expand Down Expand Up @@ -212,6 +222,11 @@ void CDemodOptions::on_cwOffsetSpin_valueChanged(int value)
emit cwOffsetChanged(value);
}

void CDemodOptions::on_SSB_Steps_valueChanged(int value)
{
emit ssbStepsChanged(value);
}

void CDemodOptions::on_syncdcrCheckBox_toggled(bool checked)
{
emit amSyncDcrToggled(checked);
Expand Down
10 changes: 9 additions & 1 deletion src/qtgui/demod_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class CDemodOptions : public QDialog
PAGE_AM_OPT = 2,
PAGE_CW_OPT = 3,
PAGE_AMSYNC_OPT = 4,
PAGE_NUM = 5
PAGE_SB_OPT = 5,
PAGE_NUM = 6
};

explicit CDemodOptions(QWidget *parent = 0);
Expand All @@ -58,6 +59,9 @@ class CDemodOptions : public QDialog
void setCurrentPage(int index);
int currentPage() const;

void setSbSteps(int offset);
int getSbSteps(void) const;

void setCwOffset(int offset);
int getCwOffset(void) const;

Expand All @@ -83,6 +87,9 @@ class CDemodOptions : public QDialog
/*! \brief CW offset changed. */
void cwOffsetChanged(int offset);

/*! \brief SSB Steps changed. */
void ssbStepsChanged(int offset);

/*! \brief Signal emitted when AM-Sync DCR is toggled. */
void amSyncDcrToggled(bool enabled);

Expand All @@ -94,6 +101,7 @@ private slots:
void on_emphSelector_activated(int index);
void on_dcrCheckBox_toggled(bool checked);
void on_cwOffsetSpin_valueChanged(int value);
void on_SSB_Steps_valueChanged(int value);
void on_syncdcrCheckBox_toggled(bool checked);
void on_pllBwSelector_activated(int index);

Expand Down
38 changes: 36 additions & 2 deletions src/qtgui/demod_options.ui
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,43 @@ to react to changes in the carrier frequency however.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_ssb">
<widget class="QWidget" name="layoutWidget_ssb">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>161</width>
<height>29</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>SSB Stepsize</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="SSB_Steps">
<property name="suffix">
<string> Hz</string>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../resources/icons.qrc"/>
Expand Down
23 changes: 23 additions & 0 deletions src/qtgui/dockrxopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ DockRxOpt::DockRxOpt(qint64 filterOffsetRange, QWidget *parent) :
connect(demodOpt, SIGNAL(fmEmphSelected(double)), this, SLOT(demodOpt_fmEmphSelected(double)));
connect(demodOpt, SIGNAL(amDcrToggled(bool)), this, SLOT(demodOpt_amDcrToggled(bool)));
connect(demodOpt, SIGNAL(cwOffsetChanged(int)), this, SLOT(demodOpt_cwOffsetChanged(int)));
connect(demodOpt, SIGNAL(ssbStepsChanged(int)), this, SLOT(demodOpt_ssbStepsChanged(int)));
connect(demodOpt, SIGNAL(amSyncDcrToggled(bool)), this, SLOT(demodOpt_amSyncDcrToggled(bool)));
connect(demodOpt, SIGNAL(amSyncPllBwSelected(float)), this, SLOT(demodOpt_amSyncPllBwSelected(float)));

Expand Down Expand Up @@ -391,6 +392,11 @@ int DockRxOpt::getCwOffset() const
return demodOpt->getCwOffset();
}

int DockRxOpt::getSbSteps() const
{
return demodOpt->getSbSteps();
}

/** Read receiver configuration from settings data. */
void DockRxOpt::readSettings(QSettings *settings)
{
Expand All @@ -404,6 +410,10 @@ void DockRxOpt::readSettings(QSettings *settings)
if (conv_ok)
demodOpt->setCwOffset(int_val);

int_val = settings->value("receiver/ssb_step", 50).toInt(&conv_ok);
if (conv_ok)
demodOpt->setSbSteps(int_val);

int_val = settings->value("receiver/fm_maxdev", 2500).toInt(&conv_ok);
if (conv_ok)
demodOpt->setMaxDev(int_val);
Expand Down Expand Up @@ -477,6 +487,12 @@ void DockRxOpt::saveSettings(QSettings *settings)
else
settings->setValue("receiver/cwoffset", cwofs);

int ssb_step = demodOpt->getSbSteps();
if (ssb_step == 50)
settings->remove("receiver/ssb_step");
else
settings->setValue("receiver/ssb_step", ssb_step);

// currently we do not need the decimal
int_val = (int)demodOpt->getMaxDev();
if (int_val == 2500)
Expand Down Expand Up @@ -627,6 +643,8 @@ void DockRxOpt::updateDemodOptPage(int demod)
demodOpt->setCurrentPage(CDemodOptions::PAGE_AM_OPT);
else if (demod == MODE_CWL || demod == MODE_CWU)
demodOpt->setCurrentPage(CDemodOptions::PAGE_CW_OPT);
else if (demod == MODE_LSB || demod == MODE_USB)
demodOpt->setCurrentPage(CDemodOptions::PAGE_SB_OPT);
else if (demod == MODE_AM_SYNC)
demodOpt->setCurrentPage(CDemodOptions::PAGE_AMSYNC_OPT);
else
Expand Down Expand Up @@ -776,6 +794,11 @@ void DockRxOpt::demodOpt_cwOffsetChanged(int offset)
emit cwOffsetChanged(offset);
}

void DockRxOpt::demodOpt_ssbStepsChanged(int offset)
{
emit ssbStepsChanged(offset);
}

/**
* @brief AM-Sync DC removal toggled by user.
* @param enabled Whether DCR is enabled or not.
Expand Down
3 changes: 3 additions & 0 deletions src/qtgui/dockrxopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class DockRxOpt : public QDockWidget

void getFilterPreset(int mode, int preset, int * lo, int * hi) const;
int getCwOffset() const;
int getSbSteps() const;

double getSqlLevel(void) const;

Expand Down Expand Up @@ -204,6 +205,7 @@ public slots:
void noiseBlankerChanged(int nbid, bool on, float threshold);

void cwOffsetChanged(int offset);
void ssbStepsChanged(int offset);

private slots:
void on_freqSpinBox_valueChanged(double freq);
Expand All @@ -229,6 +231,7 @@ private slots:
void demodOpt_fmEmphSelected(double tau);
void demodOpt_amDcrToggled(bool enabled);
void demodOpt_cwOffsetChanged(int offset);
void demodOpt_ssbStepsChanged(int offset);
void demodOpt_amSyncDcrToggled(bool enabled);
void demodOpt_amSyncPllBwSelected(float pll_bw);

Expand Down

0 comments on commit 109a031

Please sign in to comment.