Skip to content

Commit

Permalink
chores(flysky): Separate AFHDS2A and AFHDS3 into 2 different module t…
Browse files Browse the repository at this point in the history
…ype (#3783)

* chores(flysky): separate AFHDS2A and AFHDS3 into 2 different module type

This should allow to remove some of the hacks added earlier.

* chore: Add some EL18 CI bits

* fix(afhds): cmake defs

* fix(ci): add el18 to commit-tests.sh

* chore(cpn): separate AFHDS2A and AFHDS3

* chore(cpn): remove binary import of afhds and legacy fxFreq field for afhds3

* fix(cpn): limit available internal afhds protocols to those supported by hardware

* chore(cpn): update Flysky int module test

* fix(cpn): compile error

* fix(cpn): afhds2a max channels

* fix: TR_MODULE_PROTOCOLS

* enh(cpn): more support for afhds2a and 3

* fix(cpn): rebase compile error

* fix(cpn): bit indexes

* fix(cpn): emi toString

* fix(cpn): limit available internal afhds protocols to those supported by hardware

* enh(cpn): add support for Flysky EL18

* fix(cpn): available protocols

* fix(cpn): rebase moduledata

* chore(cpn): add module fields to model print

* Separate AFHDS2A and AFHDS3 UI settings.

* Fix AFHDS3 conversion from old subtype value.
Fix 'Channel Range' layout on portrait LCD.

* Fix name.

---------

Co-authored-by: Peter Feerick <[email protected]>
Co-authored-by: elecpower <[email protected]>
Co-authored-by: Phil Mitchell <[email protected]>
  • Loading branch information
4 people authored Sep 7, 2023
1 parent 9515d29 commit c4f1e71
Show file tree
Hide file tree
Showing 59 changed files with 1,096 additions and 461 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,22 @@ jobs:
strategy:
matrix:
target:
- x9dp2019
- tx16s
- nv14
- el18
- t12
- t16
- t18
- t8
- tlite
- t20
- tx12
- tx16s
- x10
- x12s
- x7
- x9d
- x9dp
- x9dp2019
- x9e
- x9lite
- x9lites
Expand Down Expand Up @@ -92,7 +93,7 @@ jobs:
strategy:
matrix:
target:
- nv14
- nv14;el18
- t12
- t16
- t18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
target:
- nv14
- nv14;el18
- t12
- t16
- t18
Expand Down
2 changes: 2 additions & 0 deletions companion/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ elseif(PCB STREQUAL X10 AND PCBREV STREQUAL TX16S)
set(FLAVOUR tx16s)
elseif(PCB STREQUAL X10 AND PCBREV STREQUAL T18)
set(FLAVOUR t18)
elseif(PCB STREQUAL NV14 AND PCBREV STREQUAL EL18)
set(FLAVOUR el18)
else()
string(TOLOWER ${PCB} FLAVOUR)
endif()
Expand Down
1 change: 0 additions & 1 deletion companion/src/firmwares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ set(firmwares_SRCS
sensordata.cpp
telem_data.cpp
timerdata.cpp
afhds3.cpp
ersky9x/ersky9xeeprom.cpp
ersky9x/ersky9xinterface.cpp
opentx/opentxeeprom.cpp
Expand Down
12 changes: 0 additions & 12 deletions companion/src/firmwares/afhds3.cpp

This file was deleted.

12 changes: 0 additions & 12 deletions companion/src/firmwares/afhds3.h

This file was deleted.

69 changes: 33 additions & 36 deletions companion/src/firmwares/boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ uint32_t Boards::getFourCC(Type board)
return 0x4378746F;
case BOARD_FLYSKY_NV14:
return 0x3A78746F;
case BOARD_FLYSKY_EL18:
return 0x3A78746F; // TODO: check this
default:
return 0;
}
Expand Down Expand Up @@ -153,6 +155,7 @@ int Boards::getEEpromSize(Board::Type board)
case BOARD_JUMPER_T18:
case BOARD_RADIOMASTER_TX16S:
case BOARD_FLYSKY_NV14:
case BOARD_FLYSKY_EL18:
return 0;
default:
return 0;
Expand Down Expand Up @@ -196,6 +199,7 @@ int Boards::getFlashSize(Type board)
case BOARD_JUMPER_T18:
case BOARD_RADIOMASTER_TX16S:
case BOARD_FLYSKY_NV14:
case BOARD_FLYSKY_EL18:
return FSIZE_HORUS;
case BOARD_UNKNOWN:
return FSIZE_MAX;
Expand Down Expand Up @@ -342,7 +346,7 @@ SwitchInfo Boards::getSwitchInfo(Board::Type board, int index)
if (index < DIM(switches))
return switches[index];
}
else if (IS_FLYSKY_NV14(board)) {
else if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) {
const Board::SwitchInfo switches[] = {
{SWITCH_2POS, "SA"},
{SWITCH_3POS, "SB"},
Expand Down Expand Up @@ -434,7 +438,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 7;
else if (IS_HORUS_X12S(board))
return 3;
else if (IS_FLYSKY_NV14(board))
else if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
return 2;
else
return 3;
Expand Down Expand Up @@ -466,10 +470,11 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 0;

case MaxAnalogs:
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) + getCapability(board, Board::MouseAnalogs) + getCapability(board, Board::GyroAnalogs);
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) +
getCapability(board, Board::MouseAnalogs) + getCapability(board, Board::GyroAnalogs);

case MultiposPots:
if (IS_HORUS_OR_TARANIS(board) && !IS_FLYSKY_NV14(board))
if (IS_HORUS_OR_TARANIS(board) && !(IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)))
return getCapability(board, Board::Pots);
else
return 0;
Expand All @@ -492,7 +497,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
board == BOARD_JUMPER_TPRO || board == BOARD_BETAFPV_LR3PRO ||
board == BOARD_IFLIGHT_COMMANDO8)
return 4;
else if (board == BOARD_FLYSKY_NV14)
else if (board == BOARD_FLYSKY_NV14 || board == BOARD_FLYSKY_EL18)
return 8;
else if (board == BOARD_RADIOMASTER_TX12_MK2 || board == BOARD_RADIOMASTER_BOXER)
return 6;
Expand Down Expand Up @@ -527,7 +532,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return getCapability(board, Board::Switches);

case SwitchPositions:
if (IS_HORUS_OR_TARANIS(board) || IS_FLYSKY_NV14(board))
if (IS_HORUS_OR_TARANIS(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
return getCapability(board, Board::Switches) * 3;
else
return 9;
Expand All @@ -537,7 +542,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)


case NumTrims:
if (IS_FAMILY_HORUS_OR_T16(board) && !IS_FLYSKY_NV14(board))
if (IS_FAMILY_HORUS_OR_T16(board) && !(IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)))
return 6;
else if (IS_IFLIGHT_COMMANDO8(board))
return 0;
Expand All @@ -563,12 +568,12 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return (IS_STM32(board) && !IS_RADIOMASTER_T8(board));

case HasAudioMuteGPIO:
// All color lcd (including NV14) except Horus X12S
// All color lcd (including NV14 and EL18) except Horus X12S
// TX12, TX12MK2, ZORRO, BOXER, T8, TLITE, TPRO, LR3PRO, COMMANDO8
return (IS_FAMILY_HORUS_OR_T16(board) && !IS_HORUS_X12S(board)) || IS_FAMILY_T12(board);

case SportMaxBaudRate:
if (IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board) || IS_TARANIS_X7_ACCESS(board) ||
if (IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board) || IS_TARANIS_X7_ACCESS(board) ||
(IS_TARANIS(board) && !IS_TARANIS_XLITE(board) && !IS_TARANIS_X7(board) && !IS_TARANIS_X9LITE(board)))
return 400000; // 400K and higher
else
Expand Down Expand Up @@ -685,31 +690,16 @@ StringTagMappingTable Boards::getAnalogNamesLookupTable(Board::Type board, const
});
}
} else if (IS_RADIOMASTER_BOXER(board)) {
if (version < adcVersion) {
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "POT1"},
{tr("S2").toStdString(), "POT2"},
{tr("S3").toStdString(), "POT3"},
});
} else {
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "P1", 4},
{tr("S2").toStdString(), "P2", 5},
{tr("S3").toStdString(), "P3", 6},
});
}
} else if ((IS_TARANIS_SMALL(board) && !IS_JUMPER_TLITE(board)) || IS_FLYSKY_NV14(board)) {
if (version < adcVersion) {
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "POT1"},
{tr("S2").toStdString(), "POT2"},
});
} else {
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "P1", 4},
{tr("S2").toStdString(), "P2", 5},
});
}
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "POT1"},
{tr("S2").toStdString(), "POT2"},
{tr("S3").toStdString(), "POT3"},
});
} else if ((IS_TARANIS_SMALL(board) && !IS_JUMPER_TLITE(board)) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) {
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "POT1"},
{tr("S2").toStdString(), "POT2"},
});
} else if (IS_TARANIS_X9(board)) {
if (version < adcVersion) {
tbl.insert(tbl.end(), {
Expand Down Expand Up @@ -872,6 +862,8 @@ QString Boards::getBoardName(Board::Type board)
return "Radiomaster T8";
case BOARD_FLYSKY_NV14:
return "FlySky NV14";
case BOARD_FLYSKY_EL18:
return "FlySky EL18";
case BOARD_BETAFPV_LR3PRO:
return "BETAFPV LR3PRO";
case BOARD_IFLIGHT_COMMANDO8:
Expand Down Expand Up @@ -1043,7 +1035,9 @@ QList<int> Boards::getSupportedInternalModules(Board::Type board)
if (IS_TARANIS_X9DP_2019(board) || IS_TARANIS_X7_ACCESS(board)) {
modules.append({(int)MODULE_TYPE_ISRM_PXX2});
} else if (IS_FLYSKY_NV14(board)) {
modules.append({(int)MODULE_TYPE_FLYSKY});
modules.append({(int)MODULE_TYPE_FLYSKY_AFHDS2A});
} else if (IS_FLYSKY_EL18(board)) {
modules.append({(int)MODULE_TYPE_FLYSKY_AFHDS3});
} else if (IS_FAMILY_HORUS_OR_T16(board) || IS_FAMILY_T12(board)
|| (IS_TARANIS_SMALL(board) && IS_ACCESS_RADIO(board))) {
modules.append({
Expand Down Expand Up @@ -1098,7 +1092,10 @@ int Boards::getDefaultInternalModules(Board::Type board)
return (int)MODULE_TYPE_CROSSFIRE;

case BOARD_FLYSKY_NV14:
return (int)MODULE_TYPE_FLYSKY;
return (int)MODULE_TYPE_FLYSKY_AFHDS2A;

case BOARD_FLYSKY_EL18:
return (int)MODULE_TYPE_FLYSKY_AFHDS3;

default:
return (int)MODULE_TYPE_NONE;
Expand Down
4 changes: 2 additions & 2 deletions companion/src/firmwares/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ inline bool IS_FAMILY_HORUS(Board::Type board)

inline bool IS_FAMILY_HORUS_OR_T16(Board::Type board)
{
return IS_FAMILY_HORUS(board) || IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board)/*generally*/;
return IS_FAMILY_HORUS(board) || IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board)/*generally*/ || IS_FLYSKY_EL18(board)/*generally*/;
}

inline bool IS_HORUS_OR_TARANIS(Board::Type board)
Expand All @@ -450,7 +450,7 @@ inline bool IS_HORUS_OR_TARANIS(Board::Type board)

inline bool IS_STM32(Board::Type board)
{
return IS_TARANIS(board) || IS_FAMILY_HORUS_OR_T16(board) || IS_FLYSKY_NV14(board);
return IS_TARANIS(board) || IS_FAMILY_HORUS_OR_T16(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board);
}

inline bool IS_ARM(Board::Type board)
Expand Down
4 changes: 3 additions & 1 deletion companion/src/firmwares/edgetx/yaml_generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ const YamlLookupTable internalModuleLut = {
{ MODULE_TYPE_R9M_LITE_PRO_PXX2, "TYPE_R9M_LITE_PRO_PXX2" },
{ MODULE_TYPE_SBUS, "TYPE_SBUS" },
{ MODULE_TYPE_XJT_LITE_PXX2, "TYPE_XJT_LITE_PXX2" },
{ MODULE_TYPE_FLYSKY, "TYPE_FLYSKY" },
{ MODULE_TYPE_FLYSKY_AFHDS2A, "TYPE_FLYSKY_AFHDS2A" },
{ MODULE_TYPE_FLYSKY_AFHDS3, "TYPE_FLYSKY_AFHDS3" },
{ MODULE_TYPE_LEMON_DSMP, "TYPE_LEMON_DSMP" },
};

YamlTelemetryBaudrate::YamlTelemetryBaudrate(
Expand Down
Loading

0 comments on commit c4f1e71

Please sign in to comment.