1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-20 06:45:10 +03:00

Meituan customized : rxNum self-growth

This commit is contained in:
WismyYao 2022-03-02 09:21:54 +08:00
parent 801b289580
commit a4d7447f72
12 changed files with 46 additions and 1 deletions

View file

@ -92,7 +92,9 @@ static const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
}; };
enum MenuModelIndexes { enum MenuModelIndexes {
#if !defined(MEITUAN)
MENU_MODEL_SELECT, MENU_MODEL_SELECT,
#endif
MENU_MODEL_SETUP, MENU_MODEL_SETUP,
CASE_HELI(MENU_MODEL_HELI) CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES) CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)
@ -135,7 +137,9 @@ void menuModelTemplates(event_t event);
void menuModelGVarOne(event_t event); void menuModelGVarOne(event_t event);
static const MenuHandlerFunc menuTabModel[] = { static const MenuHandlerFunc menuTabModel[] = {
#if !defined(MEITUAN)
menuModelSelect, menuModelSelect,
#endif
menuModelSetup, menuModelSetup,
CASE_HELI(menuModelHeli) CASE_HELI(menuModelHeli)
CASE_FLIGHT_MODES(menuModelFlightModesAll) CASE_FLIGHT_MODES(menuModelFlightModesAll)

View file

@ -80,6 +80,10 @@ void onModelSelectMenu(const char * result)
#endif #endif
} }
#if defined(MEITUAN)
uint8_t MENU_MODEL_SELECT = 0;
#endif
void menuModelSelect(event_t event) void menuModelSelect(event_t event)
{ {
event_t _event_ = event; event_t _event_ = event;

View file

@ -1368,6 +1368,13 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_MODEL_NUM: case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_MODEL_NUM:
{ {
lcdDrawText(INDENT_WIDTH, y, STR_RECEIVER_NUM); lcdDrawText(INDENT_WIDTH, y, STR_RECEIVER_NUM);
#if defined(MEITUAN)
if (g_model.header.modelId[moduleIdx] == 0) {
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, "--", attr | LEADING0 | LEFT);
}
else
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], attr | LEADING0 | LEFT, 2);
#else
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], attr | LEADING0 | LEFT, 2); lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], attr | LEADING0 | LEFT, 2);
if (attr) { if (attr) {
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], getMaxRxNum(moduleIdx)); CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], getMaxRxNum(moduleIdx));
@ -1375,6 +1382,7 @@ void menuModelSetup(event_t event)
modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx]; modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx];
} }
} }
#endif
} }
break; break;

View file

@ -458,7 +458,7 @@ void menuMainView(event_t event)
#endif #endif
case EVT_KEY_MODEL_MENU: case EVT_KEY_MODEL_MENU:
pushMenu(menuModelSelect); pushMenu(menuTabModel[0]);
killEvents(event); killEvents(event);
break; break;

View file

@ -21,7 +21,9 @@
#include "opentx.h" #include "opentx.h"
const MenuHandlerFunc menuTabModel[] = { const MenuHandlerFunc menuTabModel[] = {
#if !defined(MEITUAN)
menuModelSelect, menuModelSelect,
#endif
menuModelSetup, menuModelSetup,
CASE_HELI(menuModelHeli) CASE_HELI(menuModelHeli)
CASE_FLIGHT_MODES(menuModelFlightModesAll) CASE_FLIGHT_MODES(menuModelFlightModesAll)

View file

@ -81,7 +81,9 @@ void menuGhostModuleConfig(event_t event);
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT]; extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
enum MenuModelIndexes { enum MenuModelIndexes {
#if !defined(MEITUAN)
MENU_MODEL_SELECT, MENU_MODEL_SELECT,
#endif
MENU_MODEL_SETUP, MENU_MODEL_SETUP,
CASE_HELI(MENU_MODEL_HELI) CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES) CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)

View file

@ -21,7 +21,9 @@
#include "opentx.h" #include "opentx.h"
const MenuHandlerFunc menuTabModel[] = { const MenuHandlerFunc menuTabModel[] = {
#if !defined(MEITUAN)
menuModelSetup, menuModelSetup,
#endif
CASE_HELI(menuModelHeli) CASE_HELI(menuModelHeli)
CASE_FLIGHT_MODES(menuModelFlightModesAll) CASE_FLIGHT_MODES(menuModelFlightModesAll)
menuModelExposAll, menuModelExposAll,

View file

@ -59,8 +59,10 @@ void pushMenu(MenuHandlerFunc newMenu)
if (newMenu == menuRadioTools) if (newMenu == menuRadioTools)
menuVerticalPositions[0] = 1; menuVerticalPositions[0] = 1;
#endif #endif
#if !define(MEITUAN)
if (newMenu == menuModelSetup) if (newMenu == menuModelSetup)
menuVerticalPositions[0] = 0; menuVerticalPositions[0] = 0;
#endif
} }
else { else {
menuVerticalPositions[menuLevel] = menuVerticalPosition; menuVerticalPositions[menuLevel] = menuVerticalPosition;

View file

@ -52,6 +52,9 @@ void onPXX2R9MBindModeMenu(const char * result)
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL; moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
reusableBuffer.moduleSetup.bindInformation.step = BIND_OK; reusableBuffer.moduleSetup.bindInformation.step = BIND_OK;
POPUP_INFORMATION(STR_BIND_OK); POPUP_INFORMATION(STR_BIND_OK);
#if defined(MEITUAN)
g_model.header.modelId[moduleIdx] = (g_model.header.modelId[moduleIdx] + 1) % getMaxRxNum(moduleIdx);
#endif
#else #else
reusableBuffer.moduleSetup.bindInformation.step = BIND_START; reusableBuffer.moduleSetup.bindInformation.step = BIND_START;
#endif #endif
@ -83,6 +86,9 @@ void onPXX2BindMenu(const char * result)
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL; moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
reusableBuffer.moduleSetup.bindInformation.step = BIND_OK; reusableBuffer.moduleSetup.bindInformation.step = BIND_OK;
POPUP_INFORMATION(STR_BIND_OK); POPUP_INFORMATION(STR_BIND_OK);
#if defined(MEITUAN)
g_model.header.modelId[moduleIdx] = (g_model.header.modelId[moduleIdx] + 1) % getMaxRxNum(moduleIdx);
#endif
#else #else
reusableBuffer.moduleSetup.bindInformation.step = BIND_START; reusableBuffer.moduleSetup.bindInformation.step = BIND_START;
#endif #endif

View file

@ -268,6 +268,9 @@ void Pxx2Pulses::setupAccessBindFrame(uint8_t module)
moduleState[module].mode = MODULE_MODE_NORMAL; moduleState[module].mode = MODULE_MODE_NORMAL;
destination->step = BIND_OK; destination->step = BIND_OK;
POPUP_INFORMATION(STR_BIND_OK); // TODO rather use the new callback POPUP_INFORMATION(STR_BIND_OK); // TODO rather use the new callback
#if defined(MEITUAN)
g_model.header.modelId[module] = (g_model.header.modelId[module] + 1) % getMaxRxNum(module);
#endif
} }
return; return;
} }
@ -291,7 +294,12 @@ void Pxx2Pulses::setupAccessBindFrame(uint8_t module)
else { else {
Pxx2Transport::addByte(destination->rxUid); // RX_UID is the slot index (which is unique and never moved) Pxx2Transport::addByte(destination->rxUid); // RX_UID is the slot index (which is unique and never moved)
} }
#if defined(MEITUAN)
Pxx2Transport::addByte((g_model.header.modelId[module] + 1) % getMaxRxNum(module));
#else
Pxx2Transport::addByte(g_model.header.modelId[module]); Pxx2Transport::addByte(g_model.header.modelId[module]);
#endif
} }
else { else {
Pxx2Transport::addByte(0x00); // DATA0 Pxx2Transport::addByte(0x00); // DATA0

View file

@ -7,6 +7,7 @@ option(GHOST "Ghost TX Module" ON)
option(INTERNAL_MODULE_PPM "Support for PPM internal module" OFF) option(INTERNAL_MODULE_PPM "Support for PPM internal module" OFF)
option(AUTOUPDATE "Auto update internal chips from SD" OFF) option(AUTOUPDATE "Auto update internal chips from SD" OFF)
option(BIND_KEY "Enable bind button" OFF) option(BIND_KEY "Enable bind button" OFF)
option(MEITUAN "Meituan custom software" OFF)
set(EXTERNAL_MODULE YES) set(EXTERNAL_MODULE YES)
add_definitions(-DHARDWARE_TRIMS) add_definitions(-DHARDWARE_TRIMS)
@ -551,6 +552,10 @@ if(INTERNAL_MODULE_ELRS)
add_definitions(-DINTERNAL_MODULE_ELRS) add_definitions(-DINTERNAL_MODULE_ELRS)
endif() endif()
if(MEITUAN)
add_definitions(-DMEITUAN)
endif()
if(EXTERNAL_MODULE) if(EXTERNAL_MODULE)
set(TARGET_SRC set(TARGET_SRC
${TARGET_SRC} ${TARGET_SRC}

View file

@ -33,6 +33,7 @@ boards = {
"PPM": "NO", "PPM": "NO",
"DSM2": "NO", "DSM2": "NO",
"SBUS": "NO", "SBUS": "NO",
# "MEITUAN":"YES",
}, },
"X9LITE": { "X9LITE": {
"PCB": "X9LITE", "PCB": "X9LITE",
@ -55,6 +56,7 @@ boards = {
"DSM2": "NO", "DSM2": "NO",
"SBUS": "NO", "SBUS": "NO",
"DEFAULT_MODE": "2", "DEFAULT_MODE": "2",
# "MEITUAN":"YES",
}, },
"X9D+2019": { "X9D+2019": {
"PCB": "X9D+", "PCB": "X9D+",