This commit is contained in:
bsongis
2015-02-14 17:22:33 +01:00
parent 4a9c87cc9c
commit 88f85aef06
6 changed files with 280 additions and 124 deletions
+3 -3
View File
@@ -684,9 +684,9 @@ class FlightModeData {
class SwashRingData { // Swash Ring data
public:
SwashRingData() { clear(); }
bool invertELE;
bool invertAIL;
bool invertCOL;
int elevatorWeight;
int aileronWeight;
int collectiveWeight;
unsigned int type;
RawSource collectiveSource;
RawSource aileronSource;
+56 -18
View File
@@ -8,12 +8,32 @@ HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & gener
{
ui->setupUi(this);
connect(ui->swashTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashCollectiveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashRingValSB, SIGNAL(editingFinished()), this, SLOT(edited()));
connect(ui->swashInvertELE, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashInvertAIL, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashInvertCOL, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashType, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashRingVal, SIGNAL(editingFinished()), this, SLOT(edited()));
connect(ui->swashCollectiveSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
if (firmware->getCapability(VirtualInputs)) {
connect(ui->swashAileronSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashElevatorSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
connect(ui->swashAileronWeight, SIGNAL(editingFinished()), this, SLOT(edited()));
connect(ui->swashElevatorWeight, SIGNAL(editingFinished()), this, SLOT(edited()));
connect(ui->swashCollectiveWeight, SIGNAL(editingFinished()), this, SLOT(edited()));
ui->invertLabel->hide();
ui->swashElevatorInvert->hide();
ui->swashAileronInvert->hide();
ui->swashCollectiveInvert->hide();
}
else {
connect(ui->swashElevatorInvert, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashAileronInvert, SIGNAL(stateChanged(int)), this, SLOT(edited()));
connect(ui->swashCollectiveInvert, SIGNAL(stateChanged(int)), this, SLOT(edited()));
ui->aileronLabel->hide();
ui->elevatorLabel->hide();
ui->swashAileronSource->hide();
ui->swashElevatorSource->hide();
ui->swashAileronWeight->hide();
ui->swashElevatorWeight->hide();
ui->swashCollectiveWeight->hide();
}
disableMouseScrolling();
}
@@ -27,12 +47,21 @@ void HeliPanel::update()
{
lock = true;
ui->swashTypeCB->setCurrentIndex(model->swashRingData.type);
populateSourceCB(ui->swashCollectiveCB, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->swashRingValSB->setValue(model->swashRingData.value);
ui->swashInvertELE->setChecked(model->swashRingData.invertELE);
ui->swashInvertAIL->setChecked(model->swashRingData.invertAIL);
ui->swashInvertCOL->setChecked(model->swashRingData.invertCOL);
ui->swashType->setCurrentIndex(model->swashRingData.type);
populateSourceCB(ui->swashCollectiveSource, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->swashRingVal->setValue(model->swashRingData.value);
if (firmware->getCapability(VirtualInputs)) {
populateSourceCB(ui->swashElevatorSource, model->swashRingData.elevatorSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
populateSourceCB(ui->swashAileronSource, model->swashRingData.aileronSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->swashElevatorWeight->setValue(model->swashRingData.elevatorWeight);
ui->swashAileronWeight->setValue(model->swashRingData.aileronWeight);
ui->swashCollectiveWeight->setValue(model->swashRingData.collectiveWeight);
}
else {
ui->swashElevatorInvert->setChecked(model->swashRingData.elevatorWeight < 0);
ui->swashAileronInvert->setChecked(model->swashRingData.aileronWeight < 0);
ui->swashCollectiveInvert->setChecked(model->swashRingData.collectiveWeight < 0);
}
lock = false;
}
@@ -40,12 +69,21 @@ void HeliPanel::update()
void HeliPanel::edited()
{
if (!lock) {
model->swashRingData.type = ui->swashTypeCB->currentIndex();
model->swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt();
model->swashRingData.value = ui->swashRingValSB->value();
model->swashRingData.invertELE = ui->swashInvertELE->isChecked();
model->swashRingData.invertAIL = ui->swashInvertAIL->isChecked();
model->swashRingData.invertCOL = ui->swashInvertCOL->isChecked();
model->swashRingData.type = ui->swashType->currentIndex();
model->swashRingData.collectiveSource = ui->swashCollectiveSource->itemData(ui->swashCollectiveSource->currentIndex()).toInt();
model->swashRingData.value = ui->swashRingVal->value();
if (firmware->getCapability(VirtualInputs)) {
model->swashRingData.elevatorSource = ui->swashElevatorSource->itemData(ui->swashElevatorSource->currentIndex()).toInt();
model->swashRingData.aileronSource = ui->swashAileronSource->itemData(ui->swashAileronSource->currentIndex()).toInt();
model->swashRingData.elevatorWeight = ui->swashElevatorWeight->value();
model->swashRingData.aileronWeight = ui->swashAileronWeight->value();
model->swashRingData.collectiveWeight = ui->swashCollectiveWeight->value();
}
else {
model->swashRingData.elevatorWeight = (ui->swashElevatorInvert->isChecked() ? -100 : 100);
model->swashRingData.aileronWeight = (ui->swashAileronInvert->isChecked() ? -100 : 100);
model->swashRingData.collectiveWeight = (ui->swashCollectiveInvert->isChecked() ? -100 : 100);
}
emit modified();
}
}
+141 -43
View File
@@ -17,40 +17,15 @@
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="3" column="1">
<layout class="QGridLayout" name="gridLayout_21">
<item row="0" column="0">
<widget class="QCheckBox" name="swashInvertELE">
<property name="text">
<string>Invert Elevator</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="swashInvertAIL">
<property name="text">
<string>Invert Aileron</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="swashInvertCOL">
<property name="text">
<string>Invert Collective</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_108">
<widget class="QLabel" name="collectiveLabel">
<property name="text">
<string>Invert</string>
<string>Collective</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="swashTypeCB">
<widget class="QComboBox" name="swashType">
<item>
<property name="text">
<string>Off</string>
@@ -78,25 +53,69 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_106">
<property name="text">
<string>Collective</string>
<item row="3" column="1">
<layout class="QHBoxLayout" name="collectiveLayout">
<property name="topMargin">
<number>0</number>
</property>
</widget>
<item>
<widget class="QComboBox" name="swashCollectiveSource"/>
</item>
<item>
<widget class="QSpinBox" name="swashCollectiveWeight">
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="swashCollectiveCB"/>
<item row="6" column="1">
<layout class="QGridLayout" name="gridLayout_21">
<item row="0" column="0">
<widget class="QCheckBox" name="swashElevatorInvert">
<property name="text">
<string>Invert Elevator</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="swashAileronInvert">
<property name="text">
<string>Invert Aileron</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="swashCollectiveInvert">
<property name="text">
<string>Invert Collective</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_103">
<item row="4" column="0">
<widget class="QLabel" name="elevatorLabel">
<property name="text">
<string>Swash Type</string>
<string>Elevator</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="swashRingValSB">
<widget class="QSpinBox" name="swashRingVal">
<property name="suffix">
<string/>
</property>
@@ -114,14 +133,14 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_107">
<item row="6" column="0">
<widget class="QLabel" name="invertLabel">
<property name="text">
<string>Swash Ring</string>
<string>Invert</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="7" column="1">
<spacer name="verticalSpacer_21">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -134,6 +153,85 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_107">
<property name="text">
<string>Swash Ring</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_103">
<property name="text">
<string>Swash Type</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="elevatorLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="swashElevatorSource"/>
</item>
<item>
<widget class="QSpinBox" name="swashElevatorWeight">
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="aileronLabel">
<property name="text">
<string>Aileron</string>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="aileronLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="swashAileronSource"/>
</item>
<item>
<widget class="QSpinBox" name="swashAileronWeight">
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>