feat(mpm): remove FrSky special treatment madness (#3032)

This commit is contained in:
Raphael Coeffic
2023-01-26 11:44:46 +10:00
committed by GitHub
parent e380736197
commit 57bf180a9b
12 changed files with 83 additions and 301 deletions
@@ -1859,9 +1859,6 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
} else if (md->type == MODULE_TYPE_MULTIMODULE) {
#if defined(MULTIMODULE)
// Read type/subType by the book (see MPM documentation)
// TODO: remove that crappy translation and use the MPM
// data as-is (no FrSky special casing)
// read "[type],[subtype]"
const char* sep = (const char *)memchr(val, ',', val_len);
uint8_t l_sep = sep ? sep - val : val_len;
@@ -1873,7 +1870,6 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
int subtype = yaml_str2uint(val, val_len);
// convert to ETX format and write to vars
convertMultiProtocolToEtx(&type, &subtype);
if (type > 0) {
md->multi.rfProtocol = type - 1;
md->subType = subtype;
@@ -1907,11 +1903,8 @@ static bool w_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
} else if (md->type == MODULE_TYPE_MULTIMODULE) {
#if defined(MULTIMODULE)
// Use type/subType by the book (see MPM documentation)
// TODO: remove that crappy translation and use the MPM
// data as-is (no FrSky special casing)
int type = md->multi.rfProtocol + 1;
int subtype = val;
convertEtxProtocolToMulti(&type, &subtype);
// output "[type],[subtype]"
str = yaml_unsigned2str(type);