1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

XTRX input: removed useless status indicators and added GPS locked status

This commit is contained in:
f4exb 2018-12-29 11:07:14 +01:00
parent 7cef8cc2ab
commit f21dd8d6e5
9 changed files with 69 additions and 158 deletions

View File

@ -67,17 +67,28 @@ double DeviceXTRXShared::set_samplerate(double rate,
return m_inputRate; return m_inputRate;
} }
double DeviceXTRXShared::get_temperature() double DeviceXTRXShared::get_board_temperature()
{ {
uint64_t val = 0; uint64_t val = 0;
int res = xtrx_val_get(m_deviceParams->getDevice(), int res = xtrx_val_get(m_deviceParams->getDevice(), XTRX_TRX, XTRX_CH_AB, XTRX_BOARD_TEMP, &val);
XTRX_TRX, XTRX_CH_AB, XTRX_BOARD_TEMP, &val);
if (res) { if (res) {
//fprintf(stderr, "Unable to set samplerate, error=%d\n", res);
return 0; return 0;
} }
return val; return val;
} }
bool DeviceXTRXShared::get_gps_status()
{
uint64_t val = 0;
int res = xtrx_val_get(m_deviceParams->getDevice(), XTRX_TRX, XTRX_CH_AB, XTRX_WAIT_1PPS, &val);
if (res) {
return false;
}
return val != 0;
}

View File

@ -102,18 +102,21 @@ public:
public: public:
float getTemperature() const { return m_temperature; } float getTemperature() const { return m_temperature; }
bool getGPSLocked() const { return m_gpsLocked; }
static MsgReportDeviceInfo* create(float temperature) static MsgReportDeviceInfo* create(float temperature, bool gpsLocked)
{ {
return new MsgReportDeviceInfo(temperature); return new MsgReportDeviceInfo(temperature, gpsLocked);
} }
private: private:
float m_temperature; float m_temperature;
bool m_gpsLocked;
MsgReportDeviceInfo(float temperature) : MsgReportDeviceInfo(float temperature, bool gpsLocked) :
Message(), Message(),
m_temperature(temperature) m_temperature(temperature),
m_gpsLocked(gpsLocked)
{ } { }
}; };
@ -159,7 +162,8 @@ public:
double set_samplerate(double rate, double master, bool output); double set_samplerate(double rate, double master, bool output);
double get_temperature(); double get_board_temperature();
bool get_gps_status();
}; };
#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */ #endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */

BIN
doc/img/gps.xcf Normal file

Binary file not shown.

View File

@ -537,7 +537,7 @@ bool XTRXInput::handleMessage(const Message& message)
{ {
if (m_deviceAPI->getSampleSourceGUIMessageQueue()) if (m_deviceAPI->getSampleSourceGUIMessageQueue())
{ {
uint64_t fifolevel; uint64_t fifolevel = 0;
xtrx_val_get(m_deviceShared.m_deviceParams->getDevice(), xtrx_val_get(m_deviceShared.m_deviceParams->getDevice(),
XTRX_RX, XTRX_CH_AB, XTRX_PERF_LLFIFO, &fifolevel); XTRX_RX, XTRX_CH_AB, XTRX_PERF_LLFIFO, &fifolevel);
@ -546,30 +546,34 @@ bool XTRXInput::handleMessage(const Message& message)
true, true,
true, true,
fifolevel, fifolevel,
65536, 65536);
0,
0, if (m_deviceAPI->getSampleSourceGUIMessageQueue()) {
0,
0,
0,
0);
m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report); m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
} }
}
return true; return true;
} }
else if (MsgGetDeviceInfo::match(message)) else if (MsgGetDeviceInfo::match(message))
{ {
double temp = 0.0; double board_temp = 0.0;
bool gps_locked = false;
if (!m_deviceShared.m_deviceParams->getDevice() || ((temp = m_deviceShared.get_temperature() / 256.0) == 0.0)) { if (!m_deviceShared.m_deviceParams->getDevice() || ((board_temp = m_deviceShared.get_board_temperature() / 256.0) == 0.0)) {
qDebug("XTRXInput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); qDebug("XTRXInput::handleMessage: MsgGetDeviceInfo: cannot get board temperature");
}
if (!m_deviceShared.m_deviceParams->getDevice()) {
qDebug("XTRXInput::handleMessage: MsgGetDeviceInfo: cannot get GPS lock status");
} else {
gps_locked = m_deviceShared.get_gps_status();
} }
// send to oneself // send to oneself
if (m_deviceAPI->getSampleSourceGUIMessageQueue()) if (m_deviceAPI->getSampleSourceGUIMessageQueue())
{ {
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(temp); DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(board_temp, gps_locked);
m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report); m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
} }
@ -581,7 +585,7 @@ bool XTRXInput::handleMessage(const Message& message)
{ {
if ((*itSource)->getSampleSourceGUIMessageQueue()) if ((*itSource)->getSampleSourceGUIMessageQueue())
{ {
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(temp); DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(board_temp, gps_locked);
(*itSource)->getSampleSourceGUIMessageQueue()->push(report); (*itSource)->getSampleSourceGUIMessageQueue()->push(report);
} }
} }
@ -594,7 +598,7 @@ bool XTRXInput::handleMessage(const Message& message)
{ {
if ((*itSink)->getSampleSinkGUIMessageQueue()) if ((*itSink)->getSampleSinkGUIMessageQueue())
{ {
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(temp); DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(board_temp, gps_locked);
(*itSink)->getSampleSinkGUIMessageQueue()->push(report); (*itSink)->getSampleSinkGUIMessageQueue()->push(report);
} }
} }

View File

@ -94,37 +94,19 @@ public:
bool getActive() const { return m_active; } bool getActive() const { return m_active; }
uint32_t getFifoFilledCount() const { return m_fifoFilledCount; } uint32_t getFifoFilledCount() const { return m_fifoFilledCount; }
uint32_t getFifoSize() const { return m_fifoSize; } uint32_t getFifoSize() const { return m_fifoSize; }
uint32_t getUnderrun() const { return m_underrun; }
uint32_t getOverrun() const { return m_overrun; }
uint32_t getDroppedPackets() const { return m_droppedPackets; }
float getSampleRate() const { return m_sampleRate; }
float getLinkRate() const { return m_linkRate; }
uint64_t getTimestamp() const { return m_timestamp; }
static MsgReportStreamInfo* create( static MsgReportStreamInfo* create(
bool success, bool success,
bool active, bool active,
uint32_t fifoFilledCount, uint32_t fifoFilledCount,
uint32_t fifoSize, uint32_t fifoSize
uint32_t underrun,
uint32_t overrun,
uint32_t droppedPackets,
float sampleRate,
float linkRate,
uint64_t timestamp
) )
{ {
return new MsgReportStreamInfo( return new MsgReportStreamInfo(
success, success,
active, active,
fifoFilledCount, fifoFilledCount,
fifoSize, fifoSize
underrun,
overrun,
droppedPackets,
sampleRate,
linkRate,
timestamp
); );
} }
@ -134,36 +116,18 @@ public:
bool m_active; //!< Indicates whether the stream is currently active bool m_active; //!< Indicates whether the stream is currently active
uint32_t m_fifoFilledCount; //!< Number of samples in FIFO buffer uint32_t m_fifoFilledCount; //!< Number of samples in FIFO buffer
uint32_t m_fifoSize; //!< Size of FIFO buffer uint32_t m_fifoSize; //!< Size of FIFO buffer
uint32_t m_underrun; //!< FIFO underrun count
uint32_t m_overrun; //!< FIFO overrun count
uint32_t m_droppedPackets; //!< Number of dropped packets by HW
float m_sampleRate; //!< Sampling rate of the stream
float m_linkRate; //!< Combined data rate of all stream of the same direction (TX or RX)
uint64_t m_timestamp; //!< Current HW timestamp
MsgReportStreamInfo( MsgReportStreamInfo(
bool success, bool success,
bool active, bool active,
uint32_t fifoFilledCount, uint32_t fifoFilledCount,
uint32_t fifoSize, uint32_t fifoSize
uint32_t underrun,
uint32_t overrun,
uint32_t droppedPackets,
float sampleRate,
float linkRate,
uint64_t timestamp
) : ) :
Message(), Message(),
m_success(success), m_success(success),
m_active(active), m_active(active),
m_fifoFilledCount(fifoFilledCount), m_fifoFilledCount(fifoFilledCount),
m_fifoSize(fifoSize), m_fifoSize(fifoSize)
m_underrun(underrun),
m_overrun(overrun),
m_droppedPackets(droppedPackets),
m_sampleRate(sampleRate),
m_linkRate(linkRate),
m_timestamp(timestamp)
{ } { }
}; };

View File

@ -183,26 +183,6 @@ bool XTRXInputGUI::handleMessage(const Message& message)
ui->streamStatusLabel->setStyleSheet("QLabel { background-color : blue; }"); ui->streamStatusLabel->setStyleSheet("QLabel { background-color : blue; }");
} }
ui->streamLinkRateText->setText(tr("%1 MB/s").arg(QString::number(report.getLinkRate() / 1000000.0f, 'f', 3)));
if (report.getUnderrun() > 0) {
ui->underrunLabel->setStyleSheet("QLabel { background-color : red; }");
} else {
ui->underrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
if (report.getOverrun() > 0) {
ui->overrunLabel->setStyleSheet("QLabel { background-color : red; }");
} else {
ui->overrunLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
if (report.getDroppedPackets() > 0) {
ui->droppedLabel->setStyleSheet("QLabel { background-color : red; }");
} else {
ui->droppedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
ui->fifoBar->setMaximum(report.getFifoSize()); ui->fifoBar->setMaximum(report.getFifoSize());
ui->fifoBar->setValue(report.getFifoFilledCount()); ui->fifoBar->setValue(report.getFifoFilledCount());
ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize()))); ui->fifoBar->setToolTip(tr("FIFO fill %1/%2 samples").arg(QString::number(report.getFifoFilledCount())).arg(QString::number(report.getFifoSize())));
@ -218,6 +198,13 @@ bool XTRXInputGUI::handleMessage(const Message& message)
{ {
DeviceXTRXShared::MsgReportDeviceInfo& report = (DeviceXTRXShared::MsgReportDeviceInfo&) message; DeviceXTRXShared::MsgReportDeviceInfo& report = (DeviceXTRXShared::MsgReportDeviceInfo&) message;
ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0))); ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0)));
if (report.getGPSLocked()) {
ui->gpsStatusLabel->setStyleSheet("QLabel { background-color : green; }");
} else {
ui->gpsStatusLabel->setStyleSheet("QLabel { background:rgb(48,48,48); }");
}
return true; return true;
} }
else if (XTRXInput::MsgStartStop::match(message)) else if (XTRXInput::MsgStartStop::match(message))

View File

@ -1041,87 +1041,27 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="underrunLabel"> <widget class="QLabel" name="gpsStatusLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>12</width> <width>24</width>
<height>0</height> <height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Red if underruns</string> <string>Green when GPS is locked</string>
</property>
<property name="styleSheet">
<string notr="true">background:rgb(79,79,79);</string>
</property> </property>
<property name="text"> <property name="text">
<string>U</string> <string/>
</property> </property>
<property name="alignment"> <property name="pixmap">
<set>Qt::AlignCenter</set> <pixmap resource="../../../sdrgui/resources/res.qrc">:/gps.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="overrunLabel">
<property name="minimumSize">
<size>
<width>12</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Red if overruns</string>
</property>
<property name="styleSheet">
<string notr="true">background:rgb(79,79,79);</string>
</property>
<property name="text">
<string>O</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="droppedLabel">
<property name="minimumSize">
<size>
<width>12</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Red if dropped packets</string>
</property>
<property name="styleSheet">
<string notr="true">background:rgb(79,79,79);</string>
</property>
<property name="text">
<string>D</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="streamLinkRateText">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Stream link rate (MB/s)</string>
</property>
<property name="text">
<string>000.000 MB/s</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>

BIN
sdrgui/resources/gps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>gps.png</file>
<file>linear.png</file> <file>linear.png</file>
<file>logarithmic.png</file> <file>logarithmic.png</file>
<file>pin_last.png</file> <file>pin_last.png</file>