chore: Remove "OFF" from protocol lists (#2186)
* chore: Remove "OFF" from protocol lists * Fix subType setting for X9D+2019 * fix: Chan start and count for ISRM, dup type set Channel start and count wasn't being updated for ISRM. Also remove duplicate modulke type setting, which was the cause of an earlier bug that was worked around on 128x64 * fix(colorlcd): Shorter ACCST opts string crash * chore: Formatting only Co-authored-by: Raphael Coeffic <raphael.coeffic@frafos.com>
This commit is contained in:
co-authored by
Raphael Coeffic
parent
62692dba6a
commit
a3d44d7b09
@@ -282,12 +282,7 @@ void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
|
||||
#define IF_INTERNAL_MODULE_ON(x) (IS_INTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
|
||||
#if defined(INTERNAL_MODULE_PXX1)
|
||||
#define INTERNAL_MODULE_TYPE_ROWS ((isModuleXJT(INTERNAL_MODULE) || isModulePXX2(INTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0) // Module type + RF protocols
|
||||
#else
|
||||
#define INTERNAL_MODULE_TYPE_ROWS (0) // Module type + RF protocols
|
||||
#endif
|
||||
|
||||
#define TRAINER_CHANNELS_ROW (IS_SLAVE_TRAINER() ? (uint8_t)1 : HIDDEN_ROW)
|
||||
#define TRAINER_PPM_PARAMS_ROW (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_BLUETOOTH_M_ROW ((bluetooth.distantAddr[0] == '\0' || bluetooth.state == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
|
||||
@@ -912,51 +907,52 @@ void menuModelSetup(event_t event)
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_TYPE:
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, INDENT TR_MODE);
|
||||
#if defined(INTERNAL_MODULE_PXX1)
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_INTERNAL_MODULE_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y,
|
||||
STR_INTERNAL_MODULE_PROTOCOLS,
|
||||
g_model.moduleData[INTERNAL_MODULE].type,
|
||||
menuHorizontalPosition == 0 ? attr : 0);
|
||||
if (isModuleXJT(INTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, 1 + g_model.moduleData[INTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS,
|
||||
g_model.moduleData[INTERNAL_MODULE].subType,
|
||||
menuHorizontalPosition == 1 ? attr : 0);
|
||||
else if (isModuleISRM(INTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_ISRM_RF_PROTOCOLS, 1 + g_model.moduleData[INTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_ISRM_RF_PROTOCOLS,
|
||||
g_model.moduleData[INTERNAL_MODULE].subType,
|
||||
menuHorizontalPosition == 1 ? attr : 0);
|
||||
else if (isModuleCrossfire(INTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_CRSF_BAUDRATE, CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate),0);
|
||||
lcdDrawTextAtIndex(
|
||||
lcdNextPos + 3, y, STR_CRSF_BAUDRATE,
|
||||
CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate), 0);
|
||||
if (attr) {
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable);
|
||||
uint8_t moduleType =
|
||||
checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type,
|
||||
MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL,
|
||||
isInternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
setModuleType(INTERNAL_MODULE, moduleType);
|
||||
}
|
||||
}
|
||||
else if (isModuleXJT(INTERNAL_MODULE)) {
|
||||
g_model.moduleData[INTERNAL_MODULE].subType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].subType, 0, MODULE_SUBTYPE_PXX1_LAST, EE_MODEL, isRfProtocolAvailable);
|
||||
} else if (isModuleXJT(INTERNAL_MODULE)) {
|
||||
g_model.moduleData[INTERNAL_MODULE].subType = checkIncDec(
|
||||
event, g_model.moduleData[INTERNAL_MODULE].subType, 0,
|
||||
MODULE_SUBTYPE_PXX1_LAST, EE_MODEL, isRfProtocolAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[0].type = MODULE_TYPE_XJT_PXX1;
|
||||
g_model.moduleData[0].channelsStart = 0;
|
||||
g_model.moduleData[0].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount =
|
||||
defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
}
|
||||
}
|
||||
else if (isModulePXX2(INTERNAL_MODULE)) {
|
||||
g_model.moduleData[INTERNAL_MODULE].subType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].subType, 0, MODULE_SUBTYPE_ISRM_PXX2_ACCST_D16, EE_MODEL, isRfProtocolAvailable);
|
||||
}
|
||||
}
|
||||
#else
|
||||
uint8_t index = 0;
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_ISRM_PXX2) {
|
||||
index = 1 + g_model.moduleData[INTERNAL_MODULE].subType;
|
||||
}
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_ISRM_RF_PROTOCOLS, index, attr);
|
||||
if (attr) {
|
||||
index = checkIncDec(event, index, 0, MODULE_SUBTYPE_ISRM_PXX2_ACCST_D16 + 1 /* because of --- */, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
|
||||
if (index > 0) {
|
||||
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_ISRM_PXX2;
|
||||
g_model.moduleData[INTERNAL_MODULE].subType = index - 1;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
} else if (isModuleISRM(INTERNAL_MODULE)) {
|
||||
g_model.moduleData[INTERNAL_MODULE].subType =
|
||||
checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].subType,
|
||||
0, MODULE_SUBTYPE_ISRM_PXX2_ACCST_D16, EE_MODEL,
|
||||
isRfProtocolAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount =
|
||||
defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -968,7 +964,7 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, INDENT TR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_EXTERNAL_MODULE_PROTOCOLS, reusableBuffer.moduleSetup.newType, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (isModuleXJT(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (isModuleR9MNonAccess(EXTERNAL_MODULE))
|
||||
|
||||
Reference in New Issue
Block a user