diff --git a/dsp/rx_source_base.h b/dsp/rx_source_base.h index b10b1309a5..33d46cb5ee 100644 --- a/dsp/rx_source_base.h +++ b/dsp/rx_source_base.h @@ -74,6 +74,7 @@ class rx_source_base : public gr_hier_block2 virtual double get_sample_rate() = 0; virtual std::vector get_sample_rates() = 0; + virtual void set_freq_corr(int ppm) = 0; virtual void set_dc_corr(double dci, double dcq) = 0; virtual void set_iq_corr(double gain, double phase) = 0; }; diff --git a/dsp/rx_source_fcd.cpp b/dsp/rx_source_fcd.cpp index 30683399fd..a6a668ef80 100644 --- a/dsp/rx_source_fcd.cpp +++ b/dsp/rx_source_fcd.cpp @@ -126,6 +126,13 @@ std::vector rx_source_fcd::get_sample_rates() return d_sample_rates; } +void rx_source_fcd::set_freq_corr(int ppm) +{ + d_fcd_src->set_freq_corr(ppm); + // re-tune after frequency correction + d_fcd_src->set_freq((float) d_freq); +} + void rx_source_fcd::set_dc_corr(double dci, double dcq) { d_fcd_src->set_dc_corr(dci, dcq); diff --git a/dsp/rx_source_fcd.h b/dsp/rx_source_fcd.h index 85ca709747..7159bdd9b1 100644 --- a/dsp/rx_source_fcd.h +++ b/dsp/rx_source_fcd.h @@ -64,6 +64,7 @@ class rx_source_fcd : public rx_source_base double get_sample_rate(); std::vector get_sample_rates(); + void set_freq_corr(int ppm); void set_dc_corr(double dci, double dcq); void set_iq_corr(double gain, double phase); diff --git a/mainwindow.cpp b/mainwindow.cpp index 25b503f645..5ad618edbe 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -115,6 +115,7 @@ MainWindow::MainWindow(QWidget *parent) : /* connect signals and slots */ connect(ui->freqCtrl, SIGNAL(NewFrequency(qint64)), this, SLOT(setNewFrequency(qint64))); connect(uiDockFcdCtl, SIGNAL(lnaGainChanged(float)), SLOT(setRfGain(float))); + connect(uiDockFcdCtl, SIGNAL(freqCorrChanged(int)), this, SLOT(setFreqCorr(int))); connect(uiDockFcdCtl, SIGNAL(dcCorrChanged(double,double)), this, SLOT(setDcCorr(double,double))); connect(uiDockFcdCtl, SIGNAL(iqCorrChanged(double,double)), this, SLOT(setIqCorr(double,double))); connect(uiDockRxOpt, SIGNAL(filterOffsetChanged(qint64)), this, SLOT(setFilterOffset(qint64))); @@ -306,6 +307,16 @@ void MainWindow::setRfGain(float gain) rx->set_rf_gain(gain); } +/*! \brief Set new frequency offset value. + * \param ppm Frequency correction. + * + * The valid range is between -200 and 200, though this is not checked. + */ +void MainWindow::setFreqCorr(int ppm) +{ + qDebug() << "PPM:" << ppm; + rx->set_freq_corr(ppm); +} /*! \brief Set new DC offset values. * \param dci I correction. diff --git a/mainwindow.h b/mainwindow.h index a3743fd0d5..f05c8424f6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -77,6 +77,7 @@ public slots: private slots: void setFilterOffset(qint64 freq_hz); void setRfGain(float gain); + void setFreqCorr(int ppm); void setDcCorr(double dci, double dcq); void setIqCorr(double gain, double phase); void selectDemod(int index); diff --git a/receiver.cpp b/receiver.cpp index 3bb11dda50..f11b4b5f6f 100644 --- a/receiver.cpp +++ b/receiver.cpp @@ -265,6 +265,14 @@ receiver::status receiver::set_filter_shape(filter_shape shape) } +receiver::status receiver::set_freq_corr(int ppm) +{ + src->set_freq_corr(ppm); + + return STATUS_OK; +} + + receiver::status receiver::set_dc_corr(double dci, double dcq) { src->set_dc_corr(dci, dcq); diff --git a/receiver.h b/receiver.h index c3a46bee4e..d405cb91f9 100644 --- a/receiver.h +++ b/receiver.h @@ -104,6 +104,7 @@ class receiver status set_filter_high(double freq_hz); status set_filter_shape(filter_shape shape); + status set_freq_corr(int ppm); status set_dc_corr(double dci, double dcq); status set_iq_corr(double gain, double phase);