Companion support for EXT3 EXT4 and FlySky gimbals
This commit is contained in:
committed by
Raphael Coeffic
parent
f6329895a8
commit
23c84633da
@@ -38,15 +38,14 @@
|
||||
#define CPN_MAX_MODULES 2
|
||||
#define CPN_MAX_STICKS Board::STICK_AXIS_COUNT
|
||||
#define CPN_MAX_TRIMS Board::TRIM_AXIS_COUNT
|
||||
#define CPN_MAX_KNOBS 8
|
||||
#define CPN_MAX_POTS 8
|
||||
#define CPN_MAX_SLIDERS 4
|
||||
#define CPN_MAX_POTS (CPN_MAX_KNOBS + CPN_MAX_SLIDERS)
|
||||
#define CPN_MAX_CYC 3
|
||||
#define CPN_MAX_SWITCHES 32
|
||||
#define CPN_MAX_FUNCTION_SWITCHES 6
|
||||
#define CPN_MAX_MOUSE_ANALOGS 2
|
||||
#define CPN_MAX_GYRO_ANALOGS 2
|
||||
#define CPN_MAX_ANALOGS (CPN_MAX_STICKS + CPN_MAX_POTS + CPN_MAX_MOUSE_ANALOGS + CPN_MAX_GYRO_ANALOGS)
|
||||
#define CPN_MAX_ANALOGS (CPN_MAX_STICKS + CPN_MAX_POTS + CPN_MAX_SLIDERS + CPN_MAX_MOUSE_ANALOGS + CPN_MAX_GYRO_ANALOGS)
|
||||
|
||||
#define CPN_STR_APP_NAME QCoreApplication::translate("Companion", "EdgeTX Companion")
|
||||
#define CPN_STR_TTL_INFO QCoreApplication::translate("Companion", "Information") // shared Title Case words, eg. for a window title or section heading
|
||||
|
||||
@@ -374,7 +374,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
else if (IS_TARANIS_X9E(board))
|
||||
return 4;
|
||||
else if (IS_HORUS_X10(board) || IS_FAMILY_T16(board))
|
||||
return 5;
|
||||
return 7;
|
||||
else if (IS_HORUS_X12S(board))
|
||||
return 3;
|
||||
else if (IS_FLYSKY_NV14(board))
|
||||
@@ -570,8 +570,8 @@ StringTagMappingTable Boards::getAnalogNamesLookupTable(Board::Type board)
|
||||
{"S2", "S2"},
|
||||
{"EX1", "EXT1"},
|
||||
{"EX2", "EXT2"},
|
||||
// {"EX3", "EXT3"},
|
||||
// {"EX4", "EXT4"},
|
||||
{"EX3", "EXT3"},
|
||||
{"EX4", "EXT4"},
|
||||
{"LS", "LS"},
|
||||
{"RS", "RS"},
|
||||
});
|
||||
|
||||
@@ -41,9 +41,8 @@ const YamlLookupTable switchConfigLut = {
|
||||
};
|
||||
|
||||
const YamlLookupTable potsLut = {
|
||||
{0, "S1"}, {1, "6POS"}, {2, "S2"}, {3, "EXT1"}, {4, "EXT2"},
|
||||
// { 5, "EXT3" },
|
||||
// { 6, "EXT4" },
|
||||
{0, "S1"}, {1, "6POS"}, {2, "S2"},
|
||||
{3, "EXT1"}, {4, "EXT2"}, {5, "EXT3"}, {6, "EXT4"},
|
||||
};
|
||||
|
||||
const YamlLookupTable potConfigLut = {
|
||||
|
||||
@@ -79,7 +79,7 @@ typedef YamlKnobConfig<CPN_MAX_SWITCHES, switchesLut, switchConfigLut>
|
||||
// name:
|
||||
extern const YamlLookupTable potsLut;
|
||||
extern const YamlLookupTable potConfigLut;
|
||||
typedef YamlKnobConfig<CPN_MAX_KNOBS, potsLut, potConfigLut> YamlPotConfig;
|
||||
typedef YamlKnobConfig<CPN_MAX_POTS, potsLut, potConfigLut> YamlPotConfig;
|
||||
|
||||
// S1:
|
||||
// type: with_detent
|
||||
|
||||
@@ -167,7 +167,8 @@ enum Capability {
|
||||
TopBarZones,
|
||||
FunctionSwitches,
|
||||
Has,
|
||||
HasModelsList
|
||||
HasModelsList,
|
||||
HasFlySkyGimbals
|
||||
};
|
||||
|
||||
class EEPROMInterface
|
||||
|
||||
@@ -54,14 +54,18 @@ bool GeneralSettings::switchSourceAllowedTaranis(int index) const
|
||||
|
||||
bool GeneralSettings::isPotAvailable(int index) const
|
||||
{
|
||||
if (index < 0 || index > Boards::getCapability(getCurrentBoard(), Board::Pots))
|
||||
int numPots = Boards::getCapability(getCurrentBoard(), Board::Pots);
|
||||
if (getCurrentFirmware()->getCapability(HasFlySkyGimbals))
|
||||
numPots -= 2;
|
||||
|
||||
if (index < 0 || index >= numPots)
|
||||
return false;
|
||||
return potConfig[index] != Board::POT_NONE;
|
||||
}
|
||||
|
||||
bool GeneralSettings::isSliderAvailable(int index) const
|
||||
{
|
||||
if (index < 0 || index > Boards::getCapability(getCurrentBoard(), Board::Sliders))
|
||||
if (index < 0 || index >= Boards::getCapability(getCurrentBoard(), Board::Sliders))
|
||||
return false;
|
||||
return sliderConfig[index] != Board::SLIDER_NONE;
|
||||
}
|
||||
|
||||
@@ -231,8 +231,8 @@ class GeneralSettings {
|
||||
char switchName[CPN_MAX_SWITCHES][HARDWARE_NAME_LEN + 1];
|
||||
unsigned int switchConfig[CPN_MAX_SWITCHES];
|
||||
char stickName[CPN_MAX_STICKS][HARDWARE_NAME_LEN + 1];
|
||||
char potName[CPN_MAX_KNOBS][HARDWARE_NAME_LEN + 1];
|
||||
unsigned int potConfig[CPN_MAX_KNOBS];
|
||||
char potName[CPN_MAX_POTS][HARDWARE_NAME_LEN + 1];
|
||||
unsigned int potConfig[CPN_MAX_POTS];
|
||||
char sliderName[CPN_MAX_SLIDERS][HARDWARE_NAME_LEN + 1];
|
||||
unsigned int sliderConfig[CPN_MAX_SLIDERS];
|
||||
|
||||
|
||||
@@ -145,8 +145,8 @@ class ModelData {
|
||||
unsigned int switchWarningEnable;
|
||||
unsigned int thrTrimSwitch;
|
||||
unsigned int potsWarningMode;
|
||||
bool potsWarnEnabled[CPN_MAX_POTS];
|
||||
int potsWarnPosition[CPN_MAX_POTS];
|
||||
bool potsWarnEnabled[CPN_MAX_POTS + CPN_MAX_SLIDERS];
|
||||
int potsWarnPosition[CPN_MAX_POTS + CPN_MAX_SLIDERS];
|
||||
bool displayChecklist;
|
||||
|
||||
GVarData gvarData[CPN_MAX_GVARS];
|
||||
|
||||
@@ -79,6 +79,8 @@ inline int MAX_POTS(Board::Type board, int version)
|
||||
{
|
||||
if (version <= 218 && IS_FAMILY_HORUS_OR_T16(board))
|
||||
return 3;
|
||||
if (version <= 220 && (IS_HORUS_X10(board) || IS_FAMILY_T16(board)))
|
||||
return 5;
|
||||
if (IS_FAMILY_T12(board))
|
||||
return 2;
|
||||
return Boards::getCapability(board, Board::Pots);
|
||||
@@ -95,7 +97,7 @@ inline int MAX_POTS_STORAGE(Board::Type board, int version)
|
||||
{
|
||||
if (version <= 218 && IS_FAMILY_HORUS_OR_T16(board))
|
||||
return 3;
|
||||
if (version >= 219 && IS_FAMILY_HORUS_OR_T16(board))
|
||||
if (version <= 220 && IS_FAMILY_HORUS_OR_T16(board) && !IS_FLYSKY_NV14(board))
|
||||
return 5;
|
||||
if (IS_FAMILY_T12(board))
|
||||
return 2;
|
||||
@@ -105,6 +107,8 @@ inline int MAX_POTS_STORAGE(Board::Type board, int version)
|
||||
inline int MAX_POTS_SOURCES(Board::Type board, int version)
|
||||
{
|
||||
if (version <= 218 && IS_FAMILY_HORUS_OR_T16(board))
|
||||
return 3;
|
||||
if (version <= 220 && (IS_HORUS_X10(board) || IS_FAMILY_T16(board)))
|
||||
return 5;
|
||||
if (IS_FAMILY_T12(board))
|
||||
return 2;
|
||||
@@ -340,6 +344,8 @@ class SourcesConversionTable: public ConversionTable {
|
||||
int offset = 0;
|
||||
if (version <= 218 && IS_HORUS_X10(board) && i >= CPN_MAX_STICKS + MAX_POTS_STORAGE(board, version))
|
||||
offset += 2;
|
||||
if (version <= 220 && (IS_HORUS_X10(board) || IS_FAMILY_T16(board)) && i >= CPN_MAX_STICKS + MAX_POTS_STORAGE(board, version))
|
||||
offset += 2;
|
||||
|
||||
addConversion(RawSource(SOURCE_TYPE_STICK, i + offset), val++);
|
||||
}
|
||||
@@ -2947,6 +2953,9 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
if (version <= 218 && IS_HORUS_X10(board) && (i == CPN_MAX_STICKS + 3)) {
|
||||
input += 2;
|
||||
}
|
||||
if (version <= 220 && IS_FAMILY_HORUS_OR_T16(board) && (i == CPN_MAX_STICKS + 5)) { // make room for EXT3 and EXT4
|
||||
input += 2;
|
||||
}
|
||||
internalField.Append(new SignedField<16>(this, generalData.calibMid[input]));
|
||||
internalField.Append(new SignedField<16>(this, generalData.calibSpanNeg[input]));
|
||||
internalField.Append(new SignedField<16>(this, generalData.calibSpanPos[input]));
|
||||
|
||||
@@ -761,6 +761,8 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
return IS_JUMPER_TPRO(board) ? 6 : 0;
|
||||
case HasModelsList:
|
||||
return IS_FAMILY_HORUS_OR_T16(board);
|
||||
case HasFlySkyGimbals:
|
||||
return (IS_RADIOMASTER_TX16S(board) && id.contains("flyskygimbals"));
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -982,6 +984,12 @@ EepromLoadErrors OpenTxEepromInterface::checkVersion(unsigned int version)
|
||||
// ALL: TimerData countdownStart invert value
|
||||
// ALL: convert more fields from zchar to normal string
|
||||
// COLORLCD: change CustomScreenData and TopBarPersistentData
|
||||
return OLD_VERSION;
|
||||
|
||||
case 221:
|
||||
// ALL: YAML storage
|
||||
// X10PCB: add pots EXT3 and EXT4 (conversion required as shifts slider settings in multiple fields)
|
||||
// RM TX16S: add Flysky gimbals firmware build option and repurpose EXT3 and EXT4 if selected
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1444,6 +1452,7 @@ void registerOpenTxFirmwares()
|
||||
static const Firmware::Option opt_internal_gps("internalgps", Firmware::tr("Support internal GPS"));
|
||||
firmware->addOptionsGroup({opt_bt, opt_internal_gps});
|
||||
firmware->addOption("externalaccessmod", Firmware::tr("Support hardware mod: R9M ACCESS"));
|
||||
firmware->addOption("flyskygimbals", Firmware::tr("Support hardware mod: FlySky Paladin EV Gimbals"));
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* Jumper T18 board */
|
||||
|
||||
@@ -25,15 +25,22 @@
|
||||
CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
GeneralPanel(parent, generalSettings, firmware)
|
||||
{
|
||||
int rows = Boards::getCapability(getCurrentBoard(), Board::MaxAnalogs);
|
||||
Board::Type board = getCurrentBoard();
|
||||
int rows = Boards::getCapability(board, Board::MaxAnalogs);
|
||||
|
||||
QStringList headerLabels;
|
||||
headerLabels << "" << tr("Negative span") << tr("Mid value") << tr("Positive span");
|
||||
|
||||
TableLayout * tableLayout = new TableLayout(this, rows, headerLabels);
|
||||
|
||||
for (int i = 0; i < rows; i++) {
|
||||
for (int i = 0, row = 0; i < rows; i++) {
|
||||
int col = 0;
|
||||
if (firmware->getCapability(HasFlySkyGimbals) &&
|
||||
i >= (Boards::getCapability(board, Board::Sticks) + 5) &&
|
||||
i < (Boards::getCapability(board, Board::Sticks) + 7))
|
||||
continue;
|
||||
|
||||
row++;
|
||||
QLabel * label = new QLabel(this);
|
||||
label->setText(firmware->getAnalogInputName(i));
|
||||
tableLayout->addWidget(i, col++, label);
|
||||
|
||||
@@ -64,7 +64,8 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
}
|
||||
|
||||
count = Boards::getCapability(board, Board::Pots);
|
||||
if (count) {
|
||||
count -= firmware->getCapability(HasFlySkyGimbals) ? 2 : 0;
|
||||
if (count > 0) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
addPot(i, row);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void joystickDialog::populateSourceCombo(QComboBox * cb)
|
||||
for (i=0; i < Board::STICK_AXIS_COUNT; ++i) {
|
||||
cb->addItem(Boards::getAxisName(i) % tr(" Stick"), i);
|
||||
}
|
||||
for (; i < Board::STICK_AXIS_COUNT + CPN_MAX_POTS; ++i) {
|
||||
for (; i < Board::STICK_AXIS_COUNT + CPN_MAX_POTS + CPN_MAX_SLIDERS; ++i) {
|
||||
cb->addItem(tr("Knob/Slider %1").arg(i - Board::STICK_AXIS_COUNT + 1), i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user