chores(flysky): Separate AFHDS2A and AFHDS3 into 2 different module type (#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 <peter.feerick@gmail.com>
Co-authored-by: elecpower <neilh713@tpg.com.au>
Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com>
This commit is contained in:
Raphael Coeffic
2023-09-07 19:24:03 +10:00
committed by GitHub
co-authored by Peter Feerick elecpower Phil Mitchell
parent 9515d29c9d
commit c4f1e7127d
59 changed files with 1098 additions and 463 deletions
+46 -6
View File
@@ -47,7 +47,8 @@ enum ModuleType {
MODULE_TYPE_R9M_LITE_PRO_PXX2,
MODULE_TYPE_SBUS,
MODULE_TYPE_XJT_LITE_PXX2,
MODULE_TYPE_FLYSKY, //no more protocols possible because of 4 bits value
MODULE_TYPE_FLYSKY_AFHDS2A,
MODULE_TYPE_FLYSKY_AFHDS3,
MODULE_TYPE_LEMON_DSMP,
MODULE_TYPE_COUNT,
MODULE_TYPE_MAX = MODULE_TYPE_COUNT - 1
@@ -83,7 +84,8 @@ enum PulsesProtocol {
PULSES_XJT_LITE_X16,
PULSES_XJT_LITE_D8,
PULSES_XJT_LITE_LR12,
PULSES_AFHDS3,
PULSES_FLYSKY_AFHDS2A,
PULSES_FLYSKY_AFHDS3,
PULSES_GHOST,
PULSES_LEMON_DSMP,
PULSES_PROTOCOL_LAST
@@ -102,6 +104,11 @@ enum ModuleSubtypeR9M {
constexpr int PXX2_MAX_RECEIVERS_PER_MODULE = 3;
constexpr int PXX2_LEN_RX_NAME = 8;
static const QStringList afhds2aMode1List({"PWM", "PPM"});
static const QStringList afhds2aMode2List({"IBUS", "SBUS"});
static const QStringList afhds3PhyModeList({"Classic 18ch", "C-Fast 10ch", "Routine 18ch", "Fast 8ch", "Lora 12ch"});
static const QStringList afhds3EmiList({"CE", "FCC"});
class ModuleData {
Q_DECLARE_TR_FUNCTIONS(ModuleData)
@@ -118,7 +125,7 @@ class ModuleData {
unsigned int subType;
bool invertedSerial;
unsigned int channelsStart;
int channelsCount; // 0=8 channels
int channelsCount;
unsigned int failsafeMode;
struct PPM {
@@ -137,13 +144,36 @@ class ModuleData {
int optionValue;
} multi;
struct Afhds3 {
unsigned int rxFreq;
struct Flysky {
unsigned int rxId[4];
unsigned int mode;
unsigned int rfPower;
unsigned int reserved;
unsigned int rxFreq[2];
void setDefault() {
rxId[0] = rxId[1] = rxId[2] = rxId[3] = 0;
mode = 3;
rfPower = 0;
rxFreq[0] = 50;
rxFreq[1] = 0;
}
} flysky;
struct Afhds3 {
unsigned int emi;
unsigned int telemetry;
unsigned int phyMode;
unsigned int reserved;
unsigned int rfPower;
void setDefault() {
emi = 1;
telemetry = 0;
phyMode = 0;
reserved = 0;
rfPower = 0;
}
} afhds3;
struct PXX {
@@ -191,6 +221,16 @@ class ModuleData {
static AbstractStaticItemModel * internalModuleItemModel(int board = -1);
static bool isProtocolAvailable(int moduleidx, unsigned int protocol, GeneralSettings & generalSettings);
static AbstractStaticItemModel * protocolItemModel(GeneralSettings & settings);
static AbstractStaticItemModel * telemetryBaudrateItemModel(unsigned int protocol);
static AbstractStaticItemModel * telemetryBaudrateItemModel(unsigned int protocol);
static bool isAvailable(PulsesProtocol proto, int port = 0); // moved from OpenTxFirmware EdgeTX v2.9 - TODO remove and use isProtocolAvailable
QString afhds2aMode1ToString() const;
QString afhds2aMode2ToString() const;
QString afhds3PhyModeToString() const;
QString afhds3EmiToString() const;
static AbstractStaticItemModel * afhds2aMode1ItemModel();
static AbstractStaticItemModel * afhds2aMode2ItemModel();
static AbstractStaticItemModel * afhds3PhyModeItemModel();
static AbstractStaticItemModel * afhds3EmiItemModel();
};