From d8db3087ca439e1638704c2e7f2c1bbd91061d45 Mon Sep 17 00:00:00 2001 From: edouard Date: Wed, 8 Dec 2010 17:22:55 +0000 Subject: [PATCH] GPS Display gadget: also display SNR above each satellite bar in the display gadget. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2203 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../plugins/gpsdisplay/gpsdisplaywidget.ui | 1389 +++++++++-------- .../src/plugins/gpsdisplay/gpssnrwidget.cpp | 20 + ground/src/plugins/gpsdisplay/gpssnrwidget.h | 1 + 3 files changed, 718 insertions(+), 692 deletions(-) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui index 24ba409a8..28f1a1a3d 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui @@ -1,692 +1,697 @@ - - - GpsDisplayWidget - - - - 0 - 0 - 560 - 376 - - - - - 0 - 0 - - - - - 0 - - - 6 - - - - - - 0 - 0 - - - - Qt::Vertical - - - true - - - - - - - 0 - - - - - 0 - - - - - Coord: - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 6 - - - - - - - - 0 - - - - - Speed: - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Heading: - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 4 - - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 4 - - - - - - - - - - H / V / P DOP: - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - 0 / 0 / 0 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 4 - - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 4 - - - - - - - - 0 - - - - - Sats Used: - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 6 - - - - - - - - 0 - - - - - Fix Type: - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 6 - 0 - - - - - - - - Unknown - - - - - - - - - Qt::Vertical - - - QSizePolicy::Ignored - - - - 20 - 40 - - - - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 9 - 20 - - - - - - - - - - Connect - - - - - - - Disconnect - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 9 - 20 - - - - - - - - Qt::Horizontal - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - - 191 - 95 - - - - - 191 - 95 - - - - false - - - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QGraphicsView::DontAdjustForAntialiasing - - - - - - - - - - 250 - 95 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - 0 - - - - - - 250 - 250 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - Qt::Vertical - - - QSizePolicy::Ignored - - - - 20 - 40 - - - - - - - - - - - GPS Data Stream - - - - 0 - - - - - - 0 - 0 - - - - - 0 - 50 - - - - Qt::ScrollBarAlwaysOn - - - QTextEdit::WidgetWidth - - - false - - - - - - - - - - - - GpsConstellationWidget - QGraphicsView -
gpsconstellationwidget.h
-
- - GpsSnrWidget - QGraphicsView -
gpssnrwidget.h
-
-
- - -
+ + + GpsDisplayWidget + + + + 0 + 0 + 579 + 379 + + + + + 0 + 0 + + + + + 0 + + + 6 + + + + + + 0 + 0 + + + + Qt::Vertical + + + true + + + + + + + 0 + + + + + 0 + + + + + Coord: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 6 + + + + + + + + 0 + + + + + Speed: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Heading: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 4 + + + + + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 4 + + + + + + + + + + H / V / P DOP: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + 0 / 0 / 0 + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 4 + + + + + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 4 + + + + + + + + 0 + + + + + Sats Used: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 6 + + + + + + + + 0 + + + + + Fix Type: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 0 + + + + + + + + Unknown + + + + + + + + + Qt::Vertical + + + QSizePolicy::Ignored + + + + 20 + 40 + + + + + + + + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 9 + 20 + + + + + + + + + + Connect + + + + + + + Disconnect + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 9 + 20 + + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + + 0 + 0 + + + + + 191 + 95 + + + + + 191 + 95 + + + + false + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QGraphicsView::DontAdjustForAntialiasing + + + + + + + + + + 250 + 95 + + + + Displays the SNR for each detected sat. +Satellite number (PRN) is displayed inside the green bar. +Sat SNR is displayed above (in dBHz) + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + 0 + + + + + + 250 + 250 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + Qt::Vertical + + + QSizePolicy::Ignored + + + + 20 + 40 + + + + + + + + + + + GPS Data Stream + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 50 + + + + Qt::ScrollBarAlwaysOn + + + QTextEdit::WidgetWidth + + + false + + + + + + + + + + + + GpsConstellationWidget + QGraphicsView +
gpsconstellationwidget.h
+
+ + GpsSnrWidget + QGraphicsView +
gpssnrwidget.h
+
+
+ + +
diff --git a/ground/src/plugins/gpsdisplay/gpssnrwidget.cpp b/ground/src/plugins/gpsdisplay/gpssnrwidget.cpp index c00ee7bbb..3a6e47cef 100644 --- a/ground/src/plugins/gpsdisplay/gpssnrwidget.cpp +++ b/ground/src/plugins/gpsdisplay/gpssnrwidget.cpp @@ -21,6 +21,11 @@ GpsSnrWidget::GpsSnrWidget(QWidget *parent) : satTexts[i] = new QGraphicsSimpleTextItem("##",boxes[i]); satTexts[i]->setBrush(QColor("Black")); satTexts[i]->setFont(QFont("Courier")); + + satSNRs[i] = new QGraphicsSimpleTextItem("##",boxes[i]); + satSNRs[i]->setBrush(QColor("Black")); + satSNRs[i]->setFont(QFont("Courier")); + } } @@ -108,6 +113,21 @@ void GpsSnrWidget::drawSat(int index) { matrix.scale(scale,scale); matrix.translate(-textRect.width()/2,-textRect.height()); satTexts[index]->setTransform(matrix,false); + + QString snrString = QString().number(snr); + if (snrString.length() ==1) { // Will probably never happen! + snrString = "0" + snrString; + } + satSNRs[index]->setText(snrString); + textRect = satSNRs[index]->boundingRect(); + + matrix.reset(); + scale = 0.85 * (boxRect.width() / textRect.width()); + matrix.translate( boxRect.width()/2,0); + matrix.scale(scale,scale); + matrix.translate(-textRect.width()/2,-textRect.height()); + satSNRs[index]->setTransform(matrix,false); + } else { boxes[index]->hide(); } diff --git a/ground/src/plugins/gpsdisplay/gpssnrwidget.h b/ground/src/plugins/gpsdisplay/gpssnrwidget.h index 590045fdc..969a75abf 100644 --- a/ground/src/plugins/gpsdisplay/gpssnrwidget.h +++ b/ground/src/plugins/gpsdisplay/gpssnrwidget.h @@ -22,6 +22,7 @@ private: QGraphicsScene *scene; QGraphicsRectItem *boxes[MAX_SATTELITES]; QGraphicsSimpleTextItem* satTexts[MAX_SATTELITES]; + QGraphicsSimpleTextItem* satSNRs[MAX_SATTELITES]; void drawSat(int index);