From a177c7788ca0ee4237b5b26ce55a331c9cf34081 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 18 May 2019 23:15:46 +0200 Subject: [PATCH] ACCST on ACCESS (#6430) ACCST on ACCESS --- radio/src/gui/128x64/model_module_options.cpp | 17 ++---------- radio/src/gui/128x64/model_setup.cpp | 15 +++++++---- radio/src/gui/212x64/model_setup.cpp | 12 ++++----- .../src/gui/480x272/model_module_options.cpp | 13 ---------- radio/src/gui/480x272/model_setup.cpp | 6 ++--- radio/src/gui/480x272/model_telemetry.cpp | 2 +- radio/src/gui/gui_common.cpp | 8 +++--- radio/src/gui/gui_common.h | 4 +-- radio/src/myeeprom.h | 23 ++++++++++------ radio/src/pulses/modules.h | 26 +++++++++---------- radio/src/pulses/pulses.h | 1 - radio/src/pulses/pxx2.cpp | 8 +++--- radio/src/pulses/pxx2.h | 2 +- radio/src/storage/storage_common.cpp | 4 +-- 14 files changed, 62 insertions(+), 79 deletions(-) diff --git a/radio/src/gui/128x64/model_module_options.cpp b/radio/src/gui/128x64/model_module_options.cpp index c5ffc2f073..a33a29b98a 100644 --- a/radio/src/gui/128x64/model_module_options.cpp +++ b/radio/src/gui/128x64/model_module_options.cpp @@ -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) { diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 25ae1bf298..467c0334de 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -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) diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 77cb79696d..8816246c60 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -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)) { diff --git a/radio/src/gui/480x272/model_module_options.cpp b/radio/src/gui/480x272/model_module_options.cpp index 8db248059d..01e189b1a1 100644 --- a/radio/src/gui/480x272/model_module_options.cpp +++ b/radio/src/gui/480x272/model_module_options.cpp @@ -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); diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index 074474d7f6..ad3a5dcb04 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -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)) { diff --git a/radio/src/gui/480x272/model_telemetry.cpp b/radio/src/gui/480x272/model_telemetry.cpp index 71f90ae587..2674c46437 100644 --- a/radio/src/gui/480x272/model_telemetry.cpp +++ b/radio/src/gui/480x272/model_telemetry.cpp @@ -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) { diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index f27d8480fa..2b77067e7f 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -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 diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index 867fd74c93..8c69d90b4b 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -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 diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 80b728a85d..6c53180f4a 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -288,12 +288,19 @@ enum SwashType { #define TIMER_COUNTDOWN_START(x) 10 #endif -enum XJTRFProtocols { - RF_PROTO_OFF = -1, - RF_PROTO_X16, - RF_PROTO_D8, - RF_PROTO_LR12, - RF_PROTO_LAST = RF_PROTO_LR12 +enum { + ACCST_RF_PROTO_OFF = -1, + ACCST_RF_PROTO_D16, + ACCST_RF_PROTO_D8, + ACCST_RF_PROTO_LR12, + ACCST_RF_PROTO_LAST = ACCST_RF_PROTO_LR12 +}; + +enum { + ACCESS_RF_PROTO_ACCESS, + ACCESS_RF_PROTO_D16, + ACCESS_RF_PROTO_LR12, + ACCESS_RF_PROTO_LAST = ACCESS_RF_PROTO_LR12 }; enum R9MSubTypes @@ -388,8 +395,8 @@ enum MMRFrskySubtypes { MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH }; -#define HAS_RF_PROTOCOL_FAILSAFE(rf) ((rf) == RF_PROTO_X16) -#define HAS_RF_PROTOCOL_MODELINDEX(rf) (((rf) == RF_PROTO_X16) || ((rf) == RF_PROTO_LR12)) +#define HAS_RF_PROTOCOL_FAILSAFE(rf) ((rf) == ACCST_RF_PROTO_D16) +#define HAS_RF_PROTOCOL_MODELINDEX(rf) (((rf) == ACCST_RF_PROTO_D16) || ((rf) == ACCST_RF_PROTO_LR12)) enum DSM2Protocols { DSM2_PROTO_LP45, diff --git a/radio/src/pulses/modules.h b/radio/src/pulses/modules.h index 93cc3ce3ec..31651a4ad9 100644 --- a/radio/src/pulses/modules.h +++ b/radio/src/pulses/modules.h @@ -214,7 +214,6 @@ inline int8_t sentModuleChannels(uint8_t idx) } enum { - MODULE_OPTION_RF_PROTOCOL, MODULE_OPTION_EXTERNAL_ANTENNA, MODULE_OPTION_POWER, MODULE_OPTION_SPECTRUM_ANALYSER, @@ -222,11 +221,10 @@ enum { }; /* Options order: - * - RF Protocol (0x01) - * - External antenna (0x02) - * - Power (0x04) - * - Spektrum analyser (0x08) - * - Power meter (0x10) + * - External antenna (0x01) + * - Power (0x02) + * - Spektrum analyser (0x04) + * - Power meter (0x08) */ static const uint8_t moduleOptions[] = { #if defined(SIMU) @@ -234,14 +232,14 @@ static const uint8_t moduleOptions[] = { #else 0b00000000, // None = display all options on SIMU #endif - 0b11100011, // XJT - 0b11100011, // ISRM - 0b11111011, // ISRM-PRO - 0b11101011, // ISRM-S - 0b11100100, // R9M - 0b11100100, // R9MLite - 0b11111100, // R9MLite-PRO - 0b11101001, // ISRM-N + 0b11110001, // XJT + 0b11110001, // ISRM + 0b11111101, // ISRM-PRO + 0b11110101, // ISRM-S + 0b11110010, // R9M + 0b11110010, // R9MLite + 0b11111110, // R9MLite-PRO + 0b11110100, // ISRM-N }; inline bool isModuleOptionAvailable(uint8_t modelId, uint8_t option) diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index 835ff550c9..da9d224d66 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -110,7 +110,6 @@ class ModuleSettings { public: uint8_t state; // 0x00 = READ 0x40 = WRITE tmr10ms_t retryTime; - uint8_t rfProtocol; uint8_t externalAntenna; int8_t txPower; }; diff --git a/radio/src/pulses/pxx2.cpp b/radio/src/pulses/pxx2.cpp index 69407775a3..5b63246135 100644 --- a/radio/src/pulses/pxx2.cpp +++ b/radio/src/pulses/pxx2.cpp @@ -36,9 +36,9 @@ uint8_t Pxx2Pulses::addFlag0(uint8_t module) return flag0; } -void Pxx2Pulses::addFlag1() +void Pxx2Pulses::addFlag1(uint8_t module) { - uint8_t flag1 = 0; + uint8_t flag1 = g_model.moduleData[module].rfProtocol << 6; Pxx2Transport::addByte(flag1); } @@ -110,7 +110,7 @@ void Pxx2Pulses::setupChannelsFrame(uint8_t module) uint8_t flag0 = addFlag0(module); // Flag1 - addFlag1(); + addFlag1(module); // Failsafe / Channels if (flag0 & PXX2_CHANNELS_FLAG0_FAILSAFE) @@ -180,7 +180,7 @@ void Pxx2Pulses::setupModuleSettingsFrame(uint8_t module) flag0 |= PXX2_TX_SETTINGS_FLAG0_WRITE; Pxx2Transport::addByte(flag0); if (destination->state == PXX2_SETTINGS_WRITE) { - uint8_t flag1 = destination->rfProtocol << 6; + uint8_t flag1 = 0; if (destination->externalAntenna) flag1 |= PXX2_TX_SETTINGS_FLAG1_EXTERNAL_ANTENNA; Pxx2Transport::addByte(flag1); diff --git a/radio/src/pulses/pxx2.h b/radio/src/pulses/pxx2.h index db358501e2..880d27cd15 100644 --- a/radio/src/pulses/pxx2.h +++ b/radio/src/pulses/pxx2.h @@ -236,7 +236,7 @@ class Pxx2Pulses: public Pxx2Transport { uint8_t addFlag0(uint8_t module); - void addFlag1(); + void addFlag1(uint8_t module); void addPulsesValues(uint16_t low, uint16_t high); diff --git a/radio/src/storage/storage_common.cpp b/radio/src/storage/storage_common.cpp index 7f51bc2c74..d919d6c0c9 100644 --- a/radio/src/storage/storage_common.cpp +++ b/radio/src/storage/storage_common.cpp @@ -56,8 +56,8 @@ void preModelLoad() #if defined(PCBTARANIS) || defined(PCBHORUS) static void fixUpModel() { - // Ensure that when rfProtocol is RF_PROTO_OFF the type of the module is MODULE_TYPE_NONE - if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_PXX_XJT && g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF) + // Ensure that when rfProtocol is ACCST_RF_PROTO_OFF the type of the module is MODULE_TYPE_NONE + if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_PXX_XJT && g_model.moduleData[INTERNAL_MODULE].rfProtocol == ACCST_RF_PROTO_OFF) g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE; } #endif