Companion support for EXT3 EXT4 and FlySky gimbals

This commit is contained in:
elecpower
2021-12-31 10:53:10 +01:00
committed by Raphael Coeffic
parent f6329895a8
commit 23c84633da
13 changed files with 51 additions and 22 deletions
+3 -3
View File
@@ -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
+2 -1
View File
@@ -167,7 +167,8 @@ enum Capability {
TopBarZones,
FunctionSwitches,
Has,
HasModelsList
HasModelsList,
HasFlySkyGimbals
};
class EEPROMInterface
+6 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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];
+2 -2
View File
@@ -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 */