提交 fb12c783 编写于 作者: D dev

Place LO offset to sprate /2

上级 2abbdfb1
......@@ -58,7 +58,7 @@ CFreqCtrl::CFreqCtrl(QWidget *parent) :
m_DigitColor = QColor(0xFF, 0xFF, 0xFF, 0xFF);
m_HighlightColor = QColor(0x5A, 0x5A, 0x5A, 0xFF);
m_UnitsColor = Qt::gray;
m_freq = 146123456;
m_freq = 0;
setup(0, 1, 6000000000U, 1, FCTL_UNIT_NONE);
m_Oldfreq = 0;
m_LastLeadZeroPos = 0;
......
......@@ -118,6 +118,8 @@ void specWidget::setBookmarksEnabled(bool enabled){
ui->plotter->setBookmarksEnabled(enabled);
}
void specWidget::setCenterFreq(quint64 f){
if (f<=0)
return;
f = set_center_freq(f);
ui->plotter->setCenterFreq(f);
if (ui->doubleSpinBox_center->value() * 1e6 !=ui->freqCtrl->getFrequency())
......
......@@ -224,8 +224,9 @@ quint64 uhd_device::set_center_freq(const quint64 freq_in_hz)
{
if (usrp)
{
double rate = usrp->get_rx_rate(m_channel);
using uhd::tune_request_t;
tune_request_t tune_request_rx = tune_request_t((double)freq_in_hz);
tune_request_t tune_request_rx = tune_request_t((double)freq_in_hz,rate/2);
usrp->set_rx_freq(tune_request_rx,m_channel);
return (quint64)(usrp->get_rx_freq(m_channel));
}
......
......@@ -252,15 +252,18 @@ quint64 uhd_device::set_center_freq(const quint64 freq_in_hz)
{
if (!usrp)
return freq_in_hz;
fprintf(stderr, "Setting RX frequency: %f MHz...\n", freq_in_hz/1e6);
double srate = 0;
UHD_DO(uhd_usrp_get_rx_rate(usrp, m_channel, &srate));
fprintf(stderr, "Setting RX frequency: %f MHz...\n", freq_in_hz/1e6);
uhd_tune_result_t rx_tune_result;
uhd_tune_request_t rx_tune_request =
{
/*.target_freq =*/ (double)freq_in_hz,
/*.rf_freq_policy =*/ UHD_TUNE_REQUEST_POLICY_AUTO,
/*.rf_freq =*/ 0,
/*.dsp_freq_policy = */UHD_TUNE_REQUEST_POLICY_AUTO,
/*.dsp_freq =*/ 0,
/*.dsp_freq_policy = */UHD_TUNE_REQUEST_POLICY_MANUAL,
/*.dsp_freq =*/ srate/2,
/*.args =*/ 0
};
UHD_DO(uhd_usrp_set_rx_freq(usrp, &rx_tune_request, m_channel, &rx_tune_result));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册