1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 18:15:45 -05:00

LimeSDR output: implemented temperature reading

This commit is contained in:
f4exb 2017-07-03 16:58:46 +02:00
parent 87ccef02b6
commit 99b100959f
5 changed files with 126 additions and 1 deletions

View File

@ -30,6 +30,7 @@
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgConfigureLimeSDR, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgSetReferenceConfig, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportLimeSDRToGUI, Message)
MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportStreamInfo, Message)
@ -429,6 +430,46 @@ bool LimeSDROutput::handleMessage(const Message& message)
return true;
}
else if (MsgGetDeviceInfo::match(message))
{
if (m_deviceAPI->isBuddyLeader())
{
double temp = 0.0;
if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) == 0))
{
qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: temperature: %f", temp);
}
else
{
qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get temperature");
}
// send to oneself
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
m_deviceAPI->getDeviceOutputMessageQueue()->push(report);
// send to source buddies
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
for (; itSource != sourceBuddies.end(); ++itSource)
{
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSource)->getDeviceOutputMessageQueue()->push(report);
}
// send to sink buddies
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
for (; itSink != sinkBuddies.end(); ++itSink)
{
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSink)->getDeviceOutputMessageQueue()->push(report);
}
}
}
else
{
return false;

View File

@ -86,6 +86,21 @@ public:
{ }
};
class MsgGetDeviceInfo : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgGetDeviceInfo* create()
{
return new MsgGetDeviceInfo();
}
private:
MsgGetDeviceInfo() :
Message()
{ }
};
class MsgReportLimeSDRToGUI : public Message {
MESSAGE_CLASS_DECLARATION

View File

@ -35,7 +35,8 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent) :
m_sampleRate(0),
m_lastEngineState((DSPDeviceSinkEngine::State)-1),
m_doApplySettings(true),
m_statusCounter(0)
m_statusCounter(0),
m_deviceStatusCounter(0)
{
m_limeSDROutput = new LimeSDROutput(m_deviceAPI);
m_sampleSink = (DeviceSampleSink *) m_limeSDROutput;
@ -232,6 +233,11 @@ void LimeSDROutputGUI::handleMessagesToGUI()
ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
}
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message))
{
DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
}
}
}
@ -329,6 +335,17 @@ void LimeSDROutputGUI::updateStatus()
m_sampleSink->getInputMessageQueue()->push(message);
m_statusCounter = 0;
}
if (m_deviceStatusCounter < 10)
{
m_deviceStatusCounter++;
}
else
{
LimeSDROutput::MsgGetDeviceInfo* message = LimeSDROutput::MsgGetDeviceInfo::create();
m_sampleSink->getInputMessageQueue()->push(message);
m_deviceStatusCounter = 0;
}
}
void LimeSDROutputGUI::blockApplySettings(bool block)

View File

@ -63,6 +63,7 @@ private:
int m_lastEngineState;
bool m_doApplySettings;
int m_statusCounter;
int m_deviceStatusCounter;
void displaySettings();
void setNCODisplay();

View File

@ -819,6 +819,29 @@ QToolTip{background-color: white; color: black;}</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="temperatureText">
<property name="minimumSize">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>00C</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
@ -875,6 +898,34 @@ QToolTip{background-color: white; color: black;}</string>
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
</resources>
<connections/>
</ui>