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
+2
View File
@@ -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()
-1
View File
@@ -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
-12
View File
@@ -1,12 +0,0 @@
#include "afhds3.h"
#include "macros.h"
QString Afhds3Data::protocolToString(unsigned int protocol) {
const char * const afhds3Protocols[] = {
"PWM/IBUS",
"PWM/SBUS",
"PPM/IBUS",
"PPM/SBUS",
};
return CHECK_IN_ARRAY(afhds3Protocols, protocol);
}
-12
View File
@@ -1,12 +0,0 @@
#ifndef AFHDS3_H
#define AFHDS3_H
#include <QtCore>
class Afhds3Data
{
Q_DECLARE_TR_FUNCTIONS(Afhds3)
public:
static QString protocolToString(unsigned int protocol);
};
#endif // AFHDS3_H
+33 -36
View File
@@ -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;
}
@@ -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;
@@ -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;
@@ -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"},
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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
@@ -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(), {
@@ -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:
@@ -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({
@@ -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;
+2 -2
View File
@@ -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)
@@ -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)
@@ -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(
@@ -54,8 +54,8 @@
// channelsStart: 0
// channelsCount: 18
// failsafeMode: NOT_SET
// mod:
// afhds3:
// mod:
// afhds3:
// emi: 2
// telemetry: 1
// phyMode: 2
@@ -78,10 +78,15 @@ static const YamlLookupTable protocolLut = {
{ PULSES_ACCESS_R9M_LITE_PRO, "TYPE_R9M_LITE_PRO_PXX2" },
{ PULSES_SBUS, "TYPE_SBUS" },
{ PULSES_XJT_LITE_X16, "TYPE_XJT_LITE_PXX2" },
{ PULSES_AFHDS3, "TYPE_FLYSKY" },
{ PULSES_FLYSKY_AFHDS2A, "TYPE_FLYSKY_AFHDS2A" },
{ PULSES_FLYSKY_AFHDS3, "TYPE_FLYSKY_AFHDS3" },
{ PULSES_LEMON_DSMP, "TYPE_LEMON_DSMP" },
};
static const YamlLookupTable oldprotocolLut = {
{ PULSES_FLYSKY_AFHDS2A, "TYPE_FLYSKY" },
};
static const YamlLookupTable xjtLut = {
{ 0, "D16" },
{ 1, "D8" },
@@ -111,9 +116,10 @@ static const YamlLookupTable dsmLut = {
{ 2, "DSMX" },
};
// depreciated - used for decoding and converting module subtype to protocol
static const YamlLookupTable afhdsLut = {
{ 0, "AFHDS3" },
{ 1, "AFHDS2A" } // could be complete nonsense, CHECK IT!
{ 0, "AFHDS2A" },
{ 1, "AFHDS3" }
};
static const YamlLookupTable failsafeLut = {
@@ -166,7 +172,7 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
break;
case PULSES_PPM:
node["subType"] = LookupValue(ppmLut, subtype);
break;
break;
case PULSES_MULTIMODULE: {
int rfProtocol = rhs.multi.rfProtocol + 1;
int subType = rhs.subType;
@@ -175,10 +181,6 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
st_str += std::to_string(subType);
node["subType"] = st_str;
} break;
case PULSES_AFHDS3: {
node["subType"] = LookupValue(afhdsLut, subtype);
break;
}
}
node["channelsStart"] = rhs.channelsStart;
@@ -246,9 +248,20 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
dsmp["flags"] = rhs.dsmp.flags;
mod["dsmp"] = dsmp;
} break;
// TODO: flysky
// TODO: afhds3
case PULSES_AFHDS3: {
case PULSES_FLYSKY_AFHDS2A: {
Node flysky;
for (int i = 0; i < 4; i++) {
flysky["rx_id"][std::to_string(i)]["val"] = rhs.flysky.rxId[i];
}
flysky["mode"] = rhs.flysky.mode;
flysky["rfPower"] = rhs.flysky.rfPower;
flysky["reserved"] = rhs.flysky.reserved;
for (int i = 0; i < 2; i++) {
flysky["rx_freq"][std::to_string(i)]["val"] = rhs.flysky.rxFreq[i];
}
mod["flysky"] = flysky;
} break;
case PULSES_FLYSKY_AFHDS3: {
Node afhds3;
afhds3["emi"] = rhs.afhds3.emi;
afhds3["telemetry"] = rhs.afhds3.telemetry;
@@ -275,6 +288,8 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
bool convert<ModuleData>::decode(const Node& node, ModuleData& rhs)
{
node["type"] >> protocolLut >> rhs.protocol;
if (rhs.protocol < 0)
node["type"] >> oldprotocolLut >> rhs.protocol;
Node subType;
node["subType"] >> subType;
@@ -319,6 +334,12 @@ bool convert<ModuleData>::decode(const Node& node, ModuleData& rhs)
} catch(...) {}
}
} break;
case PULSES_FLYSKY_AFHDS2A: {
int subProto = 0;
subType >> afhdsLut >> subProto;
rhs.protocol += subProto;
rhs.subType = 0;
} break;
}
node["channelsStart"] >> rhs.channelsStart;
@@ -381,15 +402,37 @@ bool convert<ModuleData>::decode(const Node& node, ModuleData& rhs)
Node dsmp = mod["dsmp"];
dsmp["flags"] >> rhs.dsmp.flags;
} else if (mod["flysky"]) {
// TODO: flysky
Node flysky = mod["flysky"];
for (int i = 0; i < 4; i++) {
if (flysky["rx_id"][std::to_string(i)]) {
Node rxid = flysky["rx_id"][std::to_string(i)];
if (rxid.IsMap()) {
if (rxid["val"]) {
rxid["val"] >> rhs.flysky.rxId[i];
}
}
}
}
flysky["mode"] >> rhs.flysky.mode;
flysky["rfPower"] >> rhs.flysky.rfPower;
flysky["reserved"] >> rhs.flysky.reserved;
for (int i = 0; i < 2; i++) {
if (flysky["rx_freq"][std::to_string(i)]) {
Node rxfreq = flysky["rx_freq"][std::to_string(i)];
if (rxfreq.IsMap()) {
if (rxfreq["val"]) {
rxfreq["val"] >> rhs.flysky.rxFreq[i];
}
}
}
}
} else if (mod["afhds3"]) {
// TODO: afhds3
Node afhds3 = mod["afhds3"];
afhds3["emi"] >> rhs.afhds3.emi;
afhds3["telemetry"] >> rhs.afhds3.telemetry;
afhds3["phyMode"] >> rhs.afhds3.phyMode;
afhds3["reserved"] >> rhs.afhds3.reserved;
afhds3["rfPower"] >> rhs.afhds3.rfPower;
Node afhds3 = mod["afhds3"];
afhds3["emi"] >> rhs.afhds3.emi;
afhds3["telemetry"] >> rhs.afhds3.telemetry;
afhds3["phyMode"] >> rhs.afhds3.phyMode;
afhds3["reserved"] >> rhs.afhds3.reserved;
afhds3["rfPower"] >> rhs.afhds3.rfPower;
}
}
+95 -15
View File
@@ -21,11 +21,11 @@
#include "moduledata.h"
#include "eeprominterface.h"
#include "multiprotocols.h"
#include "afhds3.h"
#include "radiodataconversionstate.h"
#include "compounditemmodels.h"
#include "generalsettings.h"
#include "appdata.h"
#include "helpers.h"
#include <QPair>
#include <QVector>
@@ -90,8 +90,10 @@ bool ModuleData::isAvailable(PulsesProtocol proto, int port)
return fw->getCapability(HasIntModuleMulti);
case PULSES_CROSSFIRE:
return fw->getCapability(HasIntModuleCRSF) || fw->getCapability(HasIntModuleELRS);
case PULSES_AFHDS3:
return fw->getCapability(HasIntModuleFlySky);
case PULSES_FLYSKY_AFHDS2A:
return IS_FLYSKY_NV14(board);
case PULSES_FLYSKY_AFHDS3:
return IS_FLYSKY_EL18(board);
default:
return false;
}
@@ -112,7 +114,8 @@ bool ModuleData::isAvailable(PulsesProtocol proto, int port)
case PULSES_SBUS:
case PULSES_MULTIMODULE:
case PULSES_CROSSFIRE:
case PULSES_AFHDS3:
case PULSES_FLYSKY_AFHDS2A:
case PULSES_FLYSKY_AFHDS3:
case PULSES_GHOST:
return true;
case PULSES_ACCESS_R9M:
@@ -263,8 +266,6 @@ QString ModuleData::subTypeToString(int type) const
return CHECK_IN_ARRAY(ppmSubTypeStrings, type);
case PULSES_PXX_R9M:
return CHECK_IN_ARRAY(strings, type);
case PULSES_AFHDS3:
return Afhds3Data::protocolToString(type);
default:
return CPN_STR_UNKNOWN_ITEM;
}
@@ -273,7 +274,7 @@ QString ModuleData::subTypeToString(int type) const
QString ModuleData::powerValueToString(Firmware * fw) const
{
const QStringList & strRef = powerValueStrings((enum PulsesProtocol)protocol, subType, fw);
return strRef.value(protocol == PULSES_AFHDS3 ? afhds3.rfPower : pxx.power, CPN_STR_UNKNOWN_ITEM);
return strRef.value(protocol == PULSES_FLYSKY_AFHDS3 ? afhds3.rfPower : pxx.power, CPN_STR_UNKNOWN_ITEM);
}
// static
@@ -313,7 +314,7 @@ QString ModuleData::protocolToString(unsigned int protocol)
tr("FrSky ACCESS R9M Lite"),
tr("FrSky ACCESS R9M Lite Pro"),
tr("FrSky XJT lite (D16)"), tr("FrSky XJT lite (D8)"), tr("FrSky XJT lite (LR12)"),
tr("AFHDS3"),
tr("Flysky AFHDS2A"), tr("Flysky AFHDS3"),
tr("Ghost"),
tr("Lemon-Rx DSMP"),
};
@@ -335,7 +336,7 @@ QStringList ModuleData::powerValueStrings(enum PulsesProtocol protocol, int subT
};
switch(protocol) {
case PULSES_AFHDS3:
case PULSES_FLYSKY_AFHDS3:
return afhds3Strings;
default:
int strIdx = 0;
@@ -359,7 +360,8 @@ bool ModuleData::hasFailsafes(Firmware * fw) const
protocol == PULSES_ACCESS_R9M_LITE_PRO ||
protocol == PULSES_XJT_LITE_X16 ||
protocol == PULSES_MULTIMODULE ||
protocol == PULSES_AFHDS3
protocol == PULSES_FLYSKY_AFHDS2A ||
protocol == PULSES_FLYSKY_AFHDS3
);
}
@@ -397,7 +399,9 @@ int ModuleData::getMaxChannelCount()
else
return 16;
break;
case PULSES_AFHDS3:
case PULSES_FLYSKY_AFHDS2A:
return 14;
case PULSES_FLYSKY_AFHDS3:
return 18;
case PULSES_LEMON_DSMP:
return 12;
@@ -450,7 +454,8 @@ int ModuleData::getTypeFromProtocol(unsigned int protocol)
{ PULSES_XJT_LITE_D8, MODULE_TYPE_XJT_LITE_PXX2 },
{ PULSES_XJT_LITE_LR12, MODULE_TYPE_XJT_LITE_PXX2 },
{ PULSES_AFHDS3, MODULE_TYPE_FLYSKY },
{ PULSES_FLYSKY_AFHDS2A, MODULE_TYPE_FLYSKY_AFHDS2A },
{ PULSES_FLYSKY_AFHDS3, MODULE_TYPE_FLYSKY_AFHDS3 },
{ PULSES_LEMON_DSMP, MODULE_TYPE_LEMON_DSMP },
};
@@ -495,7 +500,8 @@ QString ModuleData::typeToString(int type)
"R9MLP ACCESS",
"SBUS",
"XJT Lite",
"FLYSKY",
"Flysky AFHDS2A",
"Flysky AFHDS3",
"Lemon-Rx DSMP",
};
@@ -548,7 +554,8 @@ bool ModuleData::isProtocolAvailable(int moduleidx, unsigned int protocol, Gener
case MODULE_TYPE_CROSSFIRE:
case MODULE_TYPE_MULTIMODULE:
case MODULE_TYPE_GHOST:
case MODULE_TYPE_FLYSKY:
case MODULE_TYPE_FLYSKY_AFHDS2A:
case MODULE_TYPE_FLYSKY_AFHDS3:
case MODULE_TYPE_LEMON_DSMP:
case MODULE_TYPE_R9M_LITE_PXX1:
case MODULE_TYPE_R9M_LITE_PXX2:
@@ -570,7 +577,8 @@ bool ModuleData::isProtocolAvailable(int moduleidx, unsigned int protocol, Gener
case MODULE_TYPE_CROSSFIRE:
case MODULE_TYPE_MULTIMODULE:
case MODULE_TYPE_GHOST:
case MODULE_TYPE_FLYSKY:
case MODULE_TYPE_FLYSKY_AFHDS2A:
case MODULE_TYPE_FLYSKY_AFHDS3:
case MODULE_TYPE_LEMON_DSMP:
return true;
default:
@@ -683,3 +691,75 @@ AbstractStaticItemModel * ModuleData::telemetryBaudrateItemModel(unsigned int p
mdl->loadItemList();
return mdl;
}
QString ModuleData::afhds2aMode1ToString() const
{
return afhds2aMode1List.at(Helpers::getBitmappedValue(flysky.mode, 0));
}
QString ModuleData::afhds2aMode2ToString() const
{
return afhds2aMode2List.at(Helpers::getBitmappedValue(flysky.mode, 1));
}
QString ModuleData::afhds3PhyModeToString() const
{
return afhds3PhyModeList.at(afhds3.phyMode);
}
QString ModuleData::afhds3EmiToString() const
{
return afhds3EmiList.at(afhds3.emi - 1);
}
AbstractStaticItemModel * ModuleData::afhds2aMode1ItemModel()
{
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
mdl->setName("moduledata.afhds2aMode1");
for (int i = 0; i < afhds2aMode1List.size(); i++) {
mdl->appendToItemList(afhds2aMode1List.at(i), i);
}
mdl->loadItemList();
return mdl;
}
AbstractStaticItemModel * ModuleData::afhds2aMode2ItemModel()
{
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
mdl->setName("moduledata.afhds2aMode2");
for (int i = 0; i < afhds2aMode2List.size(); i++) {
mdl->appendToItemList(afhds2aMode2List.at(i), i);
}
mdl->loadItemList();
return mdl;
}
AbstractStaticItemModel * ModuleData::afhds3PhyModeItemModel()
{
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
mdl->setName("moduledata.afhds3PhyMode");
for (int i = 0; i < afhds3PhyModeList.size(); i++) {
mdl->appendToItemList(afhds3PhyModeList.at(i), i);
}
mdl->loadItemList();
return mdl;
}
AbstractStaticItemModel * ModuleData::afhds3EmiItemModel()
{
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
mdl->setName("moduledata.afhds3Emi");
for (int i = 0; i < afhds3EmiList.size(); i++) {
mdl->appendToItemList(afhds3EmiList.at(i), i + 1); // Note: 1 based
}
mdl->loadItemList();
return mdl;
}
+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();
};
@@ -2211,40 +2211,6 @@ class ModuleUnionField: public UnionField<unsigned int> {
unsigned int version;
};
class Afhds3Field: public UnionField::TransformedMember {
public:
Afhds3Field(DataField * parent, ModuleData& module):
UnionField::TransformedMember(parent, internalField),
internalField(this, "AFHDS3")
{
ModuleData::Afhds3& afhds3 = module.afhds3;
internalField.Append(new UnsignedField<3>(this, minBindPower));
internalField.Append(new UnsignedField<3>(this, afhds3.rfPower));
internalField.Append(new UnsignedField<1>(this, emissionFCC));
internalField.Append(new BoolField<1>(this, operationModeUnicast));
internalField.Append(new BoolField<1>(this, operationModeUnicast));
internalField.Append(new UnsignedField<16>(this, defaultFailSafeTimout));
internalField.Append(new UnsignedField<16>(this, afhds3.rxFreq));
}
bool select(const unsigned int& attr) const override {
return attr == PULSES_AFHDS3;
}
void beforeExport() override {}
void afterImport() override {}
private:
StructField internalField;
unsigned int minBindPower = 0;
unsigned int emissionFCC = 0;
unsigned int defaultFailSafeTimout = 1000;
bool operationModeUnicast = true;
};
class AccessField: public UnionField::TransformedMember {
public:
AccessField(DataField * parent, ModuleData& module):
@@ -2331,7 +2297,6 @@ class ModuleUnionField: public UnionField<unsigned int> {
{
if (version >= 219) {
Append(new AccessField(parent, module));
Append(new Afhds3Field(parent, module));
Append(new GhostField(parent, module));
}
Append(new PxxField(parent, module, version));
@@ -112,10 +112,6 @@ class ProtocolsConversionTable: public ConversionTable
addConversion(PULSES_XJT_LITE_X16, val);
addConversion(PULSES_XJT_LITE_D8, val);
addConversion(PULSES_XJT_LITE_LR12, val++);
if (version >= 219) {
addConversion(PULSES_AFHDS3, val++);
}
}
};
@@ -116,6 +116,8 @@ const char * OpenTxEepromInterface::getName()
return "EdgeTX for FrSky X10 Express";
case BOARD_FLYSKY_NV14:
return "EdgeTX for FlySky NV14";
case BOARD_FLYSKY_EL18:
return "EdgeTX for FlySky EL18";
case BOARD_BETAFPV_LR3PRO:
return "EdgeTx for BETAFPV LR3PRO";
case BOARD_IFLIGHT_COMMANDO8:
@@ -656,7 +658,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
case HasSDLogs:
return true;
case LcdWidth:
if (IS_FLYSKY_NV14(board))
if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
return 320;
else if (IS_FAMILY_HORUS_OR_T16(board))
return 480;
@@ -667,7 +669,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
else
return 128;
case LcdHeight:
if (IS_FLYSKY_NV14(board))
if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
return 480;
else if (IS_FAMILY_HORUS_OR_T16(board))
return 272;
@@ -761,7 +763,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
else
return 40;
case HasAuxSerialMode:
return (IS_FAMILY_HORUS_OR_T16(board) && !IS_FLYSKY_NV14(board)) ||
return (IS_FAMILY_HORUS_OR_T16(board) && !(IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))) ||
(IS_TARANIS_X9(board) && !IS_TARANIS_X9DP_2019(board)) ||
IS_RADIOMASTER_ZORRO(board) || IS_RADIOMASTER_TX12_MK2(board);
case HasAux2SerialMode:
@@ -770,7 +772,8 @@ int OpenTxFirmware::getCapability(::Capability capability)
return IS_FAMILY_HORUS_OR_T16(board) || IS_RADIOMASTER_ZORRO(board) ||
IS_JUMPER_TPRO(board) || IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board);
case HasBluetooth:
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) || IS_TARANIS_X9DP_2019(board) || IS_FLYSKY_NV14(board)) ? true : false;
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) ||
IS_TARANIS_X9DP_2019(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) ? true : false;
case HasADCJitterFilter:
return IS_HORUS_OR_TARANIS(board);
case HasTelemetryBaudrate:
@@ -801,7 +804,8 @@ int OpenTxFirmware::getCapability(::Capability capability)
return id.contains("internalelrs") || IS_RADIOMASTER_TX12_MK2(board) ||
IS_IFLIGHT_COMMANDO8(board) || IS_RADIOMASTER_BOXER(board);
case HasIntModuleFlySky:
return id.contains("afhds3") || IS_FLYSKY_NV14(board);
return id.contains("afhds2a") || id.contains("afhds3") ||
IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board);
default:
return 0;
}
@@ -1136,13 +1140,15 @@ enum RfOptions {
NONE = 0,
EU = 1 << 0,
FLEX = 1 << 1,
AFHDS3 = 1 << 2
AFHDS2A = 1 << 2,
AFHDS3 = 1 << 3,
};
void addOpenTxRfOptions(OpenTxFirmware * firmware, uint8_t options)
{
static const Firmware::Option opt_eu("eu", Firmware::tr("Removes D8 FrSky protocol support which is not legal for use in the EU on radios sold after Jan 1st, 2015"));
static const Firmware::Option opt_fl("flexr9m", Firmware::tr("Enable non certified firmwares"));
static const Firmware::Option opt_afhds2a("afhds2a", Firmware::tr("Enable AFHDS2A support"));
static const Firmware::Option opt_afhds3("afhds3", Firmware::tr("Enable AFHDS3 support"));
@@ -1152,6 +1158,8 @@ void addOpenTxRfOptions(OpenTxFirmware * firmware, uint8_t options)
firmware->addOption(opt_eu);
else if ((options & FLEX) != 0)
firmware->addOption(opt_fl);
if ((options & AFHDS2A) != 0)
firmware->addOption(opt_afhds2a);
if ((options & AFHDS3) != 0)
firmware->addOption(opt_afhds3);
}
@@ -1205,7 +1213,7 @@ void registerOpenTxFirmwares()
firmware->addOption("noras", Firmware::tr("Disable RAS (SWR)"));
addOpenTxTaranisOptions(firmware);
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, EU + FLEX + AFHDS3);
addOpenTxRfOptions(firmware, EU + FLEX + AFHDS2A + AFHDS3);
/* FrSky Taranis X9D+ 2019 board */
firmware = new OpenTxFirmware(FIRMWAREID("x9d+2019"), Firmware::tr("FrSky Taranis X9D+ 2019"), BOARD_TARANIS_X9DP_2019, "x9dp2019");
@@ -1219,7 +1227,7 @@ void registerOpenTxFirmwares()
firmware->addOption("haptic", Firmware::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware);
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, EU + FLEX + AFHDS3);
addOpenTxRfOptions(firmware, EU + FLEX + AFHDS2A + AFHDS3);
/* FrSky Taranis X9E board */
firmware = new OpenTxFirmware(FIRMWAREID("x9e"), Firmware::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
@@ -1365,7 +1373,7 @@ void registerOpenTxFirmwares()
firmware->addOption("internalelrs", Firmware::tr("Select if internal ELRS module is installed"));
addOpenTxFontOptions(firmware);
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, FLEX + AFHDS3);
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);
/* Radiomaster Boxer board */
firmware = new OpenTxFirmware(FIRMWAREID("boxer"), QCoreApplication::translate("Firmware", "Radiomaster Boxer"), Board::BOARD_RADIOMASTER_BOXER);
@@ -1375,7 +1383,7 @@ void registerOpenTxFirmwares()
firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen"));
addOpenTxFontOptions(firmware);
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, FLEX + AFHDS3);
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);
/* Radiomaster T8 board */
firmware = new OpenTxFirmware(FIRMWAREID("t8"), QCoreApplication::translate("Firmware", "Radiomaster T8"), BOARD_RADIOMASTER_T8);
@@ -1409,7 +1417,14 @@ void registerOpenTxFirmwares()
firmware = new OpenTxFirmware(FIRMWAREID("nv14"), QCoreApplication::translate("Firmware", "FlySky NV14"), BOARD_FLYSKY_NV14);
addOpenTxFrskyOptions(firmware);
firmware->addOption("bluetooth", Firmware::tr("Support for bluetooth module"));
addOpenTxRfOptions(firmware, FLEX + AFHDS3);
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);
registerOpenTxFirmware(firmware);
/* FlySky EL18 board */
firmware = new OpenTxFirmware(FIRMWAREID("el18"), QCoreApplication::translate("Firmware", "FlySky EL18"), BOARD_FLYSKY_EL18);
addOpenTxFrskyOptions(firmware);
firmware->addOption("bluetooth", Firmware::tr("Support for bluetooth module"));
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);
registerOpenTxFirmware(firmware);
/* BETAFPV LR3PRO board */
+69 -18
View File
@@ -225,6 +225,7 @@ void TimerPanel::onModeChanged(int index)
#define MASK_MULTI_DSM_OPT (1<<19)
#define MASK_CHANNELMAP (1<<20)
#define MASK_MULTI_BAYANG_OPT (1<<21)
#define MASK_AFHDS (1<<22)
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
@@ -320,9 +321,32 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
connect(ui->clearRx1, SIGNAL(clicked()), this, SLOT(onClearAccessRxClicked()));
connect(ui->clearRx2, SIGNAL(clicked()), this, SLOT(onClearAccessRxClicked()));
connect(ui->clearRx3, SIGNAL(clicked()), this, SLOT(onClearAccessRxClicked()));
connect(ui->cboAfhdsOpt1, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=] (int index)
{
if (lock)
return;
if (this->module.protocol == PULSES_FLYSKY_AFHDS2A)
Helpers::setBitmappedValue(this->module.flysky.mode, ui->cboAfhdsOpt1->currentData().toInt(), 1);
else
this->module.afhds3.phyMode = ui->cboAfhdsOpt1->currentData().toInt();
emit modified();
});
connect(ui->cboAfhdsOpt2, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=] (int index)
{
if (lock)
return;
if (this->module.protocol == PULSES_FLYSKY_AFHDS2A)
Helpers::setBitmappedValue(this->module.flysky.mode, ui->cboAfhdsOpt2->currentData().toInt(), 0);
else
this->module.afhds3.emi = ui->cboAfhdsOpt2->currentData().toInt();
emit modified();
});
lock = false;
}
ModulePanel::~ModulePanel()
@@ -529,10 +553,10 @@ void ModulePanel::update()
if (pdef.disableChannelMap)
mask |= MASK_CHANNELMAP;
break;
case PULSES_AFHDS3:
module.channelsCount = 18;
mask |= MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT | MASK_FAILSAFES;
mask |= MASK_SUBTYPES | MASK_RX_FREQ | MASK_RF_POWER;
case PULSES_FLYSKY_AFHDS3:
mask |= MASK_RX_NUMBER;
case PULSES_FLYSKY_AFHDS2A:
mask |= MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT | MASK_FAILSAFES | MASK_AFHDS;
break;
case PULSES_LEMON_DSMP:
mask |= MASK_CHANNELS_RANGE;
@@ -638,9 +662,6 @@ void ModulePanel::update()
if (firmware->getCapability(HasModuleR9MFlex))
i = 2;
break;
case PULSES_AFHDS3:
numEntries = 4;
break;
case PULSES_PPM:
numEntries = PPM_NUM_SUBTYPES;
break;
@@ -755,11 +776,33 @@ void ModulePanel::update()
ui->clearRx3->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1 << 2)));
ui->rx3->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1 << 2)));
// AFHFS
if (mask & MASK_AFHDS) {
if (protocol == PULSES_FLYSKY_AFHDS2A) {
ui->label_afhds->setText(tr("Options"));
ui->cboAfhdsOpt1->setModel(ModuleData::afhds2aMode1ItemModel());
ui->cboAfhdsOpt1->setCurrentIndex(Helpers::getBitmappedValue(module.flysky.mode, 1));
ui->cboAfhdsOpt2->setModel(ModuleData::afhds2aMode2ItemModel());
ui->cboAfhdsOpt2->setCurrentIndex(Helpers::getBitmappedValue(module.flysky.mode, 0));
}
else {
ui->label_afhds->setText(tr("Type"));
ui->cboAfhdsOpt1->setModel(ModuleData::afhds3PhyModeItemModel());
ui->cboAfhdsOpt1->setCurrentIndex(ui->cboAfhdsOpt1->findData(module.afhds3.phyMode));
ui->cboAfhdsOpt2->setModel(ModuleData::afhds3EmiItemModel());
ui->cboAfhdsOpt2->setCurrentIndex(ui->cboAfhdsOpt2->findData(module.afhds3.emi));
}
}
ui->label_afhds->setVisible(mask & MASK_AFHDS);
ui->cboAfhdsOpt1->setVisible(mask & MASK_AFHDS);
ui->cboAfhdsOpt2->setVisible(mask & MASK_AFHDS);
// Failsafes
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
//hide reciever mode for afhds3
qobject_cast<QListView *>(ui->failsafeMode->view())->setRowHidden(FAILSAFE_RECEIVER, protocol == PULSES_AFHDS3);
if ((mask & MASK_FAILSAFES) && module.failsafeMode == FAILSAFE_CUSTOM) {
if (ui->failsafesGroupBox->isHidden()) {
@@ -813,6 +856,12 @@ void ModulePanel::onProtocolChanged(int index)
ui->telemetryBaudrate->setCurrentIndex(1);
}
}
else if (module.protocol == PULSES_FLYSKY_AFHDS2A) {
module.flysky.setDefault();
}
else if (module.protocol == PULSES_FLYSKY_AFHDS3) {
module.afhds3.setDefault();
}
emit protocolChanged();
emit updateItemModels();
@@ -832,7 +881,11 @@ void ModulePanel::on_r9mPower_currentIndexChanged(int index)
{
if (!lock) {
if (module.protocol == PULSES_AFHDS3 && module.afhds3.rfPower != (unsigned int)index) {
if (module.protocol == PULSES_FLYSKY_AFHDS2A && module.flysky.rfPower != (unsigned int)index) {
module.flysky.rfPower = index;
emit modified();
}
else if (module.protocol == PULSES_FLYSKY_AFHDS3 && module.afhds3.rfPower != (unsigned int)index) {
module.afhds3.rfPower = index;
emit modified();
}
@@ -978,19 +1031,17 @@ void ModulePanel::onSubTypeChanged()
if (!lock && module.subType != type) {
lock=true;
module.subType = type;
if (module.protocol != PULSES_AFHDS3) {
update();
}
emit modified();
lock = false;
}
}
void ModulePanel::onRfFreqChanged(int freq) {
if (module.afhds3.rxFreq != (unsigned int)freq) {
module.afhds3.rxFreq = (unsigned int)freq;
emit modified();
}
// TODO fix for AFHDS2A
//if (module.afhds3.rxFreq != (unsigned int)freq) {
// module.afhds3.rxFreq = (unsigned int)freq;
// emit modified();
//}
}
void ModulePanel::on_disableTelem_stateChanged(int state)
+27 -10
View File
@@ -232,7 +232,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="warning_r9mFlex">
<property name="palette">
<palette>
@@ -276,7 +276,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_failsafeMode">
<property name="maximumSize">
<size>
@@ -292,7 +292,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="failsafeMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -336,7 +336,7 @@
</item>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_trainerMode">
<property name="maximumSize">
<size>
@@ -352,7 +352,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="AutoComboBox" name="trainerMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -371,35 +371,35 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QCheckBox" name="disableTelem">
<property name="text">
<string>Disable Telemetry</string>
</property>
</widget>
</item>
<item row="11" column="1">
<item row="12" column="1">
<widget class="QCheckBox" name="disableChMap">
<property name="text">
<string>Disable Ch. Map</string>
</property>
</widget>
</item>
<item row="12" column="1">
<item row="13" column="1">
<widget class="QCheckBox" name="racingMode">
<property name="text">
<string>Racing Mode</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="14" column="1">
<widget class="QCheckBox" name="raw12bits">
<property name="text">
<string>Raw 12 bits</string>
</property>
</widget>
</item>
<item row="15" column="0" colspan="2">
<item row="16" column="0" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -412,6 +412,23 @@
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_afhds">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="cboAfhdsOpt1"/>
</item>
<item>
<widget class="QComboBox" name="cboAfhdsOpt2"/>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
+7 -5
View File
@@ -215,7 +215,8 @@ QString ModelPrinter::printModule(int idx)
str << printLabelValue(tr("Delay"), QString("%1us").arg(module.ppm.delay));
}
else {
if (!(module.protocol == PULSES_PXX_XJT_D8 || module.protocol == PULSES_CROSSFIRE || module.protocol == PULSES_GHOST || module.protocol == PULSES_SBUS)) {
if (!(module.protocol == PULSES_PXX_XJT_D8 || module.protocol == PULSES_CROSSFIRE ||
module.protocol == PULSES_GHOST || module.protocol == PULSES_SBUS || module.protocol == PULSES_FLYSKY_AFHDS2A)) {
str << printLabelValue(tr("Receiver"), QString::number(module.modelId));
}
if (module.protocol == PULSES_MULTIMODULE) {
@@ -227,10 +228,11 @@ QString ModelPrinter::printModule(int idx)
str << printLabelValue(tr("Sub Type"), module.subTypeToString());
str << printLabelValue(tr("RF Output Power"), module.powerValueToString(firmware));
}
if (module.protocol == PULSES_AFHDS3) {
str << printLabelValue(tr("Output Type"), module.subTypeToString());
str << printLabelValue(tr("RF Output Power"), module.powerValueToString(firmware));
str << printLabelValue(tr("RX Output Frequency"), QString("%1Hz").arg(module.afhds3.rxFreq));
if (module.protocol == PULSES_FLYSKY_AFHDS2A) {
str << printLabelValue(tr("Options"), module.afhds2aMode1ToString() + " " + module.afhds2aMode2ToString());
}
if (module.protocol == PULSES_FLYSKY_AFHDS3) {
str << printLabelValue(tr("Type"), module.afhds3PhyModeToString() + " " + module.afhds3EmiToString());
}
if (module.protocol == PULSES_GHOST) {
str << printLabelValue(tr("Raw 12 bits"), printBoolean(module.ghost.raw12bits, BOOLEAN_YN));
+2
View File
@@ -25,6 +25,7 @@ set(simulation_SRCS
simulateduiwidgetT8.cpp
simulateduiwidgetTX16S.cpp
simulateduiwidgetNV14.cpp
simulateduiwidgetEL18.cpp
simulatorinterface.cpp
simulatormainwindow.cpp
simulatorstartupdialog.cpp
@@ -61,6 +62,7 @@ set(simulation_UIS
simulateduiwidgetT8.ui
simulateduiwidgetTX16S.ui
simulateduiwidgetNV14.ui
simulateduiwidgetEL18.ui
simulatormainwindow.ui
simulatorstartupdialog.ui
simulatorwidget.ui
+14 -1
View File
@@ -124,6 +124,7 @@ namespace Ui {
class SimulatedUIWidgetBoxer;
class SimulatedUIWidgetT8;
class SimulatedUIWidgetNV14;
class SimulatedUIWidgetEL18;
}
class SimulatedUIWidget9X: public SimulatedUIWidget
@@ -241,7 +242,7 @@ class SimulatedUIWidgetX12: public SimulatedUIWidget
class SimulatedUIWidgetLR3PRO: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetLR3PRO(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetLR3PRO();
@@ -394,4 +395,16 @@ class SimulatedUIWidgetNV14: public SimulatedUIWidget
Ui::SimulatedUIWidgetNV14 * ui;
};
class SimulatedUIWidgetEL18: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetEL18(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetEL18();
private:
Ui::SimulatedUIWidgetEL18 * ui;
};
#endif // SIMULATEDUIWIDGET_H
@@ -0,0 +1,76 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetEL18.h"
SimulatedUIWidgetEL18::SimulatedUIWidgetEL18(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetEL18)
{
RadioUiAction * act;
ui->setupUi(this);
// add actions in order of appearance on the help menu
// Note: the EL18 has no physical buttons though at some point the trim joystick is repurposed
// allow for colorlcd key events and see what works
// the mouse click areas do not map to visual buttons on the background images
act = new RadioUiAction(12, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 1, 80, 35), "NV14/left.png", act));
m_mouseMidClickAction = new RadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 40, 80, 35), "NV14/left.png", m_mouseMidClickAction));
act = new RadioUiAction(14, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 80, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(13, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 120, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(5, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 160, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(4, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 200, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(1, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace,
SIMU_STR_HLP_KEY_DN % "<br>" % SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_RTN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 240, 80, 35), "NV14/left.png", act));
m_scrollUpAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Minus, SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_ROT_LFT);
m_scrollDnAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal, SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_ROT_RGT);
connectScrollActions();
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 280, 30, 30), "NV14/left.png", m_screenshotAction));
m_backlightColors << QColor(47, 123, 227);
setLcd(ui->lcd);
}
SimulatedUIWidgetEL18::~SimulatedUIWidgetEL18()
{
delete ui;
}
@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetEL18</class>
<widget class="QWidget" name="SimulatedUIWidgetEL18">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>520</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>520</width>
<height>500</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="2" rowspan="3">
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/right.png)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="LcdWidget" name="lcd" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<height>480</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>480</height>
</size>
</property>
<property name="font">
<font>
<pointsize>5</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="3">
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/left.png);</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="top" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>5</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/top.png)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="bottom" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>5</pointsize>
<kerning>false</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/bottom.png)</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LcdWidget</class>
<extends>QWidget</extends>
<header>lcdwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonsWidget</class>
<extends>QWidget</extends>
<header>buttonswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -128,6 +128,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
case Board::BOARD_FLYSKY_NV14:
radioUiWidget = new SimulatedUIWidgetNV14(simulator, this);
break;
case Board::BOARD_FLYSKY_EL18:
radioUiWidget = new SimulatedUIWidgetEL18(simulator, this);
break;
default:
radioUiWidget = new SimulatedUIWidget9X(simulator, this);
break;