mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +01:00
Merge remote-tracking branch 'origin/laurent/OP-1134_Populate_new_custom_tab' into next
This commit is contained in:
commit
f5fa57c7da
@ -138,6 +138,12 @@
|
|||||||
<property name="columnCount">
|
<property name="columnCount">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
</property>
|
||||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||||
<number>50</number>
|
<number>50</number>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file configmultirotorwidget.cpp
|
* @file configcustomwidget.cpp
|
||||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @addtogroup ConfigPlugin Config Plugin
|
||||||
* @{
|
* @{
|
||||||
* @brief ccpm configuration panel
|
* @brief custom configuration panel
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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++) {
|
for (int i = 0; i < (int)VehicleConfig::CHANNEL_NUMELEM; i++) {
|
||||||
channelDesc.append(QString("-"));
|
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;
|
return channelDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +130,7 @@ ConfigCustomWidget::ConfigCustomWidget(QWidget *parent) :
|
|||||||
VehicleConfig(parent), m_aircraft(new Ui_CustomConfigWidget())
|
VehicleConfig(parent), m_aircraft(new Ui_CustomConfigWidget())
|
||||||
{
|
{
|
||||||
m_aircraft->setupUi(this);
|
m_aircraft->setupUi(this);
|
||||||
|
m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
|
||||||
// Put combo boxes in line one of the custom mixer table:
|
// Put combo boxes in line one of the custom mixer table:
|
||||||
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
@ -93,7 +172,30 @@ void ConfigCustomWidget::registerWidgets(ConfigTaskWidget &parent)
|
|||||||
|
|
||||||
void ConfigCustomWidget::resetActuators(GUIConfigDataUnion *configData)
|
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);
|
setupUI(frameType);
|
||||||
|
|
||||||
|
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
|
||||||
|
Q_ASSERT(system);
|
||||||
|
QPointer<UAVObjectField> 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<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
Q_ASSERT(mixer);
|
Q_ASSERT(mixer);
|
||||||
|
|
||||||
|
getChannelDescriptions();
|
||||||
|
|
||||||
QList<double> curveValues;
|
QList<double> curveValues;
|
||||||
getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues);
|
getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues);
|
||||||
|
|
||||||
@ -162,60 +278,125 @@ void ConfigCustomWidget::refreshWidgetsValues(QString frameType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Helper function to
|
Helper function to
|
||||||
*/
|
*/
|
||||||
QString ConfigCustomWidget::updateConfigObjectsFromWidgets()
|
QString ConfigCustomWidget::updateConfigObjectsFromWidgets()
|
||||||
{
|
{
|
||||||
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
|
||||||
|
|
||||||
Q_ASSERT(mixer);
|
Q_ASSERT(system);
|
||||||
|
|
||||||
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->customThrottle1Curve->getCurve());
|
QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
|
||||||
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve());
|
|
||||||
|
|
||||||
// Update the table:
|
// Do not allow changes until AirframeType == Custom
|
||||||
for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
// If user want to save custom mixer : first set AirframeType to 'Custom' without changes and next modify.
|
||||||
QComboBox *q = (QComboBox *)m_aircraft->customMixerTable->cellWidget(0, channel);
|
if (field->getValue().toString() == "Custom") {
|
||||||
if (q->currentText() == "Disabled") {
|
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
|
|
||||||
} else if (q->currentText() == "Motor") {
|
Q_ASSERT(mixer);
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
|
|
||||||
} else if (q->currentText() == "ReversableMotor") {
|
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->customThrottle1Curve->getCurve());
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR);
|
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve());
|
||||||
} else if (q->currentText() == "Servo") {
|
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
|
GUIConfigDataUnion configData = getConfigData();
|
||||||
} else if (q->currentText() == "CameraRoll") {
|
resetActuators(&configData);
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAROLL);
|
|
||||||
} else if (q->currentText() == "CameraPitch") {
|
// Update the table:
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAPITCH);
|
for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
|
||||||
} else if (q->currentText() == "CameraYaw") {
|
QComboBox *q = (QComboBox *)m_aircraft->customMixerTable->cellWidget(0, channel);
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAYAW);
|
if (q->currentText() == "Disabled") {
|
||||||
} else if (q->currentText() == "Accessory0") {
|
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY0);
|
} else if (q->currentText() == "Motor") {
|
||||||
} else if (q->currentText() == "Accessory1") {
|
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY1);
|
if (configData.custom.Motor1 == 0) {
|
||||||
} else if (q->currentText() == "Accessory2") {
|
configData.custom.Motor1 = channel + 1;
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY2);
|
} else if (configData.custom.Motor2 == 0) {
|
||||||
} else if (q->currentText() == "Accessory3") {
|
configData.custom.Motor2 = channel + 1;
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY3);
|
} else if (configData.custom.Motor3 == 0) {
|
||||||
} else if (q->currentText() == "Accessory4") {
|
configData.custom.Motor3 = channel + 1;
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY4);
|
} else if (configData.custom.Motor4 == 0) {
|
||||||
} else if (q->currentText() == "Accessory5") {
|
configData.custom.Motor4 = channel + 1;
|
||||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY5);
|
} 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,
|
setConfigData(configData);
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Custom";
|
return "Custom";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file configairframetwidget.h
|
* @file configcustomwidget.h
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @addtogroup ConfigPlugin Config Plugin
|
||||||
* @{
|
* @{
|
||||||
* @brief Airframe configuration panel
|
* @brief custom configuration panel
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file configfixedwidget.cpp
|
* @file configfixedwingwidget.cpp
|
||||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file configairframetwidget.h
|
* @file configfixedwingwidget.h
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file configairframetwidget.h
|
* @file configgroundvehiclewidget.h
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||||
* @addtogroup GCSPlugins GCS Plugins
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup ConfigPlugin Config Plugin
|
* @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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -50,11 +50,10 @@ typedef struct {
|
|||||||
uint VTOLMotorSSW : 4;
|
uint VTOLMotorSSW : 4;
|
||||||
uint VTOLMotorWSW : 4;
|
uint VTOLMotorWSW : 4;
|
||||||
uint VTOLMotorWNW : 4;
|
uint VTOLMotorWNW : 4;
|
||||||
uint VTOLMotorNNW : 4; // 32 bits
|
uint VTOLMotorNNW : 4; // 64 bits
|
||||||
uint TRIYaw : 4;
|
uint TRIYaw : 4;
|
||||||
quint32 padding : 28; // 64 bits
|
quint32 padding : 28; // 96 bits
|
||||||
quint32 padding1;
|
quint32 padding1; // 128 bits
|
||||||
quint32 padding2; // 128 bits
|
|
||||||
} __attribute__((packed)) multiGUISettingsStruct;
|
} __attribute__((packed)) multiGUISettingsStruct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -102,12 +101,42 @@ typedef struct {
|
|||||||
quint32 padding3; // 128 bits
|
quint32 padding3; // 128 bits
|
||||||
} __attribute__((packed)) groundGUISettingsStruct;
|
} __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 {
|
typedef union {
|
||||||
uint UAVObject[4]; // 32 bits * 4
|
uint UAVObject[5]; // 32 bits * 5
|
||||||
heliGUISettingsStruct heli; // 128 bits
|
heliGUISettingsStruct heli; // 128 bits
|
||||||
fixedGUISettingsStruct fixedwing;
|
fixedGUISettingsStruct fixedwing;
|
||||||
multiGUISettingsStruct multi;
|
multiGUISettingsStruct multi;
|
||||||
groundGUISettingsStruct ground;
|
groundGUISettingsStruct ground;
|
||||||
|
customGUISettingsStruct custom;
|
||||||
} GUIConfigDataUnion;
|
} GUIConfigDataUnion;
|
||||||
|
|
||||||
class ConfigTaskWidget;
|
class ConfigTaskWidget;
|
||||||
|
@ -198,12 +198,27 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *o)
|
|||||||
// is not ideal, but there you go.
|
// is not ideal, but there you go.
|
||||||
QString frameType = field->getValue().toString();
|
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);
|
m_aircraft->aircraftType->setCurrentIndex(category);
|
||||||
|
|
||||||
VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);
|
VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);
|
||||||
|
|
||||||
if (vehicleConfig) {
|
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();
|
updateFeedForwardUI();
|
||||||
@ -252,7 +267,8 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
|
|||||||
vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value());
|
vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value());
|
||||||
vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->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();
|
updateFeedForwardUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user