From 7be6c16a40aa8892791a80a31c2c747b0996cfa9 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 20 Apr 2014 13:26:06 +0200 Subject: [PATCH] OP-1301 allow GPS protocol selection only if GPS module is enabled. This allow to be able to save HW settings with GPS module disabled. --- .../src/plugins/config/config_cc_hw_widget.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index 7256861ac..534eca823 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -26,7 +26,6 @@ */ #include "config_cc_hw_widget.h" #include "hwsettings.h" - #include #include #include @@ -83,7 +82,16 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) addWidgetBinding("HwSettings", "TelemetrySpeed", m_telemetry->telemetrySpeed); addWidgetBinding("HwSettings", "GPSSpeed", m_telemetry->gpsSpeed); // Add Gps protocol configuration - addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol); + + HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager()); + HwSettings::DataFields hwSettingsData = hwSettings->getData(); + + if(hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_GPS] != HwSettings::OPTIONALMODULES_ENABLED) { + m_telemetry->gpsProtocol->setEnabled(false); + m_telemetry->gpsProtocol->setToolTip(tr("Enable GPS module and reboot the board to be able to select GPS protocol")); + } else { + addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol); + } addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_telemetry->comUsbBridgeSpeed); connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));