From f21dd8d6e5a2880a7ca9c3917d40600a0382a55a Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 29 Dec 2018 11:07:14 +0100 Subject: [PATCH] XTRX input: removed useless status indicators and added GPS locked status --- devices/xtrx/devicextrxshared.cpp | 19 +++- devices/xtrx/devicextrxshared.h | 16 ++-- doc/img/gps.xcf | Bin 0 -> 13667 bytes plugins/samplesource/xtrxinput/xtrxinput.cpp | 34 ++++--- plugins/samplesource/xtrxinput/xtrxinput.h | 44 +-------- .../samplesource/xtrxinput/xtrxinputgui.cpp | 27 ++---- .../samplesource/xtrxinput/xtrxinputgui.ui | 86 +++--------------- sdrgui/resources/gps.png | Bin 0 -> 618 bytes sdrgui/resources/res.qrc | 1 + 9 files changed, 69 insertions(+), 158 deletions(-) create mode 100644 doc/img/gps.xcf create mode 100644 sdrgui/resources/gps.png 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 0000000000000000000000000000000000000000..39fcf0bd38d48466af1c8be1482d0d4dc885227b GIT binary patch literal 13667 zcmeI33v^Z0naB6NH}8bJ2nnye2#^Q4fk46|gyP#in31J3mcnw7@`$m3lt2l~HAW3) zI)&0W>8T+h{i0zHC9;;%M8-_C<&c=R>BZW7XQFiz_;ATH3y-Hmhby z+rpcc-n6o!#zAyt+h-S4OlX+ke&-;KiBq*)`q^__nmk|e-b9yncC1*iuzh)3MPu?_ z2-luVn2<$RFK=H}(Y}1)4U0Q;{Y^`jbSz%g*FjzVZc!ll{Yy0tiC?HY$-sY46pdj{ z+lr3)D;KP3Sh2iKRW!!>rBO8ImXeX+s-KzQfYI2ij(%B`B+ovJ=bXg{oyGIuYFF2( zq*IdDpZ&fO>ldCGU|-*<8=hxO^QS1E{{3^|tu#&F20d;}9v@X+C7;lDj2T{KO!;wR zD)Nn~*>6mgFK`m|nrbLtpq)vSOV!pb#W1`lV+!wbUWE( z*k+Syn@pCSWU}oXaEpF34j#z07yj@fHbth|FTU-A%F~Y0?0%yfGjiv z$VNGU9P|Sigo*&UX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j{D8WO#%1MmZ4|#pfCLZ0=Oa8co)tL-z#Rs!;qtzR&{wFs= zXw6LZ#|_tyAVefmob^87-FQTqty#pC z@$|OekOYN~B0qK2W4?mNS(uFY=sRA-Q64OVqP$oZMR~FuN+u8 zl}b@S6`?3a7NQiJYJ!|G<&Z9DUgv=3NE{Y3<}0HA;#5Aidp#R6XWnD#i?hB@hX$z^rZNBgVJ6} zG0P4?BZ#y5#kjkD;*5SV&g^FbC%l0bjlM>3RQtp%!zA0r=j;=+S`&!Z$>nw8UT$fU zLL6Ktj2&-Cif~*Lm+#l`ts{{q0ja=sB>zM)hU>JK3QF>D9i~&1tl~QIh@vH;IEGNH z{5m;?Q0(41`I~d%ylSE(98@T`=+;LC#pUj1_m8LxqsBYRj=FA)x1?DAZZ_A6vInml z>n_UXyl&<*(U9mg6N7d$A9!4O8dGe%lm9hBwzbpf`8)OJ?{v%;9kKBq zPI5&LRUL%YOb^X?wnwW#J?@dTwMpBWw4JFdbP)she#h})x4q(aZuF*J^N<%f8^b!D zrnQ;xaBbxnYk5iYgi>GcbfW+G^XGIjVpVIN^81{LlKESY2F}D-6RU5(=Xrfyvj~fN zi>_Gx?O(p3Z)p}z&FdvCpIN=}Umn?g;HB42o%tkRZPz literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..9130ac72b14b7e777e3e39cc8486d580121b7bb4 GIT binary patch literal 618 zcmV-w0+s!VP)W`O)l$%3P)Q*)CbibkY6g``L(z-S+!9%n5J*{OwKtbb zwANH>7>H0{<_naBep*iO^yJSnjXH37?sLw)-|xBiyxfR?Dd@r7zXg5@UvrFM%Vq)B z;S82Aj?4I*B&{0-Z$cktF^cBYpTh#~qirJu2k{9n(NVGWVLnM({*<5vL->L#6VH=x%N)=1h?`&oAY`W(TloD8`+jI8L6glY29Ep$kDQLFP71t{|~a7 zJIf>$ps{K(rh^ZYpr=~BPw^TZ*pBB((u-Ya{~q|#zR@HZ%zgK=3!hreqs}b*@g&@y zCt1KG9^>#T`-anzSGoW6uik + gps.png linear.png logarithmic.png pin_last.png