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
@@ -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]));