Schwabe/multimodule 9x (#3676)

* Fix Multimodule showing up as Crossfire when only multimode and not crossfire is enabled.

* Don't hardcode telemetry to be Frysky on non STM32 arm targets

* Port multi module code to 9X platforms

* Allow Spektrum telemetry protocol to be selected as protocol for the telemetry selection

* Fix infinite loop in spektrum code

* Fix cosmetics

Changes also done for Horus and Taranis UI where appropriate
This commit is contained in:
Arne Schwabe
2016-08-02 18:21:18 +02:00
committed by Bertrand Songis
parent d0527be2c4
commit 0b67d412a0
26 changed files with 392 additions and 115 deletions
+10 -7
View File
@@ -80,7 +80,7 @@ enum menuModelSetupItems {
ITEM_MODEL_EXTERNAL_MODULE_CHANNELS,
ITEM_MODEL_EXTERNAL_MODULE_BIND,
ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE,
#ifdef MULTIMODULE
#if defined (MULTIMODULE)
ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND,
ITEM_MODEL_EXTERNAL_MODULE_LOWPOWER,
#endif
@@ -715,7 +715,7 @@ void menuModelSetup(uint8_t event)
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
#if defined(MULTIMODULE)
else if (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) {
int8_t multi_rfProto = min(g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, (uint8_t) MM_RF_PROTO_CUSTOM);
uint8_t multi_rfProto = min(g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, (uint8_t) MM_RF_PROTO_CUSTOM);
// Do not use MODEL_SETUP_3RD_COLUMN here since some the protocol string are so long that we cannot afford the 2 spaces (+6) here
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_MULTI_PROTOCOLS, multi_rfProto, menuHorizontalPosition==1 ? attr : 0);
@@ -773,25 +773,27 @@ void menuModelSetup(uint8_t event)
case 1:
if (IS_MODULE_DSM2(EXTERNAL_MODULE))
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
#if defined(MULTIMODULE)
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);
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)
{
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;
// Sensible default for DSM2 (same as for ppm): 6ch@11ms
if (g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol == MM_RF_PROTO_DSM2)
g_model.moduleData[EXTERNAL_MODULE].multi.optionValue = 6;
g_model.moduleData[EXTERNAL_MODULE].multi.optionValue = MM_RF_DSM2_11MS_6CH_OPTION;
else
g_model.moduleData[EXTERNAL_MODULE].multi.optionValue = 0;
}
}
else
#endif
else {
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
}
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
@@ -978,7 +980,8 @@ void menuModelSetup(uint8_t event)
}
#if defined(MULTIMODULE)
else if (IS_MODULE_MULTIMODULE(moduleIdx)) {
switch (g_model.moduleData[moduleIdx].multi.rfProtocol) {
switch (g_model.moduleData[moduleIdx].multi.rfProtocol)
{
case MM_RF_PROTO_FRSKY:
case MM_RF_PROTO_SFHSS:
lcd_putsLeft(y, STR_MULTI_RFTUNE);