1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

Start basics of config plugin page for FW clean up, add support for single

servo aileron fixedwings
This commit is contained in:
Fredrik Larson 2014-08-24 01:52:41 +10:00
parent b119f7ee5f
commit 86f8997e88
4 changed files with 104 additions and 44 deletions

View File

@ -14,19 +14,22 @@
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
@ -34,17 +37,9 @@
</font>
</property>
<property name="text">
<string>Airplane type:</string>
<string>Airframe Type:</string>
</property>
</widget>
<widget class="QGraphicsView" name="planeShape">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fixedWingType"/>
@ -64,6 +59,16 @@
</item>
</layout>
</item>
<item>
<widget class="QGraphicsView" name="planeShape">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="rightMargin">
@ -475,9 +480,7 @@ margin:1px;</string>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>elevonSlider1</sender>

View File

@ -14,7 +14,16 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="0">
@ -32,10 +41,19 @@
</size>
</property>
<property name="title">
<string>Frame</string>
<string>Airframe</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="1">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
@ -90,7 +108,16 @@
<string>Throttle Curve</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
@ -136,12 +163,21 @@
<string>Mix Level</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@ -375,7 +411,7 @@ Typical value is 50% for + or X configuration on quads.</string>
</font>
</property>
<property name="text">
<string>Frame Type:</string>
<string>Airframe Type:</string>
</property>
</widget>
</item>
@ -476,7 +512,16 @@ Typical value is 50% for + or X configuration on quads.</string>
<string>Motor output channels</string>
</property>
<layout class="QGridLayout" name="gridLayout_7" columnstretch="1,1,0,0,1">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0" rowspan="5">
@ -801,9 +846,7 @@ margin:1px;</string>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>mrRollMixLevel</sender>

View File

@ -53,11 +53,11 @@ ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
populateChannelComboBoxes();
QStringList fixedWingTypes;
fixedWingTypes << "Elevator aileron rudder" << "Elevon";
fixedWingTypes << "Aileron Dual Servo" << "Aileron Single Servo" << "Elevon";
m_aircraft->fixedWingType->addItems(fixedWingTypes);
// Set default model to "Elevator aileron rudder"
m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Elevator aileron rudder"));
// Set default model to "Aileron Dual Servo"
m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Aileron Dual Servo"));
setupUI(m_aircraft->fixedWingType->currentText());
@ -135,9 +135,9 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
qDebug() << "Current Aircraft type: \n" << m_aircraft->fixedWingType->currentText();
if (frameType == "FixedWing" || frameType == "Elevator aileron rudder") {
if (frameType == "FixedWing" || frameType == "Aileron Dual Servo") {
plane->setElementId("aileron");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevator aileron rudder"));
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Aileron Dual Servo"));
resetChannelboxesAndSliders();
m_aircraft->fwRudder1ChannelBox->setEnabled(true);
@ -151,7 +151,21 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->fwAileron2Label->setText("Aileron 2");
m_aircraft->fwElevator1Label->setText("Elevator 1");
m_aircraft->fwElevator2Label->setText("Elevator 2");
} else if (frameType == "Aileron Single Servo") {
plane->setElementId("aileron-single");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Aileron Single Servo"));
resetChannelboxesAndSliders();
m_aircraft->fwRudder1ChannelBox->setEnabled(true);
m_aircraft->fwRudder2ChannelBox->setEnabled(true);
m_aircraft->fwElevator1ChannelBox->setEnabled(true);
m_aircraft->fwElevator2ChannelBox->setEnabled(true);
m_aircraft->fwAileron1ChannelBox->setEnabled(true);
m_aircraft->fwAileron2ChannelBox->setEnabled(false);
m_aircraft->fwAileron1Label->setText("Aileron 1");
m_aircraft->fwAileron2Label->setText("Aileron 2");
m_aircraft->fwElevator1Label->setText("Elevator 1");
m_aircraft->fwElevator2Label->setText("Elevator 2");
} else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
// do nothing for now
} else if (frameType == "FixedWingElevon" || frameType == "Elevon") {
@ -202,7 +216,7 @@ void ConfigFixedWingWidget::setupEnabledControls(QString frameType)
// enableComboBoxes(this, CHANNELBOXNAME, 3, true);
} else if (frameType == "Elevon" || frameType == "Elevon") {
enableComboBoxes(this, CHANNELBOXNAME, 3, true);
} else if (frameType == "aileron" || frameType == "Elevator aileron rudder") {
} else if (frameType == "aileron" || frameType == "Aileron Dual Servo" || frameType == "Aileron Single Servo") {
enableComboBoxes(this, CHANNELBOXNAME, 4, true);
}
}
@ -300,7 +314,7 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
QString airframeType;
QList<QString> motor_servo_List;
if (m_aircraft->fixedWingType->currentText() == "Elevator aileron rudder") {
if (m_aircraft->fixedWingType->currentText() == "Aileron Dual Servo" || "aileron-single") {
airframeType = "FixedWing";
setupFrameFixedWing(airframeType);
@ -312,7 +326,7 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
m_aircraft->fwStatusLabel->setText(tr("Configuration OK"));
}
}
else if (m_aircraft->fixedWingType->currentText() == "elevon") {
airframeType = "FixedWingElevon";
setupFrameElevon(airframeType);

View File

@ -198,8 +198,7 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *o)
UAVObjectField *field = system->getField(QString("AirframeType"));
Q_ASSERT(field);
// At this stage, we will need to have some hardcoded settings in this code, this
// is not ideal, but there you go.
// At this stage, we will need to have some hardcoded settings in this code
QString frameType = field->getValue().toString();
int category = frameCategory(frameType);
@ -262,8 +261,9 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
int ConfigVehicleTypeWidget::frameCategory(QString frameType)
{
if (frameType == "FixedWing" || frameType == "Elevator aileron rudder" || frameType == "FixedWingElevon"
|| frameType == "Elevon" || frameType == "FixedWingVtail" || frameType == "Vtail") {
if (frameType == "FixedWing" || frameType == "Aileron Dual Servo" || frameType == "Aileron Single Servo"
|| frameType == "FixedWingElevon" || frameType == "Elevon" || frameType == "FixedWingVtail"
|| frameType == "Vtail") {
return ConfigVehicleTypeWidget::FIXED_WING;
} else if (frameType == "Tri" || frameType == "Tricopter Y" || frameType == "QuadX" || frameType == "Quad X"
|| frameType == "QuadP" || frameType == "Quad +" || frameType == "Hexa" || frameType == "Hexacopter"