feat: S.Port telemetry for PPM/SBUS external module (#5689)
Co-authored-by: Michael <mha1@users.noreply.github.com>
This commit is contained in:
co-authored by
Michael
parent
3d1e7a914f
commit
6d17448be5
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -373,7 +373,7 @@ void ModulePanel::update()
|
||||
break;
|
||||
case PULSES_SBUS:
|
||||
module.channelsCount = 16;
|
||||
mask |= MASK_SBUSPPM_FIELDS| MASK_CHANNELS_RANGE;
|
||||
mask |= MASK_SUBTYPES | MASK_SBUSPPM_FIELDS| MASK_CHANNELS_RANGE;
|
||||
break;
|
||||
case PULSES_MULTIMODULE:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER | MASK_MULTIMODULE | MASK_SUBTYPES;
|
||||
@@ -521,6 +521,9 @@ void ModulePanel::update()
|
||||
case PULSES_PPM:
|
||||
numEntries = PPM_NUM_SUBTYPES;
|
||||
break;
|
||||
case PULSES_SBUS:
|
||||
numEntries = SBUS_NUM_SUBTYPES;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ QString ModelPrinter::printModule(int idx)
|
||||
else {
|
||||
str << printLabelValue(tr("Protocol"), ModuleData::protocolToString(module.protocol));
|
||||
if (module.protocol) {
|
||||
if (module.protocol == PULSES_PPM)
|
||||
if (module.protocol == PULSES_PPM || module.protocol == PULSES_SBUS)
|
||||
str << printLabelValue(tr("Sub Type"), module.subTypeToString());
|
||||
str << printLabelValue(tr("Channels"), QString("%1-%2").arg(module.channelsStart + 1).arg(module.channelsStart + module.channelsCount));
|
||||
if (module.protocol == PULSES_PPM || module.protocol == PULSES_SBUS) {
|
||||
|
||||
Reference in New Issue
Block a user