ACCST on ACCESS (#6430)

ACCST on ACCESS
This commit is contained in:
Bertrand Songis
2019-05-18 23:15:46 +02:00
committed by GitHub
parent aeaf46bc89
commit a177c7788c
14 changed files with 62 additions and 79 deletions
+2 -15
View File
@@ -37,7 +37,6 @@ void onTxOptionsUpdateConfirm(const char * result)
}
enum {
ITEM_MODULE_SETTINGS_RF_PROTOCOL,
ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA,
ITEM_MODULE_SETTINGS_POWER,
ITEM_MODULE_SETTINGS_COUNT
@@ -88,11 +87,10 @@ void menuModelModuleOptions(event_t event)
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
// uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
uint8_t optionsAvailable = moduleOptions[modelId] & ((1 << MODULE_OPTION_RF_PROTOCOL) | (1 << MODULE_OPTION_EXTERNAL_ANTENNA) | (1 << MODULE_OPTION_POWER));
uint8_t optionsAvailable = moduleOptions[modelId] & ((1 << MODULE_OPTION_EXTERNAL_ANTENNA) | (1 << MODULE_OPTION_POWER));
SUBMENU_NOTITLE(ITEM_MODULE_SETTINGS_COUNT, {
!optionsAvailable ? (uint8_t)0 : IF_MODULE_OPTIONS(MODULE_OPTION_RF_PROTOCOL, 0),
IF_MODULE_OPTIONS(MODULE_OPTION_EXTERNAL_ANTENNA, 0),
!optionsAvailable ? (uint8_t)0 : IF_MODULE_OPTIONS(MODULE_OPTION_EXTERNAL_ANTENNA, 0),
IF_MODULE_OPTIONS(MODULE_OPTION_POWER, 0),
});
@@ -150,17 +148,6 @@ void menuModelModuleOptions(event_t event)
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
switch (i) {
case ITEM_MODULE_SETTINGS_RF_PROTOCOL:
lcdDrawText(0, y, STR_RF_PROTOCOL);
lcdDrawTextAtIndex(RECEIVER_OPTIONS_2ND_COLUMN, y, STR_ACCESS_RF_PROTOCOLS, reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol, attr);
if (attr) {
reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol, 0, 2, 0, nullptr);
if (checkIncDec_Ret) {
reusableBuffer.hardwareAndSettings.moduleSettingsDirty = true;
}
}
break;
case ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA:
reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna = editCheckBox(reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna, RECEIVER_OPTIONS_2ND_COLUMN, y, "Ext. antenna", attr, event);
if (attr && checkIncDec_Ret) {
+10 -5
View File
@@ -169,7 +169,7 @@ enum MenuModelSetupItems {
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1)), uint8_t(getSwitchWarningsCount() > 5 ? TITLE_ROW : HIDDEN_ROW)
#endif
#define INTERNAL_MODULE_MODE_ROWS (isModuleXJT(INTERNAL_MODULE) ? (uint8_t)1 : (uint8_t)0) // Module type + RF protocols
#define INTERNAL_MODULE_MODE_ROWS ((isModuleXJT(INTERNAL_MODULE) || isModulePXX2(INTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0) // Module type + RF protocols
#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 EXTERNAL_MODULE_BIND_ROWS() ((isModuleXJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) || isModuleSBUS(EXTERNAL_MODULE)) ? (uint8_t)1 : (isModulePPM(EXTERNAL_MODULE) || isModulePXX(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE) || isModuleMultimodule(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW
@@ -1007,7 +1007,9 @@ void menuModelSetup(event_t event)
lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MODULE_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
if (isModuleXJT(INTERNAL_MODULE))
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+6*FW, y, STR_ACCST_RF_PROTOCOLS, 1+g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
lcdDrawTextAtIndex(lcdNextPos + FW, y, STR_ACCST_RF_PROTOCOLS, 1+g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
else if (isModulePXX2(INTERNAL_MODULE))
lcdDrawTextAtIndex(lcdNextPos + FW, y, STR_ACCESS_RF_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 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);
@@ -1019,13 +1021,16 @@ void menuModelSetup(event_t event)
}
}
else if (isModuleXJT(INTERNAL_MODULE)) {
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, 0, ACCST_RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
if (checkIncDec_Ret) {
g_model.moduleData[0].type = MODULE_TYPE_PXX_XJT;
g_model.moduleData[0].channelsStart = 0;
g_model.moduleData[0].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
}
}
else if (isModulePXX2(INTERNAL_MODULE)) {
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, 0, ACCESS_RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
}
}
break;
#endif
@@ -1115,7 +1120,7 @@ void menuModelSetup(event_t event)
}
#endif
else {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST);
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, 0, ACCST_RF_PROTO_LAST);
}
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
@@ -1537,7 +1542,7 @@ void menuModelSetup(event_t event)
if (attr && l_posHorz > 0) {
if (s_editMode > 0) {
if (l_posHorz == 1) {
if (isModuleR9M(moduleIdx) || (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol== RF_PROTO_X16)) {
if (isModuleR9M(moduleIdx) || (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol== ACCST_RF_PROTO_D16)) {
#if defined(PCBXLITE)
if (EVT_KEY_MASK(event) == KEY_ENTER) {
#elif defined(PCBSKY9X) || defined(PCBAR9X)
+6 -6
View File
@@ -683,7 +683,7 @@ void menuModelSetup(event_t event)
}
break;
case 1:
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, ACCST_RF_PROTO_D16, ACCST_RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
if (checkIncDec_Ret) {
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
g_model.moduleData[INTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
@@ -696,13 +696,13 @@ void menuModelSetup(event_t event)
lcdDrawTextAlignedLeft(y, STR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_ACCST_RF_PROTOCOLS, 1+g_model.moduleData[0].rfProtocol, attr);
if (attr) {
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, -1, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, -1, ACCST_RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
if (checkIncDec_Ret) {
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_PXX_XJT;
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
g_model.moduleData[INTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF)
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == ACCST_RF_PROTO_OFF)
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
}
}
@@ -802,7 +802,7 @@ void menuModelSetup(event_t event)
g_model.moduleData[EXTERNAL_MODULE].subType = newR9MType;
}
else {
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, ACCST_RF_PROTO_D16, ACCST_RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
}
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
@@ -1004,7 +1004,7 @@ void menuModelSetup(event_t event)
else {
horzpos_t l_posHorz = menuHorizontalPosition;
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
if (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == RF_PROTO_D8) {
if (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == ACCST_RF_PROTO_D8) {
xOffsetBind = 0;
lcdDrawTextAlignedLeft(y, STR_RECEIVER);
if (attr) l_posHorz += 1;
@@ -1043,7 +1043,7 @@ void menuModelSetup(event_t event)
if (attr && l_posHorz>0) {
if (s_editMode>0) {
if (l_posHorz == 1) {
if (isModuleR9M(moduleIdx) || (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol== RF_PROTO_X16)) {
if (isModuleR9M(moduleIdx) || (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == ACCST_RF_PROTO_D16)) {
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
uint8_t default_selection = 0; // R9M_LBT should default to 0 as available options are variables
if (isModuleR9M_LBT(moduleIdx)) {
@@ -34,7 +34,6 @@ void onTxOptionsUpdateConfirm(const char * result)
}
enum {
ITEM_MODULE_SETTINGS_RF_PROTOCOL,
ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA,
ITEM_MODULE_SETTINGS_POWER,
ITEM_MODULE_SETTINGS_COUNT
@@ -76,7 +75,6 @@ bool menuModelModuleOptions(event_t event)
// uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
SUBMENU("Module Options", ICON_RADIO, ITEM_MODULE_SETTINGS_COUNT, {
IF_MODULE_OPTIONS(MODULE_OPTION_RF_PROTOCOL, 0),
IF_MODULE_OPTIONS(MODULE_OPTION_EXTERNAL_ANTENNA, 0),
IF_MODULE_OPTIONS(MODULE_OPTION_POWER, 0),
});
@@ -137,17 +135,6 @@ bool menuModelModuleOptions(event_t event)
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
switch (i) {
case ITEM_MODULE_SETTINGS_RF_PROTOCOL:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RF_PROTOCOL);
lcdDrawTextAtIndex(RECEIVER_OPTIONS_2ND_COLUMN, y, STR_ACCST_RF_PROTOCOLS, reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol + 1, attr);
if (attr) {
reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, 0, nullptr);
if (checkIncDec_Ret) {
reusableBuffer.hardwareAndSettings.moduleSettingsDirty = true;
}
}
break;
case ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_EXT_ANTENNA);
reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna = editCheckBox(reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna, RECEIVER_OPTIONS_2ND_COLUMN, y, attr, event);
+3 -3
View File
@@ -941,7 +941,7 @@ bool menuModelSetup(event_t event)
}
}
else if (isModuleXJT(INTERNAL_MODULE)) {
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
g_model.moduleData[INTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, ACCST_RF_PROTO_D16, ACCST_RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
if (checkIncDec_Ret) {
g_model.moduleData[0].type = MODULE_TYPE_PXX_XJT;
g_model.moduleData[0].channelsStart = 0;
@@ -1189,7 +1189,7 @@ bool menuModelSetup(event_t event)
g_model.moduleData[EXTERNAL_MODULE].subType = newR9MType;
}
else {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST);
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, ACCST_RF_PROTO_D16, ACCST_RF_PROTO_LAST);
}
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
@@ -1394,7 +1394,7 @@ bool menuModelSetup(event_t event)
if (attr && l_posHorz>0) {
if (s_editMode>0) {
if (l_posHorz == 1) {
if (isModuleR9M(moduleIdx) || (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == RF_PROTO_X16)) {
if (isModuleR9M(moduleIdx) || (isModuleXJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == ACCST_RF_PROTO_D16)) {
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
uint8_t default_selection = 0; // R9M_LBT should default to 0 as available options are variables
if (isModuleR9M_LBT(moduleIdx)) {
+1 -1
View File
@@ -114,7 +114,7 @@ enum MenuModelTelemetryFrskyItems {
#define VARIO_ROWS
#endif
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0,
#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 (g_model.moduleData[INTERNAL_MODULE].rfProtocol == ACCST_RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
void onSensorMenu(const char * result)
{
+4 -4
View File
@@ -654,20 +654,20 @@ bool isExternalModuleAvailable(int moduleType)
bool isRfProtocolAvailable(int protocol)
{
#if defined(CROSSFIRE)
if (protocol != RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_CROSSFIRE) {
if (protocol != ACCST_RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_CROSSFIRE) {
return false;
}
#endif
#if defined(MODULE_D16_EU_ONLY_SUPPORT)
if (protocol == RF_PROTO_D8) {
if (protocol == ACCST_RF_PROTO_D8) {
return false;
}
#endif
#if defined(PCBTARANIS) || defined(PCBHORUS)
if (protocol != RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PXX_R9M) {
if (protocol != ACCST_RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PXX_R9M) {
return false;
}
if (protocol != RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_ACCESS_R9M) {
if (protocol != ACCST_RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_ACCESS_R9M) {
return false;
}
#endif
+2 -2
View File
@@ -153,8 +153,8 @@ const mm_protocol_definition *getMultiProtocolDefinition (uint8_t protocol);
#endif
#define MAX_RX_NUM(x) (isModuleDSM2(x) ? 20 : isModuleMultimodule(x) ? MULTI_MAX_RX_NUM(x) : 63)
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == RF_PROTO_D8)
#define IS_R9M_OR_XJTD16(x) ((isModuleXJT(x) && g_model.moduleData[x].rfProtocol== RF_PROTO_X16) || isModuleR9M(x))
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == ACCST_RF_PROTO_D8)
#define IS_R9M_OR_XJTD16(x) ((isModuleXJT(x) && g_model.moduleData[x].rfProtocol== ACCST_RF_PROTO_D16) || isModuleR9M(x))
#define FAILSAFE_ROWS(x) ((isModuleXJTVariant(x) && HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[x].rfProtocol)) || MULTIMODULE_HASFAILSAFE(x) || isModuleR9M(x) || isModuleR9M2(x)) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW