mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 14:25:11 +03:00
#2032 fixed
This commit is contained in:
parent
4a9c87cc9c
commit
88f85aef06
6 changed files with 280 additions and 124 deletions
|
@ -684,9 +684,9 @@ class FlightModeData {
|
||||||
class SwashRingData { // Swash Ring data
|
class SwashRingData { // Swash Ring data
|
||||||
public:
|
public:
|
||||||
SwashRingData() { clear(); }
|
SwashRingData() { clear(); }
|
||||||
bool invertELE;
|
int elevatorWeight;
|
||||||
bool invertAIL;
|
int aileronWeight;
|
||||||
bool invertCOL;
|
int collectiveWeight;
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
RawSource collectiveSource;
|
RawSource collectiveSource;
|
||||||
RawSource aileronSource;
|
RawSource aileronSource;
|
||||||
|
|
|
@ -8,12 +8,32 @@ HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & gener
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
connect(ui->swashTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
connect(ui->swashType, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||||
connect(ui->swashCollectiveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
connect(ui->swashRingVal, SIGNAL(editingFinished()), this, SLOT(edited()));
|
||||||
connect(ui->swashRingValSB, SIGNAL(editingFinished()), this, SLOT(edited()));
|
connect(ui->swashCollectiveSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||||
connect(ui->swashInvertELE, SIGNAL(stateChanged(int)), this, SLOT(edited()));
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
connect(ui->swashInvertAIL, SIGNAL(stateChanged(int)), this, SLOT(edited()));
|
connect(ui->swashAileronSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||||
connect(ui->swashInvertCOL, SIGNAL(stateChanged(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();
|
disableMouseScrolling();
|
||||||
}
|
}
|
||||||
|
@ -27,12 +47,21 @@ void HeliPanel::update()
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
ui->swashTypeCB->setCurrentIndex(model->swashRingData.type);
|
ui->swashType->setCurrentIndex(model->swashRingData.type);
|
||||||
populateSourceCB(ui->swashCollectiveCB, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
populateSourceCB(ui->swashCollectiveSource, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||||
ui->swashRingValSB->setValue(model->swashRingData.value);
|
ui->swashRingVal->setValue(model->swashRingData.value);
|
||||||
ui->swashInvertELE->setChecked(model->swashRingData.invertELE);
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
ui->swashInvertAIL->setChecked(model->swashRingData.invertAIL);
|
populateSourceCB(ui->swashElevatorSource, model->swashRingData.elevatorSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||||
ui->swashInvertCOL->setChecked(model->swashRingData.invertCOL);
|
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;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
@ -40,12 +69,21 @@ void HeliPanel::update()
|
||||||
void HeliPanel::edited()
|
void HeliPanel::edited()
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
model->swashRingData.type = ui->swashTypeCB->currentIndex();
|
model->swashRingData.type = ui->swashType->currentIndex();
|
||||||
model->swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt();
|
model->swashRingData.collectiveSource = ui->swashCollectiveSource->itemData(ui->swashCollectiveSource->currentIndex()).toInt();
|
||||||
model->swashRingData.value = ui->swashRingValSB->value();
|
model->swashRingData.value = ui->swashRingVal->value();
|
||||||
model->swashRingData.invertELE = ui->swashInvertELE->isChecked();
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
model->swashRingData.invertAIL = ui->swashInvertAIL->isChecked();
|
model->swashRingData.elevatorSource = ui->swashElevatorSource->itemData(ui->swashElevatorSource->currentIndex()).toInt();
|
||||||
model->swashRingData.invertCOL = ui->swashInvertCOL->isChecked();
|
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();
|
emit modified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,40 +17,15 @@
|
||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</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">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_108">
|
<widget class="QLabel" name="collectiveLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Invert</string>
|
<string>Collective</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="swashTypeCB">
|
<widget class="QComboBox" name="swashType">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Off</string>
|
<string>Off</string>
|
||||||
|
@ -78,25 +53,69 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_106">
|
<layout class="QHBoxLayout" name="collectiveLayout">
|
||||||
<property name="text">
|
<property name="topMargin">
|
||||||
<string>Collective</string>
|
<number>0</number>
|
||||||
</property>
|
</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>
|
||||||
<item row="1" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QComboBox" name="swashCollectiveCB"/>
|
<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>
|
||||||
<item row="0" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_103">
|
<widget class="QLabel" name="elevatorLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Swash Type</string>
|
<string>Elevator</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="swashRingValSB">
|
<widget class="QSpinBox" name="swashRingVal">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -114,14 +133,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_107">
|
<widget class="QLabel" name="invertLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Swash Ring</string>
|
<string>Invert</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="7" column="1">
|
||||||
<spacer name="verticalSpacer_21">
|
<spacer name="verticalSpacer_21">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -134,6 +153,85 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -37,17 +37,17 @@
|
||||||
|
|
||||||
enum menuModelHeliItems {
|
enum menuModelHeliItems {
|
||||||
ITEM_HELI_SWASHTYPE,
|
ITEM_HELI_SWASHTYPE,
|
||||||
ITEM_HELI_ELESOURCE,
|
|
||||||
ITEM_HELI_AILSOURCE,
|
|
||||||
ITEM_HELI_COLSOURCE,
|
|
||||||
ITEM_HELI_SWASHRING,
|
ITEM_HELI_SWASHRING,
|
||||||
ITEM_HELI_ELEDIRECTION,
|
ITEM_HELI_ELE,
|
||||||
ITEM_HELI_AILDIRECTION,
|
ITEM_HELI_ELE_WEIGHT,
|
||||||
ITEM_HELI_COLDIRECTION,
|
ITEM_HELI_AIL,
|
||||||
|
ITEM_HELI_AIL_WEIGHT,
|
||||||
|
ITEM_HELI_COL,
|
||||||
|
ITEM_HELI_COL_WEIGHT,
|
||||||
ITEM_HELI_MAX
|
ITEM_HELI_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HELI_PARAM_OFS (23*FW)
|
#define MODEL_HELI_2ND_COLUMN (LCD_W-17*FW-MENUS_SCROLLBAR_WIDTH)
|
||||||
|
|
||||||
void menuModelHeli(uint8_t event)
|
void menuModelHeli(uint8_t event)
|
||||||
{
|
{
|
||||||
|
@ -56,51 +56,58 @@ void menuModelHeli(uint8_t event)
|
||||||
int sub = m_posVert;
|
int sub = m_posVert;
|
||||||
|
|
||||||
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
for (unsigned int i=0; i<NUM_BODY_LINES; i++) {
|
||||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||||
int k = i+s_pgOfs;
|
int k = i+s_pgOfs;
|
||||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||||
LcdFlags attr = (sub == k ? blink : 0);
|
LcdFlags attr = (sub == k ? blink : 0);
|
||||||
|
|
||||||
switch(k) {
|
switch(k) {
|
||||||
case ITEM_HELI_SWASHTYPE:
|
case ITEM_HELI_SWASHTYPE:
|
||||||
g_model.swashR.type = selectMenuItem(HELI_PARAM_OFS, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event);
|
g_model.swashR.type = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event);
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_HELI_ELESOURCE:
|
|
||||||
lcd_putsLeft(y, STR_ELEVATOR_SOURCE);
|
|
||||||
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH);
|
|
||||||
putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.elevatorSource, attr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_HELI_AILSOURCE:
|
|
||||||
lcd_putsLeft(y, STR_AILERON_SOURCE);
|
|
||||||
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH);
|
|
||||||
putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.aileronSource, attr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_HELI_COLSOURCE:
|
|
||||||
lcd_putsLeft(y, STR_COLLECTIVE_SOURCE);
|
|
||||||
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH);
|
|
||||||
putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.collectiveSource, attr);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_HELI_SWASHRING:
|
case ITEM_HELI_SWASHRING:
|
||||||
lcd_putsLeft(y, STR_SWASHRING);
|
lcd_putsLeft(y, STR_SWASHRING);
|
||||||
lcd_outdezAtt(HELI_PARAM_OFS, y, g_model.swashR.value, LEFT|attr);
|
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr);
|
||||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100);
|
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_HELI_ELEDIRECTION:
|
case ITEM_HELI_ELE:
|
||||||
g_model.swashR.invertELE = selectMenuItem(HELI_PARAM_OFS, y, STR_ELEDIRECTION, STR_MMMINV, g_model.swashR.invertELE, 0, 1, attr, event);
|
lcd_putsLeft(y, "Elevator" /*STR_ELEVATOR_SOURCE*/);
|
||||||
|
putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorSource, attr);
|
||||||
|
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_HELI_AILDIRECTION:
|
case ITEM_HELI_ELE_WEIGHT:
|
||||||
g_model.swashR.invertAIL = selectMenuItem(HELI_PARAM_OFS, y, STR_AILDIRECTION, STR_MMMINV, g_model.swashR.invertAIL, 0, 1, attr, event);
|
lcd_puts(INDENT_WIDTH, y, STR_WEIGHT);
|
||||||
|
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorWeight, LEFT|attr);
|
||||||
|
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.elevatorWeight, -100, 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_HELI_COLDIRECTION:
|
case ITEM_HELI_AIL:
|
||||||
g_model.swashR.invertCOL = selectMenuItem(HELI_PARAM_OFS, y, STR_COLDIRECTION, STR_MMMINV, g_model.swashR.invertCOL, 0, 1, attr, event);
|
lcd_putsLeft(y, "Aileron" /*STR_ELEVATOR_SOURCE*/);
|
||||||
|
putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronSource, attr);
|
||||||
|
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ITEM_HELI_AIL_WEIGHT:
|
||||||
|
lcd_puts(INDENT_WIDTH, y, STR_WEIGHT);
|
||||||
|
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronWeight, LEFT|attr);
|
||||||
|
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.aileronWeight, -100, 100);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ITEM_HELI_COL:
|
||||||
|
lcd_putsLeft(y, "Collective" /*STR_ELEVATOR_SOURCE*/);
|
||||||
|
putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr);
|
||||||
|
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ITEM_HELI_COL_WEIGHT:
|
||||||
|
lcd_puts(INDENT_WIDTH, y, STR_WEIGHT);
|
||||||
|
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveWeight, LEFT|attr);
|
||||||
|
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.collectiveWeight, -100, 100);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
int8_t virtualInputsTrims[NUM_INPUTS];
|
int8_t virtualInputsTrims[NUM_INPUTS];
|
||||||
#else
|
#else
|
||||||
int16_t rawAnas[NUM_INPUTS] = {0};
|
int16_t rawAnas[NUM_INPUTS] = {0};
|
||||||
|
@ -67,7 +67,7 @@ int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMa
|
||||||
|
|
||||||
void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||||
{
|
{
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(VIRTUALINPUTS)
|
||||||
int16_t anas2[NUM_INPUTS]; // values before expo, to ensure same expo base when multiple expo lines are used
|
int16_t anas2[NUM_INPUTS]; // values before expo, to ensure same expo base when multiple expo lines are used
|
||||||
memcpy(anas2, anas, sizeof(anas2));
|
memcpy(anas2, anas, sizeof(anas2));
|
||||||
#endif
|
#endif
|
||||||
|
@ -85,7 +85,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||||
if (ed->flightModes & (1<<mixerCurrentFlightMode))
|
if (ed->flightModes & (1<<mixerCurrentFlightMode))
|
||||||
continue;
|
continue;
|
||||||
if (getSwitch(ed->swtch)) {
|
if (getSwitch(ed->swtch)) {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
int v;
|
int v;
|
||||||
if (ed->srcRaw == ovwrIdx) {
|
if (ed->srcRaw == ovwrIdx) {
|
||||||
v = ovwrValue;
|
v = ovwrValue;
|
||||||
|
@ -107,7 +107,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||||
cur_chn = ed->chn;
|
cur_chn = ed->chn;
|
||||||
|
|
||||||
//========== CURVE=================
|
//========== CURVE=================
|
||||||
#if defined(PCBTARANIS)
|
#if defined(XCURVES)
|
||||||
if (ed->curve.value) {
|
if (ed->curve.value) {
|
||||||
v = applyCurve(v, ed->curve);
|
v = applyCurve(v, ed->curve);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||||
weight = calc100to256(weight);
|
weight = calc100to256(weight);
|
||||||
v = ((int32_t)v * weight) >> 8;
|
v = ((int32_t)v * weight) >> 8;
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
//========== OFFSET ===============
|
//========== OFFSET ===============
|
||||||
int16_t offset = GET_GVAR(ed->offset, -100, 100, mixerCurrentFlightMode);
|
int16_t offset = GET_GVAR(ed->offset, -100, 100, mixerCurrentFlightMode);
|
||||||
if (offset) v += calc100toRESX(offset);
|
if (offset) v += calc100toRESX(offset);
|
||||||
|
@ -243,13 +243,13 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
{
|
{
|
||||||
if (i==MIXSRC_NONE) return 0;
|
if (i==MIXSRC_NONE) return 0;
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
else if (i <= MIXSRC_LAST_INPUT) {
|
else if (i <= MIXSRC_LAST_INPUT) {
|
||||||
return anas[i-MIXSRC_FIRST_INPUT];
|
return anas[i-MIXSRC_FIRST_INPUT];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(LUAINPUTS)
|
||||||
else if (i<MIXSRC_LAST_LUA) {
|
else if (i<MIXSRC_LAST_LUA) {
|
||||||
#if defined(LUA_MODEL_SCRIPTS)
|
#if defined(LUA_MODEL_SCRIPTS)
|
||||||
div_t qr = div(i-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
div_t qr = div(i-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
||||||
|
@ -277,7 +277,14 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
|
|
||||||
else if (i<=MIXSRC_TrimAil) return calc1000toRESX((int16_t)8 * getTrimValue(mixerCurrentFlightMode, i-MIXSRC_TrimRud));
|
else if (i<=MIXSRC_TrimAil) return calc1000toRESX((int16_t)8 * getTrimValue(mixerCurrentFlightMode, i-MIXSRC_TrimRud));
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTBS)
|
||||||
|
else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024));
|
||||||
|
else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : 1024);
|
||||||
|
else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024));
|
||||||
|
// else if (i==MIXSRC_SD) return (switchState(SW_SD0) ? -1024 : 1024);
|
||||||
|
else if (i==MIXSRC_SE) return (switchState(SW_SE0) ? -1024 : 1024);
|
||||||
|
else if (i==MIXSRC_SF) return (switchState(SW_SF0) ? -1024 : (switchState(SW_SF1) ? 0 : 1024));
|
||||||
|
#elif defined(PCBTARANIS)
|
||||||
else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024));
|
else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024));
|
||||||
else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : (switchState(SW_SB1) ? 0 : 1024));
|
else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : (switchState(SW_SB1) ? 0 : 1024));
|
||||||
else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024));
|
else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024));
|
||||||
|
@ -401,7 +408,7 @@ void evalInputs(uint8_t mode)
|
||||||
#if defined(HELI)
|
#if defined(HELI)
|
||||||
uint16_t d = 0;
|
uint16_t d = 0;
|
||||||
if (g_model.swashR.value) {
|
if (g_model.swashR.value) {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
int ele = (int16_t)anaIn(ELE_STICK);
|
int ele = (int16_t)anaIn(ELE_STICK);
|
||||||
int ail = (int16_t)anaIn(AIL_STICK);
|
int ail = (int16_t)anaIn(AIL_STICK);
|
||||||
uint32_t v = (ele*ele) + (ail*ail);
|
uint32_t v = (ele*ele) + (ail*ail);
|
||||||
|
@ -493,7 +500,7 @@ void evalInputs(uint8_t mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch < NUM_STICKS) { //only do this for sticks
|
if (ch < NUM_STICKS) { //only do this for sticks
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
if (mode & e_perout_mode_nosticks) {
|
if (mode & e_perout_mode_nosticks) {
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +533,7 @@ void evalInputs(uint8_t mode)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
calibratedStick[ch] = v;
|
calibratedStick[ch] = v;
|
||||||
#else
|
#else
|
||||||
rawAnas[ch] = v;
|
rawAnas[ch] = v;
|
||||||
|
@ -550,7 +557,7 @@ void evalInputs(uint8_t mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
int getStickTrimValue(int stick)
|
int getStickTrimValue(int stick)
|
||||||
{
|
{
|
||||||
int trim = trims[stick];
|
int trim = trims[stick];
|
||||||
|
@ -590,7 +597,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HELI)
|
#if defined(HELI)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
int heliEleValue = getValue(g_model.swashR.elevatorSource);
|
int heliEleValue = getValue(g_model.swashR.elevatorSource);
|
||||||
int heliAilValue = getValue(g_model.swashR.aileronSource);
|
int heliAilValue = getValue(g_model.swashR.aileronSource);
|
||||||
#else
|
#else
|
||||||
|
@ -613,7 +620,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
#define REZ_SWASH_Y(x) ((x)) // 1024 => 1024
|
#define REZ_SWASH_Y(x) ((x)) // 1024 => 1024
|
||||||
|
|
||||||
if (g_model.swashR.type) {
|
if (g_model.swashR.type) {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
getvalue_t vp = heliEleValue + getSourceTrimValue(g_model.swashR.elevatorSource);
|
getvalue_t vp = heliEleValue + getSourceTrimValue(g_model.swashR.elevatorSource);
|
||||||
getvalue_t vr = heliAilValue + getSourceTrimValue(g_model.swashR.aileronSource);
|
getvalue_t vr = heliAilValue + getSourceTrimValue(g_model.swashR.aileronSource);
|
||||||
#else
|
#else
|
||||||
|
@ -624,9 +631,15 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
if (g_model.swashR.collectiveSource)
|
if (g_model.swashR.collectiveSource)
|
||||||
vc = getValue(g_model.swashR.collectiveSource);
|
vc = getValue(g_model.swashR.collectiveSource);
|
||||||
|
|
||||||
|
#if defined(VIRTUALINPUTS)
|
||||||
|
vp = (vp * g_model.swashR.elevatorWeight) / 100;
|
||||||
|
vr = (vr * g_model.swashR.aileronWeight) / 100;
|
||||||
|
vc = (vc * g_model.swashR.collectiveWeight) / 100;
|
||||||
|
#else
|
||||||
if (g_model.swashR.invertELE) vp = -vp;
|
if (g_model.swashR.invertELE) vp = -vp;
|
||||||
if (g_model.swashR.invertAIL) vr = -vr;
|
if (g_model.swashR.invertAIL) vr = -vr;
|
||||||
if (g_model.swashR.invertCOL) vc = -vc;
|
if (g_model.swashR.invertCOL) vc = -vc;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (g_model.swashR.type) {
|
switch (g_model.swashR.type) {
|
||||||
case SWASH_TYPE_120:
|
case SWASH_TYPE_120:
|
||||||
|
@ -705,7 +718,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
MIXER_LINE_DISABLE();
|
MIXER_LINE_DISABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(LUA_MODEL_SCRIPTS)
|
#if defined(LUA_MODEL_SCRIPTS)
|
||||||
// disable mixer if Lua script is used as source and script was killed
|
// disable mixer if Lua script is used as source and script was killed
|
||||||
if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_LUA && md->srcRaw <= MIXSRC_LAST_LUA) {
|
if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_LUA && md->srcRaw <= MIXSRC_LAST_LUA) {
|
||||||
div_t qr = div(md->srcRaw-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
div_t qr = div(md->srcRaw-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
||||||
|
@ -718,7 +731,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
//========== VALUE ===============
|
//========== VALUE ===============
|
||||||
getvalue_t v = 0;
|
getvalue_t v = 0;
|
||||||
if (mode > e_perout_mode_inactive_flight_mode) {
|
if (mode > e_perout_mode_inactive_flight_mode) {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
if (!mixEnabled) {
|
if (!mixEnabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -735,7 +748,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(VIRTUALINPUTS)
|
||||||
if (stickIndex < NUM_STICKS) {
|
if (stickIndex < NUM_STICKS) {
|
||||||
v = md->noExpo ? rawAnas[stickIndex] : anas[stickIndex];
|
v = md->noExpo ? rawAnas[stickIndex] : anas[stickIndex];
|
||||||
}
|
}
|
||||||
|
@ -804,7 +817,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
|
|
||||||
//========== TRIMS ================
|
//========== TRIMS ================
|
||||||
if (!(mode & e_perout_mode_notrims)) {
|
if (!(mode & e_perout_mode_notrims)) {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
if (md->carryTrim == 0) {
|
if (md->carryTrim == 0) {
|
||||||
v += getSourceTrimValue(md->srcRaw);
|
v += getSourceTrimValue(md->srcRaw);
|
||||||
}
|
}
|
||||||
|
@ -873,7 +886,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//========== CURVES ===============
|
//========== CURVES ===============
|
||||||
#if defined(PCBTARANIS)
|
#if defined(XCURVES)
|
||||||
if (apply_offset_and_curve && md->curve.value) {
|
if (apply_offset_and_curve && md->curve.value) {
|
||||||
v = applyCurve(v, md->curve);
|
v = applyCurve(v, md->curve);
|
||||||
}
|
}
|
||||||
|
@ -893,7 +906,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//========== DIFFERENTIAL =========
|
//========== DIFFERENTIAL =========
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(XCURVES)
|
||||||
if (md->curveMode == MODE_DIFFERENTIAL) {
|
if (md->curveMode == MODE_DIFFERENTIAL) {
|
||||||
// @@@2 also recalculate curveParam to a 256 basis which ease the calculation later a lot
|
// @@@2 also recalculate curveParam to a 256 basis which ease the calculation later a lot
|
||||||
int16_t curveParam = calc100to256(GET_GVAR(md->curveParam, -100, 100, mixerCurrentFlightMode));
|
int16_t curveParam = calc100to256(GET_GVAR(md->curveParam, -100, 100, mixerCurrentFlightMode));
|
||||||
|
|
|
@ -1502,16 +1502,16 @@ enum SwashType {
|
||||||
SWASH_TYPE_MAX = SWASH_TYPE_90
|
SWASH_TYPE_MAX = SWASH_TYPE_90
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(VIRTUALINPUTS)
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t invertELE:1;
|
uint8_t type;
|
||||||
uint8_t invertAIL:1;
|
uint8_t value;
|
||||||
uint8_t invertCOL:1;
|
|
||||||
uint8_t type:5;
|
|
||||||
uint8_t collectiveSource;
|
uint8_t collectiveSource;
|
||||||
uint8_t aileronSource;
|
uint8_t aileronSource;
|
||||||
uint8_t elevatorSource;
|
uint8_t elevatorSource;
|
||||||
uint8_t value;
|
int8_t collectiveWeight;
|
||||||
|
int8_t aileronWeight;
|
||||||
|
int8_t elevatorWeight;
|
||||||
}) SwashRingData;
|
}) SwashRingData;
|
||||||
#else
|
#else
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue