mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 02:28:33 -04:00
LimeSDR output: implemented transverter shift
This commit is contained in:
parent
b9587273d8
commit
ff88a2e1db
@ -701,6 +701,10 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
double clockGenFreq = 0.0;
|
||||
// QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
|
||||
if (LMS_GetClockFreq(m_deviceShared.m_deviceParams->getDevice(), LMS_CLOCK_CGEN, &clockGenFreq) != 0)
|
||||
{
|
||||
qCritical("LimeSDROutput::applySettings: could not get clock gen frequency");
|
||||
@ -852,32 +856,35 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
settings.m_antennaPath))
|
||||
{
|
||||
doCalibration = true;
|
||||
qDebug("LimeSDRInput::applySettings: set antenna path to %d",
|
||||
qDebug("LimeSDROutput::applySettings: set antenna path to %d",
|
||||
(int) settings.m_antennaPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCritical("LimeSDRInput::applySettings: could not set antenna path to %d",
|
||||
qCritical("LimeSDROutput::applySettings: could not set antenna path to %d",
|
||||
(int) settings.m_antennaPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||
|| force)
|
||||
{
|
||||
forwardChangeTxDSP = true;
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
|
||||
{
|
||||
if (LMS_SetClockFreq(m_deviceShared.m_deviceParams->getDevice(), LMS_CLOCK_SXT, settings.m_centerFrequency) < 0)
|
||||
if (LMS_SetClockFreq(m_deviceShared.m_deviceParams->getDevice(), LMS_CLOCK_SXT, deviceCenterFrequency) < 0)
|
||||
{
|
||||
qCritical("LimeSDROutput::applySettings: could not set frequency to %lu", settings.m_centerFrequency);
|
||||
qCritical("LimeSDROutput::applySettings: could not set frequency to %lld", deviceCenterFrequency);
|
||||
}
|
||||
else
|
||||
{
|
||||
doCalibration = true;
|
||||
m_deviceShared.m_centerFrequency = settings.m_centerFrequency; // for buddies
|
||||
qDebug("LimeSDROutput::applySettings: frequency set to %lu", settings.m_centerFrequency);
|
||||
m_deviceShared.m_centerFrequency = deviceCenterFrequency; // for buddies
|
||||
qDebug("LimeSDROutput::applySettings: frequency set to %lld", deviceCenterFrequency);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1063,6 +1070,9 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
||||
QLocale loc;
|
||||
|
||||
qDebug().noquote() << "LimeSDROutput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
|
||||
<< " m_transverterMode: " << m_settings.m_transverterMode
|
||||
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
||||
<< " deviceCenterFrequency: " << deviceCenterFrequency
|
||||
<< " device stream sample rate: " << loc.toString(m_settings.m_devSampleRate) << "S/s"
|
||||
<< " sample rate with soft interpolation: " << loc.toString( m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp)) << "S/s"
|
||||
<< " DAC sample rate with hard interpolation: " << loc.toString(m_settings.m_devSampleRate*(1<<m_settings.m_log2HardInterp)) << "S/s"
|
||||
@ -1142,6 +1152,12 @@ int LimeSDROutput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("ncoFrequency")) {
|
||||
settings.m_ncoFrequency = response.getLimeSdrOutputSettings()->getNcoFrequency();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
|
||||
settings.m_transverterDeltaFrequency = response.getLimeSdrOutputSettings()->getTransverterDeltaFrequency();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("transverterMode")) {
|
||||
settings.m_transverterMode = response.getLimeSdrOutputSettings()->getTransverterMode() != 0;
|
||||
}
|
||||
|
||||
MsgConfigureLimeSDR *msg = MsgConfigureLimeSDR::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
@ -1171,6 +1187,8 @@ void LimeSDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
|
||||
response.getLimeSdrOutputSettings()->setLpfFirbw(settings.m_lpfFIRBW);
|
||||
response.getLimeSdrOutputSettings()->setNcoEnable(settings.m_ncoEnable ? 1 : 0);
|
||||
response.getLimeSdrOutputSettings()->setNcoFrequency(settings.m_ncoFrequency);
|
||||
response.getLimeSdrOutputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
|
||||
response.getLimeSdrOutputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
|
||||
}
|
||||
|
||||
int LimeSDROutput::webapiRunGet(
|
||||
|
@ -140,6 +140,23 @@ bool LimeSDROutputGUI::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
void LimeSDROutputGUI::updateFrequencyLimits()
|
||||
{
|
||||
// values in kHz
|
||||
float minF, maxF;
|
||||
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
|
||||
m_limeSDROutput->getLORange(minF, maxF);
|
||||
qint64 minLimit = minF/1000 + deltaFrequency;
|
||||
qint64 maxLimit = maxF/1000 + deltaFrequency;
|
||||
|
||||
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
|
||||
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
|
||||
|
||||
qDebug("LimeSDROutputGUI::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
|
||||
|
||||
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
|
||||
}
|
||||
|
||||
bool LimeSDROutputGUI::handleMessage(const Message& message)
|
||||
{
|
||||
if (LimeSDROutput::MsgConfigureLimeSDR::match(message))
|
||||
@ -469,13 +486,6 @@ void LimeSDROutputGUI::on_ncoEnable_toggled(bool checked)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDROutputGUI::on_ncoReset_clicked(bool checked __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_ncoFrequency = 0;
|
||||
ui->ncoFrequency->setValue(0);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDROutputGUI::on_sampleRate_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_devSampleRate = value;
|
||||
@ -543,3 +553,14 @@ void LimeSDROutputGUI::on_extClock_clicked()
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDROutputGUI::on_transverter_clicked()
|
||||
{
|
||||
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
|
||||
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
||||
qDebug("LimeSDRInputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
setCenterFrequencySetting(ui->centerFrequency->getValueNew());
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,6 +75,7 @@ private:
|
||||
void sendSettings();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateDACRate();
|
||||
void updateFrequencyLimits();
|
||||
void blockApplySettings(bool block);
|
||||
|
||||
private slots:
|
||||
@ -83,7 +84,6 @@ private slots:
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_ncoFrequency_changed(qint64 value);
|
||||
void on_ncoEnable_toggled(bool checked);
|
||||
void on_ncoReset_clicked(bool checked);
|
||||
void on_sampleRate_changed(quint64 value);
|
||||
void on_hwInterp_currentIndexChanged(int index);
|
||||
void on_swInterp_currentIndexChanged(int index);
|
||||
@ -93,6 +93,7 @@ private slots:
|
||||
void on_gain_valueChanged(int value);
|
||||
void on_antenna_currentIndexChanged(int index);
|
||||
void on_extClock_clicked();
|
||||
void on_transverter_clicked();
|
||||
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
|
@ -29,7 +29,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LimeSDR Input</string>
|
||||
<string>LimeSDR output</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
@ -207,22 +207,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ncoReset">
|
||||
<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="ValueDialZ" name="ncoFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
@ -271,6 +255,22 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="TransverterButton" name="transverter">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Transverter frequency translation dialog</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ExternalClockButton" name="extClock">
|
||||
<property name="toolTip">
|
||||
@ -935,6 +935,11 @@ QToolTip{background-color: white; color: black;}</string>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TransverterButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>gui/transverterbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
|
@ -38,6 +38,8 @@ void LimeSDROutputSettings::resetToDefaults()
|
||||
m_antennaPath = PATH_RFE_NONE;
|
||||
m_extClock = false;
|
||||
m_extClockFreq = 10000000; // 10 MHz
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
}
|
||||
|
||||
QByteArray LimeSDROutputSettings::serialize() const
|
||||
@ -56,6 +58,8 @@ QByteArray LimeSDROutputSettings::serialize() const
|
||||
s.writeS32(13, (int) m_antennaPath);
|
||||
s.writeBool(14, m_extClock);
|
||||
s.writeU32(15, m_extClockFreq);
|
||||
s.writeBool(16, m_transverterMode);
|
||||
s.writeS64(17, m_transverterDeltaFrequency);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -87,6 +91,8 @@ bool LimeSDROutputSettings::deserialize(const QByteArray& data)
|
||||
m_antennaPath = (PathRFE) intval;
|
||||
d.readBool(14, &m_extClock, false);
|
||||
d.readU32(15, &m_extClockFreq, 10000000);
|
||||
d.readBool(16, &m_transverterMode, false);
|
||||
d.readS64(17, &m_transverterDeltaFrequency, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ struct LimeSDROutputSettings
|
||||
PathRFE m_antennaPath;
|
||||
bool m_extClock; //!< True if external clock source
|
||||
uint32_t m_extClockFreq; //!< Frequency (Hz) of external clock source
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
|
||||
LimeSDROutputSettings();
|
||||
void resetToDefaults();
|
||||
|
@ -1021,9 +1021,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||
|| setAntennaAuto || force)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||
|| setAntennaAuto || force)
|
||||
{
|
||||
forwardChangeRxDSP = true;
|
||||
|
||||
|
@ -74,8 +74,8 @@ private:
|
||||
void sendSettings();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateADCRate();
|
||||
void blockApplySettings(bool block);
|
||||
void updateFrequencyLimits();
|
||||
void blockApplySettings(bool block);
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
|
@ -308,6 +308,9 @@
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Transverter frequency translation dialog</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
|
@ -1733,6 +1733,13 @@ margin-bottom: 20px;
|
||||
},
|
||||
"extClockFreq" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"transverterMode" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"transverterDeltaFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
}
|
||||
},
|
||||
"description" : "LimeSDR"
|
||||
@ -20636,7 +20643,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-04-17T00:16:15.209+02:00
|
||||
Generated 2018-04-17T00:43:20.797+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,4 +76,8 @@ LimeSdrOutputSettings:
|
||||
type: integer
|
||||
extClockFreq:
|
||||
type: integer
|
||||
|
||||
transverterMode:
|
||||
type: integer
|
||||
transverterDeltaFrequency:
|
||||
type: integer
|
||||
format: int64
|
||||
|
@ -76,4 +76,8 @@ LimeSdrOutputSettings:
|
||||
type: integer
|
||||
extClockFreq:
|
||||
type: integer
|
||||
|
||||
transverterMode:
|
||||
type: integer
|
||||
transverterDeltaFrequency:
|
||||
type: integer
|
||||
format: int64
|
||||
|
@ -1733,6 +1733,13 @@ margin-bottom: 20px;
|
||||
},
|
||||
"extClockFreq" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"transverterMode" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"transverterDeltaFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
}
|
||||
},
|
||||
"description" : "LimeSDR"
|
||||
@ -20636,7 +20643,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-04-17T00:16:15.209+02:00
|
||||
Generated 2018-04-17T00:43:20.797+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -54,6 +54,10 @@ SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings() {
|
||||
m_ext_clock_isSet = false;
|
||||
ext_clock_freq = 0;
|
||||
m_ext_clock_freq_isSet = false;
|
||||
transverter_mode = 0;
|
||||
m_transverter_mode_isSet = false;
|
||||
transverter_delta_frequency = 0L;
|
||||
m_transverter_delta_frequency_isSet = false;
|
||||
}
|
||||
|
||||
SWGLimeSdrOutputSettings::~SWGLimeSdrOutputSettings() {
|
||||
@ -88,6 +92,10 @@ SWGLimeSdrOutputSettings::init() {
|
||||
m_ext_clock_isSet = false;
|
||||
ext_clock_freq = 0;
|
||||
m_ext_clock_freq_isSet = false;
|
||||
transverter_mode = 0;
|
||||
m_transverter_mode_isSet = false;
|
||||
transverter_delta_frequency = 0L;
|
||||
m_transverter_delta_frequency_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -105,6 +113,8 @@ SWGLimeSdrOutputSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGLimeSdrOutputSettings*
|
||||
@ -144,6 +154,10 @@ SWGLimeSdrOutputSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -199,6 +213,12 @@ SWGLimeSdrOutputSettings::asJsonObject() {
|
||||
if(m_ext_clock_freq_isSet){
|
||||
obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
|
||||
}
|
||||
if(m_transverter_mode_isSet){
|
||||
obj->insert("transverterMode", QJsonValue(transverter_mode));
|
||||
}
|
||||
if(m_transverter_delta_frequency_isSet){
|
||||
obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -333,6 +353,26 @@ SWGLimeSdrOutputSettings::setExtClockFreq(qint32 ext_clock_freq) {
|
||||
this->m_ext_clock_freq_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGLimeSdrOutputSettings::getTransverterMode() {
|
||||
return transverter_mode;
|
||||
}
|
||||
void
|
||||
SWGLimeSdrOutputSettings::setTransverterMode(qint32 transverter_mode) {
|
||||
this->transverter_mode = transverter_mode;
|
||||
this->m_transverter_mode_isSet = true;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGLimeSdrOutputSettings::getTransverterDeltaFrequency() {
|
||||
return transverter_delta_frequency;
|
||||
}
|
||||
void
|
||||
SWGLimeSdrOutputSettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) {
|
||||
this->transverter_delta_frequency = transverter_delta_frequency;
|
||||
this->m_transverter_delta_frequency_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGLimeSdrOutputSettings::isSet(){
|
||||
@ -351,6 +391,8 @@ SWGLimeSdrOutputSettings::isSet(){
|
||||
if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -80,6 +80,12 @@ public:
|
||||
qint32 getExtClockFreq();
|
||||
void setExtClockFreq(qint32 ext_clock_freq);
|
||||
|
||||
qint32 getTransverterMode();
|
||||
void setTransverterMode(qint32 transverter_mode);
|
||||
|
||||
qint64 getTransverterDeltaFrequency();
|
||||
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -123,6 +129,12 @@ private:
|
||||
qint32 ext_clock_freq;
|
||||
bool m_ext_clock_freq_isSet;
|
||||
|
||||
qint32 transverter_mode;
|
||||
bool m_transverter_mode_isSet;
|
||||
|
||||
qint64 transverter_delta_frequency;
|
||||
bool m_transverter_delta_frequency_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user