feat: S.Port telemetry for PPM/SBUS external module (#5689)

Co-authored-by: Michael <mha1@users.noreply.github.com>
This commit is contained in:
Raphael Coeffic
2024-12-12 11:19:34 +10:00
committed by GitHub
co-authored by Michael
parent 3d1e7a914f
commit 6d17448be5
18 changed files with 171 additions and 28 deletions
@@ -109,7 +109,13 @@ static const YamlLookupTable r9mLut = {
static const YamlLookupTable ppmLut = {
{ 0, "NOTLM" },
{ 1, "MLINK" }
{ 1, "MLINK" },
{ 2, "SPort"}
};
static const YamlLookupTable sbusLut = {
{ 0, "NOTLM" },
{ 1, "SPort"}
};
static const YamlLookupTable dsmLut = {
@@ -175,6 +181,9 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
case PULSES_PPM:
node["subType"] = LookupValue(ppmLut, subtype);
break;
case PULSES_SBUS:
node["subType"] = LookupValue(sbusLut, subtype);
break;
case PULSES_MULTIMODULE: {
int rfProtocol = rhs.multi.rfProtocol + 1;
int subType = rhs.subType;
@@ -317,6 +326,9 @@ bool convert<ModuleData>::decode(const Node& node, ModuleData& rhs)
case PULSES_PPM: {
subType >> ppmLut >> rhs.subType;
} break;
case PULSES_SBUS: {
subType >> sbusLut >> rhs.subType;
} break;
case PULSES_LP45: {
int subProto = 0;
subType >> dsmLut >> subProto;
+9 -1
View File
@@ -258,7 +258,13 @@ QString ModuleData::subTypeToString(int type) const
static const QString ppmSubTypeStrings[PPM_NUM_SUBTYPES] = {
tr("No Telemetry"),
tr("MLink")
tr("MLink"),
tr("SPort")
};
static const QString sbusSubTypeStrings[SBUS_NUM_SUBTYPES] = {
tr("No Telemetry"),
tr("SPort")
};
if (type < 0)
@@ -269,6 +275,8 @@ QString ModuleData::subTypeToString(int type) const
return Multiprotocols::subTypeToString((int)multi.rfProtocol, (unsigned)type);
case PULSES_PPM:
return CHECK_IN_ARRAY(ppmSubTypeStrings, type);
case PULSES_SBUS:
return CHECK_IN_ARRAY(sbusSubTypeStrings, type);
case PULSES_PXX_R9M:
return CHECK_IN_ARRAY(strings, type);
default:
+2 -1
View File
@@ -103,7 +103,8 @@ enum ModuleSubtypeR9M {
MODULE_SUBTYPE_R9M_LAST=MODULE_SUBTYPE_R9M_AUPLUS
};
#define PPM_NUM_SUBTYPES 2
#define PPM_NUM_SUBTYPES 3
#define SBUS_NUM_SUBTYPES 2
constexpr int PXX2_MAX_RECEIVERS_PER_MODULE = 3;
constexpr int PXX2_LEN_RX_NAME = 8;