mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
LimeSDR input GUI: NCO and baseband center frequency now show actual values
This commit is contained in:
parent
56178c65cf
commit
a9887bcdaa
@ -50,7 +50,7 @@ bool DeviceLimeSDR::setNCOFrequency(lms_device_t *device, bool dir_tx, std::size
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LMS_SetNCOIndex(device, dir_tx, chan, 0, !positive) < 0)
|
||||
if (LMS_SetNCOIndex(device, dir_tx, chan, 0, positive) < 0)
|
||||
{
|
||||
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot set conversion direction %sfreq\n", positive ? "+" : "-");
|
||||
return false;
|
||||
|
@ -298,7 +298,7 @@ void LimeSDRInputGUI::displaySettings()
|
||||
ui->extClock->setExternalClockFrequency(m_settings.m_extClockFreq);
|
||||
ui->extClock->setExternalClockActive(m_settings.m_extClock);
|
||||
|
||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||
setCenterFrequencyDisplay();
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||
|
||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
@ -347,11 +347,41 @@ void LimeSDRInputGUI::displaySettings()
|
||||
void LimeSDRInputGUI::setNCODisplay()
|
||||
{
|
||||
int ncoHalfRange = (m_settings.m_devSampleRate * (1<<(m_settings.m_log2HardDecim)))/2;
|
||||
int lowBoundary = std::max(0, (int) m_settings.m_centerFrequency - ncoHalfRange);
|
||||
ui->ncoFrequency->setValueRange(7,
|
||||
lowBoundary/1000,
|
||||
(m_settings.m_centerFrequency + ncoHalfRange)/1000); // frequency dial is in kHz
|
||||
ui->ncoFrequency->setValue((m_settings.m_centerFrequency + m_settings.m_ncoFrequency)/1000);
|
||||
ui->ncoFrequency->setValueRange(
|
||||
false,
|
||||
8,
|
||||
-ncoHalfRange,
|
||||
ncoHalfRange); // frequency dial is in kHz
|
||||
|
||||
ui->ncoFrequency->blockSignals(true);
|
||||
ui->ncoFrequency->setValue(m_settings.m_ncoFrequency);
|
||||
ui->ncoFrequency->blockSignals(false);
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::setCenterFrequencyDisplay()
|
||||
{
|
||||
int64_t centerFrequency = m_settings.m_centerFrequency;
|
||||
ui->centerFrequency->setToolTip(QString("Main center frequency in kHz (LO: %1 kHz)").arg(centerFrequency/1000));
|
||||
|
||||
if (m_settings.m_ncoEnable) {
|
||||
centerFrequency += m_settings.m_ncoFrequency;
|
||||
}
|
||||
|
||||
ui->centerFrequency->blockSignals(true);
|
||||
ui->centerFrequency->setValue(centerFrequency < 0 ? 0 : (uint64_t) centerFrequency/1000); // kHz
|
||||
ui->centerFrequency->blockSignals(false);
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::setCenterFrequencySetting(uint64_t kHzValue)
|
||||
{
|
||||
int64_t centerFrequency = kHzValue*1000;
|
||||
|
||||
if (m_settings.m_ncoEnable) {
|
||||
centerFrequency -= m_settings.m_ncoFrequency;
|
||||
}
|
||||
|
||||
m_settings.m_centerFrequency = centerFrequency < 0 ? 0 : (uint64_t) centerFrequency;
|
||||
ui->centerFrequency->setToolTip(QString("Main center frequency in kHz (LO: %1 kHz)").arg(centerFrequency/1000));
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::sendSettings()
|
||||
@ -455,28 +485,28 @@ void LimeSDRInputGUI::on_record_toggled(bool checked)
|
||||
|
||||
void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
setNCODisplay();
|
||||
setCenterFrequencySetting(value);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_ncoFrequency_changed(quint64 value)
|
||||
void LimeSDRInputGUI::on_ncoFrequency_changed(qint64 value)
|
||||
{
|
||||
m_settings.m_ncoFrequency = (int64_t) value - (int64_t) m_settings.m_centerFrequency/1000;
|
||||
m_settings.m_ncoFrequency *= 1000;
|
||||
m_settings.m_ncoFrequency = value;
|
||||
setCenterFrequencyDisplay();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_ncoEnable_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_ncoEnable = checked;
|
||||
setCenterFrequencyDisplay();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_ncoReset_clicked(bool checked __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_ncoFrequency = 0;
|
||||
ui->ncoFrequency->setValue(m_settings.m_centerFrequency/1000);
|
||||
ui->ncoFrequency->setValue(0);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,8 @@ private:
|
||||
|
||||
void displaySettings();
|
||||
void setNCODisplay();
|
||||
void setCenterFrequencyDisplay();
|
||||
void setCenterFrequencySetting(uint64_t kHzValue);
|
||||
void sendSettings();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateADCRate();
|
||||
@ -79,7 +81,7 @@ private slots:
|
||||
void on_startStop_toggled(bool checked);
|
||||
void on_record_toggled(bool checked);
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_ncoFrequency_changed(quint64 value);
|
||||
void on_ncoFrequency_changed(qint64 value);
|
||||
void on_ncoEnable_toggled(bool checked);
|
||||
void on_ncoReset_clicked(bool checked);
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
|
@ -35,16 +35,7 @@
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -256,7 +247,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDial" name="ncoFrequency" native="true">
|
||||
<widget class="ValueDialZ" name="ncoFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
@ -281,14 +272,14 @@
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Center frequency with NCO engaged (kHz)</string>
|
||||
<string>NCO frequency (Hz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="ncoUnits">
|
||||
<property name="text">
|
||||
<string>kHz</string>
|
||||
<string>Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1166,6 +1157,12 @@ QToolTip{background-color: white; color: black;}</string>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/externalclockbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
|
Loading…
Reference in New Issue
Block a user