diff --git a/plugins/samplesink/xtrxoutput/xtrxoutput.cpp b/plugins/samplesink/xtrxoutput/xtrxoutput.cpp index 3dcf5e49c..232d49c46 100644 --- a/plugins/samplesink/xtrxoutput/xtrxoutput.cpp +++ b/plugins/samplesink/xtrxoutput/xtrxoutput.cpp @@ -771,24 +771,24 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b // apply settings - qDebug() << "XTRXOutput::applySettings: m_centerFrequency: " << m_settings.m_centerFrequency - << " m_devSampleRate: " << m_settings.m_devSampleRate - << " m_log2SoftInterp: " << m_settings.m_log2SoftInterp - << " m_gain: " << m_settings.m_gain - << " m_lpfBW: " << m_settings.m_lpfBW - << " m_pwrmode: " << m_settings.m_pwrmode - << " m_ncoEnable: " << m_settings.m_ncoEnable - << " m_ncoFrequency: " << m_settings.m_ncoFrequency - << " m_antennaPath: " << m_settings.m_antennaPath - << " m_extClock: " << m_settings.m_extClock - << " m_extClockFreq: " << m_settings.m_extClockFreq + qDebug() << "XTRXOutput::applySettings: m_centerFrequency: " << settings.m_centerFrequency + << " m_devSampleRate: " << settings.m_devSampleRate + << " m_log2SoftInterp: " << settings.m_log2SoftInterp + << " m_gain: " << settings.m_gain + << " m_lpfBW: " << settings.m_lpfBW + << " m_pwrmode: " << settings.m_pwrmode + << " m_ncoEnable: " << settings.m_ncoEnable + << " m_ncoFrequency: " << settings.m_ncoFrequency + << " m_antennaPath: " << settings.m_antennaPath + << " m_extClock: " << settings.m_extClock + << " m_extClockFreq: " << settings.m_extClockFreq << " force: " << force; if ((m_settings.m_pwrmode != settings.m_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(), XTRX_TRX, @@ -810,7 +810,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b if ((m_settings.m_extClock != settings.m_extClock) || (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(), (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; - if (m_deviceShared.m_dev->getDevice() != 0) { + if (m_deviceShared.m_dev->getDevice()) { doChangeSampleRate = true; } } @@ -847,7 +847,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b { 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(), 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"); - if (m_deviceShared.m_dev->getDevice() != 0) { + if (m_deviceShared.m_dev->getDevice()) { doLPCalibration = true; } } @@ -874,7 +874,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || (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(), LMS_CH_RX, @@ -902,7 +902,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b reverseAPIKeys.append("log2SoftInterp"); forwardChangeOwnDSP = true; - if (outputThread != 0) + if (outputThread) { outputThread->setLog2Interpolation(requestedChannel, settings.m_log2SoftInterp); qDebug() << "XTRXOutput::applySettings: set soft interpolation to " << (1<getDevice() != 0) + if (m_deviceShared.m_dev->getDevice()) { 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); @@ -962,7 +962,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b m_settings = settings; - if (doChangeSampleRate) + if (doChangeSampleRate && (settings.m_devSampleRate != 0)) { XTRXOutputThread *txThread = findThread(); @@ -1018,7 +1018,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b { forwardChangeTxDSP = true; - if (m_deviceShared.m_dev->getDevice() != 0) + if (m_deviceShared.m_dev->getDevice()) { if (xtrx_tune(m_deviceShared.m_dev->getDevice(), XTRX_TUNE_TX_FDD, @@ -1034,7 +1034,7 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b if (forceNCOFrequency) { - if (m_deviceShared.m_dev->getDevice() != 0) + if (m_deviceShared.m_dev->getDevice()) { if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(), XTRX_TUNE_BB_TX, diff --git a/plugins/samplesink/xtrxoutput/xtrxoutputgui.cpp b/plugins/samplesink/xtrxoutput/xtrxoutputgui.cpp index 72200a71b..022cdd004 100644 --- a/plugins/samplesink/xtrxoutput/xtrxoutputgui.cpp +++ b/plugins/samplesink/xtrxoutput/xtrxoutputgui.cpp @@ -232,7 +232,7 @@ void XTRXOutputGUI::handleInputMessages() { Message* message; - while ((message = m_inputMessageQueue.pop()) != 0) + while ((message = m_inputMessageQueue.pop())) { if (DSPSignalNotification::match(*message)) { diff --git a/plugins/samplesource/xtrxinput/xtrxinput.cpp b/plugins/samplesource/xtrxinput/xtrxinput.cpp index 11f1170ee..b52ac3bf2 100644 --- a/plugins/samplesource/xtrxinput/xtrxinput.cpp +++ b/plugins/samplesource/xtrxinput/xtrxinput.cpp @@ -869,21 +869,21 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo // 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" << " sample rate with soft decimation: " << getSampleRate() << "S/s" - << " m_devSampleRate: " << m_settings.m_devSampleRate - << " m_dcBlock: " << m_settings.m_dcBlock - << " m_iqCorrection: " << m_settings.m_iqCorrection - << " m_log2SoftDecim: " << m_settings.m_log2SoftDecim - << " m_gain: " << m_settings.m_gain - << " m_lpfBW: " << m_settings.m_lpfBW - << " m_pwrmode: " << m_settings.m_pwrmode - << " m_ncoEnable: " << m_settings.m_ncoEnable - << " m_ncoFrequency: " << m_settings.m_ncoFrequency - << " m_antennaPath: " << m_settings.m_antennaPath - << " m_extClock: " << m_settings.m_extClock - << " m_extClockFreq: " << m_settings.m_extClockFreq + << " m_devSampleRate: " << settings.m_devSampleRate + << " m_dcBlock: " << settings.m_dcBlock + << " m_iqCorrection: " << settings.m_iqCorrection + << " m_log2SoftDecim: " << settings.m_log2SoftDecim + << " m_gain: " << settings.m_gain + << " m_lpfBW: " << settings.m_lpfBW + << " m_pwrmode: " << settings.m_pwrmode + << " m_ncoEnable: " << settings.m_ncoEnable + << " m_ncoFrequency: " << settings.m_ncoFrequency + << " m_antennaPath: " << settings.m_antennaPath + << " m_extClock: " << settings.m_extClock + << " m_extClockFreq: " << settings.m_extClockFreq << " force: " << force << " forceNCOFrequency: " << forceNCOFrequency << " doLPCalibration: " << doLPCalibration; @@ -904,7 +904,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo { 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(), XTRX_TRX, @@ -926,7 +926,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo if ((m_settings.m_extClock != settings.m_extClock) || (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(), (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; - if (m_deviceShared.m_dev->getDevice() != 0) { + if (m_deviceShared.m_dev->getDevice()) { doChangeSampleRate = true; } } @@ -975,7 +975,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo 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) { @@ -1014,7 +1014,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo { reverseAPIKeys.append("lpfBW"); - if (m_deviceShared.m_dev->getDevice() != 0) { + if (m_deviceShared.m_dev->getDevice()) { doLPCalibration = true; } } @@ -1023,7 +1023,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || (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(), LMS_CH_RX, @@ -1051,7 +1051,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo reverseAPIKeys.append("log2SoftDecim"); forwardChangeOwnDSP = true; - if (inputThread != 0) + if (inputThread) { inputThread->setLog2Decimation(requestedChannel, settings.m_log2SoftDecim); qDebug() << "XTRXInput::applySettings: set soft decimation to " << (1<getDevice() != 0) + if (m_deviceShared.m_dev->getDevice()) { 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); @@ -1102,7 +1102,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo m_settings = settings; - if (doChangeSampleRate) + if (doChangeSampleRate && (settings.m_devSampleRate != 0)) { XTRXInputThread *rxThread = findThread(); @@ -1175,7 +1175,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo { forwardChangeRxDSP = true; - if (m_deviceShared.m_dev->getDevice() != 0) + if (m_deviceShared.m_dev->getDevice()) { if (xtrx_tune(m_deviceShared.m_dev->getDevice(), XTRX_TUNE_RX_FDD, @@ -1191,7 +1191,7 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo if (forceNCOFrequency) { - if (m_deviceShared.m_dev->getDevice() != 0) + if (m_deviceShared.m_dev->getDevice()) { if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(), XTRX_TUNE_BB_RX, diff --git a/plugins/samplesource/xtrxinput/xtrxinputgui.cpp b/plugins/samplesource/xtrxinput/xtrxinputgui.cpp index 4b7135416..e2dca64d0 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputgui.cpp +++ b/plugins/samplesource/xtrxinput/xtrxinputgui.cpp @@ -255,7 +255,7 @@ void XTRXInputGUI::handleInputMessages() { Message* message; - while ((message = m_inputMessageQueue.pop()) != 0) + while ((message = m_inputMessageQueue.pop())) { if (DSPSignalNotification::match(*message)) { @@ -566,21 +566,17 @@ void XTRXInputGUI::on_sampleRate_changed(quint64 value) updateADCRate(); setNCODisplay(); - sendSettings();} + sendSettings(); +} void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index) { - if ((index <0) || (index > 5)) + if ((index <0) || (index > 5)) { 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(); setNCODisplay(); sendSettings(); @@ -593,6 +589,14 @@ void XTRXInputGUI::on_swDecim_currentIndexChanged(int 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(); }