Fix changing back from custom multi protocol selection to normal protocols
This commit is contained in:
@@ -776,6 +776,12 @@ void menuModelSetup(uint8_t event)
|
|||||||
else if (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) {
|
else if (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) {
|
||||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, MM_RF_PROTO_FIRST, MM_RF_PROTO_LAST);
|
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, MM_RF_PROTO_FIRST, MM_RF_PROTO_LAST);
|
||||||
if (checkIncDec_Ret) {
|
if (checkIncDec_Ret) {
|
||||||
|
// When in custom protocol mode the highest bit (0x20) is set to indicate the protocl we might be way above MM_RF_PROTO_LAST.
|
||||||
|
// Reset to MM_RF_PROTO_LAST-1 in that case
|
||||||
|
if (checkIncDec_Ret == -1 && g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol >= MM_RF_PROTO_LAST)
|
||||||
|
{
|
||||||
|
g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol = MM_RF_PROTO_LAST-1;
|
||||||
|
}
|
||||||
g_model.moduleData[EXTERNAL_MODULE].subType = 0;
|
g_model.moduleData[EXTERNAL_MODULE].subType = 0;
|
||||||
// Sensible default for DSM2 (same as for ppm): 6ch@11ms
|
// Sensible default for DSM2 (same as for ppm): 6ch@11ms
|
||||||
if (g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_DSM2)
|
if (g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_DSM2)
|
||||||
@@ -816,6 +822,7 @@ void menuModelSetup(uint8_t event)
|
|||||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 7);
|
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 7);
|
||||||
break;
|
break;
|
||||||
case MM_RF_PROTO_CUSTOM:
|
case MM_RF_PROTO_CUSTOM:
|
||||||
|
//custom protocol using the highest bit 0x20 to indicate that the protocol and the lower bits as the rfProtocol
|
||||||
g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol = 0x20 | checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol & 0x1f, 1, 31, EE_MODEL);
|
g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol = 0x20 | checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol & 0x1f, 1, 31, EE_MODEL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user