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:
Arne Schwabe
2017-08-15 21:47:45 -07:00
committed by Bertrand Songis
parent 8e84724c62
commit e16b48db30
29 changed files with 87 additions and 60 deletions
+11 -3
View File
@@ -209,8 +209,8 @@ int getSwitchWarningsCount()
return count;
}
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
#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)
#define INTERNAL_MODULE_MODE_ROWS (uint8_t)0
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
@@ -624,7 +624,10 @@ bool menuModelSetup(event_t event)
g_model.moduleData[0].type = MODULE_TYPE_XJT;
g_model.moduleData[0].channelsStart = 0;
g_model.moduleData[0].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;
@@ -978,8 +981,13 @@ bool menuModelSetup(event_t event)
#endif
if (IS_MODULE_R9M(moduleIdx)) {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SPORT_OUT);
g_model.moduleData[moduleIdx].pxx.sport_out = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].pxx.sport_out, MODEL_SETUP_2ND_COLUMN, y, attr, event);
if (IS_TELEMETRY_INTERNAL_MODULE) {
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, attr, event);
}
}
}
break;
case ITEM_MODEL_EXTERNAL_MODULE_POWER: {