From 109a031ae09dec78496d73c17a1bb237a2fccc3a Mon Sep 17 00:00:00 2001 From: ulrichloose Date: Mon, 4 Jan 2021 10:22:24 +0100 Subject: [PATCH] User settabel SSB Stepsize for #920 --- src/applications/gqrx/mainwindow.cpp | 14 ++++++++-- src/applications/gqrx/mainwindow.h | 1 + src/qtgui/demod_options.cpp | 15 +++++++++++ src/qtgui/demod_options.h | 10 +++++++- src/qtgui/demod_options.ui | 38 ++++++++++++++++++++++++++-- src/qtgui/dockrxopt.cpp | 23 +++++++++++++++++ src/qtgui/dockrxopt.h | 3 +++ 7 files changed, 99 insertions(+), 5 deletions(-) diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index 574e86b329..62112b0dd3 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -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))); @@ -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; @@ -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: @@ -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. diff --git a/src/applications/gqrx/mainwindow.h b/src/applications/gqrx/mainwindow.h index 968d0b6e6a..18443432d7 100644 --- a/src/applications/gqrx/mainwindow.h +++ b/src/applications/gqrx/mainwindow.h @@ -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); diff --git a/src/qtgui/demod_options.cpp b/src/qtgui/demod_options.cpp index c1f4b113a1..bed7141896 100644 --- a/src/qtgui/demod_options.cpp +++ b/src/qtgui/demod_options.cpp @@ -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)); @@ -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); diff --git a/src/qtgui/demod_options.h b/src/qtgui/demod_options.h index 581ef81944..beb864fb67 100644 --- a/src/qtgui/demod_options.h +++ b/src/qtgui/demod_options.h @@ -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); @@ -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; @@ -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); @@ -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); diff --git a/src/qtgui/demod_options.ui b/src/qtgui/demod_options.ui index c0dc77b092..a33c640995 100644 --- a/src/qtgui/demod_options.ui +++ b/src/qtgui/demod_options.ui @@ -354,9 +354,43 @@ to react to changes in the carrier frequency however. + + + + + 20 + 30 + 161 + 29 + + + + + + + SSB Stepsize + + + + + + + Hz + + + 500 + + + 50 + + + + - - + + + + diff --git a/src/qtgui/dockrxopt.cpp b/src/qtgui/dockrxopt.cpp index 120ec890e5..f26f4dba0d 100644 --- a/src/qtgui/dockrxopt.cpp +++ b/src/qtgui/dockrxopt.cpp @@ -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))); @@ -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) { @@ -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); @@ -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) @@ -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 @@ -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. diff --git a/src/qtgui/dockrxopt.h b/src/qtgui/dockrxopt.h index 180c22294a..eb0df1358c 100644 --- a/src/qtgui/dockrxopt.h +++ b/src/qtgui/dockrxopt.h @@ -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; @@ -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); @@ -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);