1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-72 Apply flexiPort changes to GUI

This commit is contained in:
Laurent Lalanne 2016-05-22 18:57:23 +02:00
parent afb32d3090
commit 05b927eefc

View File

@ -2,7 +2,7 @@
******************************************************************************
*
* @file configsparky2hwwidget.cpp
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
@ -53,7 +53,7 @@ ConfigSparky2HWWidget::ConfigSparky2HWWidget(QWidget *parent) : ConfigTaskWidget
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
addWidgetBinding("HwSettings", "RM_FlexiPort", m_ui->cbFlexi);
addWidgetBinding("HwSettings", "SPK2_FlexiPort", m_ui->cbFlexi);
addWidgetBinding("HwSettings", "SPK2_MainPort", m_ui->cbMain);
addWidgetBinding("HwSettings", "SPK2_RcvrPort", m_ui->cbRcvr);
addWidgetBinding("HwSettings", "SPK2_I2CPort", m_ui->cbI2C);
@ -122,7 +122,7 @@ void ConfigSparky2HWWidget::updateObjectsFromWidgets()
// If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module.
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_GPS)
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_GPS)) {
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED;
} else {
@ -141,10 +141,10 @@ void ConfigSparky2HWWidget::usbVCPPortChanged(int index)
m_ui->lblUSBVCPSpeed->setVisible(vcpComBridgeEnabled);
m_ui->cbUSBVCPSpeed->setVisible(vcpComBridgeEnabled);
if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DISABLED);
}
enableComboBoxOptionItem(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE, vcpComBridgeEnabled);
enableComboBoxOptionItem(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_COMBRIDGE, vcpComBridgeEnabled);
if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DISABLED);
@ -156,8 +156,8 @@ void ConfigSparky2HWWidget::usbVCPPortChanged(int index)
if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DISABLED);
}
}
@ -193,13 +193,13 @@ void ConfigSparky2HWWidget::flexiPortChanged(int index)
m_ui->lbFlexiGPSProtocol->setVisible(false);
switch (getComboboxSelectedOption(m_ui->cbFlexi)) {
case HwSettings::RM_FLEXIPORT_TELEMETRY:
case HwSettings::SPK2_FLEXIPORT_TELEMETRY:
m_ui->cbFlexiTelemSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_TELEMETRY)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DISABLED);
}
break;
case HwSettings::RM_FLEXIPORT_GPS:
case HwSettings::SPK2_FLEXIPORT_GPS:
// Add Gps protocol configuration
m_ui->cbFlexiGPSProtocol->setVisible(true);
m_ui->lbFlexiGPSProtocol->setVisible(true);
@ -209,13 +209,13 @@ void ConfigSparky2HWWidget::flexiPortChanged(int index)
setComboboxSelectedOption(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DISABLED);
}
break;
case HwSettings::RM_FLEXIPORT_COMBRIDGE:
case HwSettings::SPK2_FLEXIPORT_COMBRIDGE:
m_ui->cbFlexiComSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DISABLED);
}
break;
case HwSettings::RM_FLEXIPORT_DEBUGCONSOLE:
case HwSettings::SPK2_FLEXIPORT_DEBUGCONSOLE:
m_ui->cbFlexiComSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::SPK2_MAINPORT_DISABLED);
@ -246,8 +246,8 @@ void ConfigSparky2HWWidget::mainPortChanged(int index)
switch (getComboboxSelectedOption(m_ui->cbMain)) {
case HwSettings::SPK2_MAINPORT_TELEMETRY:
m_ui->cbMainTelemSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_TELEMETRY)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DISABLED);
}
break;
case HwSettings::SPK2_MAINPORT_GPS:
@ -256,20 +256,20 @@ void ConfigSparky2HWWidget::mainPortChanged(int index)
m_ui->lbMainGPSProtocol->setVisible(true);
m_ui->cbMainGPSSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_GPS)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DISABLED);
}
break;
case HwSettings::SPK2_MAINPORT_COMBRIDGE:
m_ui->cbMainComSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DISABLED);
}
break;
case HwSettings::SPK2_MAINPORT_DEBUGCONSOLE:
m_ui->cbMainComSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::SPK2_FLEXIPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);