diff --git a/ground/gcs/src/plugins/config/airframe_fixedwing.ui b/ground/gcs/src/plugins/config/airframe_fixedwing.ui index 7e5ede296..c6901b9b3 100644 --- a/ground/gcs/src/plugins/config/airframe_fixedwing.ui +++ b/ground/gcs/src/plugins/config/airframe_fixedwing.ui @@ -6,8 +6,8 @@ 0 0 - 880 - 608 + 920 + 690 @@ -66,8 +66,8 @@ - 10 - 10 + 250 + 250 @@ -130,8 +130,8 @@ - 10 - 10 + 250 + 250 @@ -514,7 +514,7 @@ margin:1px; Output Channel Assignments - + 9 @@ -538,42 +538,6 @@ margin:1px; 6 - - - - - 70 - 0 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px; - - - Elevator 2 - - - - - - - true - - - - 0 - 0 - - - - Assign your output channel - - - @@ -755,8 +719,458 @@ margin:1px; + + + + + 70 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Elevator 2 + + + + + + + true + + + + 0 + 0 + + + + Assign your output channel + + + + + + + QLayout::SetMaximumSize + + + 0 + + + + + Select output curve for Accessory1 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory0 RcInput + + + + + + + + 0 + 0 + + + + + 90 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Accessory0 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 90 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + RC Input + + + Qt::AlignCenter + + + + + + + + 90 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Accessory1 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + RcOutput channels + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + RC Output 1 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory2 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory1 RcInput + + + + + + + + 90 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Accessory2 + + + Qt::AlignCenter + + + + + + + + 90 + 0 + + + + RcOutput curve + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Curve + + + Qt::AlignCenter + + + + + + + Select output curve for Accessory0 RcInput + + + + + + + Select output curve for Accessory3 RcInput + + + + + + + Select output curve for Accessory2 RcInput + + + + + + + + 90 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Accessory3 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory3 RcInput + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + RcOutput channels + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + RC Output 2 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory0 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory1 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory2 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory3 RcInput + + + + + + + + + Qt::Vertical + + + diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 65f5084f7..0edbc616c 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -51,7 +51,8 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions() } // get the gui config data - GUIConfigDataUnion configData = getConfigData(); + GUIConfigDataUnion configData = getConfigData(); + fixedGUISettingsStruct fixedwing = configData.fixedwing; if (configData.fixedwing.FixedWingPitch1 > 0) { channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1"); @@ -74,6 +75,33 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions() if (configData.fixedwing.FixedWingThrottle > 0) { channelDesc[configData.fixedwing.FixedWingThrottle - 1] = QString("FixedWingThrottle"); } + + if (fixedwing.Accessory0 > 0 && fixedwing.Accessory0 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory0 - 1] = QString("Accessory0-1"); + } + if (fixedwing.Accessory1 > 0 && fixedwing.Accessory1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory1 - 1] = QString("Accessory1-1"); + } + if (fixedwing.Accessory2 > 0 && fixedwing.Accessory2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory2 - 1] = QString("Accessory2-1"); + } + if (fixedwing.Accessory3 > 0 && fixedwing.Accessory3 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory3 - 1] = QString("Accessory3-1"); + } + + if (fixedwing.Accessory0_2 > 0 && fixedwing.Accessory0_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory0_2 - 1] = QString("Accessory0-2"); + } + if (fixedwing.Accessory1_2 > 0 && fixedwing.Accessory1_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory1_2 - 1] = QString("Accessory1-2"); + } + if (fixedwing.Accessory2_2 > 0 && fixedwing.Accessory2_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory2_2 - 1] = QString("Accessory2-2"); + } + if (fixedwing.Accessory3_2 > 0 && fixedwing.Accessory3_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory3_2 - 1] = QString("Accessory3-2"); + } + return channelDesc; } @@ -84,6 +112,13 @@ ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) : populateChannelComboBoxes(); + QStringList mixerCurveList; + mixerCurveList << "Curve1" << "Curve2"; + m_aircraft->rcOutputCurveBoxFw1->addItems(mixerCurveList); + m_aircraft->rcOutputCurveBoxFw2->addItems(mixerCurveList); + m_aircraft->rcOutputCurveBoxFw3->addItems(mixerCurveList); + m_aircraft->rcOutputCurveBoxFw4->addItems(mixerCurveList); + QStringList fixedWingTypes; fixedWingTypes << "Aileron" << "Elevon" << "Vtail"; m_aircraft->fixedWingType->addItems(fixedWingTypes); @@ -238,6 +273,18 @@ void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent) parent.addWidget(m_aircraft->elevonSlider1); parent.addWidget(m_aircraft->elevonSlider2); parent.addWidget(m_aircraft->elevonSlider3); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw1); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw3); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw4); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw1_2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw2_2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw3_2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw4_2); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw1); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw2); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw3); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw4); } void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData) @@ -251,6 +298,44 @@ void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData) configData->fixedwing.FixedWingThrottle = 0; } +void ConfigFixedWingWidget::resetRcOutputs(GUIConfigDataUnion *configData) +{ + configData->fixedwing.Accessory0 = 0; + configData->fixedwing.Accessory1 = 0; + configData->fixedwing.Accessory2 = 0; + configData->fixedwing.Accessory3 = 0; + configData->fixedwing.Accessory0_2 = 0; + configData->fixedwing.Accessory1_2 = 0; + configData->fixedwing.Accessory2_2 = 0; + configData->fixedwing.Accessory3_2 = 0; +} + + +void ConfigFixedWingWidget::updateRcCurvesUsed() +{ + UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); + + Q_ASSERT(mixer); + + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw1, VehicleConfig::MIXER_THROTTLECURVE1); + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw2, VehicleConfig::MIXER_THROTTLECURVE1); + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw3, VehicleConfig::MIXER_THROTTLECURVE1); + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw4, VehicleConfig::MIXER_THROTTLECURVE1); + + for (int channel = 0; channel < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; channel++) { + QString mixerType = getMixerType(mixer, channel); + if (mixerType == "Accessory0" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw1, VehicleConfig::MIXER_THROTTLECURVE2); + } else if (mixerType == "Accessory1" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw2, VehicleConfig::MIXER_THROTTLECURVE2); + } else if (mixerType == "Accessory2" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw3, VehicleConfig::MIXER_THROTTLECURVE2); + } else if (mixerType == "Accessory3" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw4, VehicleConfig::MIXER_THROTTLECURVE2); + } + } +} + /** Virtual function to refresh the UI widget values */ @@ -287,6 +372,18 @@ void ConfigFixedWingWidget::refreshWidgetsValues(QString frameType) setComboCurrentIndex(m_aircraft->fwRudder1ChannelBox, fixed.FixedWingYaw1); setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw1, fixed.Accessory0); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw2, fixed.Accessory1); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw3, fixed.Accessory2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw4, fixed.Accessory3); + + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw1_2, fixed.Accessory0_2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw2_2, fixed.Accessory1_2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw3_2, fixed.Accessory2_2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw4_2, fixed.Accessory3_2); + + updateRcCurvesUsed(); + // Get mixing values for GUI sliders (values stored onboard) m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential")); if (frameType == "FixedWingElevon" || frameType == "Elevon") { @@ -310,6 +407,13 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets() Q_ASSERT(mixer); + // Reset all Mixers type + resetAllMixersType(mixer); + + QList rcOutputList; + rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3"; + setupRcOutputs(rcOutputList); + // Set the throttle curve setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve()); @@ -580,6 +684,118 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType) return true; } +/** + Helper function: setup rc outputs. Takes a list of channel names in input. + */ +void ConfigFixedWingWidget::setupRcOutputs(QList rcOutputList) +{ + QList rcList; + rcList << m_aircraft->rcOutputChannelBoxFw1 << m_aircraft->rcOutputChannelBoxFw2 + << m_aircraft->rcOutputChannelBoxFw3 << m_aircraft->rcOutputChannelBoxFw4; + + QList rcList2; + rcList2 << m_aircraft->rcOutputChannelBoxFw1_2 << m_aircraft->rcOutputChannelBoxFw2_2 + << m_aircraft->rcOutputChannelBoxFw3_2 << m_aircraft->rcOutputChannelBoxFw4_2; + + GUIConfigDataUnion configData = getConfigData(); + resetRcOutputs(&configData); + + UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject("MixerSettings")); + Q_ASSERT(mixer); + + int curveAccessory0 = m_aircraft->rcOutputCurveBoxFw1->currentIndex(); + int curveAccessory1 = m_aircraft->rcOutputCurveBoxFw2->currentIndex(); + int curveAccessory2 = m_aircraft->rcOutputCurveBoxFw3->currentIndex(); + int curveAccessory3 = m_aircraft->rcOutputCurveBoxFw4->currentIndex(); + + foreach(QString rc_output, rcOutputList) { + int index = rcList.takeFirst()->currentIndex(); + int index2 = rcList2.takeFirst()->currentIndex(); + + if (rc_output == "Accessory0") { + // First output for Accessory0 + configData.fixedwing.Accessory0 = index; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY0); + if (curveAccessory0) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + // Second output for Accessory0 + configData.fixedwing.Accessory0_2 = index2; + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY0); + if (curveAccessory0) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } else if (rc_output == "Accessory1") { + configData.fixedwing.Accessory1 = index; + configData.fixedwing.Accessory1_2 = index2; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY1); + if (curveAccessory1) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY1); + if (curveAccessory1) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } else if (rc_output == "Accessory2") { + configData.fixedwing.Accessory2 = index; + configData.fixedwing.Accessory2_2 = index2; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY2); + if (curveAccessory2) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY2); + if (curveAccessory2) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } else if (rc_output == "Accessory3") { + configData.fixedwing.Accessory3 = index; + configData.fixedwing.Accessory3_2 = index2; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY3); + if (curveAccessory3) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY3); + if (curveAccessory3) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } + } + setConfigData(configData); +} + + void ConfigFixedWingWidget::enableControls(bool enable) { ConfigTaskWidget::enableControls(enable); @@ -648,6 +864,44 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType) channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText(); } } + + // Iterate through all instances of rcOutputChannelBoxFw + for (int i = 0; i < 5; i++) { + // Find widgets with his name "rcOutputChannelBoxFw.x", where x is an integer + QComboBox *combobox = this->findChild("rcOutputChannelBoxFw" + QString::number(i + 1)); + if (combobox) { + if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) { + int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize); + QPixmap pixmap(size, size); + pixmap.fill(QColor("orange")); + combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes + combobox->setToolTip(tr("Channel already used")); + } else { + for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) { + combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes + combobox->setToolTip(tr("Select first output channel for Accessory%1 RcInput").arg(i)); + } + } + channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText(); + } + // Find duplicates in second output comboboxes + QComboBox *combobox2 = this->findChild("rcOutputChannelBoxFw" + QString::number(i + 1) + "_2"); + if (combobox2) { + if (channelNames.contains(combobox2->currentText(), Qt::CaseInsensitive)) { + int size = combobox2->style()->pixelMetric(QStyle::PM_SmallIconSize); + QPixmap pixmap(size, size); + pixmap.fill(QColor("orange")); + combobox2->setItemData(combobox2->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes + combobox2->setToolTip(tr("Channel already used")); + } else { + for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) { + combobox2->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes + combobox2->setToolTip(tr("Select second output channel for Accessory%1 RcInput").arg(i)); + } + } + channelNames += (combobox2->currentText() == "None") ? "" : combobox2->currentText(); + } + } return error; } diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index 5e25d99d3..e61add426 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -58,10 +58,13 @@ private: virtual void registerWidgets(ConfigTaskWidget &parent); virtual void resetActuators(GUIConfigDataUnion *configData); + virtual void resetRcOutputs(GUIConfigDataUnion *configData); bool setupFrameFixedWing(QString airframeType); bool setupFrameElevon(QString airframeType); bool setupFrameVtail(QString airframeType); + void setupRcOutputs(QList rcOutputList); + void updateRcCurvesUsed(); protected: void enableControls(bool enable); diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 78a2b6b9d..e90f838e9 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -373,18 +373,6 @@ void ConfigMultiRotorWidget::resetRcOutputs(GUIConfigDataUnion *configData) configData->multi.Accessory3 = 0; } -void ConfigMultiRotorWidget::resetMixers() -{ - UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); - - Q_ASSERT(mixer); - - for (int channel = 0; channel < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; channel++) { - resetMixerVector(mixer, channel); - setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED); - } -} - void ConfigMultiRotorWidget::updateRcCurvesUsed() { UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); @@ -545,8 +533,8 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets() Q_ASSERT(mixer); - // Reset all Mixers - resetMixers(); + // Reset all Mixers types + resetAllMixersType(mixer); QList rcOutputList; rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3"; diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h index 488fd5cce..df44c73f6 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h @@ -73,7 +73,6 @@ private: bool setupMultiRotorMixer(double mixerFactors[8][3]); void setupMotors(QList motorList); void setupRcOutputs(QList rcOutputList); - void resetMixers(); void setupQuadMotor(int channel, double roll, double pitch, double yaw); void setYawMixLevel(int); diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp index 621f539eb..bbea43bb9 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp @@ -232,6 +232,15 @@ void VehicleConfig::resetMotorAndServoMixers(UAVDataObject *mixer) } } +// Disable all mixers types +void VehicleConfig::resetAllMixersType(UAVDataObject *mixer) +{ + for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) { + resetMixerVector(mixer, channel); + setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED); + } +} + double VehicleConfig::getMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName) { Q_ASSERT(mixer); diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h index f4a9765ac..88d6f15a4 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h @@ -89,10 +89,17 @@ typedef struct { uint FixedWingPitch2 : 4; uint FixedWingYaw1 : 4; uint FixedWingYaw2 : 4; - uint padding : 4; // 32 bits + uint Accessory0 : 4; // 32 bits + uint Accessory1 : 4; + uint Accessory2 : 4; + uint Accessory3 : 4; + uint Accessory0_2 : 4; + uint Accessory1_2 : 4; + uint Accessory2_2 : 4; + uint Accessory3_2 : 4; + quint32 padding : 4; // 64bits quint32 padding1; - quint32 padding2; - quint32 padding3; // 128 bits + quint32 padding2; // 128 bits } __attribute__((packed)) fixedGUISettingsStruct; typedef struct { @@ -228,6 +235,7 @@ protected: void setMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName, double value); void resetMixerVector(UAVDataObject *mixer, int channel); void resetMotorAndServoMixers(UAVDataObject *mixer); + void resetAllMixersType(UAVDataObject *mixer); QString getMixerType(UAVDataObject *mixer, int channel); void setMixerType(UAVDataObject *mixer, int channel, MixerTypeElem mixerType); void setThrottleCurve(UAVDataObject *mixer, MixerThrottleCurveElem curveType, QList curve); diff --git a/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg b/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg index 1d36aa374..d9c88d775 100644 --- a/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg +++ b/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg @@ -487,13 +487,13 @@ inkscape:window-height="928" id="namedview4099" showgrid="false" - inkscape:zoom="1.0458791" - inkscape:cx="384.95499" - inkscape:cy="955.071" + inkscape:zoom="2.0917582" + inkscape:cx="391.2913" + inkscape:cy="1188.8255" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:current-layer="elevon" + inkscape:current-layer="aileron-frame" showborder="true" inkscape:showpageshadow="false" inkscape:object-paths="true" @@ -767,32 +767,7 @@ id="path4400-5-6" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:125%;font-family:Prototype;-inkscape-font-specification:Prototype;letter-spacing:0px;word-spacing:0px;fill:#ff6000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 961.2594,723.76703 q 0,-0.8 0.9106,-0.8 l 7.4667,0 q 0.9106,0 0.9106,-0.8 l 0,-8.15999 q 0,-0.8 -0.9106,-0.8 l -7.4667,0 q -0.9106,0 -0.9106,-0.8 l 0,-10 q 0,-0.8 -0.9106,-0.8 l -9.2879,0 q -0.9106,0 -0.9106,0.8 l 0,10 q 0,0.8 -0.9105,0.8 l -4.8261,0 q -0.9106,0 -0.9106,0.8 l 0,8.15999 q 0,0.8 0.9106,0.8 l 4.8261,0 q 0.9105,0 0.9105,0.8 l 0,24.96001 q 0,2.48 2.2765,4.32 q 2.2764,1.84 5.7366,1.84 l 11.4733,0 q 0.9106,0 0.9106,-0.8 l 0,-8.16 q 0,-0.72 -0.7285,-0.8 l -7.6488,0 q -0.9106,0 -0.9106,-0.8 l 0,-20.56001 z" - inkscape:connector-curvature="0" />