mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 17:45:48 -05:00
XTRX input: removed useless status indicators and added GPS locked status
This commit is contained in:
parent
7cef8cc2ab
commit
f21dd8d6e5
@ -67,17 +67,28 @@ double DeviceXTRXShared::set_samplerate(double rate,
|
||||
return m_inputRate;
|
||||
}
|
||||
|
||||
double DeviceXTRXShared::get_temperature()
|
||||
double DeviceXTRXShared::get_board_temperature()
|
||||
{
|
||||
uint64_t val = 0;
|
||||
|
||||
int res = xtrx_val_get(m_deviceParams->getDevice(),
|
||||
XTRX_TRX, XTRX_CH_AB, XTRX_BOARD_TEMP, &val);
|
||||
int res = xtrx_val_get(m_deviceParams->getDevice(), XTRX_TRX, XTRX_CH_AB, XTRX_BOARD_TEMP, &val);
|
||||
|
||||
if (res) {
|
||||
//fprintf(stderr, "Unable to set samplerate, error=%d\n", res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -102,18 +102,21 @@ public:
|
||||
|
||||
public:
|
||||
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:
|
||||
float m_temperature;
|
||||
float m_temperature;
|
||||
bool m_gpsLocked;
|
||||
|
||||
MsgReportDeviceInfo(float temperature) :
|
||||
MsgReportDeviceInfo(float temperature, bool gpsLocked) :
|
||||
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 get_temperature();
|
||||
double get_board_temperature();
|
||||
bool get_gps_status();
|
||||
};
|
||||
|
||||
#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */
|
||||
|
BIN
doc/img/gps.xcf
Normal file
BIN
doc/img/gps.xcf
Normal file
Binary file not shown.
@ -537,7 +537,7 @@ bool XTRXInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (m_deviceAPI->getSampleSourceGUIMessageQueue())
|
||||
{
|
||||
uint64_t fifolevel;
|
||||
uint64_t fifolevel = 0;
|
||||
|
||||
xtrx_val_get(m_deviceShared.m_deviceParams->getDevice(),
|
||||
XTRX_RX, XTRX_CH_AB, XTRX_PERF_LLFIFO, &fifolevel);
|
||||
@ -546,30 +546,34 @@ bool XTRXInput::handleMessage(const Message& message)
|
||||
true,
|
||||
true,
|
||||
fifolevel,
|
||||
65536,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
|
||||
65536);
|
||||
|
||||
if (m_deviceAPI->getSampleSourceGUIMessageQueue()) {
|
||||
m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
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)) {
|
||||
qDebug("XTRXInput::handleMessage: MsgGetDeviceInfo: cannot get temperature");
|
||||
if (!m_deviceShared.m_deviceParams->getDevice() || ((board_temp = m_deviceShared.get_board_temperature() / 256.0) == 0.0)) {
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
@ -581,7 +585,7 @@ bool XTRXInput::handleMessage(const Message& message)
|
||||
{
|
||||
if ((*itSource)->getSampleSourceGUIMessageQueue())
|
||||
{
|
||||
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(temp);
|
||||
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(board_temp, gps_locked);
|
||||
(*itSource)->getSampleSourceGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
@ -594,7 +598,7 @@ bool XTRXInput::handleMessage(const Message& message)
|
||||
{
|
||||
if ((*itSink)->getSampleSinkGUIMessageQueue())
|
||||
{
|
||||
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(temp);
|
||||
DeviceXTRXShared::MsgReportDeviceInfo *report = DeviceXTRXShared::MsgReportDeviceInfo::create(board_temp, gps_locked);
|
||||
(*itSink)->getSampleSinkGUIMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
@ -94,37 +94,19 @@ public:
|
||||
bool getActive() const { return m_active; }
|
||||
uint32_t getFifoFilledCount() const { return m_fifoFilledCount; }
|
||||
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(
|
||||
bool success,
|
||||
bool active,
|
||||
uint32_t fifoFilledCount,
|
||||
uint32_t fifoSize,
|
||||
uint32_t underrun,
|
||||
uint32_t overrun,
|
||||
uint32_t droppedPackets,
|
||||
float sampleRate,
|
||||
float linkRate,
|
||||
uint64_t timestamp
|
||||
uint32_t fifoSize
|
||||
)
|
||||
{
|
||||
return new MsgReportStreamInfo(
|
||||
success,
|
||||
active,
|
||||
fifoFilledCount,
|
||||
fifoSize,
|
||||
underrun,
|
||||
overrun,
|
||||
droppedPackets,
|
||||
sampleRate,
|
||||
linkRate,
|
||||
timestamp
|
||||
fifoSize
|
||||
);
|
||||
}
|
||||
|
||||
@ -134,36 +116,18 @@ public:
|
||||
bool m_active; //!< Indicates whether the stream is currently active
|
||||
uint32_t m_fifoFilledCount; //!< Number of samples in 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(
|
||||
bool success,
|
||||
bool active,
|
||||
uint32_t fifoFilledCount,
|
||||
uint32_t fifoSize,
|
||||
uint32_t underrun,
|
||||
uint32_t overrun,
|
||||
uint32_t droppedPackets,
|
||||
float sampleRate,
|
||||
float linkRate,
|
||||
uint64_t timestamp
|
||||
uint32_t fifoSize
|
||||
) :
|
||||
Message(),
|
||||
m_success(success),
|
||||
m_active(active),
|
||||
m_fifoFilledCount(fifoFilledCount),
|
||||
m_fifoSize(fifoSize),
|
||||
m_underrun(underrun),
|
||||
m_overrun(overrun),
|
||||
m_droppedPackets(droppedPackets),
|
||||
m_sampleRate(sampleRate),
|
||||
m_linkRate(linkRate),
|
||||
m_timestamp(timestamp)
|
||||
m_fifoSize(fifoSize)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -183,26 +183,6 @@ bool XTRXInputGUI::handleMessage(const Message& message)
|
||||
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->setValue(report.getFifoFilledCount());
|
||||
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;
|
||||
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;
|
||||
}
|
||||
else if (XTRXInput::MsgStartStop::match(message))
|
||||
|
@ -1041,87 +1041,27 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="underrunLabel">
|
||||
<widget class="QLabel" name="gpsStatusLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>12</width>
|
||||
<height>0</height>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Red if underruns</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:rgb(79,79,79);</string>
|
||||
<string>Green when GPS is locked</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>U</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</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 name="pixmap">
|
||||
<pixmap resource="../../../sdrgui/resources/res.qrc">:/gps.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
BIN
sdrgui/resources/gps.png
Normal file
BIN
sdrgui/resources/gps.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 618 B |
@ -1,5 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>gps.png</file>
|
||||
<file>linear.png</file>
|
||||
<file>logarithmic.png</file>
|
||||
<file>pin_last.png</file>
|
||||
|
Loading…
Reference in New Issue
Block a user