1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-26 14:05:33 -04:00

Merge pull request #1395 from srcejon/fix_1389_part_2

Lime: Implement #1389
This commit is contained in:
Edouard Griffiths 2022-08-29 23:25:32 +02:00 committed by GitHub
commit 6320cd7d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 183 additions and 40 deletions

View File

@ -41,6 +41,7 @@
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgConfigureLimeSDR, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgConfigureLimeSDR, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgStartStop, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgCalibrationResult, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetStreamInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetDeviceInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportStreamInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportStreamInfo, Message)
@ -1066,19 +1067,20 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
if (doCalibration) if (doCalibration)
{ {
double bw = std::min((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz double bw = std::max((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(), bool calibrationOK = LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_TX, LMS_CH_TX,
m_deviceShared.m_channel, m_deviceShared.m_channel,
bw, bw,
0) != 0) 0) == 0;
{ if (!calibrationOK) {
qCritical("LimeSDROutput::applySettings: calibration failed on Tx channel %d", m_deviceShared.m_channel); 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); qDebug("LimeSDROutput::applySettings: calibration successful on Tx channel %d", m_deviceShared.m_channel);
} }
if (m_guiMessageQueue) {
m_guiMessageQueue->push(MsgCalibrationResult::create(calibrationOK));
}
} }
if (doLPCalibration) if (doLPCalibration)

View File

@ -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 { class MsgGetStreamInfo : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION

View File

@ -202,6 +202,16 @@ bool LimeSDROutputGUI::handleMessage(const Message& message)
return true; 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)) else if (LimeSDROutput::MsgReportStreamInfo::match(message))
{ {
LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message; LimeSDROutput::MsgReportStreamInfo& report = (LimeSDROutput::MsgReportStreamInfo&) message;
@ -303,6 +313,32 @@ void LimeSDROutputGUI::updateSampleRateAndFrequency()
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
displaySampleRate(); 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() void LimeSDROutputGUI::updateDACRate()
@ -573,6 +609,7 @@ void LimeSDROutputGUI::on_swInterp_currentIndexChanged(int index)
void LimeSDROutputGUI::on_lpf_changed(quint64 value) void LimeSDROutputGUI::on_lpf_changed(quint64 value)
{ {
m_settings.m_lpfBW = value * 1000; m_settings.m_lpfBW = value * 1000;
checkLPF();
sendSettings(); sendSettings();
} }

View File

@ -73,6 +73,7 @@ private:
void setCenterFrequencySetting(uint64_t kHzValue); void setCenterFrequencySetting(uint64_t kHzValue);
void sendSettings(); void sendSettings();
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
void checkLPF();
void updateDACRate(); void updateDACRate();
void updateFrequencyLimits(); void updateFrequencyLimits();
void blockApplySettings(bool block); void blockApplySettings(bool block);

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>360</width> <width>360</width>
<height>209</height> <height>230</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,7 +19,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>360</width> <width>360</width>
<height>209</height> <height>230</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -831,6 +831,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="calibrationLabel">
<property name="toolTip">
<string>Red if calibration failed (check log for error)</string>
</property>
<property name="styleSheet">
<string notr="true">background:rgb(79,79,79);</string>
</property>
<property name="text">
<string>C</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="streamLinkRateText"> <widget class="QLabel" name="streamLinkRateText">
<property name="minimumSize"> <property name="minimumSize">
@ -934,12 +947,6 @@ QToolTip{background-color: white; color: black;}</string>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>ButtonSwitch</class> <class>ButtonSwitch</class>
<extends>QToolButton</extends> <extends>QToolButton</extends>
@ -951,6 +958,12 @@ QToolTip{background-color: white; color: black;}</string>
<header>gui/valuedialz.h</header> <header>gui/valuedialz.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>TransverterButton</class> <class>TransverterButton</class>
<extends>QPushButton</extends> <extends>QPushButton</extends>

View File

@ -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 - **U**: turns red if stream experiences underruns
- **O**: turns red if stream experiences overruns - **O**: turns red if stream experiences overruns
- **P**: turns red if stream experiences packet drop outs - **P**: turns red if stream experiences packet drop outs
- **C**: turns red if calibration fails
<h3>18: Stream global (all Tx) throughput in MB/s</h3> <h3>18: Stream global (all Tx) throughput in MB/s</h3>

View File

@ -77,6 +77,7 @@ private:
void displayTime(); void displayTime();
void sendSettings(); void sendSettings();
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
void checkLPF();
void configureFileName(); void configureFileName();
void updateWithAcquisition(); void updateWithAcquisition();
void updateWithStreamData(); void updateWithStreamData();

View File

@ -45,6 +45,7 @@ MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetDeviceInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportStreamInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgStartStop, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgCalibrationResult, Message)
LimeSDRInput::LimeSDRInput(DeviceAPI *deviceAPI) : LimeSDRInput::LimeSDRInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
@ -1227,19 +1228,20 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (doCalibration) if (doCalibration)
{ {
double bw = std::min((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz double bw = std::max((double)m_settings.m_devSampleRate, 2500000.0); // Min supported calibration bandwidth is 2.5MHz
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(), bool calibrationOK = LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX, LMS_CH_RX,
m_deviceShared.m_channel, m_deviceShared.m_channel,
bw, bw,
0) != 0) 0) == 0;
{ if (!calibrationOK) {
qCritical("LimeSDRInput::applySettings: calibration failed on Rx channel %d", m_deviceShared.m_channel); 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); qDebug("LimeSDRInput::applySettings: calibration successful on Rx channel %d", m_deviceShared.m_channel);
} }
if (m_guiMessageQueue) {
m_guiMessageQueue->push(MsgCalibrationResult::create(calibrationOK));
}
} }
if (doLPCalibration) if (doLPCalibration)

View File

@ -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); LimeSDRInput(DeviceAPI *deviceAPI);
virtual ~LimeSDRInput(); virtual ~LimeSDRInput();
virtual void destroy(); virtual void destroy();

View File

@ -189,6 +189,16 @@ bool LimeSDRInputGUI::handleMessage(const Message& message)
return true; 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)) else if (LimeSDRInput::MsgReportStreamInfo::match(message))
{ {
LimeSDRInput::MsgReportStreamInfo& report = (LimeSDRInput::MsgReportStreamInfo&) message; LimeSDRInput::MsgReportStreamInfo& report = (LimeSDRInput::MsgReportStreamInfo&) message;
@ -322,6 +332,32 @@ void LimeSDRInputGUI::updateSampleRateAndFrequency()
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
displaySampleRate(); 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() void LimeSDRInputGUI::displaySampleRate()
@ -619,6 +655,7 @@ void LimeSDRInputGUI::on_swDecim_currentIndexChanged(int index)
void LimeSDRInputGUI::on_lpf_changed(quint64 value) void LimeSDRInputGUI::on_lpf_changed(quint64 value)
{ {
m_settings.m_lpfBW = value * 1000; m_settings.m_lpfBW = value * 1000;
checkLPF();
sendSettings(); sendSettings();
} }

View File

@ -72,6 +72,7 @@ private:
void setCenterFrequencySetting(uint64_t kHzValue); void setCenterFrequencySetting(uint64_t kHzValue);
void sendSettings(); void sendSettings();
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
void checkLPF();
void updateADCRate(); void updateADCRate();
void updateFrequencyLimits(); void updateFrequencyLimits();
void blockApplySettings(bool block); void blockApplySettings(bool block);

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>370</width> <width>360</width>
<height>209</height> <height>230</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -18,13 +18,13 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>370</width> <width>360</width>
<height>209</height> <height>230</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>390</width> <width>380</width>
<height>266</height> <height>266</height>
</size> </size>
</property> </property>
@ -135,7 +135,6 @@
<font> <font>
<family>Liberation Mono</family> <family>Liberation Mono</family>
<pointsize>16</pointsize> <pointsize>16</pointsize>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -248,7 +247,6 @@
<font> <font>
<family>Liberation Mono</family> <family>Liberation Mono</family>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -374,7 +372,6 @@
<font> <font>
<family>Liberation Mono</family> <family>Liberation Mono</family>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -565,7 +562,6 @@
<font> <font>
<family>Liberation Mono</family> <family>Liberation Mono</family>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -1057,6 +1053,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="calibrationLabel">
<property name="toolTip">
<string>Red if calibration failed (check log for error)</string>
</property>
<property name="styleSheet">
<string notr="true">background:rgb(79,79,79);</string>
</property>
<property name="text">
<string>C</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="streamLinkRateText"> <widget class="QLabel" name="streamLinkRateText">
<property name="minimumSize"> <property name="minimumSize">
@ -1163,12 +1172,6 @@ QToolTip{background-color: white; color: black;}</string>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>ButtonSwitch</class> <class>ButtonSwitch</class>
<extends>QToolButton</extends> <extends>QToolButton</extends>
@ -1180,6 +1183,12 @@ QToolTip{background-color: white; color: black;}</string>
<header>gui/valuedialz.h</header> <header>gui/valuedialz.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>TransverterButton</class> <class>TransverterButton</class>
<extends>QPushButton</extends> <extends>QPushButton</extends>

View File

@ -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 - **U**: turns red if stream experiences underruns
- **O**: turns red if stream experiences overruns - **O**: turns red if stream experiences overruns
- **P**: turns red if stream experiences packet drop outs - **P**: turns red if stream experiences packet drop outs
- **C**: turns red if calibration fails
<h3>12: Stream global (all Rx) throughput in MB/s</h3> <h3>12: Stream global (all Rx) throughput in MB/s</h3>