mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-23 00:05:13 +03:00
[Companion][Horus] Add joystick axes (JSx & JSy) and trims T5 & T6 as usable sources. (#4550)
* [Companion][Horus] Add joystick axes (JSx & JSy) to sources list (fixes #4336). * [Companion][Horus] Add aux trims T5 & T6 and associated switches to respective selector lists. Rename "Joysticks" enum to "MouseAnalogs".
This commit is contained in:
parent
d911d382f2
commit
2540e166b0
8 changed files with 130 additions and 115 deletions
|
@ -52,17 +52,20 @@ int getEEpromSize(Board::Type board)
|
||||||
Board::SwitchInfo getSwitchInfo(Board::Type board, unsigned index)
|
Board::SwitchInfo getSwitchInfo(Board::Type board, unsigned index)
|
||||||
{
|
{
|
||||||
if (IS_TARANIS_X7(board)) {
|
if (IS_TARANIS_X7(board)) {
|
||||||
const Board::SwitchInfo switches[] = {{Board::SWITCH_3POS, "SA"},
|
const Board::SwitchInfo switches[] = {
|
||||||
|
{Board::SWITCH_3POS, "SA"},
|
||||||
{Board::SWITCH_3POS, "SB"},
|
{Board::SWITCH_3POS, "SB"},
|
||||||
{Board::SWITCH_3POS, "SC"},
|
{Board::SWITCH_3POS, "SC"},
|
||||||
{Board::SWITCH_3POS, "SD"},
|
{Board::SWITCH_3POS, "SD"},
|
||||||
{Board::SWITCH_2POS, "SF"},
|
{Board::SWITCH_2POS, "SF"},
|
||||||
{Board::SWITCH_TOGGLE, "SH"}};
|
{Board::SWITCH_TOGGLE, "SH"}
|
||||||
|
};
|
||||||
if (index < DIM(switches))
|
if (index < DIM(switches))
|
||||||
return switches[index];
|
return switches[index];
|
||||||
}
|
}
|
||||||
else if (IS_HORUS_OR_TARANIS(board)) {
|
else if (IS_HORUS_OR_TARANIS(board)) {
|
||||||
const Board::SwitchInfo switches[] = {{Board::SWITCH_3POS, "SA"},
|
const Board::SwitchInfo switches[] = {
|
||||||
|
{Board::SWITCH_3POS, "SA"},
|
||||||
{Board::SWITCH_3POS, "SB"},
|
{Board::SWITCH_3POS, "SB"},
|
||||||
{Board::SWITCH_3POS, "SC"},
|
{Board::SWITCH_3POS, "SC"},
|
||||||
{Board::SWITCH_3POS, "SD"},
|
{Board::SWITCH_3POS, "SD"},
|
||||||
|
@ -79,18 +82,21 @@ Board::SwitchInfo getSwitchInfo(Board::Type board, unsigned index)
|
||||||
{Board::SWITCH_3POS, "SO"},
|
{Board::SWITCH_3POS, "SO"},
|
||||||
{Board::SWITCH_3POS, "SP"},
|
{Board::SWITCH_3POS, "SP"},
|
||||||
{Board::SWITCH_3POS, "SQ"},
|
{Board::SWITCH_3POS, "SQ"},
|
||||||
{Board::SWITCH_3POS, "SR"}};
|
{Board::SWITCH_3POS, "SR"}
|
||||||
|
};
|
||||||
if (index < DIM(switches))
|
if (index < DIM(switches))
|
||||||
return switches[index];
|
return switches[index];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const Board::SwitchInfo switches[] = {{Board::SWITCH_2POS, "THR"},
|
const Board::SwitchInfo switches[] = {
|
||||||
|
{Board::SWITCH_2POS, "THR"},
|
||||||
{Board::SWITCH_2POS, "RUD"},
|
{Board::SWITCH_2POS, "RUD"},
|
||||||
{Board::SWITCH_2POS, "ELE"},
|
{Board::SWITCH_2POS, "ELE"},
|
||||||
{Board::SWITCH_3POS, "3POS"},
|
{Board::SWITCH_3POS, "3POS"},
|
||||||
{Board::SWITCH_2POS, "AIL"},
|
{Board::SWITCH_2POS, "AIL"},
|
||||||
{Board::SWITCH_2POS, "GEA"},
|
{Board::SWITCH_2POS, "GEA"},
|
||||||
{Board::SWITCH_TOGGLE, "TRN"}};
|
{Board::SWITCH_TOGGLE, "TRN"}
|
||||||
|
};
|
||||||
if (index < DIM(switches))
|
if (index < DIM(switches))
|
||||||
return switches[index];
|
return switches[index];
|
||||||
}
|
}
|
||||||
|
@ -123,6 +129,11 @@ int getBoardCapability(Board::Type board, Board::Capability capability)
|
||||||
return 2;
|
return 2;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
case MouseAnalogs:
|
||||||
|
if (IS_HORUS(board))
|
||||||
|
return 2;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
case FactoryInstalledSwitches:
|
case FactoryInstalledSwitches:
|
||||||
if (IS_TARANIS_X9E(board))
|
if (IS_TARANIS_X9E(board))
|
||||||
return 8;
|
return 8;
|
||||||
|
@ -136,6 +147,13 @@ int getBoardCapability(Board::Type board, Board::Capability capability)
|
||||||
return 8;
|
return 8;
|
||||||
else
|
else
|
||||||
return 7;
|
return 7;
|
||||||
|
case NumTrims:
|
||||||
|
if (IS_HORUS(board))
|
||||||
|
return 6;
|
||||||
|
else
|
||||||
|
return 4;
|
||||||
|
case NumTrimSwitches:
|
||||||
|
return getBoardCapability(board, NumTrims) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -85,8 +85,11 @@ namespace Board {
|
||||||
enum Capability {
|
enum Capability {
|
||||||
Pots,
|
Pots,
|
||||||
Sliders,
|
Sliders,
|
||||||
|
MouseAnalogs,
|
||||||
Switches,
|
Switches,
|
||||||
FactoryInstalledSwitches
|
FactoryInstalledSwitches,
|
||||||
|
NumTrims,
|
||||||
|
NumTrimSwitches
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,7 @@ QString RotaryEncoderString(int index)
|
||||||
QString RawSource::toString(const ModelData * model) const
|
QString RawSource::toString(const ModelData * model) const
|
||||||
{
|
{
|
||||||
static const QString trims[] = {
|
static const QString trims[] = {
|
||||||
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
|
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA"), QObject::tr("Trm5"), QObject::tr("Trm6")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const QString special[] = {
|
static const QString special[] = {
|
||||||
|
@ -617,7 +617,9 @@ QString RawSwitch::toString(Board::Type board) const
|
||||||
QObject::tr("RudTrim Left"), QObject::tr("RudTrim Right"),
|
QObject::tr("RudTrim Left"), QObject::tr("RudTrim Right"),
|
||||||
QObject::tr("EleTrim Down"), QObject::tr("EleTrim Up"),
|
QObject::tr("EleTrim Down"), QObject::tr("EleTrim Up"),
|
||||||
QObject::tr("ThrTrim Down"), QObject::tr("ThrTrim Up"),
|
QObject::tr("ThrTrim Down"), QObject::tr("ThrTrim Up"),
|
||||||
QObject::tr("AilTrim Left"), QObject::tr("AilTrim Right")
|
QObject::tr("AilTrim Left"), QObject::tr("AilTrim Right"),
|
||||||
|
QObject::tr("Trim 5 Down"), QObject::tr("Trim 5 Up"),
|
||||||
|
QObject::tr("Trim 6 Down"), QObject::tr("Trim 6 Up")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const QString rotaryEncoders[] = {
|
static const QString rotaryEncoders[] = {
|
||||||
|
|
|
@ -52,7 +52,6 @@ enum Capability {
|
||||||
MultiLangVoice,
|
MultiLangVoice,
|
||||||
ModelImage,
|
ModelImage,
|
||||||
SwitchesPositions,
|
SwitchesPositions,
|
||||||
NumTrimSwitches,
|
|
||||||
CustomFunctions,
|
CustomFunctions,
|
||||||
SafetyChannelCustomFunction,
|
SafetyChannelCustomFunction,
|
||||||
LogicalSwitches,
|
LogicalSwitches,
|
||||||
|
|
|
@ -517,11 +517,6 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||||
return getBoardCapability(board, Board::Switches) * 3;
|
return getBoardCapability(board, Board::Switches) * 3;
|
||||||
else
|
else
|
||||||
return 9;
|
return 9;
|
||||||
case NumTrimSwitches:
|
|
||||||
if (IS_HORUS(board))
|
|
||||||
return 12;
|
|
||||||
else
|
|
||||||
return 8;
|
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
if (IS_ARM(board))
|
if (IS_ARM(board))
|
||||||
return 64;
|
return 64;
|
||||||
|
@ -735,48 +730,60 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||||
QString OpenTxFirmware::getAnalogInputName(unsigned int index)
|
QString OpenTxFirmware::getAnalogInputName(unsigned int index)
|
||||||
{
|
{
|
||||||
if (index < 4) {
|
if (index < 4) {
|
||||||
const QString sticks[] = { QObject::tr("Rud"),
|
const QString sticks[] = {
|
||||||
|
QObject::tr("Rud"),
|
||||||
QObject::tr("Ele"),
|
QObject::tr("Ele"),
|
||||||
QObject::tr("Thr"),
|
QObject::tr("Thr"),
|
||||||
QObject::tr("Ail") };
|
QObject::tr("Ail")
|
||||||
|
};
|
||||||
return sticks[index];
|
return sticks[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
index -= 4;
|
index -= 4;
|
||||||
|
|
||||||
if (IS_9X(board) || IS_2560(board) || IS_SKY9X(board)) {
|
if (IS_9X(board) || IS_2560(board) || IS_SKY9X(board)) {
|
||||||
const QString pots[] = { QObject::tr("P1"),
|
const QString pots[] = {
|
||||||
|
QObject::tr("P1"),
|
||||||
QObject::tr("P2"),
|
QObject::tr("P2"),
|
||||||
QObject::tr("P3") };
|
QObject::tr("P3")
|
||||||
|
};
|
||||||
return CHECK_IN_ARRAY(pots, index);
|
return CHECK_IN_ARRAY(pots, index);
|
||||||
}
|
}
|
||||||
else if (IS_TARANIS_X9E(board)) {
|
else if (IS_TARANIS_X9E(board)) {
|
||||||
const QString pots[] = { QObject::tr("F1"),
|
const QString pots[] = {
|
||||||
|
QObject::tr("F1"),
|
||||||
QObject::tr("F2"),
|
QObject::tr("F2"),
|
||||||
QObject::tr("F3"),
|
QObject::tr("F3"),
|
||||||
QObject::tr("F4"),
|
QObject::tr("F4"),
|
||||||
QObject::tr("S1"),
|
QObject::tr("S1"),
|
||||||
QObject::tr("S2"),
|
QObject::tr("S2"),
|
||||||
QObject::tr("LS"),
|
QObject::tr("LS"),
|
||||||
QObject::tr("RS") };
|
QObject::tr("RS")
|
||||||
|
};
|
||||||
return CHECK_IN_ARRAY(pots, index);
|
return CHECK_IN_ARRAY(pots, index);
|
||||||
}
|
}
|
||||||
else if (IS_TARANIS(board)) {
|
else if (IS_TARANIS(board)) {
|
||||||
const QString pots[] = {QObject::tr("S1"),
|
const QString pots[] = {
|
||||||
|
QObject::tr("S1"),
|
||||||
QObject::tr("S2"),
|
QObject::tr("S2"),
|
||||||
QObject::tr("S3"),
|
QObject::tr("S3"),
|
||||||
QObject::tr("LS"),
|
QObject::tr("LS"),
|
||||||
QObject::tr("RS")};
|
QObject::tr("RS")
|
||||||
|
};
|
||||||
return CHECK_IN_ARRAY(pots, index);
|
return CHECK_IN_ARRAY(pots, index);
|
||||||
}
|
}
|
||||||
else if (IS_HORUS(board)) {
|
else if (IS_HORUS(board)) {
|
||||||
const QString pots[] = {QObject::tr("S1"),
|
const QString pots[] = {
|
||||||
|
QObject::tr("S1"),
|
||||||
QObject::tr("6P"),
|
QObject::tr("6P"),
|
||||||
QObject::tr("S2"),
|
QObject::tr("S2"),
|
||||||
QObject::tr("L1"),
|
QObject::tr("L1"),
|
||||||
QObject::tr("L2"),
|
QObject::tr("L2"),
|
||||||
QObject::tr("LS"),
|
QObject::tr("LS"),
|
||||||
QObject::tr("RS")};
|
QObject::tr("RS"),
|
||||||
|
QObject::tr("JSx"),
|
||||||
|
QObject::tr("JSy")
|
||||||
|
};
|
||||||
return CHECK_IN_ARRAY(pots, index);
|
return CHECK_IN_ARRAY(pots, index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -387,7 +387,6 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
for (int i=-getCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
|
for (int i=-getCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,20 +395,17 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
for (int i=-getCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
|
for (int i=-getCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=-getCurrentFirmware()->getCapability(RotaryEncoders); i<0; i++) {
|
for (int i=-getCurrentFirmware()->getCapability(RotaryEncoders); i<0; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
|
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=-8; i<0; i++) {
|
for (int i = -getBoardCapability(board, Board::NumTrimSwitches); i < 0; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_TRIM, i);
|
item = RawSwitch(SWITCH_TYPE_TRIM, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=getCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
|
for (int i=getCurrentFirmware()->getCapability(MultiposPots)-1; i>=0; i--) {
|
||||||
|
@ -417,7 +413,6 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
for (int j=-getCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
|
for (int j=-getCurrentFirmware()->getCapability(MultiposPotsPositions); j<0; j++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,20 +423,17 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context == TimersContext) {
|
if (context == TimersContext) {
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_TIMER_MODE, i);
|
item = RawSwitch(SWITCH_TYPE_TIMER_MODE, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item = RawSwitch(SWITCH_TYPE_NONE);
|
item = RawSwitch(SWITCH_TYPE_NONE);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=getCurrentFirmware()->getCapability(SwitchesPositions); i++) {
|
for (int i=1; i<=getCurrentFirmware()->getCapability(SwitchesPositions); i++) {
|
||||||
|
@ -450,7 +442,6 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(MultiposPots); i++) {
|
for (int i=0; i<getCurrentFirmware()->getCapability(MultiposPots); i++) {
|
||||||
|
@ -458,28 +449,24 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
for (int j=1; j<=getCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
|
for (int j=1; j<=getCurrentFirmware()->getCapability(MultiposPotsPositions); j++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*getCurrentFirmware()->getCapability(MultiposPotsPositions)+j);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=8; i++) {
|
for (int i=1; i <= getBoardCapability(board, Board::NumTrimSwitches); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_TRIM, i);
|
item = RawSwitch(SWITCH_TYPE_TRIM, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=getCurrentFirmware()->getCapability(RotaryEncoders); i++) {
|
for (int i=1; i<=getCurrentFirmware()->getCapability(RotaryEncoders); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
|
item = RawSwitch(SWITCH_TYPE_ROTARY_ENCODER, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context != GlobalFunctionsContext) {
|
if (context != GlobalFunctionsContext) {
|
||||||
for (int i=1; i<=getCurrentFirmware()->getCapability(LogicalSwitches); i++) {
|
for (int i=1; i<=getCurrentFirmware()->getCapability(LogicalSwitches); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,11 +474,9 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
// ON
|
// ON
|
||||||
item = RawSwitch(SWITCH_TYPE_ON);
|
item = RawSwitch(SWITCH_TYPE_ON);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
// One
|
// One
|
||||||
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FMx
|
// FMx
|
||||||
|
@ -500,11 +485,17 @@ void populateSwitchCB(QComboBox * b, const RawSwitch & value, const GeneralSetti
|
||||||
for (int i=1; i<=getCurrentFirmware()->getCapability(FlightModes); i++) {
|
for (int i=1; i<=getCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i=0; i < b->count(); ++i) {
|
||||||
|
if (RawSwitch(b->itemData(i).toInt()) == value) {
|
||||||
|
b->setCurrentIndex(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b->setMaxVisibleItems(10);
|
b->setMaxVisibleItems(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +535,7 @@ void populateGVCB(QComboBox & b, int value, const ModelData & model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags)
|
void populateSourceCB(QComboBox * b, const RawSource & source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags)
|
||||||
{
|
{
|
||||||
Board::Type board = getCurrentBoard();
|
Board::Type board = getCurrentBoard();
|
||||||
RawSource item;
|
RawSource item;
|
||||||
|
@ -554,7 +545,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
if (flags & POPULATE_NONE) {
|
if (flags & POPULATE_NONE) {
|
||||||
item = RawSource(SOURCE_TYPE_NONE);
|
item = RawSource(SOURCE_TYPE_NONE);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_SCRIPT_OUTPUTS) {
|
if (flags & POPULATE_SCRIPT_OUTPUTS) {
|
||||||
|
@ -562,7 +552,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
for (int j=0; j<getCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
for (int j=0; j<getCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
||||||
item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j);
|
item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -573,39 +562,38 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
if (model->isInputValid(i)) {
|
if (model->isInputValid(i)) {
|
||||||
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
|
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_SOURCES) {
|
if (flags & POPULATE_SOURCES) {
|
||||||
for (int i=0; i<CPN_MAX_STICKS+getBoardCapability(getCurrentBoard(), Board::Pots)+getBoardCapability(getCurrentBoard(), Board::Sliders); i++) {
|
int totalSources = CPN_MAX_STICKS + getBoardCapability(board, Board::Pots) + getBoardCapability(board, Board::Sliders) + getBoardCapability(board, Board::MouseAnalogs);
|
||||||
|
for (int i=0; i < totalSources; i++) {
|
||||||
item = RawSource(SOURCE_TYPE_STICK, i);
|
item = RawSource(SOURCE_TYPE_STICK, i);
|
||||||
// skip unavailable pots and sliders
|
// skip unavailable pots and sliders
|
||||||
if (item.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS)) continue;
|
if (item.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS))
|
||||||
if (item.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-getBoardCapability(getCurrentBoard(), Board::Pots))) continue;
|
continue;
|
||||||
|
if (item.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-getBoardCapability(board, Board::Pots)))
|
||||||
|
continue;
|
||||||
|
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(RotaryEncoders); i++) {
|
for (int i=0; i<getCurrentFirmware()->getCapability(RotaryEncoders); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
|
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_TRIMS) {
|
if (flags & POPULATE_TRIMS) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i < getBoardCapability(board, Board::NumTrims); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_TRIM, i);
|
item = RawSource(SOURCE_TYPE_TRIM, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_SOURCES) {
|
if (flags & POPULATE_SOURCES) {
|
||||||
item = RawSource(SOURCE_TYPE_MAX);
|
item = RawSource(SOURCE_TYPE_MAX);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_SWITCHES) {
|
if (flags & POPULATE_SWITCHES) {
|
||||||
|
@ -617,13 +605,11 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
QVariant v(0);
|
QVariant v(0);
|
||||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||||
}
|
}
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(LogicalSwitches); i++) {
|
for (int i=0; i<getCurrentFirmware()->getCapability(LogicalSwitches); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
|
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,28 +617,24 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
for (int i=0; i<CPN_MAX_CYC; i++) {
|
for (int i=0; i<CPN_MAX_CYC; i++) {
|
||||||
item = RawSource(SOURCE_TYPE_CYC, i);
|
item = RawSource(SOURCE_TYPE_CYC, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(TrainerInputs); i++) {
|
for (int i=0; i<getCurrentFirmware()->getCapability(TrainerInputs); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_PPM, i);
|
item = RawSource(SOURCE_TYPE_PPM, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(Outputs); i++) {
|
for (int i=0; i<getCurrentFirmware()->getCapability(Outputs); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_CH, i);
|
item = RawSource(SOURCE_TYPE_CH, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_TELEMETRY) {
|
if (flags & POPULATE_TELEMETRY) {
|
||||||
if (IS_ARM(getCurrentBoard())) {
|
if (IS_ARM(board)) {
|
||||||
for (int i=0; i<5; ++i) {
|
for (int i=0; i<5; ++i) {
|
||||||
item = RawSource(SOURCE_TYPE_SPECIAL, i);
|
item = RawSource(SOURCE_TYPE_SPECIAL, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
|
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
|
||||||
if (model && model->sensorData[i].isAvailable()) { //this conditon must be false if we populate Global Functions where model = 0
|
if (model && model->sensorData[i].isAvailable()) { //this conditon must be false if we populate Global Functions where model = 0
|
||||||
|
@ -660,7 +642,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
|
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
// qDebug() << item.toString(model) << source.toString(model);
|
// qDebug() << item.toString(model) << source.toString(model);
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,7 +656,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
continue;
|
continue;
|
||||||
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
|
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -684,7 +664,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(Gvars); i++) {
|
for (int i=0; i<getCurrentFirmware()->getCapability(Gvars); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_GVAR, i);
|
item = RawSource(SOURCE_TYPE_GVAR, i);
|
||||||
b->addItem(item.toString(model), item.toValue());
|
b->addItem(item.toString(model), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i < b->count(); ++i) {
|
||||||
|
if (RawSource(b->itemData(i).toInt()) == source) {
|
||||||
|
b->setCurrentIndex(i);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||||
ui->trimCB->hide();
|
ui->trimCB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i < CPN_MAX_STICKS; i++) {
|
for(int i=0; i < getBoardCapability(getCurrentBoard(), Board::NumTrims); i++) {
|
||||||
ui->trimCB->addItem(firmware->getAnalogInputName(i), i+1);
|
ui->trimCB->addItem(RawSource(SOURCE_TYPE_TRIM, i).toString(), i+1);
|
||||||
}
|
}
|
||||||
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
|
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
|
||||||
|
|
||||||
|
|
|
@ -717,7 +717,7 @@ void SimulatorWidget::setValues()
|
||||||
// "get" values from this UI and send them to the firmware simulator.
|
// "get" values from this UI and send them to the firmware simulator.
|
||||||
void SimulatorWidget::getValues()
|
void SimulatorWidget::getValues()
|
||||||
{
|
{
|
||||||
static const int numTrims = firmware->getCapability(NumTrimSwitches);
|
static const int numTrims = getBoardCapability(m_board, Board::NumTrimSwitches);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TxInputs inp;
|
TxInputs inp;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue