diff --git a/plugins/samplesink/limesdroutput/limesdroutput.cpp b/plugins/samplesink/limesdroutput/limesdroutput.cpp
index 5a38c8a61..484d6134f 100644
--- a/plugins/samplesink/limesdroutput/limesdroutput.cpp
+++ b/plugins/samplesink/limesdroutput/limesdroutput.cpp
@@ -41,6 +41,7 @@
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgConfigureLimeSDR, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgStartStop, Message)
+MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgCalibrationResult, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportStreamInfo, Message)
@@ -1066,19 +1067,20 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
if (doCalibration)
{
- double bw = std::min((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
- if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
- LMS_CH_TX,
- m_deviceShared.m_channel,
- bw,
- 0) != 0)
- {
+ double bw = std::max((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
+ bool calibrationOK = LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
+ LMS_CH_TX,
+ m_deviceShared.m_channel,
+ bw,
+ 0) == 0;
+ if (!calibrationOK) {
qCritical("LimeSDROutput::applySettings: calibration failed on Tx channel %d", m_deviceShared.m_channel);
- }
- else
- {
+ } else {
qDebug("LimeSDROutput::applySettings: calibration successful on Tx channel %d", m_deviceShared.m_channel);
}
+ if (m_guiMessageQueue) {
+ m_guiMessageQueue->push(MsgCalibrationResult::create(calibrationOK));
+ }
}
if (doLPCalibration)
diff --git a/plugins/samplesink/limesdroutput/limesdroutput.h b/plugins/samplesink/limesdroutput/limesdroutput.h
index 07808c4cd..3e1f0fce9 100644
--- a/plugins/samplesink/limesdroutput/limesdroutput.h
+++ b/plugins/samplesink/limesdroutput/limesdroutput.h
@@ -79,6 +79,25 @@ public:
{ }
};
+ class MsgCalibrationResult : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ bool getSuccess() const { return m_success; }
+
+ static MsgCalibrationResult* create(bool success) {
+ return new MsgCalibrationResult(success);
+ }
+
+ protected:
+ bool m_success;
+
+ MsgCalibrationResult(bool success) :
+ Message(),
+ m_success(success)
+ { }
+ };
+
class MsgGetStreamInfo : public Message {
MESSAGE_CLASS_DECLARATION
diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp
index 48a2e1dc8..0e9dba0fa 100644
--- a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp
+++ b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp
@@ -202,6 +202,16 @@ bool LimeSDROutputGUI::handleMessage(const Message& message)
return true;
}
+ else if (LimeSDROutput::MsgCalibrationResult::match(message))
+ {
+ LimeSDROutput::MsgCalibrationResult& report = (LimeSDROutput::MsgCalibrationResult&) message;
+
+ if (report.getSuccess()) {
+ ui->calibrationLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ } else {
+ ui->calibrationLabel->setStyleSheet("QLabel { background-color : red; }");
+ }
+ }
else if (LimeSDROutput::MsgReportStreamInfo::match(message))
{
LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message;
@@ -303,6 +313,32 @@ void LimeSDROutputGUI::updateSampleRateAndFrequency()
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
displaySampleRate();
+ checkLPF();
+}
+
+// Check if LPF BW is set wide enough when down-converting using NCO
+void LimeSDROutputGUI::checkLPF()
+{
+ bool highlightLPFLabel = false;
+ int64_t centerFrequency = m_settings.m_centerFrequency;
+ if (m_settings.m_ncoEnable) {
+ centerFrequency += m_settings.m_ncoFrequency;
+ }
+ if (centerFrequency < 30000000)
+ {
+ int64_t requiredBW = 30000000 - centerFrequency;
+ highlightLPFLabel = m_settings.m_lpfBW < requiredBW;
+ }
+ if (highlightLPFLabel)
+ {
+ ui->lpfLabel->setStyleSheet("QLabel { background-color : red; }");
+ ui->lpfLabel->setToolTip("LPF BW is too low for selected center frequency");
+ }
+ else
+ {
+ ui->lpfLabel->setStyleSheet("QLabel { background-color: rgb(64, 64, 64); }");
+ ui->lpfLabel->setToolTip("");
+ }
}
void LimeSDROutputGUI::updateDACRate()
@@ -573,6 +609,7 @@ void LimeSDROutputGUI::on_swInterp_currentIndexChanged(int index)
void LimeSDROutputGUI::on_lpf_changed(quint64 value)
{
m_settings.m_lpfBW = value * 1000;
+ checkLPF();
sendSettings();
}
diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.h b/plugins/samplesink/limesdroutput/limesdroutputgui.h
index 71831b414..2eb6dfadb 100644
--- a/plugins/samplesink/limesdroutput/limesdroutputgui.h
+++ b/plugins/samplesink/limesdroutput/limesdroutputgui.h
@@ -73,6 +73,7 @@ private:
void setCenterFrequencySetting(uint64_t kHzValue);
void sendSettings();
void updateSampleRateAndFrequency();
+ void checkLPF();
void updateDACRate();
void updateFrequencyLimits();
void blockApplySettings(bool block);
diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.ui b/plugins/samplesink/limesdroutput/limesdroutputgui.ui
index 91ff5d9cc..773d426c5 100644
--- a/plugins/samplesink/limesdroutput/limesdroutputgui.ui
+++ b/plugins/samplesink/limesdroutput/limesdroutputgui.ui
@@ -7,7 +7,7 @@
0
0
360
- 209
+ 230
@@ -19,7 +19,7 @@
360
- 209
+ 230
@@ -831,6 +831,19 @@
+ -
+
+
+ Red if calibration failed (check log for error)
+
+
+ background:rgb(79,79,79);
+
+
+ C
+
+
+
-
@@ -934,12 +947,6 @@ QToolTip{background-color: white; color: black;}
-
- ValueDial
- QWidget
-
- 1
-
ButtonSwitch
QToolButton
@@ -951,6 +958,12 @@ QToolTip{background-color: white; color: black;}
1
+
+ ValueDial
+ QWidget
+
+ 1
+
TransverterButton
QPushButton
diff --git a/plugins/samplesink/limesdroutput/readme.md b/plugins/samplesink/limesdroutput/readme.md
index 24134d093..e12723830 100644
--- a/plugins/samplesink/limesdroutput/readme.md
+++ b/plugins/samplesink/limesdroutput/readme.md
@@ -202,6 +202,7 @@ This label turns green when status can be obtained from the current stream. Usua
- **U**: turns red if stream experiences underruns
- **O**: turns red if stream experiences overruns
- **P**: turns red if stream experiences packet drop outs
+ - **C**: turns red if calibration fails
18: Stream global (all Tx) throughput in MB/s
diff --git a/plugins/samplesource/fileinput/fileinputgui.h b/plugins/samplesource/fileinput/fileinputgui.h
index 78dc0b338..561c8f34d 100644
--- a/plugins/samplesource/fileinput/fileinputgui.h
+++ b/plugins/samplesource/fileinput/fileinputgui.h
@@ -77,6 +77,7 @@ private:
void displayTime();
void sendSettings();
void updateSampleRateAndFrequency();
+ void checkLPF();
void configureFileName();
void updateWithAcquisition();
void updateWithStreamData();
diff --git a/plugins/samplesource/limesdrinput/limesdrinput.cpp b/plugins/samplesource/limesdrinput/limesdrinput.cpp
index e6824dda6..b372fc6c6 100644
--- a/plugins/samplesource/limesdrinput/limesdrinput.cpp
+++ b/plugins/samplesource/limesdrinput/limesdrinput.cpp
@@ -45,6 +45,7 @@ MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgStartStop, Message)
+MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgCalibrationResult, Message)
LimeSDRInput::LimeSDRInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
@@ -1227,19 +1228,20 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (doCalibration)
{
- double bw = std::min((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
- if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
+ double bw = std::max((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
+ bool calibrationOK = LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
bw,
- 0) != 0)
- {
+ 0) == 0;
+ if (!calibrationOK) {
qCritical("LimeSDRInput::applySettings: calibration failed on Rx channel %d", m_deviceShared.m_channel);
- }
- else
- {
+ } else {
qDebug("LimeSDRInput::applySettings: calibration successful on Rx channel %d", m_deviceShared.m_channel);
}
+ if (m_guiMessageQueue) {
+ m_guiMessageQueue->push(MsgCalibrationResult::create(calibrationOK));
+ }
}
if (doLPCalibration)
diff --git a/plugins/samplesource/limesdrinput/limesdrinput.h b/plugins/samplesource/limesdrinput/limesdrinput.h
index 06643cb1d..e2b2c7887 100644
--- a/plugins/samplesource/limesdrinput/limesdrinput.h
+++ b/plugins/samplesource/limesdrinput/limesdrinput.h
@@ -184,6 +184,25 @@ public:
{ }
};
+ class MsgCalibrationResult : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ bool getSuccess() const { return m_success; }
+
+ static MsgCalibrationResult* create(bool success) {
+ return new MsgCalibrationResult(success);
+ }
+
+ protected:
+ bool m_success;
+
+ MsgCalibrationResult(bool success) :
+ Message(),
+ m_success(success)
+ { }
+ };
+
LimeSDRInput(DeviceAPI *deviceAPI);
virtual ~LimeSDRInput();
virtual void destroy();
diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp
index c996bb475..b56f9d945 100644
--- a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp
+++ b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp
@@ -189,6 +189,16 @@ bool LimeSDRInputGUI::handleMessage(const Message& message)
return true;
}
+ else if (LimeSDRInput::MsgCalibrationResult::match(message))
+ {
+ LimeSDRInput::MsgCalibrationResult& report = (LimeSDRInput::MsgCalibrationResult&) message;
+
+ if (report.getSuccess()) {
+ ui->calibrationLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
+ } else {
+ ui->calibrationLabel->setStyleSheet("QLabel { background-color : red; }");
+ }
+ }
else if (LimeSDRInput::MsgReportStreamInfo::match(message))
{
LimeSDRInput::MsgReportStreamInfo& report = (LimeSDRInput::MsgReportStreamInfo&) message;
@@ -322,6 +332,32 @@ void LimeSDRInputGUI::updateSampleRateAndFrequency()
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
displaySampleRate();
+ checkLPF();
+}
+
+// Check if LPF BW is set wide enough when up-converting using NCO
+void LimeSDRInputGUI::checkLPF()
+{
+ bool highlightLPFLabel = false;
+ int64_t centerFrequency = m_settings.m_centerFrequency;
+ if (m_settings.m_ncoEnable) {
+ centerFrequency += m_settings.m_ncoFrequency;
+ }
+ if (centerFrequency < 30000000)
+ {
+ int64_t requiredBW = 30000000 - centerFrequency;
+ highlightLPFLabel = m_settings.m_lpfBW < requiredBW;
+ }
+ if (highlightLPFLabel)
+ {
+ ui->lpfLabel->setStyleSheet("QLabel { background-color : red; }");
+ ui->lpfLabel->setToolTip("LPF BW is too low for selected center frequency");
+ }
+ else
+ {
+ ui->lpfLabel->setStyleSheet("QLabel { background-color: rgb(64, 64, 64); }");
+ ui->lpfLabel->setToolTip("");
+ }
}
void LimeSDRInputGUI::displaySampleRate()
@@ -619,6 +655,7 @@ void LimeSDRInputGUI::on_swDecim_currentIndexChanged(int index)
void LimeSDRInputGUI::on_lpf_changed(quint64 value)
{
m_settings.m_lpfBW = value * 1000;
+ checkLPF();
sendSettings();
}
diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.h b/plugins/samplesource/limesdrinput/limesdrinputgui.h
index 401f334cb..c71614657 100644
--- a/plugins/samplesource/limesdrinput/limesdrinputgui.h
+++ b/plugins/samplesource/limesdrinput/limesdrinputgui.h
@@ -72,6 +72,7 @@ private:
void setCenterFrequencySetting(uint64_t kHzValue);
void sendSettings();
void updateSampleRateAndFrequency();
+ void checkLPF();
void updateADCRate();
void updateFrequencyLimits();
void blockApplySettings(bool block);
diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.ui b/plugins/samplesource/limesdrinput/limesdrinputgui.ui
index 6c18b71f2..baba795b6 100644
--- a/plugins/samplesource/limesdrinput/limesdrinputgui.ui
+++ b/plugins/samplesource/limesdrinput/limesdrinputgui.ui
@@ -6,8 +6,8 @@
0
0
- 370
- 209
+ 360
+ 230
@@ -18,13 +18,13 @@
- 370
- 209
+ 360
+ 230
- 390
+ 380
266
@@ -135,7 +135,6 @@
Liberation Mono
16
- 50
false
@@ -248,7 +247,6 @@
Liberation Mono
12
- 50
false
@@ -374,7 +372,6 @@
Liberation Mono
12
- 50
false
@@ -565,7 +562,6 @@
Liberation Mono
12
- 50
false
@@ -1057,6 +1053,19 @@
+ -
+
+
+ Red if calibration failed (check log for error)
+
+
+ background:rgb(79,79,79);
+
+
+ C
+
+
+
-
@@ -1163,12 +1172,6 @@ QToolTip{background-color: white; color: black;}
-
- ValueDial
- QWidget
-
- 1
-
ButtonSwitch
QToolButton
@@ -1180,6 +1183,12 @@ QToolTip{background-color: white; color: black;}
1
+
+ ValueDial
+ QWidget
+
+ 1
+
TransverterButton
QPushButton
diff --git a/plugins/samplesource/limesdrinput/readme.md b/plugins/samplesource/limesdrinput/readme.md
index a29c7f1c7..c29b39e68 100644
--- a/plugins/samplesource/limesdrinput/readme.md
+++ b/plugins/samplesource/limesdrinput/readme.md
@@ -195,6 +195,7 @@ This label turns green when status can be obtained from the current stream. Usua
- **U**: turns red if stream experiences underruns
- **O**: turns red if stream experiences overruns
- **P**: turns red if stream experiences packet drop outs
+ - **C**: turns red if calibration fails
12: Stream global (all Rx) throughput in MB/s