From 0555f7e0ec59de3f066b6fc0d763d594b6397c3b Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 7 Oct 2014 00:44:06 +0200 Subject: [PATCH] OP-1528 Add GUI support for Telemetry and Telemetry+PPM over the Flexi-IO port. --- .../src/plugins/config/configrevohwwidget.cpp | 36 + .../src/plugins/config/configrevohwwidget.h | 1 + .../src/plugins/config/configrevohwwidget.ui | 768 +++++++++--------- 3 files changed, 433 insertions(+), 372 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp index 902716058..ae224bd6c 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp @@ -65,6 +65,8 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbMainGPSSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed); + addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed); + // Add Gps protocol configuration addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol); addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol); @@ -95,6 +97,7 @@ void ConfigRevoHWWidget::setupCustomCombos() connect(m_ui->cbFlexi, SIGNAL(currentIndexChanged(int)), this, SLOT(flexiPortChanged(int))); connect(m_ui->cbMain, SIGNAL(currentIndexChanged(int)), this, SLOT(mainPortChanged(int))); + connect(m_ui->cbRcvr, SIGNAL(currentIndexChanged(int)), this, SLOT(rcvrPortChanged(int))); } void ConfigRevoHWWidget::refreshWidgetsValues(UAVObject *obj) @@ -105,6 +108,7 @@ void ConfigRevoHWWidget::refreshWidgetsValues(UAVObject *obj) usbVCPPortChanged(0); mainPortChanged(0); flexiPortChanged(0); + rcvrPortChanged(0); m_refreshing = false; } @@ -196,6 +200,10 @@ void ConfigRevoHWWidget::flexiPortChanged(int index) if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_TELEMETRY) { m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); } + if (m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_PPMTELEMETRY + || m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_TELEMETRY) { + m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); + } break; case HwSettings::RM_FLEXIPORT_GPS: // Add Gps protocol configuration @@ -247,6 +255,10 @@ void ConfigRevoHWWidget::mainPortChanged(int index) if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); } + if (m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_PPMTELEMETRY + || m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_TELEMETRY) { + m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); + } break; case HwSettings::RM_MAINPORT_GPS: // Add Gps protocol configuration @@ -279,6 +291,30 @@ void ConfigRevoHWWidget::mainPortChanged(int index) } } +void ConfigRevoHWWidget::rcvrPortChanged(int index) +{ + Q_UNUSED(index); + + switch (m_ui->cbRcvr->currentIndex()) { + case HwSettings::RM_RCVRPORT_TELEMETRY: + case HwSettings::RM_RCVRPORT_PPMTELEMETRY: + m_ui->lblRcvrSpeed->setVisible(true); + m_ui->cbRcvrTelemSpeed->setVisible(true); + + if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { + m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); + } + if (m_ui->cbMain->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { + m_ui->cbMain->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); + } + break; + default: + m_ui->lblRcvrSpeed->setVisible(false); + m_ui->cbRcvrTelemSpeed->setVisible(false); + break; + } +} + void ConfigRevoHWWidget::openHelp() { QDesktopServices::openUrl(QUrl(tr("http://wiki.openpilot.org/x/GgDBAQ"), QUrl::StrictMode)); diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.h b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.h index abb079839..436982fef 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.h @@ -57,6 +57,7 @@ private slots: void usbHIDPortChanged(int index); void flexiPortChanged(int index); void mainPortChanged(int index); + void rcvrPortChanged(int index); void openHelp(); }; diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui index 71fe01a23..f199499cb 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui @@ -121,9 +121,9 @@ 0 - 0 - 810 - 665 + -87 + 789 + 847 @@ -139,6 +139,45 @@ 12 + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -192,81 +231,100 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - 0 - 0 - - + + + - USB HID Function + Protocol + + + Qt::PlainText + + + Qt::AlignCenter + + + + + + + + + + + + + Qt::Horizontal + + + + 80 + 10 + + + + + + + + Speed Qt::AlignBottom|Qt::AlignHCenter - - + + - Qt::Horizontal + Qt::Vertical QSizePolicy::Fixed - 50 - 10 + 20 + 20 - - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + Qt::Horizontal @@ -281,17 +339,201 @@ - - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + 0 + + + + + true + + + + + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 90 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 120 + 10 + + + + + + + + + 0 + 0 + + - Protocol + Receiver Port - Qt::AlignCenter + Qt::AlignBottom|Qt::AlignHCenter - + + + + + 0 + 0 + + + + Sonar Port + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + Speed + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 120 + 10 + + + + + + + + + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 70 + 10 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Main Port + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + + + + Flexi Port + + + Qt::AlignBottom|Qt::AlignHCenter + + + + @@ -322,28 +564,12 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - + 0 - + true @@ -358,64 +584,8 @@ - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 70 - 10 - - - - - - - - Flexi Port - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - false - - - - - - - - - - Main Port - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - true - - - - - + + Qt::Horizontal @@ -430,13 +600,80 @@ - - + + + + Protocol + + + Qt::AlignCenter + + - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 50 + 10 + + + - + + + + + + + + + 0 + 0 + + + + Speed + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + + + + Qt::Vertical + + + + 0 + 50 + + + + + + + + + + true + + + + @@ -452,71 +689,10 @@ - - - - - 0 - 0 - - - - Sonar Port - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - - 0 - 0 - - - - Receiver Port - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 25 - - - + + - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 120 - 10 - - - - - @@ -532,177 +708,25 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 120 - - - + + - - + + + + + 0 + 0 + + - Speed + USB HID Function Qt::AlignBottom|Qt::AlignHCenter - - - - 0 - - - - - true - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 120 - 10 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 13 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 13 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 13 - - - - - - - - Qt::Horizontal - - - - 80 - 10 - - - - - - - - Speed - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - Protocol - - - Qt::PlainText - - - Qt::AlignCenter - - - - - - - - - @@ -908,8 +932,8 @@ Beware of not locking yourself out! - +