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 {
#if !defined(MEITUAN)
MENU_MODEL_SELECT,
#endif
MENU_MODEL_SETUP,
CASE_HELI(MENU_MODEL_HELI)
CASE_FLIGHT_MODES(MENU_MODEL_FLIGHT_MODES)
@ -135,7 +137,9 @@ void menuModelTemplates(event_t event);
void menuModelGVarOne(event_t event);
static const MenuHandlerFunc menuTabModel[] = {
#if !defined(MEITUAN)
menuModelSelect,
#endif
menuModelSetup,
CASE_HELI(menuModelHeli)
CASE_FLIGHT_MODES(menuModelFlightModesAll)

View file

@ -80,6 +80,10 @@ void onModelSelectMenu(const char * result)
#endif
}
#if defined(MEITUAN)
uint8_t MENU_MODEL_SELECT = 0;
#endif
void menuModelSelect(event_t 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:
{
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);
if (attr) {
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];
}
}
#endif
}
break;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,6 +52,9 @@ void onPXX2R9MBindModeMenu(const char * result)
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
reusableBuffer.moduleSetup.bindInformation.step = 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
reusableBuffer.moduleSetup.bindInformation.step = BIND_START;
#endif
@ -83,6 +86,9 @@ void onPXX2BindMenu(const char * result)
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
reusableBuffer.moduleSetup.bindInformation.step = 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
reusableBuffer.moduleSetup.bindInformation.step = BIND_START;
#endif

View file

@ -268,6 +268,9 @@ void Pxx2Pulses::setupAccessBindFrame(uint8_t module)
moduleState[module].mode = MODULE_MODE_NORMAL;
destination->step = BIND_OK;
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;
}
@ -291,7 +294,12 @@ void Pxx2Pulses::setupAccessBindFrame(uint8_t module)
else {
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]);
#endif
}
else {
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(AUTOUPDATE "Auto update internal chips from SD" OFF)
option(BIND_KEY "Enable bind button" OFF)
option(MEITUAN "Meituan custom software" OFF)
set(EXTERNAL_MODULE YES)
add_definitions(-DHARDWARE_TRIMS)
@ -551,6 +552,10 @@ if(INTERNAL_MODULE_ELRS)
add_definitions(-DINTERNAL_MODULE_ELRS)
endif()
if(MEITUAN)
add_definitions(-DMEITUAN)
endif()
if(EXTERNAL_MODULE)
set(TARGET_SRC
${TARGET_SRC}

View file

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