1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-24 00:35:14 +03:00

[X7] Hardware menu navigation fix (last line) + some TODO removed

This commit is contained in:
Bertrand Songis 2017-01-28 19:52:34 +01:00
parent c36d4d0be5
commit dfbdcdba85
17 changed files with 107 additions and 83 deletions

View file

@ -338,11 +338,17 @@ if(GUI)
keys.cpp
maths.cpp
translations.cpp
gui/gui_common_arm.cpp
gui/gui_common.cpp
)
foreach(FILE ${GUI_SRC})
set(SRC ${SRC} gui/${GUI_DIR}/${FILE})
endforeach()
if(ARCH STREQUAL ARM)
set(SRC
${SRC}
gui/gui_common_arm.cpp
)
endif()
endif()
foreach(FILE ${TARGET_SRC})

View file

@ -195,7 +195,9 @@ void menuModelLogicalSwitchOne(event_t event)
case LS_FIELD_ANDSW:
lcdDrawTextAlignedLeft(y, STR_AND_SWITCH);
drawSwitch(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
if (attr) CHECK_INCDEC_MODELSWITCH(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches);
if (attr) {
CHECK_INCDEC_MODELSWITCH(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW, isSwitchAvailableInLogicalSwitches);
}
break;
case LS_FIELD_DURATION:
@ -203,8 +205,10 @@ void menuModelLogicalSwitchOne(event_t event)
if (cs->duration > 0)
lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->duration, attr|PREC1|LEFT);
else
lcdDrawTextAtIndex(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION);
lcdDrawMMM(CSWONE_2ND_COLUMN, y, attr);
if (attr) {
CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION);
}
break;
case LS_FIELD_DELAY:
@ -212,8 +216,10 @@ void menuModelLogicalSwitchOne(event_t event)
if (cs->delay > 0)
lcdDrawNumber(CSWONE_2ND_COLUMN, y, cs->delay, attr|PREC1|LEFT);
else
lcdDrawTextAtIndex(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_LS_DELAY);
lcdDrawMMM(CSWONE_2ND_COLUMN, y, attr);
if (attr) {
CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_LS_DELAY);
}
break;
}
}

View file

@ -301,7 +301,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
lcdDrawChar(lcdLastPos, y, 's');
}
else {
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_MMMINV, 0, attr);
lcdDrawMMM(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, attr);
}
}
#endif

View file

@ -109,8 +109,8 @@ enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_SB,
ITEM_RADIO_HARDWARE_SC,
ITEM_RADIO_HARDWARE_SD,
ITEM_RADIO_HARDWARE_SE,
ITEM_RADIO_HARDWARE_SF,
ITEM_RADIO_HARDWARE_SH,
ITEM_RADIO_HARDWARE_JITTER_FILTER,
ITEM_RADIO_HARDWARE_MAX
};
@ -122,7 +122,7 @@ enum MenuRadioHardwareItems {
void menuRadioHardware(event_t event)
{
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS });
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0 });
uint8_t sub = menuVerticalPosition;
@ -144,15 +144,8 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_STICK2:
case ITEM_RADIO_HARDWARE_STICK3:
case ITEM_RADIO_HARDWARE_STICK4:
{
int idx = k-1;
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
editStickHardwareSettings(HW_SETTINGS_COLUMN, y, k - ITEM_RADIO_HARDWARE_STICK1, event, attr);
break;
}
case ITEM_RADIO_HARDWARE_LABEL_POTS:
lcdDrawTextAlignedLeft(y, STR_POTS);
@ -164,10 +157,10 @@ void menuRadioHardware(event_t event)
uint8_t shift = (2*idx);
uint8_t mask = (0x03 << shift);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition==0 ? attr : 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask;
@ -182,16 +175,16 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_SB:
case ITEM_RADIO_HARDWARE_SC:
case ITEM_RADIO_HARDWARE_SD:
case ITEM_RADIO_HARDWARE_SE:
case ITEM_RADIO_HARDWARE_SF:
case ITEM_RADIO_HARDWARE_SH:
{
int index = k-ITEM_RADIO_HARDWARE_SA;
int config = SWITCH_CONFIG(index);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition == 0 ? attr : 0);
config = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index);

View file

@ -185,7 +185,7 @@ void menuModelLogicalSwitches(event_t event)
if (cs->duration > 0)
lcdDrawNumber(CSW_5TH_COLUMN, y, cs->duration, (horz==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT);
else
lcdDrawTextAtIndex(CSW_5TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DURATION ? attr : 0);
lcdDrawMMM(CSW_5TH_COLUMN, y, horz==LS_FIELD_DURATION ? attr : 0);
// CSW delay
if (cstate == LS_FAMILY_EDGE) {
@ -198,7 +198,7 @@ void menuModelLogicalSwitches(event_t event)
lcdDrawNumber(CSW_6TH_COLUMN, y, cs->delay, (horz==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT);
}
else {
lcdDrawTextAtIndex(CSW_6TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DELAY ? attr : 0);
lcdDrawMMM(CSW_6TH_COLUMN, y, horz==LS_FIELD_DELAY ? attr : 0);
}
if (attr && horz == LS_FIELD_V3 && cstate != LS_FAMILY_EDGE) {

View file

@ -329,7 +329,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
lcdDrawChar(lcdLastPos, y, 's');
}
else {
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_MMMINV, 0, attr);
lcdDrawMMM(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, attr);
}
}
#if defined(PCBX9E) || defined(PCBX9DP)

View file

@ -103,15 +103,8 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_STICK2:
case ITEM_RADIO_HARDWARE_STICK3:
case ITEM_RADIO_HARDWARE_STICK4:
{
int idx = (k<=ITEM_RADIO_HARDWARE_STICK4 ? k-ITEM_RADIO_HARDWARE_STICK1 : k-ITEM_RADIO_HARDWARE_LS+MIXSRC_SLIDER1-MIXSRC_Rud);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
editStickHardwareSettings(HW_SETTINGS_COLUMN, y, k - ITEM_RADIO_HARDWARE_STICK1, event, attr);
break;
}
case ITEM_RADIO_HARDWARE_LS:
case ITEM_RADIO_HARDWARE_RS:
@ -121,12 +114,12 @@ void menuRadioHardware(event_t event)
#endif
{
int idx = k - ITEM_RADIO_HARDWARE_LS;
uint8_t mask = (0x01 << idx);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_POTS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx]) || (attr && menuHorizontalPosition == 0))
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx]) || (attr && menuHorizontalPosition == 0 && s_editMode > 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition == 0 ? attr : 0);
uint8_t mask = (0x01 << idx);
uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx;
potType = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.slidersConfig &= ~mask;
@ -150,10 +143,10 @@ void menuRadioHardware(event_t event)
uint8_t shift = (2*idx);
uint8_t mask = (0x03 << shift);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0 && s_editMode > 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition == 0 ? attr : 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask;
@ -187,10 +180,10 @@ void menuRadioHardware(event_t event)
int index = k-ITEM_RADIO_HARDWARE_SA;
int config = SWITCH_CONFIG(index);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0 && s_editMode > 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, menuHorizontalPosition == 0 ? attr : 0);
config = editChoice(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index);

View file

@ -396,7 +396,7 @@ void menuRadioSetup(event_t event)
lcdDrawChar(lcdLastPos, y, 's');
}
else {
lcdDrawTextAtIndex(RADIO_SETUP_2ND_COLUMN, y, STR_MMMINV, 0, attr); // TODO define
lcdDrawMMM(RADIO_SETUP_2ND_COLUMN, y, attr);
}
if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4);
break;

View file

@ -184,7 +184,7 @@ bool menuModelLogicalSwitches(event_t event)
if (cs->duration > 0)
lcdDrawNumber(CSW_5TH_COLUMN, y, cs->duration, (menuHorizontalPosition==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT);
else
lcdDrawTextAtIndex(CSW_5TH_COLUMN, y, STR_MMMINV, 0, menuHorizontalPosition==LS_FIELD_DURATION ? attr : 0);
lcdDrawMMM(CSW_5TH_COLUMN, y, menuHorizontalPosition==LS_FIELD_DURATION ? attr : 0);
// CSW delay
if (cstate == LS_FAMILY_EDGE) {
@ -194,7 +194,7 @@ bool menuModelLogicalSwitches(event_t event)
lcdDrawNumber(CSW_6TH_COLUMN, y, cs->delay, (menuHorizontalPosition==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT);
}
else {
lcdDrawTextAtIndex(CSW_6TH_COLUMN, y, STR_MMMINV, 0, menuHorizontalPosition==LS_FIELD_DELAY ? attr : 0);
lcdDrawMMM(CSW_6TH_COLUMN, y, menuHorizontalPosition==LS_FIELD_DELAY ? attr : 0);
}
if (s_editMode>0 && attr) {

View file

@ -333,7 +333,7 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT, 0, NULL, "s");
}
else {
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_MMMINV, 0, attr);
lcdDrawMMM(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, attr);
}
}
#if defined(GVARS)

View file

@ -88,15 +88,8 @@ bool menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_STICK2:
case ITEM_RADIO_HARDWARE_STICK3:
case ITEM_RADIO_HARDWARE_STICK4:
{
int idx = k - ITEM_RADIO_HARDWARE_STICK1;
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
editStickHardwareSettings(HW_SETTINGS_COLUMN, y, k - ITEM_RADIO_HARDWARE_STICK1, event, attr);
break;
}
case ITEM_RADIO_HARDWARE_LS:
case ITEM_RADIO_HARDWARE_RS:
@ -109,7 +102,7 @@ bool menuRadioHardware(event_t event)
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx]) || (attr && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx;
potType = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.slidersConfig &= ~mask;
@ -132,7 +125,7 @@ bool menuRadioHardware(event_t event)
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
potType = editChoice(HW_SETTINGS_COLUMN+50, y, STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
g_eeGeneral.potsConfig &= ~mask;
@ -157,7 +150,7 @@ bool menuRadioHardware(event_t event)
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
else
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
config = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index);

View file

@ -401,7 +401,7 @@ bool menuRadioSetup(event_t event)
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT, 0, NULL, "s");
}
else {
lcdDrawTextAtIndex(RADIO_SETUP_2ND_COLUMN, y, STR_MMMINV, 0, attr); // TODO define
lcdDrawMMM(RADIO_SETUP_2ND_COLUMN, y, attr);
}
if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4);
break;

View file

@ -73,7 +73,7 @@ void displayLogicalSwitchedDetails(coord_t x, coord_t y, uint8_t idx)
if (cs->duration > 0)
lcdDrawNumber(CSW_5TH_COLUMN, y, cs->duration, PREC1 | LEFT);
else
lcdDrawTextAtIndex(CSW_5TH_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(CSW_5TH_COLUMN, y, 0);
// CSW delay
if (cstate == LS_FAMILY_EDGE) {
@ -83,7 +83,7 @@ void displayLogicalSwitchedDetails(coord_t x, coord_t y, uint8_t idx)
lcdDrawNumber(CSW_6TH_COLUMN, y, cs->delay, PREC1 | LEFT);
}
else {
lcdDrawTextAtIndex(CSW_6TH_COLUMN, y, STR_MMMINV, 0, 0);
lcdDrawMMM(CSW_6TH_COLUMN, y, 0);
}
}

View file

@ -20,11 +20,16 @@
#include "opentx.h"
void lcdDrawMMM(coord_t x, coord_t y, LcdFlags flags)
{
lcdDrawTextAtIndex(x, y, STR_MMMINV, 0, flags);
}
#if defined(FLIGHT_MODES)
void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx==0) {
lcdDrawTextAtIndex(x, y, STR_MMMINV, 0, att); // TODO macro
lcdDrawMMM(x, y, att);
return;
}
// TODO this code was not included in Taranis! and used with abs(...) on Horus
@ -41,4 +46,3 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
drawStringWithIndex(x, y, STR_FP, idx-1, att);
}
#endif

View file

@ -0,0 +1,37 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
#if defined(PCBTARANIS) || defined(PCBHORUS) || defined(PCBFLAMENCO)
uint8_t switchToMix(uint8_t source)
{
div_t qr = div(source-1, 3);
return qr.quot+MIXSRC_FIRST_SWITCH;
}
#else
uint8_t switchToMix(uint8_t source)
{
if (source <= 3)
return MIXSRC_3POS;
else
return MIXSRC_FIRST_SWITCH - 3 + source;
}
#endif

View file

@ -111,6 +111,7 @@ void drawFatalErrorScreen(const char * message);
void runFatalErrorScreen(const char * message);
#endif
void lcdDrawMMM(coord_t x, coord_t y, LcdFlags flags=0);
// model_setup Defines that are used in all uis in the same way
#define EXTERNAL_MODULE_CHANNELS_ROWS IF_EXTERNAL_MODULE_ON((IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_CROSSFIRE(EXTERNAL_MODULE) || (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE) && g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) != MM_RF_PROTO_DSM2)) ? (uint8_t)0 : (uint8_t)1)
@ -152,4 +153,6 @@ const mm_protocol_definition *getMultiProtocolDefinition (uint8_t protocol);
#define FAILSAFE_ROWS(x) (IS_MODULE_XJT(x) && HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[x].rfProtocol) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : MULTIMODULE_FAILSAFEROWS(x))
void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, LcdFlags flags);
#endif // _GUI_COMMON_H_

View file

@ -20,23 +20,6 @@
#include "opentx.h"
#if defined(PCBTARANIS) || defined(PCBHORUS) || defined(PCBFLAMENCO)
uint8_t switchToMix(uint8_t source)
{
div_t qr = div(source-1, 3);
return qr.quot+MIXSRC_FIRST_SWITCH;
}
#else
uint8_t switchToMix(uint8_t source)
{
if (source <= 3)
return MIXSRC_3POS;
else
return MIXSRC_FIRST_SWITCH - 3 + source;
}
#endif
#if defined(CPUARM)
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable)
{
do {
@ -636,7 +619,13 @@ const mm_protocol_definition *getMultiProtocolDefinition (uint8_t protocol)
// Return the empty last protocol
return pdef;
}
#endif
#endif
void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, LcdFlags flags)
{
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || (flags && s_editMode > 0))
editName(x, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, flags);
else
lcdDrawMMM(x, y, flags);
}