mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
XTRX input: use NCO value as a delta from LO (like with LimeSDR)
This commit is contained in:
parent
961607ae8d
commit
cf953496b9
@ -105,12 +105,12 @@ void XTRXInputGUI::resetToDefaults()
|
|||||||
|
|
||||||
qint64 XTRXInputGUI::getCenterFrequency() const
|
qint64 XTRXInputGUI::getCenterFrequency() const
|
||||||
{
|
{
|
||||||
return m_settings.m_centerFrequency;
|
return m_settings.m_centerFrequency + (m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTRXInputGUI::setCenterFrequency(qint64 centerFrequency)
|
void XTRXInputGUI::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = centerFrequency;
|
m_settings.m_centerFrequency = centerFrequency - (m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ void XTRXInputGUI::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);
|
||||||
@ -310,11 +310,42 @@ void XTRXInputGUI::displaySettings()
|
|||||||
void XTRXInputGUI::setNCODisplay()
|
void XTRXInputGUI::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);
|
||||||
|
|
||||||
|
ui->ncoFrequency->blockSignals(true);
|
||||||
|
ui->ncoFrequency->setToolTip(QString("NCO frequency shift in Hz (Range: +/- %1 kHz)").arg(ncoHalfRange/1000));
|
||||||
|
ui->ncoFrequency->setValue(m_settings.m_ncoFrequency);
|
||||||
|
ui->ncoFrequency->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XTRXInputGUI::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 XTRXInputGUI::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 XTRXInputGUI::sendSettings()
|
void XTRXInputGUI::sendSettings()
|
||||||
@ -418,28 +449,21 @@ void XTRXInputGUI::on_record_toggled(bool checked)
|
|||||||
|
|
||||||
void XTRXInputGUI::on_centerFrequency_changed(quint64 value)
|
void XTRXInputGUI::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
setCenterFrequencySetting(value);
|
||||||
setNCODisplay();
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTRXInputGUI::on_ncoFrequency_changed(quint64 value)
|
void XTRXInputGUI::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 XTRXInputGUI::on_ncoEnable_toggled(bool checked)
|
void XTRXInputGUI::on_ncoEnable_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_ncoEnable = checked;
|
m_settings.m_ncoEnable = checked;
|
||||||
sendSettings();
|
setCenterFrequencyDisplay();
|
||||||
}
|
|
||||||
|
|
||||||
void XTRXInputGUI::on_ncoReset_clicked(bool checked __attribute__((unused)))
|
|
||||||
{
|
|
||||||
m_settings.m_ncoFrequency = 0;
|
|
||||||
ui->ncoFrequency->setValue(m_settings.m_centerFrequency/1000);
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,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();
|
||||||
@ -80,9 +82,8 @@ 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_dcOffset_toggled(bool checked);
|
void on_dcOffset_toggled(bool checked);
|
||||||
void on_iqImbalance_toggled(bool checked);
|
void on_iqImbalance_toggled(bool checked);
|
||||||
void on_sampleRate_changed(quint64 value);
|
void on_sampleRate_changed(quint64 value);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>373</width>
|
<width>370</width>
|
||||||
<height>290</height>
|
<height>290</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -240,23 +240,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="ncoReset">
|
<widget class="ValueDialZ" name="ncoFrequency" native="true">
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Reset the NCO to zero frequency</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>R</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="ValueDial" 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>
|
||||||
@ -1122,6 +1106,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…
Reference in New Issue
Block a user