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

Merge branch 'rel-nano-15.05' into corvuscorax/fixedwingautotakeofftest

This commit is contained in:
Corvus Corax 2015-06-05 15:17:35 +02:00
commit 96f58605ec
8 changed files with 434 additions and 345 deletions

View File

@ -42,6 +42,7 @@
#include <gpsvelocitysensor.h> #include <gpsvelocitysensor.h>
#include <homelocation.h> #include <homelocation.h>
#include <auxmagsensor.h> #include <auxmagsensor.h>
#include <auxmagsettings.h>
#include <gyrostate.h> #include <gyrostate.h>
#include <accelstate.h> #include <accelstate.h>
@ -254,7 +255,7 @@ static const filterPipeline *ekf13Queue = &(filterPipeline) {
static void settingsUpdatedCb(UAVObjEvent *objEv); static void settingsUpdatedCb(UAVObjEvent *objEv);
static void sensorUpdatedCb(UAVObjEvent *objEv); static void sensorUpdatedCb(UAVObjEvent *objEv);
static void homeLocationUpdatedCb(UAVObjEvent *objEv); static void criticalConfigUpdatedCb(UAVObjEvent *objEv);
static void StateEstimationCb(void); static void StateEstimationCb(void);
static inline int32_t maxint32_t(int32_t a, int32_t b) static inline int32_t maxint32_t(int32_t a, int32_t b)
@ -289,10 +290,12 @@ int32_t StateEstimationInitialize(void)
AirspeedStateInitialize(); AirspeedStateInitialize();
PositionStateInitialize(); PositionStateInitialize();
VelocityStateInitialize(); VelocityStateInitialize();
AuxMagSettingsInitialize();
RevoSettingsConnectCallback(&settingsUpdatedCb); RevoSettingsConnectCallback(&settingsUpdatedCb);
HomeLocationConnectCallback(&homeLocationUpdatedCb); HomeLocationConnectCallback(&criticalConfigUpdatedCb);
AuxMagSettingsConnectCallback(&criticalConfigUpdatedCb);
GyroSensorConnectCallback(&sensorUpdatedCb); GyroSensorConnectCallback(&sensorUpdatedCb);
AccelSensorConnectCallback(&sensorUpdatedCb); AccelSensorConnectCallback(&sensorUpdatedCb);
@ -538,9 +541,9 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
} }
/** /**
* Callback for eventdispatcher when HomeLocation has been updated * Callback for eventdispatcher when HomeLocation or other critical configs (auxmagsettings, ...) has been updated
*/ */
static void homeLocationUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) static void criticalConfigUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{ {
// Ask for a filter init (necessary for LLA filter) // Ask for a filter init (necessary for LLA filter)
// Only possible if disarmed // Only possible if disarmed

View File

@ -66,6 +66,7 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed);
addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed); addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed);
addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbRcvrComSpeed);
// Add Gps protocol configuration // Add Gps protocol configuration
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol); addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol);
@ -121,7 +122,8 @@ void ConfigRevoHWWidget::updateObjectsFromWidgets()
// If any port is configured to be GPS port, enable GPS module if it is not enabled. // If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module. // Otherwise disable GPS module.
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_GPS || m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_GPS) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED;
} else { } else {
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
@ -134,44 +136,40 @@ void ConfigRevoHWWidget::usbVCPPortChanged(int index)
{ {
Q_UNUSED(index); Q_UNUSED(index);
bool vcpComBridgeEnabled = m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_COMBRIDGE; bool vcpComBridgeEnabled = isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_COMBRIDGE);
m_ui->lblUSBVCPSpeed->setVisible(vcpComBridgeEnabled); m_ui->lblUSBVCPSpeed->setVisible(vcpComBridgeEnabled);
m_ui->cbUSBVCPSpeed->setVisible(vcpComBridgeEnabled); m_ui->cbUSBVCPSpeed->setVisible(vcpComBridgeEnabled);
if (!vcpComBridgeEnabled && m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_COMBRIDGE) { if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
m_ui->cbFlexi->model()->setData(m_ui->cbFlexi->model()->index(HwSettings::RM_FLEXIPORT_COMBRIDGE, 0), enableComboBoxOptionItem(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE, vcpComBridgeEnabled);
!vcpComBridgeEnabled ? QVariant(0) : QVariant(1 | 32), Qt::UserRole - 1);
if (!vcpComBridgeEnabled && m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_COMBRIDGE) { if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
m_ui->cbMain->model()->setData(m_ui->cbMain->model()->index(HwSettings::RM_MAINPORT_COMBRIDGE, 0), enableComboBoxOptionItem(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE, vcpComBridgeEnabled);
!vcpComBridgeEnabled ? QVariant(0) : QVariant(1 | 32), Qt::UserRole - 1);
if (!vcpComBridgeEnabled && m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_COMBRIDGE) { if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
m_ui->cbRcvr->model()->setData(m_ui->cbRcvr->model()->index(HwSettings::RM_RCVRPORT_COMBRIDGE, 0), enableComboBoxOptionItem(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE, vcpComBridgeEnabled);
!vcpComBridgeEnabled ? QVariant(0) : QVariant(1 | 32), Qt::UserRole - 1);
// _DEBUGCONSOLE modes are mutual exclusive // _DEBUGCONSOLE modes are mutual exclusive
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
} }
// _USBTELEMETRY modes are mutual exclusive // _USBTELEMETRY modes are mutual exclusive
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_USBTELEMETRY) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_USBTELEMETRY)
if (m_ui->cbUSBHIDFunction->currentIndex() == HwSettings::USB_HIDPORT_USBTELEMETRY) { && isComboboxOptionSelected(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_USBTELEMETRY)) {
m_ui->cbUSBHIDFunction->setCurrentIndex(HwSettings::USB_HIDPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_DISABLED);
}
} }
} }
@ -180,10 +178,9 @@ void ConfigRevoHWWidget::usbHIDPortChanged(int index)
Q_UNUSED(index); Q_UNUSED(index);
// _USBTELEMETRY modes are mutual exclusive // _USBTELEMETRY modes are mutual exclusive
if (m_ui->cbUSBHIDFunction->currentIndex() == HwSettings::USB_HIDPORT_USBTELEMETRY) { if (isComboboxOptionSelected(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_USBTELEMETRY)
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_USBTELEMETRY) { && isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_USBTELEMETRY)) {
m_ui->cbUSBVCPFunction->setCurrentIndex(HwSettings::USB_VCPPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
}
} }
} }
@ -200,15 +197,15 @@ void ConfigRevoHWWidget::flexiPortChanged(int index)
m_ui->cbFlexiGPSProtocol->setVisible(false); m_ui->cbFlexiGPSProtocol->setVisible(false);
m_ui->lbFlexiGPSProtocol->setVisible(false); m_ui->lbFlexiGPSProtocol->setVisible(false);
switch (m_ui->cbFlexi->currentIndex()) { switch (getComboboxSelectedOption(m_ui->cbFlexi)) {
case HwSettings::RM_FLEXIPORT_TELEMETRY: case HwSettings::RM_FLEXIPORT_TELEMETRY:
m_ui->cbFlexiTelemSpeed->setVisible(true); m_ui->cbFlexiTelemSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_TELEMETRY)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
if (m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_PPMTELEMETRY if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMTELEMETRY)
|| m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_TELEMETRY) { || isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_TELEMETRY)) {
m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_FLEXIPORT_GPS: case HwSettings::RM_FLEXIPORT_GPS:
@ -217,23 +214,26 @@ void ConfigRevoHWWidget::flexiPortChanged(int index)
m_ui->lbFlexiGPSProtocol->setVisible(true); m_ui->lbFlexiGPSProtocol->setVisible(true);
m_ui->cbFlexiGPSSpeed->setVisible(true); m_ui->cbFlexiGPSSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_GPS) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
break; break;
case HwSettings::RM_FLEXIPORT_COMBRIDGE: case HwSettings::RM_FLEXIPORT_COMBRIDGE:
m_ui->cbFlexiComSpeed->setVisible(true); m_ui->cbFlexiComSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_COMBRIDGE) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_FLEXIPORT_DEBUGCONSOLE: case HwSettings::RM_FLEXIPORT_DEBUGCONSOLE:
m_ui->cbFlexiComSpeed->setVisible(true); m_ui->cbFlexiComSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
m_ui->cbUSBVCPFunction->setCurrentIndex(HwSettings::USB_VCPPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
} }
break; break;
default: default:
@ -255,15 +255,15 @@ void ConfigRevoHWWidget::mainPortChanged(int index)
m_ui->cbMainGPSProtocol->setVisible(false); m_ui->cbMainGPSProtocol->setVisible(false);
m_ui->lbMainGPSProtocol->setVisible(false); m_ui->lbMainGPSProtocol->setVisible(false);
switch (m_ui->cbMain->currentIndex()) { switch (getComboboxSelectedOption(m_ui->cbMain)) {
case HwSettings::RM_MAINPORT_TELEMETRY: case HwSettings::RM_MAINPORT_TELEMETRY:
m_ui->cbMainTelemSpeed->setVisible(true); m_ui->cbMainTelemSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
if (m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_PPMTELEMETRY if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMTELEMETRY)
|| m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_TELEMETRY) { || isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_TELEMETRY)) {
m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_MAINPORT_GPS: case HwSettings::RM_MAINPORT_GPS:
@ -272,23 +272,26 @@ void ConfigRevoHWWidget::mainPortChanged(int index)
m_ui->lbMainGPSProtocol->setVisible(true); m_ui->lbMainGPSProtocol->setVisible(true);
m_ui->cbMainGPSSpeed->setVisible(true); m_ui->cbMainGPSSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_GPS) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
break; break;
case HwSettings::RM_MAINPORT_COMBRIDGE: case HwSettings::RM_MAINPORT_COMBRIDGE:
m_ui->cbMainComSpeed->setVisible(true); m_ui->cbMainComSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_COMBRIDGE) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_MAINPORT_DEBUGCONSOLE: case HwSettings::RM_MAINPORT_DEBUGCONSOLE:
m_ui->cbMainComSpeed->setVisible(true); m_ui->cbMainComSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
m_ui->cbUSBVCPFunction->setCurrentIndex(HwSettings::USB_VCPPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
} }
break; break;
default: default:
@ -300,23 +303,33 @@ void ConfigRevoHWWidget::mainPortChanged(int index)
void ConfigRevoHWWidget::rcvrPortChanged(int index) void ConfigRevoHWWidget::rcvrPortChanged(int index)
{ {
Q_UNUSED(index); Q_UNUSED(index);
m_ui->lblRcvrSpeed->setVisible(true);
m_ui->cbRcvrTelemSpeed->setVisible(false);
m_ui->cbRcvrComSpeed->setVisible(false);
switch (m_ui->cbRcvr->currentIndex()) { switch (getComboboxSelectedOption(m_ui->cbRcvr)) {
case HwSettings::RM_RCVRPORT_TELEMETRY: case HwSettings::RM_RCVRPORT_TELEMETRY:
case HwSettings::RM_RCVRPORT_PPMTELEMETRY: case HwSettings::RM_RCVRPORT_PPMTELEMETRY:
m_ui->lblRcvrSpeed->setVisible(true);
m_ui->cbRcvrTelemSpeed->setVisible(true); m_ui->cbRcvrTelemSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
if (m_ui->cbMain->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_FLEXIPORT_DISABLED);
}
break;
case HwSettings::RM_RCVRPORT_COMBRIDGE:
m_ui->cbRcvrComSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
break; break;
default: default:
m_ui->lblRcvrSpeed->setVisible(false); m_ui->lblRcvrSpeed->setVisible(false);
m_ui->cbRcvrTelemSpeed->setVisible(false);
break; break;
} }
} }

View File

@ -121,9 +121,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-87</y> <y>-148</y>
<width>789</width> <width>796</width>
<height>847</height> <height>804</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
@ -232,130 +232,8 @@
</spacer> </spacer>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<item row="22" column="1"> <item row="15" column="3">
<widget class="QLabel" name="lbFlexiGPSProtocol">
<property name="text">
<string>Protocol</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="24" column="3">
<widget class="QComboBox" name="cbMainGPSProtocol"/>
</item>
<item row="24" column="1">
<widget class="QComboBox" name="cbFlexiGPSProtocol"/>
</item>
<item row="25" column="2">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>80</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="20" column="3">
<widget class="QLabel" name="lblMainSpeed">
<property name="text">
<string>Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="14" column="5">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="17" column="5">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="15" column="5">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="25" column="3">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>120</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="5">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="21" column="3">
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@ -375,10 +253,10 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QComboBox" name="cbRcvr"/> <widget class="QComboBox" name="cbRcvr"/>
</item> </item>
<item row="1" column="0"> <item row="0" column="0">
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -394,7 +272,65 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="18" column="0"> <item row="14" column="3" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lblMainSpeed">
<property name="text">
<string>Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="8" column="5">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="5">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="17" column="1">
<widget class="QComboBox" name="cbFlexiGPSProtocol"/>
</item>
<item row="18" column="2">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>80</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="0">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -410,7 +346,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0"> <item row="1" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -426,7 +362,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="5"> <item row="13" column="3">
<widget class="QComboBox" name="cbMain"/>
</item>
<item row="5" column="5" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -442,7 +381,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="20" column="1"> <item row="14" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lblFlexiSpeed"> <widget class="QLabel" name="lblFlexiSpeed">
<property name="text"> <property name="text">
<string>Speed</string> <string>Speed</string>
@ -452,7 +391,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="18" column="5"> <item row="12" column="5">
<spacer name="horizontalSpacer_6"> <spacer name="horizontalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -468,17 +407,81 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="19" column="3"> <item row="13" column="1">
<widget class="QComboBox" name="cbMain"/> <widget class="QComboBox" name="cbFlexi"/>
</item> </item>
<item row="12" column="5"> <item row="6" column="5">
<widget class="QComboBox" name="cbSonar"> <widget class="QComboBox" name="cbSonar">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="25" column="4"> <item row="16" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbFlexiGPSProtocol">
<property name="text">
<string>Protocol</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="17" column="3">
<widget class="QComboBox" name="cbMainGPSProtocol"/>
</item>
<item row="9" column="5">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="18" column="3">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>120</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="5">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="18" column="4">
<spacer name="horizontalSpacer_8"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -494,7 +497,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="16" column="5"> <item row="10" column="5">
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -510,7 +513,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="18" column="3"> <item row="12" column="3" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Main Port</string> <string>Main Port</string>
@ -520,10 +523,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="19" column="1"> <item row="12" column="1" alignment="Qt::AlignHCenter">
<widget class="QComboBox" name="cbFlexi"/>
</item>
<item row="18" column="1">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Flexi Port</string> <string>Flexi Port</string>
@ -533,7 +533,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" rowspan="17" colspan="4" alignment="Qt::AlignHCenter|Qt::AlignVCenter"> <item row="0" column="1" rowspan="12" colspan="4" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -564,7 +564,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="21" column="1"> <item row="15" column="1">
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@ -584,7 +584,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="25" column="1"> <item row="18" column="1">
<spacer name="horizontalSpacer_7"> <spacer name="horizontalSpacer_7">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -600,7 +600,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="22" column="3"> <item row="16" column="3" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbMainGPSProtocol"> <widget class="QLabel" name="lbMainGPSProtocol">
<property name="text"> <property name="text">
<string>Protocol</string> <string>Protocol</string>
@ -610,7 +610,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="18" column="4"> <item row="12" column="4">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -626,11 +626,14 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0"> <item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <property name="spacing">
<number>0</number>
</property>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lblRcvrSpeed"> <widget class="QLabel" name="lblRcvrSpeed">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -649,31 +652,24 @@
<item> <item>
<widget class="QComboBox" name="cbRcvrTelemSpeed"/> <widget class="QComboBox" name="cbRcvrTelemSpeed"/>
</item> </item>
<item>
<widget class="QComboBox" name="cbRcvrComSpeed"/>
</item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer_11">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="15" column="0"> <item row="9" column="0">
<widget class="QComboBox" name="cbUSBVCPSpeed"> <widget class="QComboBox" name="cbUSBVCPSpeed">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="0"> <item row="7" column="0">
<widget class="QComboBox" name="cbUSBVCPFunction"/>
</item>
<item row="8" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lblUSBVCPSpeed"> <widget class="QLabel" name="lblUSBVCPSpeed">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -689,10 +685,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="0"> <item row="5" column="0">
<widget class="QComboBox" name="cbUSBVCPFunction"/> <widget class="QComboBox" name="cbUSBHIDFunction"/>
</item> </item>
<item row="12" column="0"> <item row="6" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -708,10 +704,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0"> <item row="4" column="0" alignment="Qt::AlignHCenter">
<widget class="QComboBox" name="cbUSBHIDFunction"/>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">

View File

@ -68,6 +68,7 @@ ConfigRevoNanoHWWidget::ConfigRevoNanoHWWidget(QWidget *parent) : ConfigTaskWidg
addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed);
addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed); addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed);
addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbRcvrComSpeed);
// Add Gps protocol configuration // Add Gps protocol configuration
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol); addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol);
@ -118,7 +119,8 @@ void ConfigRevoNanoHWWidget::updateObjectsFromWidgets()
// If any port is configured to be GPS port, enable GPS module if it is not enabled. // If any port is configured to be GPS port, enable GPS module if it is not enabled.
// Otherwise disable GPS module. // Otherwise disable GPS module.
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_GPS || m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_GPS) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)
|| isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_ENABLED;
} else { } else {
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED;
@ -131,38 +133,40 @@ void ConfigRevoNanoHWWidget::usbVCPPortChanged(int index)
{ {
Q_UNUSED(index); Q_UNUSED(index);
bool vcpComBridgeEnabled = m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_COMBRIDGE; bool vcpComBridgeEnabled = isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_COMBRIDGE);
m_ui->lblUSBVCPSpeed->setVisible(vcpComBridgeEnabled); m_ui->lblUSBVCPSpeed->setVisible(vcpComBridgeEnabled);
m_ui->cbUSBVCPSpeed->setVisible(vcpComBridgeEnabled); m_ui->cbUSBVCPSpeed->setVisible(vcpComBridgeEnabled);
if (!vcpComBridgeEnabled && m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_COMBRIDGE) { if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
m_ui->cbFlexi->model()->setData(m_ui->cbFlexi->model()->index(HwSettings::RM_FLEXIPORT_COMBRIDGE, 0), enableComboBoxOptionItem(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE, vcpComBridgeEnabled);
!vcpComBridgeEnabled ? QVariant(0) : QVariant(1 | 32), Qt::UserRole - 1);
if (!vcpComBridgeEnabled && m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_COMBRIDGE) { if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
m_ui->cbMain->model()->setData(m_ui->cbMain->model()->index(HwSettings::RM_MAINPORT_COMBRIDGE, 0), enableComboBoxOptionItem(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE, vcpComBridgeEnabled);
!vcpComBridgeEnabled ? QVariant(0) : QVariant(1 | 32), Qt::UserRole - 1);
if (!vcpComBridgeEnabled && isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
}
enableComboBoxOptionItem(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE, vcpComBridgeEnabled);
// _DEBUGCONSOLE modes are mutual exclusive // _DEBUGCONSOLE modes are mutual exclusive
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
} }
// _USBTELEMETRY modes are mutual exclusive // _USBTELEMETRY modes are mutual exclusive
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_USBTELEMETRY) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_USBTELEMETRY)
if (m_ui->cbUSBHIDFunction->currentIndex() == HwSettings::USB_HIDPORT_USBTELEMETRY) { && isComboboxOptionSelected(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_USBTELEMETRY)) {
m_ui->cbUSBHIDFunction->setCurrentIndex(HwSettings::USB_HIDPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_DISABLED);
}
} }
} }
@ -171,10 +175,9 @@ void ConfigRevoNanoHWWidget::usbHIDPortChanged(int index)
Q_UNUSED(index); Q_UNUSED(index);
// _USBTELEMETRY modes are mutual exclusive // _USBTELEMETRY modes are mutual exclusive
if (m_ui->cbUSBHIDFunction->currentIndex() == HwSettings::USB_HIDPORT_USBTELEMETRY) { if (isComboboxOptionSelected(m_ui->cbUSBHIDFunction, HwSettings::USB_HIDPORT_USBTELEMETRY)
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_USBTELEMETRY) { && isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_USBTELEMETRY)) {
m_ui->cbUSBVCPFunction->setCurrentIndex(HwSettings::USB_VCPPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
}
} }
} }
@ -191,15 +194,15 @@ void ConfigRevoNanoHWWidget::flexiPortChanged(int index)
m_ui->cbFlexiGPSProtocol->setVisible(false); m_ui->cbFlexiGPSProtocol->setVisible(false);
m_ui->lbFlexiGPSProtocol->setVisible(false); m_ui->lbFlexiGPSProtocol->setVisible(false);
switch (m_ui->cbFlexi->currentIndex()) { switch (getComboboxSelectedOption(m_ui->cbFlexi)) {
case HwSettings::RM_FLEXIPORT_TELEMETRY: case HwSettings::RM_FLEXIPORT_TELEMETRY:
m_ui->cbFlexiTelemSpeed->setVisible(true); m_ui->cbFlexiTelemSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_TELEMETRY)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
if (m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_PPMTELEMETRY if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMTELEMETRY)
|| m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_TELEMETRY) { || isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_TELEMETRY)) {
m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_FLEXIPORT_GPS: case HwSettings::RM_FLEXIPORT_GPS:
@ -208,23 +211,26 @@ void ConfigRevoNanoHWWidget::flexiPortChanged(int index)
m_ui->lbFlexiGPSProtocol->setVisible(true); m_ui->lbFlexiGPSProtocol->setVisible(true);
m_ui->cbFlexiGPSSpeed->setVisible(true); m_ui->cbFlexiGPSSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_GPS) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_GPS)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
break; break;
case HwSettings::RM_FLEXIPORT_COMBRIDGE: case HwSettings::RM_FLEXIPORT_COMBRIDGE:
m_ui->cbFlexiComSpeed->setVisible(true); m_ui->cbFlexiComSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_COMBRIDGE) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_FLEXIPORT_DEBUGCONSOLE: case HwSettings::RM_FLEXIPORT_DEBUGCONSOLE:
m_ui->cbFlexiComSpeed->setVisible(true); m_ui->cbFlexiComSpeed->setVisible(true);
if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_DEBUGCONSOLE)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
m_ui->cbUSBVCPFunction->setCurrentIndex(HwSettings::USB_VCPPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
} }
break; break;
default: default:
@ -246,15 +252,15 @@ void ConfigRevoNanoHWWidget::mainPortChanged(int index)
m_ui->cbMainGPSProtocol->setVisible(false); m_ui->cbMainGPSProtocol->setVisible(false);
m_ui->lbMainGPSProtocol->setVisible(false); m_ui->lbMainGPSProtocol->setVisible(false);
switch (m_ui->cbMain->currentIndex()) { switch (getComboboxSelectedOption(m_ui->cbMain)) {
case HwSettings::RM_MAINPORT_TELEMETRY: case HwSettings::RM_MAINPORT_TELEMETRY:
m_ui->cbMainTelemSpeed->setVisible(true); m_ui->cbMainTelemSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
if (m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_PPMTELEMETRY if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_PPMTELEMETRY)
|| m_ui->cbRcvr->currentIndex() == HwSettings::RM_RCVRPORT_TELEMETRY) { || isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_TELEMETRY)) {
m_ui->cbRcvr->setCurrentIndex(HwSettings::RM_RCVRPORT_DISABLED); setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_MAINPORT_GPS: case HwSettings::RM_MAINPORT_GPS:
@ -263,23 +269,26 @@ void ConfigRevoNanoHWWidget::mainPortChanged(int index)
m_ui->lbMainGPSProtocol->setVisible(true); m_ui->lbMainGPSProtocol->setVisible(true);
m_ui->cbMainGPSSpeed->setVisible(true); m_ui->cbMainGPSSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_GPS) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_GPS)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
break; break;
case HwSettings::RM_MAINPORT_COMBRIDGE: case HwSettings::RM_MAINPORT_COMBRIDGE:
m_ui->cbMainComSpeed->setVisible(true); m_ui->cbMainComSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_COMBRIDGE) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbRcvr, HwSettings::RM_RCVRPORT_DISABLED);
} }
break; break;
case HwSettings::RM_MAINPORT_DEBUGCONSOLE: case HwSettings::RM_MAINPORT_DEBUGCONSOLE:
m_ui->cbMainComSpeed->setVisible(true); m_ui->cbMainComSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DEBUGCONSOLE)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
if (m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) { if (isComboboxOptionSelected(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DEBUGCONSOLE)) {
m_ui->cbUSBVCPFunction->setCurrentIndex(HwSettings::USB_VCPPORT_DISABLED); setComboboxSelectedOption(m_ui->cbUSBVCPFunction, HwSettings::USB_VCPPORT_DISABLED);
} }
break; break;
default: default:
@ -292,22 +301,33 @@ void ConfigRevoNanoHWWidget::rcvrPortChanged(int index)
{ {
Q_UNUSED(index); Q_UNUSED(index);
switch (m_ui->cbRcvr->currentIndex()) { m_ui->lblRcvrSpeed->setVisible(true);
m_ui->cbRcvrTelemSpeed->setVisible(false);
m_ui->cbRcvrComSpeed->setVisible(false);
switch (getComboboxSelectedOption(m_ui->cbRcvr)) {
case HwSettings::RM_RCVRPORT_TELEMETRY: case HwSettings::RM_RCVRPORT_TELEMETRY:
case HwSettings::RM_RCVRPORT_PPMTELEMETRY: case HwSettings::RM_RCVRPORT_PPMTELEMETRY:
m_ui->lblRcvrSpeed->setVisible(true);
m_ui->cbRcvrTelemSpeed->setVisible(true); m_ui->cbRcvrTelemSpeed->setVisible(true);
if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
} }
if (m_ui->cbMain->currentIndex() == HwSettings::RM_FLEXIPORT_TELEMETRY) { if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_FLEXIPORT_TELEMETRY)) {
m_ui->cbMain->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_FLEXIPORT_DISABLED);
}
break;
case HwSettings::RM_RCVRPORT_COMBRIDGE:
m_ui->cbRcvrComSpeed->setVisible(true);
if (isComboboxOptionSelected(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbFlexi, HwSettings::RM_FLEXIPORT_DISABLED);
}
if (isComboboxOptionSelected(m_ui->cbMain, HwSettings::RM_MAINPORT_COMBRIDGE)) {
setComboboxSelectedOption(m_ui->cbMain, HwSettings::RM_MAINPORT_DISABLED);
} }
break; break;
default: default:
m_ui->lblRcvrSpeed->setVisible(false); m_ui->lblRcvrSpeed->setVisible(false);
m_ui->cbRcvrTelemSpeed->setVisible(false);
break; break;
} }
} }

View File

@ -232,7 +232,7 @@
</spacer> </spacer>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="lblUSBVCPSpeed"> <widget class="QLabel" name="lblUSBVCPSpeed">
<property name="sizePolicy"> <property name="sizePolicy">
@ -302,6 +302,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QComboBox" name="cbUSBVCPSpeed">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="sizePolicy"> <property name="sizePolicy">
@ -334,19 +341,12 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QComboBox" name="cbUSBVCPSpeed">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0" alignment="Qt::AlignTop">
<widget class="QComboBox" name="cbRcvrTelemSpeed"/>
</item>
<item row="9" column="0"> <item row="9" column="0">
<widget class="QComboBox" name="cbRcvr"/> <widget class="QComboBox" name="cbRcvr"/>
</item> </item>
<item row="9" column="2" colspan="2">
<widget class="QComboBox" name="cbMain"/>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="sizePolicy"> <property name="sizePolicy">
@ -373,8 +373,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="2" colspan="2"> <item row="14" column="2" colspan="2">
<widget class="QComboBox" name="cbMain"/> <widget class="QComboBox" name="cbMainGPSProtocol"/>
</item> </item>
<item row="10" column="2" colspan="2"> <item row="10" column="2" colspan="2">
<widget class="QLabel" name="lblMainSpeed"> <widget class="QLabel" name="lblMainSpeed">
@ -406,7 +406,10 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="12" column="2" colspan="2"> <item row="5" column="1" colspan="2">
<widget class="QComboBox" name="cbFlexiGPSProtocol"/>
</item>
<item row="13" column="2" colspan="2">
<widget class="QLabel" name="lbMainGPSProtocol"> <widget class="QLabel" name="lbMainGPSProtocol">
<property name="text"> <property name="text">
<string>Protocol</string> <string>Protocol</string>
@ -416,12 +419,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="2" colspan="2">
<widget class="QComboBox" name="cbMainGPSProtocol"/>
</item>
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="cbFlexiGPSProtocol"/>
</item>
<item row="4" column="1" colspan="2"> <item row="4" column="1" colspan="2">
<widget class="QLabel" name="lbFlexiGPSProtocol"> <widget class="QLabel" name="lbFlexiGPSProtocol">
<property name="text"> <property name="text">
@ -435,6 +432,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="cbFlexi"/>
</item>
<item row="3" column="1" colspan="2"> <item row="3" column="1" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing"> <property name="spacing">
@ -455,6 +455,16 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Flexi Port</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2"> <item row="2" column="1" colspan="2">
<widget class="QLabel" name="lblFlexiSpeed"> <widget class="QLabel" name="lblFlexiSpeed">
<property name="text"> <property name="text">
@ -465,18 +475,34 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="11" column="0">
<widget class="QComboBox" name="cbFlexi"/> <layout class="QVBoxLayout" name="verticalLayout_2">
</item> <property name="spacing">
<item row="0" column="1" colspan="2"> <number>0</number>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Flexi Port</string>
</property> </property>
<property name="alignment"> <property name="topMargin">
<set>Qt::AlignBottom|Qt::AlignHCenter</set> <number>0</number>
</property> </property>
</widget> <item>
<widget class="QComboBox" name="cbRcvrTelemSpeed"/>
</item>
<item alignment="Qt::AlignTop">
<widget class="QComboBox" name="cbRcvrComSpeed"/>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@ -683,8 +709,8 @@ Beware of not locking yourself out!</string>
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="configgadget.qrc"/>
<include location="../coreplugin/core.qrc"/> <include location="../coreplugin/core.qrc"/>
<include location="configgadget.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -209,6 +209,39 @@ ConfigTaskWidget::~ConfigTaskWidget()
} }
} }
bool ConfigTaskWidget::isComboboxOptionSelected(QComboBox *combo, int optionValue)
{
bool ok;
int value = combo->currentData().toInt(&ok);
return ok ? value == optionValue : false;
}
int ConfigTaskWidget::getComboboxSelectedOption(QComboBox *combo)
{
bool ok;
int index = combo->currentData().toInt(&ok);
return ok ? index : -1;
}
void ConfigTaskWidget::setComboboxSelectedOption(QComboBox *combo, int optionValue)
{
int index = combo->findData(QVariant(optionValue));
if (index != -1) {
combo->setCurrentIndex(index);
}
}
int ConfigTaskWidget::getComboboxIndexForOption(QComboBox *combo, int optionValue)
{
return combo->findData(QVariant(optionValue));
}
void ConfigTaskWidget::enableComboBoxOptionItem(QComboBox *combo, int optionValue, bool enable)
{
combo->model()->setData(combo->model()->index(getComboboxIndexForOption(combo, optionValue), 0),
!enable ? QVariant(0) : QVariant(1 | 32), Qt::UserRole - 1);
}
void ConfigTaskWidget::saveObjectToSD(UAVObject *obj) void ConfigTaskWidget::saveObjectToSD(UAVObject *obj)
{ {
// saveObjectToSD is now handled by the UAVUtils plugin in one // saveObjectToSD is now handled by the UAVUtils plugin in one
@ -858,7 +891,7 @@ QVariant ConfigTaskWidget::getVariantFromWidget(QWidget *widget, WidgetBinding *
if (QComboBox * cb = qobject_cast<QComboBox *>(widget)) { if (QComboBox * cb = qobject_cast<QComboBox *>(widget)) {
if (binding->isInteger()) { if (binding->isInteger()) {
return cb->currentIndex(); return QVariant(getComboboxSelectedOption(cb));
} }
return (QString)cb->currentText(); return (QString)cb->currentText();
} else if (QDoubleSpinBox * cb = qobject_cast<QDoubleSpinBox *>(widget)) { } else if (QDoubleSpinBox * cb = qobject_cast<QDoubleSpinBox *>(widget)) {
@ -889,7 +922,7 @@ bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, Wid
if (QComboBox * cb = qobject_cast<QComboBox *>(widget)) { if (QComboBox * cb = qobject_cast<QComboBox *>(widget)) {
bool ok = true; bool ok = true;
if (binding->isInteger()) { if (binding->isInteger()) {
cb->setCurrentIndex(value.toInt(&ok)); setComboboxSelectedOption(cb, value.toInt(&ok));
} else { } else {
cb->setCurrentIndex(cb->findText(value.toString())); cb->setCurrentIndex(cb->findText(value.toString()));
} }
@ -1004,22 +1037,16 @@ void ConfigTaskWidget::loadWidgetLimits(QWidget *widget, UAVObjectField *field,
} }
if (QComboBox * cb = qobject_cast<QComboBox *>(widget)) { if (QComboBox * cb = qobject_cast<QComboBox *>(widget)) {
cb->clear(); cb->clear();
QStringList option = field->getOptions(); QStringList options = field->getOptions();
if (hasLimits) {
// Only add options to combo box if we have a board id to check limits for. for(int optionIndex = 0; optionIndex < options.count(); optionIndex++) {
// We could enter this method while there is no board connected and without if (hasLimits) {
// this check, we would add all the board dependent options whether they were if (m_currentBoardId > -1 && field->isWithinLimits(options.at(optionIndex), index, m_currentBoardId)) {
// valid or not. Ultimately this method will be called again when the connected cb->addItem(options.at(optionIndex), QVariant(optionIndex));
// signal is handled.
if (m_currentBoardId > -1) {
foreach(QString str, option) {
if (field->isWithinLimits(str, index, m_currentBoardId)) {
cb->addItem(str);
}
} }
} else {
cb->addItem(options.at(optionIndex), QVariant(optionIndex));
} }
} else {
cb->addItems(option);
} }
} }
if (!hasLimits) { if (!hasLimits) {

View File

@ -104,6 +104,13 @@ public:
ConfigTaskWidget(QWidget *parent = 0); ConfigTaskWidget(QWidget *parent = 0);
virtual ~ConfigTaskWidget(); virtual ~ConfigTaskWidget();
// Combobox helper functions
static bool isComboboxOptionSelected(QComboBox *combo, int optionValue);
static int getComboboxSelectedOption(QComboBox *combo);
static void setComboboxSelectedOption(QComboBox *combo, int optionValue);
static int getComboboxIndexForOption(QComboBox *combo, int optionValue);
static void enableComboBoxOptionItem(QComboBox *combo, int optionValue, bool enable);
void disableMouseWheelEvents(); void disableMouseWheelEvents();
bool eventFilter(QObject *obj, QEvent *evt); bool eventFilter(QObject *obj, QEvent *evt);

View File

@ -10,7 +10,7 @@
<field name="RM_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Telemetry,PPM+Outputs,Outputs,Telemetry,ComBridge" <field name="RM_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Telemetry,PPM+Outputs,Outputs,Telemetry,ComBridge"
defaultvalue="PWM" defaultvalue="PWM"
limits="%0905NE:PPM+PWM:PPM+Telemetry:Telemetry;"/> limits="%0905NE:PPM+PWM:PPM+Telemetry:Telemetry:ComBridge;"/>
<field name="RM_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM,DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/> <field name="RM_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM,DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/>
<field name="RM_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM,SRXL,DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/> <field name="RM_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM,SRXL,DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/>