mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-23 18:52:28 -04: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;
|
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 ? "+" : "-");
|
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot set conversion direction %sfreq\n", positive ? "+" : "-");
|
||||||
return false;
|
return false;
|
||||||
|
@ -298,7 +298,7 @@ void LimeSDRInputGUI::displaySettings()
|
|||||||
ui->extClock->setExternalClockFrequency(m_settings.m_extClockFreq);
|
ui->extClock->setExternalClockFrequency(m_settings.m_extClockFreq);
|
||||||
ui->extClock->setExternalClockActive(m_settings.m_extClock);
|
ui->extClock->setExternalClockActive(m_settings.m_extClock);
|
||||||
|
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
setCenterFrequencyDisplay();
|
||||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||||
|
|
||||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||||
@ -347,11 +347,41 @@ void LimeSDRInputGUI::displaySettings()
|
|||||||
void LimeSDRInputGUI::setNCODisplay()
|
void LimeSDRInputGUI::setNCODisplay()
|
||||||
{
|
{
|
||||||
int ncoHalfRange = (m_settings.m_devSampleRate * (1<<(m_settings.m_log2HardDecim)))/2;
|
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(
|
||||||
ui->ncoFrequency->setValueRange(7,
|
false,
|
||||||
lowBoundary/1000,
|
8,
|
||||||
(m_settings.m_centerFrequency + ncoHalfRange)/1000); // frequency dial is in kHz
|
-ncoHalfRange,
|
||||||
ui->ncoFrequency->setValue((m_settings.m_centerFrequency + m_settings.m_ncoFrequency)/1000);
|
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()
|
void LimeSDRInputGUI::sendSettings()
|
||||||
@ -455,28 +485,28 @@ void LimeSDRInputGUI::on_record_toggled(bool checked)
|
|||||||
|
|
||||||
void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value)
|
void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
setCenterFrequencySetting(value);
|
||||||
setNCODisplay();
|
|
||||||
sendSettings();
|
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 = value;
|
||||||
m_settings.m_ncoFrequency *= 1000;
|
setCenterFrequencyDisplay();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDRInputGUI::on_ncoEnable_toggled(bool checked)
|
void LimeSDRInputGUI::on_ncoEnable_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_ncoEnable = checked;
|
m_settings.m_ncoEnable = checked;
|
||||||
|
setCenterFrequencyDisplay();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDRInputGUI::on_ncoReset_clicked(bool checked __attribute__((unused)))
|
void LimeSDRInputGUI::on_ncoReset_clicked(bool checked __attribute__((unused)))
|
||||||
{
|
{
|
||||||
m_settings.m_ncoFrequency = 0;
|
m_settings.m_ncoFrequency = 0;
|
||||||
ui->ncoFrequency->setValue(m_settings.m_centerFrequency/1000);
|
ui->ncoFrequency->setValue(0);
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ private:
|
|||||||
|
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
void setNCODisplay();
|
void setNCODisplay();
|
||||||
|
void setCenterFrequencyDisplay();
|
||||||
|
void setCenterFrequencySetting(uint64_t kHzValue);
|
||||||
void sendSettings();
|
void sendSettings();
|
||||||
void updateSampleRateAndFrequency();
|
void updateSampleRateAndFrequency();
|
||||||
void updateADCRate();
|
void updateADCRate();
|
||||||
@ -79,7 +81,7 @@ private slots:
|
|||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
void on_record_toggled(bool checked);
|
void on_record_toggled(bool checked);
|
||||||
void on_centerFrequency_changed(quint64 value);
|
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_ncoEnable_toggled(bool checked);
|
||||||
void on_ncoReset_clicked(bool checked);
|
void on_ncoReset_clicked(bool checked);
|
||||||
void on_dcOffset_toggled(bool checked);
|
void on_dcOffset_toggled(bool checked);
|
||||||
|
@ -35,16 +35,7 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -256,7 +247,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ValueDial" name="ncoFrequency" native="true">
|
<widget class="ValueDialZ" name="ncoFrequency" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -281,14 +272,14 @@
|
|||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Center frequency with NCO engaged (kHz)</string>
|
<string>NCO frequency (Hz)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="ncoUnits">
|
<widget class="QLabel" name="ncoUnits">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>kHz</string>
|
<string>Hz</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1166,6 +1157,12 @@ QToolTip{background-color: white; color: black;}</string>
|
|||||||
<extends>QToolButton</extends>
|
<extends>QToolButton</extends>
|
||||||
<header>gui/externalclockbutton.h</header>
|
<header>gui/externalclockbutton.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ValueDialZ</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/valuedialz.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user