1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-04 14:17:50 -04:00

XTRX: cosmetic changes

This commit is contained in:
f4exb 2020-04-11 17:47:28 +02:00
parent ab6f3d02f0
commit be7ec93654
4 changed files with 61 additions and 57 deletions

View File

@ -771,24 +771,24 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
// apply settings // apply settings
qDebug() << "XTRXOutput::applySettings: m_centerFrequency: " << m_settings.m_centerFrequency qDebug() << "XTRXOutput::applySettings: m_centerFrequency: " << settings.m_centerFrequency
<< " m_devSampleRate: " << m_settings.m_devSampleRate << " m_devSampleRate: " << settings.m_devSampleRate
<< " m_log2SoftInterp: " << m_settings.m_log2SoftInterp << " m_log2SoftInterp: " << settings.m_log2SoftInterp
<< " m_gain: " << m_settings.m_gain << " m_gain: " << settings.m_gain
<< " m_lpfBW: " << m_settings.m_lpfBW << " m_lpfBW: " << settings.m_lpfBW
<< " m_pwrmode: " << m_settings.m_pwrmode << " m_pwrmode: " << settings.m_pwrmode
<< " m_ncoEnable: " << m_settings.m_ncoEnable << " m_ncoEnable: " << settings.m_ncoEnable
<< " m_ncoFrequency: " << m_settings.m_ncoFrequency << " m_ncoFrequency: " << settings.m_ncoFrequency
<< " m_antennaPath: " << m_settings.m_antennaPath << " m_antennaPath: " << settings.m_antennaPath
<< " m_extClock: " << m_settings.m_extClock << " m_extClock: " << settings.m_extClock
<< " m_extClockFreq: " << m_settings.m_extClockFreq << " m_extClockFreq: " << settings.m_extClockFreq
<< " force: " << force; << " force: " << force;
if ((m_settings.m_pwrmode != settings.m_pwrmode)) if ((m_settings.m_pwrmode != settings.m_pwrmode))
{ {
reverseAPIKeys.append("pwrmode"); reverseAPIKeys.append("pwrmode");
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_val_set(m_deviceShared.m_dev->getDevice(), if (xtrx_val_set(m_deviceShared.m_dev->getDevice(),
XTRX_TRX, XTRX_TRX,
@ -810,7 +810,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
if ((m_settings.m_extClock != settings.m_extClock) if ((m_settings.m_extClock != settings.m_extClock)
|| (settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force) || (settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force)
{ {
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
xtrx_set_ref_clk(m_deviceShared.m_dev->getDevice(), xtrx_set_ref_clk(m_deviceShared.m_dev->getDevice(),
(settings.m_extClock) ? settings.m_extClockFreq : 0, (settings.m_extClock) ? settings.m_extClockFreq : 0,
@ -838,7 +838,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
{ {
forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate; forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate;
if (m_deviceShared.m_dev->getDevice() != 0) { if (m_deviceShared.m_dev->getDevice()) {
doChangeSampleRate = true; doChangeSampleRate = true;
} }
} }
@ -847,7 +847,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
{ {
reverseAPIKeys.append("gain"); reverseAPIKeys.append("gain");
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_set_gain(m_deviceShared.m_dev->getDevice(), if (xtrx_set_gain(m_deviceShared.m_dev->getDevice(),
m_deviceShared.m_channel == 0 ? XTRX_CH_A : XTRX_CH_B, m_deviceShared.m_channel == 0 ? XTRX_CH_A : XTRX_CH_B,
@ -865,7 +865,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
{ {
reverseAPIKeys.append("lpfBW"); reverseAPIKeys.append("lpfBW");
if (m_deviceShared.m_dev->getDevice() != 0) { if (m_deviceShared.m_dev->getDevice()) {
doLPCalibration = true; doLPCalibration = true;
} }
} }
@ -874,7 +874,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) ||
(m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force) (m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force)
{ {
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired) if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
{ {
if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(), if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX, LMS_CH_RX,
@ -902,7 +902,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
reverseAPIKeys.append("log2SoftInterp"); reverseAPIKeys.append("log2SoftInterp");
forwardChangeOwnDSP = true; forwardChangeOwnDSP = true;
if (outputThread != 0) if (outputThread)
{ {
outputThread->setLog2Interpolation(requestedChannel, settings.m_log2SoftInterp); outputThread->setLog2Interpolation(requestedChannel, settings.m_log2SoftInterp);
qDebug() << "XTRXOutput::applySettings: set soft interpolation to " << (1<<settings.m_log2SoftInterp); qDebug() << "XTRXOutput::applySettings: set soft interpolation to " << (1<<settings.m_log2SoftInterp);
@ -922,7 +922,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
{ {
reverseAPIKeys.append("antennaPath"); reverseAPIKeys.append("antennaPath");
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_set_antenna(m_deviceShared.m_dev->getDevice(), settings.m_antennaPath) < 0) { if (xtrx_set_antenna(m_deviceShared.m_dev->getDevice(), settings.m_antennaPath) < 0) {
qCritical("XTRXOutput::applySettings: could not set antenna path to %d", (int) settings.m_antennaPath); qCritical("XTRXOutput::applySettings: could not set antenna path to %d", (int) settings.m_antennaPath);
@ -962,7 +962,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
m_settings = settings; m_settings = settings;
if (doChangeSampleRate) if (doChangeSampleRate && (settings.m_devSampleRate != 0))
{ {
XTRXOutputThread *txThread = findThread(); XTRXOutputThread *txThread = findThread();
@ -1018,7 +1018,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
{ {
forwardChangeTxDSP = true; forwardChangeTxDSP = true;
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_tune(m_deviceShared.m_dev->getDevice(), if (xtrx_tune(m_deviceShared.m_dev->getDevice(),
XTRX_TUNE_TX_FDD, XTRX_TUNE_TX_FDD,
@ -1034,7 +1034,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
if (forceNCOFrequency) if (forceNCOFrequency)
{ {
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(), if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(),
XTRX_TUNE_BB_TX, XTRX_TUNE_BB_TX,

View File

@ -232,7 +232,7 @@ void XTRXOutputGUI::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()))
{ {
if (DSPSignalNotification::match(*message)) if (DSPSignalNotification::match(*message))
{ {

View File

@ -869,21 +869,21 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
// apply settings // apply settings
qDebug() << "XTRXInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz" qDebug() << "XTRXInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz"
<< " device stream sample rate: " << getDevSampleRate() << "S/s" << " device stream sample rate: " << getDevSampleRate() << "S/s"
<< " sample rate with soft decimation: " << getSampleRate() << "S/s" << " sample rate with soft decimation: " << getSampleRate() << "S/s"
<< " m_devSampleRate: " << m_settings.m_devSampleRate << " m_devSampleRate: " << settings.m_devSampleRate
<< " m_dcBlock: " << m_settings.m_dcBlock << " m_dcBlock: " << settings.m_dcBlock
<< " m_iqCorrection: " << m_settings.m_iqCorrection << " m_iqCorrection: " << settings.m_iqCorrection
<< " m_log2SoftDecim: " << m_settings.m_log2SoftDecim << " m_log2SoftDecim: " << settings.m_log2SoftDecim
<< " m_gain: " << m_settings.m_gain << " m_gain: " << settings.m_gain
<< " m_lpfBW: " << m_settings.m_lpfBW << " m_lpfBW: " << settings.m_lpfBW
<< " m_pwrmode: " << m_settings.m_pwrmode << " m_pwrmode: " << settings.m_pwrmode
<< " m_ncoEnable: " << m_settings.m_ncoEnable << " m_ncoEnable: " << settings.m_ncoEnable
<< " m_ncoFrequency: " << m_settings.m_ncoFrequency << " m_ncoFrequency: " << settings.m_ncoFrequency
<< " m_antennaPath: " << m_settings.m_antennaPath << " m_antennaPath: " << settings.m_antennaPath
<< " m_extClock: " << m_settings.m_extClock << " m_extClock: " << settings.m_extClock
<< " m_extClockFreq: " << m_settings.m_extClockFreq << " m_extClockFreq: " << settings.m_extClockFreq
<< " force: " << force << " force: " << force
<< " forceNCOFrequency: " << forceNCOFrequency << " forceNCOFrequency: " << forceNCOFrequency
<< " doLPCalibration: " << doLPCalibration; << " doLPCalibration: " << doLPCalibration;
@ -904,7 +904,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
{ {
reverseAPIKeys.append("pwrmode"); reverseAPIKeys.append("pwrmode");
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_val_set(m_deviceShared.m_dev->getDevice(), if (xtrx_val_set(m_deviceShared.m_dev->getDevice(),
XTRX_TRX, XTRX_TRX,
@ -926,7 +926,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
if ((m_settings.m_extClock != settings.m_extClock) if ((m_settings.m_extClock != settings.m_extClock)
|| (settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force) || (settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force)
{ {
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
xtrx_set_ref_clk(m_deviceShared.m_dev->getDevice(), xtrx_set_ref_clk(m_deviceShared.m_dev->getDevice(),
(settings.m_extClock) ? settings.m_extClockFreq : 0, (settings.m_extClock) ? settings.m_extClockFreq : 0,
@ -954,7 +954,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
{ {
forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate; forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate;
if (m_deviceShared.m_dev->getDevice() != 0) { if (m_deviceShared.m_dev->getDevice()) {
doChangeSampleRate = true; doChangeSampleRate = true;
} }
} }
@ -975,7 +975,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
reverseAPIKeys.append("pgaGain"); reverseAPIKeys.append("pgaGain");
} }
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if ((m_settings.m_gainMode != settings.m_gainMode) || force) if ((m_settings.m_gainMode != settings.m_gainMode) || force)
{ {
@ -1014,7 +1014,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
{ {
reverseAPIKeys.append("lpfBW"); reverseAPIKeys.append("lpfBW");
if (m_deviceShared.m_dev->getDevice() != 0) { if (m_deviceShared.m_dev->getDevice()) {
doLPCalibration = true; doLPCalibration = true;
} }
} }
@ -1023,7 +1023,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) ||
(m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force) (m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force)
{ {
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired) if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
{ {
if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(), if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX, LMS_CH_RX,
@ -1051,7 +1051,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
reverseAPIKeys.append("log2SoftDecim"); reverseAPIKeys.append("log2SoftDecim");
forwardChangeOwnDSP = true; forwardChangeOwnDSP = true;
if (inputThread != 0) if (inputThread)
{ {
inputThread->setLog2Decimation(requestedChannel, settings.m_log2SoftDecim); inputThread->setLog2Decimation(requestedChannel, settings.m_log2SoftDecim);
qDebug() << "XTRXInput::applySettings: set soft decimation to " << (1<<settings.m_log2SoftDecim); qDebug() << "XTRXInput::applySettings: set soft decimation to " << (1<<settings.m_log2SoftDecim);
@ -1062,7 +1062,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
{ {
reverseAPIKeys.append("antennaPath"); reverseAPIKeys.append("antennaPath");
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_set_antenna(m_deviceShared.m_dev->getDevice(), settings.m_antennaPath) < 0) { if (xtrx_set_antenna(m_deviceShared.m_dev->getDevice(), settings.m_antennaPath) < 0) {
qCritical("XTRXInput::applySettings: could not set antenna path to %d", (int) settings.m_antennaPath); qCritical("XTRXInput::applySettings: could not set antenna path to %d", (int) settings.m_antennaPath);
@ -1102,7 +1102,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
m_settings = settings; m_settings = settings;
if (doChangeSampleRate) if (doChangeSampleRate && (settings.m_devSampleRate != 0))
{ {
XTRXInputThread *rxThread = findThread(); XTRXInputThread *rxThread = findThread();
@ -1175,7 +1175,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
{ {
forwardChangeRxDSP = true; forwardChangeRxDSP = true;
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_tune(m_deviceShared.m_dev->getDevice(), if (xtrx_tune(m_deviceShared.m_dev->getDevice(),
XTRX_TUNE_RX_FDD, XTRX_TUNE_RX_FDD,
@ -1191,7 +1191,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
if (forceNCOFrequency) if (forceNCOFrequency)
{ {
if (m_deviceShared.m_dev->getDevice() != 0) if (m_deviceShared.m_dev->getDevice())
{ {
if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(), if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(),
XTRX_TUNE_BB_RX, XTRX_TUNE_BB_RX,

View File

@ -255,7 +255,7 @@ void XTRXInputGUI::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()))
{ {
if (DSPSignalNotification::match(*message)) if (DSPSignalNotification::match(*message))
{ {
@ -566,21 +566,17 @@ void XTRXInputGUI::on_sampleRate_changed(quint64 value)
updateADCRate(); updateADCRate();
setNCODisplay(); setNCODisplay();
sendSettings();} sendSettings();
}
void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index) void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index)
{ {
if ((index <0) || (index > 5)) if ((index <0) || (index > 5)) {
return; return;
m_settings.m_log2HardDecim = index;
displaySampleRate();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftDecim);
} }
m_settings.m_log2HardDecim = index;
updateADCRate(); updateADCRate();
setNCODisplay(); setNCODisplay();
sendSettings(); sendSettings();
@ -593,6 +589,14 @@ void XTRXInputGUI::on_swDecim_currentIndexChanged(int index)
} }
m_settings.m_log2SoftDecim = index; m_settings.m_log2SoftDecim = index;
displaySampleRate();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftDecim);
}
sendSettings(); sendSettings();
} }