Fix compiling with DSM2=OFF and MULTIMODULE=OFF

This commit is contained in:
Raphael Coeffic
2022-01-10 16:23:32 +01:00
parent dc8f86700c
commit 91a676b64f
3 changed files with 13 additions and 3 deletions
+9 -2
View File
@@ -107,6 +107,14 @@ inline int getChannelValue(uint8_t port, int channel)
return channelOutputs[ch] + 2 * PPM_CH_CENTER(ch) - 2*PPM_CENTER;
}
static void sbusFlush()
{
if (extmodulePulsesData.dsm2.index & 1)
*extmodulePulsesData.dsm2.ptr++ = 60000;
else
*(extmodulePulsesData.dsm2.ptr - 1) = 60000;
}
void setupPulsesSbus()
{
#if defined(PPM_PIN_SERIAL)
@@ -150,6 +158,5 @@ void setupPulsesSbus()
// last byte, always 0x0
sendByteSbus(0x00);
putDsm2Flush();
sbusFlush();
}
@@ -1133,6 +1133,7 @@ bool w_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
} else if (md->type == MODULE_TYPE_FLYSKY) {
str = yaml_output_enum(val, enum_FLYSKY_Subtypes);
} 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)
@@ -1145,7 +1146,7 @@ bool w_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
if (!wf(opaque, str, strlen(str))) return false;
if (!wf(opaque, ",", 1)) return false;
str = yaml_unsigned2str(subtype);
#endif
} else if (md->type == MODULE_TYPE_DSM2) {
str = yaml_output_enum(md->rfProtocol, enum_DSM2_Subtypes);
} else {
@@ -1645,6 +1645,7 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
} else if (md->type == MODULE_TYPE_FLYSKY) {
md->subType = yaml_parse_enum(yaml_conv_220::enum_FLYSKY_Subtypes, val, val_len);
} 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)
@@ -1665,6 +1666,7 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
md->setMultiProtocol(type - 1);
md->subType = subtype;
}
#endif
} else if (md->type == MODULE_TYPE_DSM2) {
md->rfProtocol = yaml_parse_enum(yaml_conv_220::enum_DSM2_Subtypes, val, val_len);
} else {