diff --git a/devices/xtrx/devicextrxshared.cpp b/devices/xtrx/devicextrxshared.cpp index 4ae1f7c81..ae733173c 100644 --- a/devices/xtrx/devicextrxshared.cpp +++ b/devices/xtrx/devicextrxshared.cpp @@ -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; +} diff --git a/devices/xtrx/devicextrxshared.h b/devices/xtrx/devicextrxshared.h index b1441e815..0be1b8d71 100644 --- a/devices/xtrx/devicextrxshared.h +++ b/devices/xtrx/devicextrxshared.h @@ -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_ */ diff --git a/doc/img/gps.xcf b/doc/img/gps.xcf new file mode 100644 index 000000000..39fcf0bd3 Binary files /dev/null and b/doc/img/gps.xcf differ diff --git a/plugins/samplesource/xtrxinput/xtrxinput.cpp b/plugins/samplesource/xtrxinput/xtrxinput.cpp index e2922f7d1..c027e4f26 100644 --- a/plugins/samplesource/xtrxinput/xtrxinput.cpp +++ b/plugins/samplesource/xtrxinput/xtrxinput.cpp @@ -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); } } diff --git a/plugins/samplesource/xtrxinput/xtrxinput.h b/plugins/samplesource/xtrxinput/xtrxinput.h index b17562210..9d713ba4c 100644 --- a/plugins/samplesource/xtrxinput/xtrxinput.h +++ b/plugins/samplesource/xtrxinput/xtrxinput.h @@ -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) { } }; diff --git a/plugins/samplesource/xtrxinput/xtrxinputgui.cpp b/plugins/samplesource/xtrxinput/xtrxinputgui.cpp index 5b1b162f1..4a30d7e44 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputgui.cpp +++ b/plugins/samplesource/xtrxinput/xtrxinputgui.cpp @@ -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)) diff --git a/plugins/samplesource/xtrxinput/xtrxinputgui.ui b/plugins/samplesource/xtrxinput/xtrxinputgui.ui index 96c54244f..416d6f7bd 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputgui.ui +++ b/plugins/samplesource/xtrxinput/xtrxinputgui.ui @@ -1041,87 +1041,27 @@ - + - 12 - 0 + 24 + 24 + + + + + 24 + 24 - Red if underruns - - - background:rgb(79,79,79); + Green when GPS is locked - U + - - Qt::AlignCenter - - - - - - - - 12 - 0 - - - - Red if overruns - - - background:rgb(79,79,79); - - - O - - - Qt::AlignCenter - - - - - - - - 12 - 0 - - - - Red if dropped packets - - - background:rgb(79,79,79); - - - D - - - Qt::AlignCenter - - - - - - - - 90 - 0 - - - - Stream link rate (MB/s) - - - 000.000 MB/s - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + :/gps.png diff --git a/sdrgui/resources/gps.png b/sdrgui/resources/gps.png new file mode 100644 index 000000000..9130ac72b Binary files /dev/null and b/sdrgui/resources/gps.png differ diff --git a/sdrgui/resources/res.qrc b/sdrgui/resources/res.qrc index d628419ae..e94749960 100644 --- a/sdrgui/resources/res.qrc +++ b/sdrgui/resources/res.qrc @@ -1,5 +1,6 @@ + gps.png linear.png logarithmic.png pin_last.png