Reduce RF_PROTO_OFF logic, disable R9M Sport out when internal telemetry is on (#5159)
* Remove most of the special logic associated with RF_PROTO_OFF This simplifies code in many areas since the internal module does not require special handling and also fixes a few bugs with INTERNAL_PPM * Disable R9M sport option if internal module has telemetry * Fix X12s build * Use macros instead of direct comparisions * Fix sport bit sent the wrong way. Rename S.port out to Telemetry * Compile fix
This commit is contained in:
committed by
Bertrand Songis
parent
8e84724c62
commit
e16b48db30
@@ -231,14 +231,13 @@ int getSwitchWarningsCount()
|
||||
return count;
|
||||
}
|
||||
|
||||
#define IF_INTERNAL_MODULE_ON(x) (IS_INTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define INTERNAL_MODULE_MODE_ROWS (IS_MODULE_XJT(INTERNAL_MODULE) ? (uint8_t)1 : (uint8_t)0) // Module type + RF protocols
|
||||
#else
|
||||
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define INTERNAL_MODULE_MODE_ROWS 0 // (OFF / RF protocols)
|
||||
#endif
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
|
||||
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 1))
|
||||
|
||||
@@ -704,11 +703,14 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[0].rfProtocol, attr);
|
||||
if (attr) {
|
||||
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
|
||||
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, -1, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
|
||||
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_XJT;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = DEFAULT_CHANNELS(INTERNAL_MODULE);
|
||||
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF)
|
||||
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1079,7 +1081,13 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
if (IS_MODULE_R9M(moduleIdx)) {
|
||||
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, STR_SPORT_OUT, attr, event);
|
||||
if (IS_TELEMETRY_INTERNAL_MODULE) {
|
||||
lcdDrawTextAlignedLeft(y, STR_SPORT_OUT);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_DISABLE_INTERNAL);
|
||||
}
|
||||
else {
|
||||
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, STR_SPORT_OUT, attr, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -88,7 +88,7 @@ enum MenuModelTelemetryFrskyItems {
|
||||
#endif
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0,
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
#define TELEMETRY_TYPE_ROWS (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
|
||||
enum SensorFields {
|
||||
SENSOR_FIELD_NAME,
|
||||
@@ -516,7 +516,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
#if defined(MULTIMODULE)
|
||||
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF &&
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_XJT &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
|
||||
lcdDrawTextAlignedLeft(y, PSTR("RSNR"));
|
||||
|
||||
Reference in New Issue
Block a user