diff --git a/ground/openpilotgcs/src/plugins/config/airframe_custom.ui b/ground/openpilotgcs/src/plugins/config/airframe_custom.ui
index 189356db1..b9fe945fd 100644
--- a/ground/openpilotgcs/src/plugins/config/airframe_custom.ui
+++ b/ground/openpilotgcs/src/plugins/config/airframe_custom.ui
@@ -138,6 +138,12 @@
12
+
+ QAbstractItemView::NoEditTriggers
+
+
+ QAbstractItemView::NoSelection
+
50
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp
index 7b2abd7df..93a9e9da6 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp
@@ -1,13 +1,13 @@
/**
******************************************************************************
*
- * @file configmultirotorwidget.cpp
+ * @file configcustomwidget.cpp
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
- * @brief ccpm configuration panel
+ * @brief custom configuration panel
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@@ -45,6 +45,84 @@ QStringList ConfigCustomWidget::getChannelDescriptions()
for (int i = 0; i < (int)VehicleConfig::CHANNEL_NUMELEM; i++) {
channelDesc.append(QString("-"));
}
+ // get the gui config data
+ GUIConfigDataUnion configData = getConfigData();
+ customGUISettingsStruct custom = configData.custom;
+
+ if (custom.Motor1 > 0 && custom.Motor1 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor1 - 1] = QString("Motor1");
+ }
+ if (custom.Motor2 > 0 && custom.Motor2 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor2 - 1] = QString("Motor2");
+ }
+ if (custom.Motor3 > 0 && custom.Motor3 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor3 - 1] = QString("Motor3");
+ }
+ if (custom.Motor4 > 0 && custom.Motor4 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor4 - 1] = QString("Motor4");
+ }
+ if (custom.Motor5 > 0 && custom.Motor5 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor5 - 1] = QString("Motor5");
+ }
+ if (custom.Motor6 > 0 && custom.Motor6 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor6 - 1] = QString("Motor6");
+ }
+ if (custom.Motor7 > 0 && custom.Motor7 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor7 - 1] = QString("Motor7");
+ }
+ if (custom.Motor8 > 0 && custom.Motor8 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Motor8 - 1] = QString("Motor8");
+ }
+
+ if (custom.RevMotor1 > 0 && custom.RevMotor1 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor1 - 1] = QString("RevMotor1");
+ }
+ if (custom.RevMotor2 > 0 && custom.RevMotor2 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor2 - 1] = QString("RevMotor2");
+ }
+ if (custom.RevMotor3 > 0 && custom.RevMotor3 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor3 - 1] = QString("RevMotor3");
+ }
+ if (custom.RevMotor4 > 0 && custom.RevMotor4 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor4 - 1] = QString("RevMotor4");
+ }
+ if (custom.RevMotor5 > 0 && custom.RevMotor5 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor5 - 1] = QString("RevMotor5");
+ }
+ if (custom.RevMotor6 > 0 && custom.RevMotor6 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor6 - 1] = QString("RevMotor6");
+ }
+ if (custom.RevMotor7 > 0 && custom.RevMotor7 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor7 - 1] = QString("RevMotor7");
+ }
+ if (custom.RevMotor8 > 0 && custom.RevMotor8 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.RevMotor8 - 1] = QString("RevMotor8");
+ }
+
+ if (custom.Servo1 > 0 && custom.Servo1 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo1 - 1] = QString("Servo1");
+ }
+ if (custom.Servo2 > 0 && custom.Servo2 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo2 - 1] = QString("Servo2");
+ }
+ if (custom.Servo3 > 0 && custom.Servo3 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo3 - 1] = QString("Servo3");
+ }
+ if (custom.Servo4 > 0 && custom.Servo4 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo4 - 1] = QString("Servo4");
+ }
+ if (custom.Servo5 > 0 && custom.Servo5 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo5 - 1] = QString("Servo5");
+ }
+ if (custom.Servo6 > 0 && custom.Servo6 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo6 - 1] = QString("Servo6");
+ }
+ if (custom.Servo7 > 0 && custom.Servo7 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo7 - 1] = QString("Servo7");
+ }
+ if (custom.Servo8 > 0 && custom.Servo8 <= VehicleConfig::CHANNEL_NUMELEM) {
+ channelDesc[custom.Servo8 - 1] = QString("Servo8");
+ }
return channelDesc;
}
@@ -52,6 +130,7 @@ ConfigCustomWidget::ConfigCustomWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_CustomConfigWidget())
{
m_aircraft->setupUi(this);
+ m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
// Put combo boxes in line one of the custom mixer table:
UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings")));
@@ -93,7 +172,30 @@ void ConfigCustomWidget::registerWidgets(ConfigTaskWidget &parent)
void ConfigCustomWidget::resetActuators(GUIConfigDataUnion *configData)
{
- Q_UNUSED(configData);
+ configData->custom.Motor1 = 0;
+ configData->custom.Motor2 = 0;
+ configData->custom.Motor3 = 0;
+ configData->custom.Motor4 = 0;
+ configData->custom.Motor5 = 0;
+ configData->custom.Motor6 = 0;
+ configData->custom.Motor7 = 0;
+ configData->custom.Motor8 = 0;
+ configData->custom.RevMotor1 = 0;
+ configData->custom.RevMotor2 = 0;
+ configData->custom.RevMotor3 = 0;
+ configData->custom.RevMotor4 = 0;
+ configData->custom.RevMotor5 = 0;
+ configData->custom.RevMotor6 = 0;
+ configData->custom.RevMotor7 = 0;
+ configData->custom.RevMotor8 = 0;
+ configData->custom.Servo1 = 0;
+ configData->custom.Servo2 = 0;
+ configData->custom.Servo3 = 0;
+ configData->custom.Servo4 = 0;
+ configData->custom.Servo5 = 0;
+ configData->custom.Servo6 = 0;
+ configData->custom.Servo7 = 0;
+ configData->custom.Servo8 = 0;
}
/**
@@ -105,9 +207,23 @@ void ConfigCustomWidget::refreshWidgetsValues(QString frameType)
setupUI(frameType);
+ UAVDataObject *system = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings")));
+ Q_ASSERT(system);
+ QPointer field = system->getField(QString("AirframeType"));
+
+ // Do not allow table edit until AirframeType == Custom
+ // First save set AirframeType to 'Custom' and next modify.
+ if (field->getValue().toString() != "Custom") {
+ m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ } else {
+ m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
+ }
+
UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
+ getChannelDescriptions();
+
QList curveValues;
getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues);
@@ -162,60 +278,125 @@ void ConfigCustomWidget::refreshWidgetsValues(QString frameType)
}
}
+
/**
Helper function to
*/
QString ConfigCustomWidget::updateConfigObjectsFromWidgets()
{
- UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings")));
+ UAVDataObject *system = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings")));
- Q_ASSERT(mixer);
+ Q_ASSERT(system);
- setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->customThrottle1Curve->getCurve());
- setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve());
+ QPointer field = system->getField(QString("AirframeType"));
- // Update the table:
- for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
- QComboBox *q = (QComboBox *)m_aircraft->customMixerTable->cellWidget(0, channel);
- if (q->currentText() == "Disabled") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
- } else if (q->currentText() == "Motor") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
- } else if (q->currentText() == "ReversableMotor") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR);
- } else if (q->currentText() == "Servo") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
- } else if (q->currentText() == "CameraRoll") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAROLL);
- } else if (q->currentText() == "CameraPitch") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAPITCH);
- } else if (q->currentText() == "CameraYaw") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAYAW);
- } else if (q->currentText() == "Accessory0") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY0);
- } else if (q->currentText() == "Accessory1") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY1);
- } else if (q->currentText() == "Accessory2") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY2);
- } else if (q->currentText() == "Accessory3") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY3);
- } else if (q->currentText() == "Accessory4") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY4);
- } else if (q->currentText() == "Accessory5") {
- setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY5);
+ // Do not allow changes until AirframeType == Custom
+ // If user want to save custom mixer : first set AirframeType to 'Custom' without changes and next modify.
+ if (field->getValue().toString() == "Custom") {
+ UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings")));
+
+ Q_ASSERT(mixer);
+
+ setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->customThrottle1Curve->getCurve());
+ setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve());
+
+ GUIConfigDataUnion configData = getConfigData();
+ resetActuators(&configData);
+
+ // Update the table:
+ for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
+ QComboBox *q = (QComboBox *)m_aircraft->customMixerTable->cellWidget(0, channel);
+ if (q->currentText() == "Disabled") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
+ } else if (q->currentText() == "Motor") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
+ if (configData.custom.Motor1 == 0) {
+ configData.custom.Motor1 = channel + 1;
+ } else if (configData.custom.Motor2 == 0) {
+ configData.custom.Motor2 = channel + 1;
+ } else if (configData.custom.Motor3 == 0) {
+ configData.custom.Motor3 = channel + 1;
+ } else if (configData.custom.Motor4 == 0) {
+ configData.custom.Motor4 = channel + 1;
+ } else if (configData.custom.Motor5 == 0) {
+ configData.custom.Motor5 = channel + 1;
+ } else if (configData.custom.Motor6 == 0) {
+ configData.custom.Motor6 = channel + 1;
+ } else if (configData.custom.Motor7 == 0) {
+ configData.custom.Motor7 = channel + 1;
+ } else if (configData.custom.Motor8 == 0) {
+ configData.custom.Motor8 = channel + 1;
+ }
+ } else if (q->currentText() == "ReversableMotor") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR);
+ if (configData.custom.RevMotor1 == 0) {
+ configData.custom.RevMotor1 = channel + 1;
+ } else if (configData.custom.RevMotor2 == 0) {
+ configData.custom.RevMotor2 = channel + 1;
+ } else if (configData.custom.RevMotor3 == 0) {
+ configData.custom.RevMotor3 = channel + 1;
+ } else if (configData.custom.RevMotor4 == 0) {
+ configData.custom.RevMotor4 = channel + 1;
+ } else if (configData.custom.RevMotor5 == 0) {
+ configData.custom.RevMotor5 = channel + 1;
+ } else if (configData.custom.RevMotor6 == 0) {
+ configData.custom.RevMotor6 = channel;
+ } else if (configData.custom.RevMotor7 == 0) {
+ configData.custom.RevMotor7 = channel;
+ } else if (configData.custom.RevMotor8 == 0) {
+ configData.custom.RevMotor8 = channel;
+ }
+ } else if (q->currentText() == "Servo") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
+ if (configData.custom.Servo1 == 0) {
+ configData.custom.Servo1 = channel + 1;
+ } else if (configData.custom.Servo2 == 0) {
+ configData.custom.Servo2 = channel + 1;
+ } else if (configData.custom.Servo3 == 0) {
+ configData.custom.Servo3 = channel + 1;
+ } else if (configData.custom.Servo4 == 0) {
+ configData.custom.Servo4 = channel + 1;
+ } else if (configData.custom.Servo5 == 0) {
+ configData.custom.Servo5 = channel + 1;
+ } else if (configData.custom.Servo6 == 0) {
+ configData.custom.Servo6 = channel + 1;
+ } else if (configData.custom.Servo7 == 0) {
+ configData.custom.Servo7 = channel + 1;
+ } else if (configData.custom.Servo8 == 0) {
+ configData.custom.Servo8 = channel + 1;
+ }
+ } else if (q->currentText() == "CameraRoll") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAROLL);
+ } else if (q->currentText() == "CameraPitch") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAPITCH);
+ } else if (q->currentText() == "CameraYaw") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAYAW);
+ } else if (q->currentText() == "Accessory0") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY0);
+ } else if (q->currentText() == "Accessory1") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY1);
+ } else if (q->currentText() == "Accessory2") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY2);
+ } else if (q->currentText() == "Accessory3") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY3);
+ } else if (q->currentText() == "Accessory4") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY4);
+ } else if (q->currentText() == "Accessory5") {
+ setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY5);
+ }
+ setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1,
+ m_aircraft->customMixerTable->item(1, channel)->text().toDouble());
+ setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2,
+ m_aircraft->customMixerTable->item(2, channel)->text().toDouble());
+ setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL,
+ m_aircraft->customMixerTable->item(3, channel)->text().toDouble());
+ setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH,
+ m_aircraft->customMixerTable->item(4, channel)->text().toDouble());
+ setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW,
+ m_aircraft->customMixerTable->item(5, channel)->text().toDouble());
}
- setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1,
- m_aircraft->customMixerTable->item(1, channel)->text().toDouble());
- setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2,
- m_aircraft->customMixerTable->item(2, channel)->text().toDouble());
- setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL,
- m_aircraft->customMixerTable->item(3, channel)->text().toDouble());
- setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH,
- m_aircraft->customMixerTable->item(4, channel)->text().toDouble());
- setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW,
- m_aircraft->customMixerTable->item(5, channel)->text().toDouble());
+ setConfigData(configData);
}
-
return "Custom";
}
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.h
index fbef8939e..88392c4e0 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.h
@@ -1,13 +1,13 @@
/**
******************************************************************************
*
- * @file configairframetwidget.h
+ * @file configcustomwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
- * @brief Airframe configuration panel
+ * @brief custom configuration panel
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp
index 1a667fa5e..ff9c3e8c3 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp
@@ -1,13 +1,13 @@
/**
******************************************************************************
*
- * @file configfixedwidget.cpp
+ * @file configfixedwingwidget.cpp
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
- * @brief ccpm configuration panel
+ * @brief fixed wing configuration panel
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h
index f0b786379..c96c534a0 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h
@@ -1,13 +1,13 @@
/**
******************************************************************************
*
- * @file configairframetwidget.h
+ * @file configfixedwingwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
- * @brief Airframe configuration panel
+ * @brief fixed wing configuration panel
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp
index 4270fc347..72fc61b33 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp
@@ -7,7 +7,7 @@
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
- * @brief ccpm configuration panel
+ * @brief ground vehicle configuration panel
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h
index 72d7d0fff..2b9fb9249 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h
@@ -1,13 +1,13 @@
/**
******************************************************************************
*
- * @file configairframetwidget.h
+ * @file configgroundvehiclewidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
- * @brief Airframe configuration panel
+ * @brief ground vehicle configuration panel
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h
index fa85ec133..26e4963bd 100644
--- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h
+++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h
@@ -50,11 +50,10 @@ typedef struct {
uint VTOLMotorSSW : 4;
uint VTOLMotorWSW : 4;
uint VTOLMotorWNW : 4;
- uint VTOLMotorNNW : 4; // 32 bits
+ uint VTOLMotorNNW : 4; // 64 bits
uint TRIYaw : 4;
- quint32 padding : 28; // 64 bits
- quint32 padding1;
- quint32 padding2; // 128 bits
+ quint32 padding : 28; // 96 bits
+ quint32 padding1; // 128 bits
} __attribute__((packed)) multiGUISettingsStruct;
typedef struct {
@@ -102,12 +101,42 @@ typedef struct {
quint32 padding3; // 128 bits
} __attribute__((packed)) groundGUISettingsStruct;
+typedef struct {
+ uint Motor1 : 4;
+ uint Motor2 : 4;
+ uint Motor3 : 4;
+ uint Motor4 : 4;
+ uint Motor5 : 4;
+ uint Motor6 : 4;
+ uint Motor7 : 4;
+ uint Motor8 : 4; // 32 bits
+ uint Servo1 : 4;
+ uint Servo2 : 4;
+ uint Servo3 : 4;
+ uint Servo4 : 4;
+ uint Servo5 : 4;
+ uint Servo6 : 4;
+ uint Servo7 : 4;
+ uint Servo8 : 4; // 64 bits
+ uint RevMotor1 : 4;
+ uint RevMotor2 : 4;
+ uint RevMotor3 : 4;
+ uint RevMotor4 : 4;
+ uint RevMotor5 : 4;
+ uint RevMotor6 : 4;
+ uint RevMotor7 : 4;
+ uint RevMotor8 : 4; // 96 bits
+ quint32 padding; // 128 bits
+} __attribute__((packed)) customGUISettingsStruct;
+
+
typedef union {
- uint UAVObject[4]; // 32 bits * 4
+ uint UAVObject[5]; // 32 bits * 5
heliGUISettingsStruct heli; // 128 bits
fixedGUISettingsStruct fixedwing;
multiGUISettingsStruct multi;
groundGUISettingsStruct ground;
+ customGUISettingsStruct custom;
} GUIConfigDataUnion;
class ConfigTaskWidget;
diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp
index b5675cbec..6bb6f6b98 100644
--- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp
@@ -198,12 +198,27 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *o)
// is not ideal, but there you go.
QString frameType = field->getValue().toString();
- int category = frameCategory(frameType);
+ // Always update custom tab from others airframe settings : debug/learn hardcoded mixers
+ int category = frameCategory("Custom");
m_aircraft->aircraftType->setCurrentIndex(category);
VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);
+
if (vehicleConfig) {
- vehicleConfig->refreshWidgetsValues(frameType);
+ vehicleConfig->refreshWidgetsValues("Custom");
+ }
+
+ // Switch to Airframe currently used
+ category = frameCategory(frameType);
+
+ if (frameType != "Custom") {
+ m_aircraft->aircraftType->setCurrentIndex(category);
+
+ VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);
+
+ if (vehicleConfig) {
+ vehicleConfig->refreshWidgetsValues(frameType);
+ }
}
updateFeedForwardUI();
@@ -252,7 +267,8 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value());
vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->value());
- // TODO call refreshWidgetsValues() to reflect actual saved values ?
+ // call refreshWidgetsValues() to reflect actual saved values
+ refreshWidgetsValues();
updateFeedForwardUI();
}