feat: enable Companion simulator to switch UI language at runtime (#6510)
This commit is contained in:
@@ -155,7 +155,7 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
|
||||
att &= ~RIGHT & ~BOLD;
|
||||
uint32_t absvalue = abs(value);
|
||||
lcdDrawNumber(x, y, absvalue / 1000000, att); // ddd
|
||||
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, att);
|
||||
lcdDrawChar(lcdLastRightPos, y, CHAR_BW_DEGREE, att);
|
||||
absvalue = absvalue % 1000000;
|
||||
absvalue *= 60;
|
||||
if (g_eeGeneral.gpsFormat == 0 || !seconds) {
|
||||
|
||||
@@ -48,7 +48,7 @@ void runPopupCurvePreset(event_t event)
|
||||
}
|
||||
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS);
|
||||
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, STR_CHAR_BW_DEGREE, INVERS);
|
||||
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, CHAR_BW_DEGREE, INVERS);
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
|
||||
@@ -173,7 +173,7 @@ void menuModelLimitsOne(event_t event)
|
||||
case ITEM_OUTPUTONE_SYMETRICAL:
|
||||
lcdDrawTextAlignedLeft(y, STR_LIMITS_HEADERS_SUBTRIMMODE);
|
||||
lcdDrawSizedText(LIMITS_ONE_2ND_COLUMN, y,
|
||||
ld->symetrical ? "=" : STR_CHAR_DELTA, 2, attr);
|
||||
ld->symetrical ? "=" : CHAR_DELTA, 2, attr);
|
||||
if (active) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);
|
||||
}
|
||||
@@ -319,7 +319,7 @@ void menuModelLimits(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_OUTPUTS_SYMETRICAL:
|
||||
lcdDrawSizedText(LCD_W-FW, y, ld->symetrical ? "=" : STR_CHAR_DELTA, 2, 0);
|
||||
lcdDrawSizedText(LCD_W-FW, y, ld->symetrical ? "=" : CHAR_DELTA, 2, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ uint8_t viewOptChoice(coord_t y, const char* title, uint8_t value, uint8_t attr,
|
||||
}
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
const char* _fct_sw_start[] = { STR_CHAR_UP, STR_CHAR_DOWN, "=" };
|
||||
const char* _fct_sw_start[] = { CHAR_UP, CHAR_DOWN, "=" };
|
||||
int swIndex;
|
||||
static uint8_t cfsGroup;
|
||||
|
||||
@@ -668,7 +668,7 @@ void menuCFSColor(coord_t y, RGBLedColor& color, const char* title, LcdFlags att
|
||||
|
||||
static void menuModelCFSOne(event_t event)
|
||||
{
|
||||
std::string s(STR_CHAR_SWITCH);
|
||||
std::string s(CHAR_SWITCH);
|
||||
s += switchGetDefaultName(swIndex);
|
||||
|
||||
int config = g_model.cfsType(swIndex);
|
||||
@@ -1060,7 +1060,7 @@ void menuModelSetup(event_t event)
|
||||
{
|
||||
int index = (k - ITEM_MODEL_SETUP_SW1);
|
||||
|
||||
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, attr);
|
||||
lcdDrawSizedText(INDENT_WIDTH, y, CHAR_SWITCH, 2, attr);
|
||||
lcdDrawText(lcdNextPos, y, switchGetDefaultName(index), attr);
|
||||
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
|
||||
@@ -126,12 +126,12 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
uint8_t x = INDENT_WIDTH;
|
||||
lcdDrawText(x, y, "X:");
|
||||
lcdDrawNumber(x+3*FW-1, y, gyro.outputs[0] * 180 / 1024);
|
||||
lcdDrawChar(lcdNextPos, y, STR_CHAR_BW_DEGREE);
|
||||
lcdDrawChar(lcdNextPos, y, CHAR_BW_DEGREE);
|
||||
lcdDrawNumber(x+10*FW-1, y, gyro.scaledX(), RIGHT);
|
||||
x = LCD_W/2 + INDENT_WIDTH;
|
||||
lcdDrawText(x, y, "Y:");
|
||||
lcdDrawNumber(x+3*FW-1, y, gyro.outputs[1] * 180 / 1024);
|
||||
lcdDrawChar(lcdNextPos, y, STR_CHAR_BW_DEGREE);
|
||||
lcdDrawChar(lcdNextPos, y, CHAR_BW_DEGREE);
|
||||
lcdDrawNumber(x+10*FW-1, y, gyro.scaledY(), RIGHT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -81,10 +81,10 @@ void menuRadioDiagFS(event_t event)
|
||||
if (r < 6) {
|
||||
uint8_t sw = switchGetCustomSwitchIdx(i);
|
||||
coord_t y = 2*FH + r*FH + 1;
|
||||
lcdDrawTextIndented(y, STR_CHAR_SWITCH);
|
||||
lcdDrawTextIndented(y, CHAR_SWITCH);
|
||||
lcdDrawText(lcdNextPos, y, switchGetDefaultName(i));
|
||||
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||
lcdDrawText(FS_2ND_COLUMN + 5, y, g_model.cfsState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? CHAR_DOWN : CHAR_UP);
|
||||
lcdDrawText(FS_2ND_COLUMN + 5, y, g_model.cfsState(i) ? CHAR_DOWN : CHAR_UP);
|
||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||
lcdDrawText(FS_3RD_COLUMN, y, STR_FS_COLOR_LIST[getRGBColorIndex(rgbGetLedColor(sw))], 0);
|
||||
#else
|
||||
|
||||
@@ -453,7 +453,7 @@ void menuRadioSetup(event_t event)
|
||||
lcdDrawTextIndented(y, STR_IMU_MAX);
|
||||
lcdDrawNumber(LCD_W-7, y, IMU_MAX_DEFAULT + g_eeGeneral.imuMax, attr|RIGHT);
|
||||
coord_t lp = lcdLastLeftPos - 2;
|
||||
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, attr);
|
||||
lcdDrawChar(lcdLastRightPos, y, CHAR_BW_DEGREE, attr);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.imuMax, IMU_MAX_DEFAULT - IMU_MAX_RANGE, IMU_MAX_DEFAULT + IMU_MAX_RANGE);
|
||||
lcdDrawText(lp, y, ")", RIGHT);
|
||||
@@ -468,7 +468,7 @@ void menuRadioSetup(event_t event)
|
||||
lcdDrawTextIndented(y, STR_IMU_OFFSET);
|
||||
lcdDrawNumber(LCD_W-7, y, g_eeGeneral.imuOffset, attr|RIGHT);
|
||||
coord_t lp = lcdLastLeftPos - 2;
|
||||
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, attr);
|
||||
lcdDrawChar(lcdLastRightPos, y, CHAR_BW_DEGREE, attr);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.imuOffset, IMU_OFFSET_MIN, IMU_OFFSET_MAX);
|
||||
lcdDrawText(lp, y, ")", RIGHT);
|
||||
@@ -676,12 +676,21 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
case ITEM_RADIO_SETUP_LANGUAGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_VOICE_LANGUAGE);
|
||||
#if !defined(ALL_LANGS)
|
||||
lcdDrawText(LCD_W-2, y, currentLanguagePack->name, attr|RIGHT);
|
||||
#else
|
||||
lcdDrawText(LCD_W-2, y, currentLanguagePack->name(), attr|RIGHT);
|
||||
#endif
|
||||
if (attr) {
|
||||
currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL);
|
||||
if (checkIncDec_Ret) {
|
||||
currentLanguagePack = languagePacks[currentLanguagePackIdx];
|
||||
strncpy(g_eeGeneral.ttsLanguage, currentLanguagePack->id, 2);
|
||||
#if defined(ALL_LANGS)
|
||||
currentLangStrings = langStrings[currentLanguagePackIdx];
|
||||
extern void setLanguageFont(int n);
|
||||
setLanguageFont(currentLanguagePackIdx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -186,7 +186,7 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
|
||||
att &= ~RIGHT;
|
||||
if (x > 10) x-=10;
|
||||
lcdDrawNumber(x, y, absvalue / 1000000, att); // ddd
|
||||
lcdDrawChar(lcdLastRightPos, y, STR_CHAR_BW_DEGREE, att);
|
||||
lcdDrawChar(lcdLastRightPos, y, CHAR_BW_DEGREE, att);
|
||||
absvalue = absvalue % 1000000;
|
||||
absvalue *= 60;
|
||||
if (g_eeGeneral.gpsFormat == 0 || !seconds) {
|
||||
|
||||
@@ -50,7 +50,7 @@ void runPopupCurvePreset(event_t event)
|
||||
}
|
||||
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS);
|
||||
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, STR_CHAR_BW_DEGREE, INVERS);
|
||||
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, CHAR_BW_DEGREE, INVERS);
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
|
||||
@@ -241,7 +241,7 @@ void menuModelLimits(event_t event)
|
||||
#if defined(PPM_LIMITS_SYMETRICAL)
|
||||
case ITEM_LIMITS_SYMETRICAL:
|
||||
lcdDrawSizedText(LCD_W - FW - MENUS_SCROLLBAR_WIDTH, y,
|
||||
ld->symetrical ? "=" : STR_CHAR_DELTA, 2, attr);
|
||||
ld->symetrical ? "=" : CHAR_DELTA, 2, attr);
|
||||
if (active) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);
|
||||
}
|
||||
|
||||
@@ -645,12 +645,21 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
case ITEM_RADIO_SETUP_LANGUAGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_VOICE_LANGUAGE);
|
||||
#if !defined(ALL_LANGS)
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr);
|
||||
#else
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name(), attr);
|
||||
#endif
|
||||
if (attr) {
|
||||
currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL);
|
||||
if (checkIncDec_Ret) {
|
||||
currentLanguagePack = languagePacks[currentLanguagePackIdx];
|
||||
strncpy(g_eeGeneral.ttsLanguage, currentLanguagePack->id, 2);
|
||||
#if defined(ALL_LANGS)
|
||||
currentLangStrings = langStrings[currentLanguagePackIdx];
|
||||
extern void setLanguageFont(int n);
|
||||
setLanguageFont(currentLanguagePackIdx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -46,13 +46,12 @@ ChannelBar::ChannelBar(Window* parent, const rect_t& rect, uint8_t channel,
|
||||
|
||||
coord_t yo = (height() < 10) ? -1 : -PAD_TINY;
|
||||
|
||||
valText = lv_label_create(lvobj);
|
||||
valText = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
lv_obj_set_pos(valText, width() / 2 + VAL_XO, yo);
|
||||
lv_obj_set_size(valText, VAL_W, VAL_H);
|
||||
etx_obj_add_style(valText, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_style_translate_x(valText, VAL_XT, LV_STATE_USER_1);
|
||||
etx_obj_add_style(valText, styles->text_align_right, LV_STATE_USER_1);
|
||||
etx_font(valText, FONT_XS_INDEX);
|
||||
etx_txt_color(valText, txtColorIndex);
|
||||
lv_label_set_text(valText, "");
|
||||
|
||||
|
||||
@@ -260,17 +260,16 @@ class BarColorType : public ColorType
|
||||
|
||||
lv_obj_t* create_bar_label(lv_obj_t* parent, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
lv_obj_t* obj = lv_label_create(parent);
|
||||
lv_obj_t* obj = etx_label_create(parent, FONT_XXS_INDEX);
|
||||
lv_obj_set_pos(obj, x, y);
|
||||
etx_txt_color(obj, COLOR_THEME_PRIMARY1_INDEX);
|
||||
etx_font(obj, FONT_XXS_INDEX);
|
||||
return obj;
|
||||
}
|
||||
|
||||
lv_obj_t* create_bar_value_label(lv_obj_t* parent, lv_coord_t x,
|
||||
lv_coord_t y)
|
||||
{
|
||||
lv_obj_t* obj = lv_label_create(parent);
|
||||
lv_obj_t* obj = etx_label_create(parent);
|
||||
lv_obj_set_pos(obj, x, y);
|
||||
etx_txt_color(obj, COLOR_THEME_PRIMARY1_INDEX);
|
||||
return obj;
|
||||
|
||||
@@ -35,11 +35,11 @@ class SourceChoiceMenuToolbar : public MenuToolbar
|
||||
SourceChoiceMenuToolbar(SourceChoice* choice, Menu* menu) :
|
||||
MenuToolbar(choice, menu, FILTER_COLUMNS)
|
||||
{
|
||||
addButton(STR_CHAR_INPUT, MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, nullptr,
|
||||
addButton(CHAR_INPUT, MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT, nullptr,
|
||||
STR_MENU_INPUTS);
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
if (modelCustomScriptsEnabled())
|
||||
addButton(STR_CHAR_LUA, MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA, nullptr,
|
||||
addButton(CHAR_LUA, MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA, nullptr,
|
||||
STR_MENU_LUA);
|
||||
#endif
|
||||
#if defined(PCBHORUS)
|
||||
@@ -50,17 +50,17 @@ class SourceChoiceMenuToolbar : public MenuToolbar
|
||||
auto lastSource = MIXSRC_LAST_STICK;
|
||||
#endif
|
||||
addButton(
|
||||
STR_CHAR_STICK, MIXSRC_FIRST_STICK, lastSource,
|
||||
CHAR_STICK, MIXSRC_FIRST_STICK, lastSource,
|
||||
[=](int16_t index) {
|
||||
if (index >= MIXSRC_FIRST_POT && index <= MIXSRC_LAST_POT)
|
||||
return false;
|
||||
return index >= MIXSRC_FIRST_STICK && index <= lastSource;
|
||||
},
|
||||
STR_MENU_STICKS);
|
||||
addButton(STR_CHAR_POT, MIXSRC_FIRST_POT, MIXSRC_LAST_POT, nullptr,
|
||||
addButton(CHAR_POT, MIXSRC_FIRST_POT, MIXSRC_LAST_POT, nullptr,
|
||||
STR_MENU_POTS);
|
||||
addButton(
|
||||
STR_CHAR_FUNCTION, MIXSRC_MIN, MIXSRC_LAST_TIMER,
|
||||
CHAR_FUNCTION, MIXSRC_MIN, MIXSRC_LAST_TIMER,
|
||||
[=](int16_t index) {
|
||||
return (index >= MIXSRC_MIN && index <= MIXSRC_MAX) ||
|
||||
(index >= MIXSRC_TX_VOLTAGE && index <= MIXSRC_LAST_TIMER);
|
||||
@@ -68,32 +68,32 @@ class SourceChoiceMenuToolbar : public MenuToolbar
|
||||
STR_MENU_OTHER);
|
||||
#if defined(HELI)
|
||||
if (modelHeliEnabled())
|
||||
addButton(STR_CHAR_CYC, MIXSRC_FIRST_HELI, MIXSRC_LAST_HELI, nullptr,
|
||||
addButton(CHAR_CYC, MIXSRC_FIRST_HELI, MIXSRC_LAST_HELI, nullptr,
|
||||
STR_MENU_HELI);
|
||||
#endif
|
||||
addButton(STR_CHAR_TRIM, MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM, nullptr,
|
||||
addButton(CHAR_TRIM, MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM, nullptr,
|
||||
STR_MENU_TRIMS);
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
addButton(STR_CHAR_SWITCH, MIXSRC_FIRST_SWITCH, MIXSRC_LAST_CUSTOMSWITCH_GROUP, nullptr,
|
||||
addButton(CHAR_SWITCH, MIXSRC_FIRST_SWITCH, MIXSRC_LAST_CUSTOMSWITCH_GROUP, nullptr,
|
||||
STR_MENU_SWITCHES);
|
||||
#else
|
||||
addButton(STR_CHAR_SWITCH, MIXSRC_FIRST_SWITCH, MIXSRC_LAST_SWITCH, nullptr,
|
||||
addButton(CHAR_SWITCH, MIXSRC_FIRST_SWITCH, MIXSRC_LAST_SWITCH, nullptr,
|
||||
STR_MENU_SWITCHES);
|
||||
#endif
|
||||
if (modelLSEnabled())
|
||||
addButton("LS", MIXSRC_FIRST_LOGICAL_SWITCH, MIXSRC_LAST_LOGICAL_SWITCH,
|
||||
nullptr, STR_MENU_LOGICAL_SWITCHES);
|
||||
addButton(STR_CHAR_TRAINER, MIXSRC_FIRST_TRAINER, MIXSRC_LAST_TRAINER,
|
||||
addButton(CHAR_TRAINER, MIXSRC_FIRST_TRAINER, MIXSRC_LAST_TRAINER,
|
||||
nullptr, STR_MENU_TRAINER);
|
||||
addButton(STR_CHAR_CHANNEL, MIXSRC_FIRST_CH, MIXSRC_LAST_CH, nullptr,
|
||||
addButton(CHAR_CHANNEL, MIXSRC_FIRST_CH, MIXSRC_LAST_CH, nullptr,
|
||||
STR_MENU_CHANNELS);
|
||||
#if defined(GVARS)
|
||||
if (modelGVEnabled())
|
||||
addButton(STR_CHAR_SLIDER, MIXSRC_FIRST_GVAR, MIXSRC_LAST_GVAR, nullptr,
|
||||
addButton(CHAR_SLIDER, MIXSRC_FIRST_GVAR, MIXSRC_LAST_GVAR, nullptr,
|
||||
STR_MENU_GVARS);
|
||||
#endif
|
||||
if (modelTelemetryEnabled())
|
||||
addButton(STR_CHAR_TELEMETRY, MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM,
|
||||
addButton(CHAR_TELEMETRY, MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM,
|
||||
nullptr, STR_MENU_TELEMETRY);
|
||||
|
||||
if ((nxtBtnPos > filterColumns) && choice->isValueAvailable &&
|
||||
|
||||
@@ -84,7 +84,7 @@ void SwitchWarnDialog::checkEvents()
|
||||
}
|
||||
if ((g_model.potsWarnEnabled & (1 << i))) {
|
||||
if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) {
|
||||
warn_txt += STR_CHAR_POT;
|
||||
warn_txt += CHAR_POT;
|
||||
warn_txt += getPotLabel(i);
|
||||
warn_txt += " ";
|
||||
}
|
||||
|
||||
@@ -33,15 +33,15 @@ class SwitchChoiceMenuToolbar : public MenuToolbar
|
||||
SwitchChoiceMenuToolbar(SwitchChoice* choice, Menu* menu) :
|
||||
MenuToolbar(choice, menu, 2)
|
||||
{
|
||||
addButton(STR_CHAR_SWITCH, SWSRC_FIRST_SWITCH, SWSRC_LAST_MULTIPOS_SWITCH,
|
||||
addButton(CHAR_SWITCH, SWSRC_FIRST_SWITCH, SWSRC_LAST_MULTIPOS_SWITCH,
|
||||
nullptr, STR_MENU_SWITCHES);
|
||||
addButton(STR_CHAR_TRIM, SWSRC_FIRST_TRIM, SWSRC_LAST_TRIM, nullptr,
|
||||
addButton(CHAR_TRIM, SWSRC_FIRST_TRIM, SWSRC_LAST_TRIM, nullptr,
|
||||
STR_MENU_TRIMS);
|
||||
addButton("LS", SWSRC_FIRST_LOGICAL_SWITCH, SWSRC_LAST_LOGICAL_SWITCH,
|
||||
nullptr, STR_MENU_LOGICAL_SWITCHES);
|
||||
addButton("FM", SWSRC_FIRST_FLIGHT_MODE, SWSRC_LAST_FLIGHT_MODE, nullptr,
|
||||
STR_FLIGHT_MODE);
|
||||
addButton(STR_CHAR_TELEMETRY, SWSRC_FIRST_SENSOR, SWSRC_LAST_SENSOR,
|
||||
addButton(CHAR_TELEMETRY, SWSRC_FIRST_SENSOR, SWSRC_LAST_SENSOR,
|
||||
nullptr, STR_MENU_TELEMETRY);
|
||||
#if defined(DEBUG_LATENCY)
|
||||
auto lastSource = SWSRC_LATENCY_TOGGLE;
|
||||
@@ -49,7 +49,7 @@ class SwitchChoiceMenuToolbar : public MenuToolbar
|
||||
auto lastSource = SWSRC_TRAINER_CONNECTED;
|
||||
#endif
|
||||
addButton(
|
||||
STR_CHAR_FUNCTION, SWSRC_ON, lastSource,
|
||||
CHAR_FUNCTION, SWSRC_ON, lastSource,
|
||||
[=](int16_t index) {
|
||||
index = abs(index);
|
||||
return index == 0 || index == SWSRC_ON || index == SWSRC_ONE ||
|
||||
|
||||
@@ -21,84 +21,326 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if !defined(SIMU)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "fonts.h"
|
||||
#include "lz4/lz4.h"
|
||||
#include "libopenui_defines.h"
|
||||
#include "lz4_fonts.h"
|
||||
|
||||
#include "translations/tts/tts.h"
|
||||
|
||||
#if !defined(BOOT)
|
||||
|
||||
extern "C" {
|
||||
|
||||
// All languages uss the same font for XXL size
|
||||
extern const etxLz4Font lv_font_en_bold_XXL;
|
||||
|
||||
#define FONT_TABLE(name) \
|
||||
extern const etxLz4Font lv_font_##name##_bold_STD; \
|
||||
extern const etxLz4Font lv_font_##name##_XXS; \
|
||||
extern const etxLz4Font lv_font_##name##_XS; \
|
||||
extern const etxLz4Font lv_font_##name##_L; \
|
||||
extern const etxLz4Font lv_font_##name##_bold_XL; \
|
||||
static const etxLz4Font* lz4FontTable[FONTS_COUNT] = { \
|
||||
nullptr, /* FONT_STD_INDEX */ \
|
||||
&lv_font_##name##_bold_STD, /* FONT_BOLD_INDEX */ \
|
||||
&lv_font_##name##_XXS, /* FONT_XXS_INDEX */ \
|
||||
&lv_font_##name##_XS, /* FONT_XS_INDEX */ \
|
||||
&lv_font_##name##_L, /* FONT_L_INDEX */ \
|
||||
&lv_font_##name##_bold_XL, /* FONT_XL_INDEX */ \
|
||||
&lv_font_en_bold_XXL, /* FONT_XXL_INDEX */ \
|
||||
}; \
|
||||
static const lv_font_t* lvglFontTable[FONTS_COUNT] = { \
|
||||
LV_FONT_DEFAULT, /* FONT_STD_INDEX */ \
|
||||
nullptr, /* FONT_BOLD_INDEX */ \
|
||||
nullptr, /* FONT_XXS_INDEX */ \
|
||||
nullptr, /* FONT_XS_INDEX */ \
|
||||
nullptr, /* FONT_L_INDEX */ \
|
||||
nullptr, /* FONT_XL_INDEX */ \
|
||||
nullptr, /* FONT_XXL_INDEX */ \
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
struct etxLvglFont {
|
||||
const etxLz4Font* lz4Font;
|
||||
lv_font_t* lvglFont;
|
||||
bool loaded;
|
||||
};
|
||||
|
||||
static bool fontAllocFailed = false;
|
||||
|
||||
#define BUFSIZE(x) (((x) + 15) & 0xFFFFFFF0)
|
||||
|
||||
#if !defined(ALL_LANGS)
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define FONT_TABLE(x) \
|
||||
extern const lv_font_t lv_font_##x##_STD; \
|
||||
extern const etxLz4Font lv_font_##x##_bold_STD; \
|
||||
extern const etxLz4Font lv_font_##x##_XXS; \
|
||||
extern const etxLz4Font lv_font_##x##_XS; \
|
||||
extern const etxLz4Font lv_font_##x##_L; \
|
||||
extern const etxLz4Font lv_font_##x##_bold_XL; \
|
||||
static etxLvglFont fontTable[FONTS_COUNT] = { \
|
||||
{ nullptr, (lv_font_t*)&lv_font_##x##_STD, true }, /* FONT_STD_INDEX */ \
|
||||
{ &lv_font_##x##_bold_STD, nullptr, false }, /* FONT_BOLD_INDEX */ \
|
||||
{ &lv_font_##x##_XXS, nullptr, false }, /* FONT_XXS_INDEX */ \
|
||||
{ &lv_font_##x##_XS, nullptr, false }, /* FONT_XS_INDEX */ \
|
||||
{ &lv_font_##x##_L, nullptr, false }, /* FONT_L_INDEX */ \
|
||||
{ &lv_font_##x##_bold_XL, nullptr, false }, /* FONT_XL_INDEX */ \
|
||||
{ &lv_font_en_bold_XXL, nullptr, false }, /* FONT_XXL_INDEX */ \
|
||||
};
|
||||
|
||||
#if defined(TRANSLATIONS_CN)
|
||||
FONT_TABLE(cn);
|
||||
FONT_TABLE(cn)
|
||||
#define ENABLE_FALLBACK
|
||||
#elif defined(TRANSLATIONS_TW)
|
||||
FONT_TABLE(tw);
|
||||
FONT_TABLE(tw)
|
||||
#define ENABLE_FALLBACK
|
||||
#elif defined(TRANSLATIONS_JP)
|
||||
FONT_TABLE(jp);
|
||||
FONT_TABLE(jp)
|
||||
#define ENABLE_FALLBACK
|
||||
#elif defined(TRANSLATIONS_KO)
|
||||
FONT_TABLE(ko);
|
||||
FONT_TABLE(ko)
|
||||
#define ENABLE_FALLBACK
|
||||
#elif defined(TRANSLATIONS_HE)
|
||||
FONT_TABLE(he);
|
||||
FONT_TABLE(he)
|
||||
#define ENABLE_FALLBACK
|
||||
#elif defined(TRANSLATIONS_RU)
|
||||
FONT_TABLE(ru);
|
||||
FONT_TABLE(ru)
|
||||
#define ENABLE_FALLBACK
|
||||
#elif defined(TRANSLATIONS_UA)
|
||||
FONT_TABLE(ua);
|
||||
FONT_TABLE(ua)
|
||||
#define ENABLE_FALLBACK
|
||||
#else
|
||||
FONT_TABLE(en);
|
||||
FONT_TABLE(en)
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_FALLBACK)
|
||||
// Fallback fonts - language fonts only contain language specific characters
|
||||
extern const lv_font_t lv_font_en_STD;
|
||||
extern const etxLz4Font lv_font_en_bold_STD;
|
||||
extern const etxLz4Font lv_font_en_XXS;
|
||||
extern const etxLz4Font lv_font_en_XS;
|
||||
extern const etxLz4Font lv_font_en_L;
|
||||
extern const etxLz4Font lv_font_en_bold_XL;
|
||||
static etxLvglFont en_fontTable[FONTS_COUNT] = {
|
||||
{ nullptr, (lv_font_t*)&lv_font_en_STD, true }, /* FONT_STD_INDEX */
|
||||
{ &lv_font_en_bold_STD, nullptr, false }, /* FONT_BOLD_INDEX */
|
||||
{ &lv_font_en_XXS, nullptr, false }, /* FONT_XXS_INDEX */
|
||||
{ &lv_font_en_XS, nullptr, false }, /* FONT_XS_INDEX */
|
||||
{ &lv_font_en_L, nullptr, false }, /* FONT_L_INDEX */
|
||||
{ &lv_font_en_bold_XL, nullptr, false }, /* FONT_XL_INDEX */
|
||||
{ nullptr, nullptr, true }, /* FONT_XXL_INDEX */
|
||||
};
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
|
||||
int getSize(etxLvglFont* fonts)
|
||||
{
|
||||
int sz = 0;
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
if (fonts[i].lz4Font) {
|
||||
sz += BUFSIZE(fonts[i].lz4Font->lvglFontBufSize);
|
||||
}
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
|
||||
uint8_t* allocBuf(etxLvglFont* fonts, uint8_t* b)
|
||||
{
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
if (fonts[i].lz4Font) {
|
||||
fonts[i].lvglFont = (lv_font_t*)b;
|
||||
b += BUFSIZE(fonts[i].lz4Font->lvglFontBufSize);
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
void forceStd(etxLvglFont* fonts)
|
||||
{
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
if (fonts[i].lz4Font) {
|
||||
fonts[i].lvglFont = fonts[FONT_STD_INDEX].lvglFont;
|
||||
fonts[i].loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void initFontBuffers()
|
||||
{
|
||||
if (fontTable[FONT_BOLD_INDEX].lvglFont || fontAllocFailed) return;
|
||||
|
||||
// Calc max size needed for all compressed fonts
|
||||
int sz = 0;
|
||||
#if defined(ENABLE_FALLBACK)
|
||||
sz += getSize(en_fontTable);
|
||||
#endif
|
||||
sz += getSize(fontTable);
|
||||
|
||||
// Allocate buffer and assign to fonts
|
||||
#if defined(SIMU)
|
||||
uint8_t* b = (uint8_t*)malloc(sz);
|
||||
#else
|
||||
uint8_t* b = (uint8_t*)sbrk(sz);
|
||||
#endif
|
||||
if (b) {
|
||||
#if defined(ENABLE_FALLBACK)
|
||||
b = allocBuf(en_fontTable, b);
|
||||
#endif
|
||||
b = allocBuf(fontTable, b);
|
||||
} else {
|
||||
// Force all fonts to use STD size
|
||||
fontAllocFailed = true;
|
||||
#if defined(ENABLE_FALLBACK)
|
||||
forceStd(en_fontTable);
|
||||
#endif
|
||||
forceStd(fontTable);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define ENABLE_FALLBACK
|
||||
|
||||
#define FONT_TABLE(x) \
|
||||
extern const lv_font_t lv_font_##x##_STD; \
|
||||
extern const etxLz4Font lv_font_##x##_bold_STD; \
|
||||
extern const etxLz4Font lv_font_##x##_XXS; \
|
||||
extern const etxLz4Font lv_font_##x##_XS; \
|
||||
extern const etxLz4Font lv_font_##x##_L; \
|
||||
extern const etxLz4Font lv_font_##x##_bold_XL; \
|
||||
static etxLvglFont x##_fontTable[FONTS_COUNT] = { \
|
||||
{ nullptr, (lv_font_t*)&lv_font_##x##_STD, true }, /* FONT_STD_INDEX */ \
|
||||
{ &lv_font_##x##_bold_STD, nullptr, false }, /* FONT_BOLD_INDEX */ \
|
||||
{ &lv_font_##x##_XXS, nullptr, false }, /* FONT_XXS_INDEX */ \
|
||||
{ &lv_font_##x##_XS, nullptr, false }, /* FONT_XS_INDEX */ \
|
||||
{ &lv_font_##x##_L, nullptr, false }, /* FONT_L_INDEX */ \
|
||||
{ &lv_font_##x##_bold_XL, nullptr, false }, /* FONT_XL_INDEX */ \
|
||||
{ &lv_font_en_bold_XXL, nullptr, false }, /* FONT_XXL_INDEX */ \
|
||||
};
|
||||
|
||||
FONT_TABLE(en);
|
||||
FONT_TABLE(cn);
|
||||
FONT_TABLE(tw);
|
||||
FONT_TABLE(jp);
|
||||
FONT_TABLE(ko);
|
||||
FONT_TABLE(he);
|
||||
FONT_TABLE(ru);
|
||||
FONT_TABLE(ua);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
// Must match RadioLanguage order
|
||||
etxLvglFont* etxFonts[] = {
|
||||
cn_fontTable, // CN
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
he_fontTable, // HE
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
jp_fontTable, // JP
|
||||
ko_fontTable, // KO
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
ru_fontTable, // RU
|
||||
en_fontTable,
|
||||
en_fontTable,
|
||||
tw_fontTable, // TW
|
||||
ua_fontTable, // UA
|
||||
};
|
||||
|
||||
etxLvglFont* fontTable = en_fontTable;
|
||||
|
||||
extern void setAllFonts();
|
||||
|
||||
void setLanguageFont(int idx)
|
||||
{
|
||||
if (fontAllocFailed) return;
|
||||
|
||||
if (fontTable != etxFonts[idx]) {
|
||||
fontTable = etxFonts[idx];
|
||||
if (fontTable != en_fontTable) {
|
||||
// Force fonts to be decompressed.
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
if ((fontTable[i].lz4Font != nullptr) && (i != FONT_XXL_INDEX)) {
|
||||
fontTable[i].loaded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
setAllFonts();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t getMaxFontSize(int fontIdx)
|
||||
{
|
||||
uint32_t max = 0;
|
||||
for (int l = 0; l < LANG_COUNT; l += 1) {
|
||||
if (etxFonts[l] != en_fontTable) {
|
||||
if (etxFonts[l][fontIdx].lz4Font->lvglFontBufSize > max)
|
||||
max = etxFonts[l][fontIdx].lz4Font->lvglFontBufSize;
|
||||
}
|
||||
}
|
||||
return BUFSIZE(max);
|
||||
}
|
||||
|
||||
void initFontBuffers()
|
||||
{
|
||||
if (en_fontTable[FONT_BOLD_INDEX].lvglFont || fontAllocFailed) return;
|
||||
|
||||
// Calc max size needed for all compressed fonts
|
||||
int sz = 0;
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
if (en_fontTable[i].lz4Font) {
|
||||
// EN data
|
||||
sz += BUFSIZE(en_fontTable[i].lz4Font->lvglFontBufSize);
|
||||
// Shared buf for other languages
|
||||
sz += getMaxFontSize(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate buffer and assign to fonts
|
||||
#if defined(SIMU)
|
||||
uint8_t* b = (uint8_t*)malloc(sz);
|
||||
#else
|
||||
uint8_t* b = (uint8_t*)sbrk(sz);
|
||||
#endif
|
||||
if (b) {
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
if (en_fontTable[i].lz4Font) {
|
||||
// EN data
|
||||
en_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
b += BUFSIZE(en_fontTable[i].lz4Font->lvglFontBufSize);
|
||||
// All languages except EN use the same buffer for the uncompressed data (only one active)
|
||||
cn_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
tw_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
jp_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
ko_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
he_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
ru_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
ua_fontTable[i].lvglFont = (lv_font_t*)b;
|
||||
b += getMaxFontSize(i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Force all fonts to use STD size
|
||||
fontAllocFailed = true;
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
for (int l = 0; l < LANG_COUNT; l += 1) {
|
||||
if (etxFonts[l][i].lvglFont == nullptr) {
|
||||
etxFonts[l][i].lvglFont = etxFonts[l][FONT_STD_INDEX].lvglFont;
|
||||
etxFonts[l][i].loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Decompress an LZ4 font and build LVGL font structures.
|
||||
*/
|
||||
void decompressFont(int idx)
|
||||
void decompressFont(int idx, etxLvglFont* fonts)
|
||||
{
|
||||
// Check if already decompressed
|
||||
if (lvglFontTable[idx]) return;
|
||||
if (fonts[idx].loaded) return;
|
||||
|
||||
const etxLz4Font* etxFont = lz4FontTable[idx];
|
||||
|
||||
// Calculate size of memory block to allocate for uncompressed data plus LVGL
|
||||
// font structures.
|
||||
int size = etxFont->uncomp_size + sizeof(lv_font_t) +
|
||||
sizeof(lv_font_fmt_txt_dsc_t) +
|
||||
sizeof(lv_font_fmt_txt_glyph_cache_t) +
|
||||
etxFont->cmap_num * sizeof(lv_font_fmt_txt_cmap_t);
|
||||
if (etxFont->kern_classes) size += sizeof(lv_font_fmt_txt_kern_classes_t);
|
||||
const etxLz4Font* etxFont = fonts[idx].lz4Font;
|
||||
|
||||
// Init SDRAM buffer
|
||||
uint8_t* data = etxFont->lvglFontBuf;
|
||||
initFontBuffers();
|
||||
uint8_t* data = (uint8_t*)fonts[idx].lvglFont;
|
||||
memset(data, 0, etxFont->lvglFontBufSize);
|
||||
|
||||
// Pointer to next free area in data block
|
||||
@@ -188,8 +430,15 @@ void decompressFont(int idx)
|
||||
lvglCmaps[i].type = etxFont->cmaps[i].type;
|
||||
}
|
||||
|
||||
// Save LVGL font to lookup array
|
||||
lvglFontTable[idx] = lvglFont;
|
||||
#if defined(ENABLE_FALLBACK)
|
||||
if (fonts[idx].lz4Font != en_fontTable[idx].lz4Font) {
|
||||
decompressFont(idx, en_fontTable);
|
||||
lvglFont->fallback = en_fontTable[idx].lvglFont;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set LVGL font loaded flag
|
||||
fonts[idx].loaded = true;
|
||||
}
|
||||
|
||||
#endif // BOOT
|
||||
@@ -212,9 +461,9 @@ const lv_font_t* getFont(LcdFlags flags)
|
||||
return LV_FONT_DEFAULT;
|
||||
#else
|
||||
auto fontIndex = FONT_INDEX(flags);
|
||||
if (fontIndex >= FONTS_COUNT) return LV_FONT_DEFAULT;
|
||||
decompressFont(fontIndex);
|
||||
return lvglFontTable[fontIndex];
|
||||
if (fontIndex >= FONTS_COUNT) return fontTable[FONT_STD_INDEX].lvglFont;
|
||||
decompressFont(fontIndex, fontTable);
|
||||
return fontTable[fontIndex].lvglFont;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "layout.h"
|
||||
#include "layout_factory_impl.h"
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_APPMODE[] = {LAYOUT_OPTIONS_END};
|
||||
const LayoutOption OPTIONS_LAYOUT_APPMODE[] = {LAYOUT_OPTIONS_END};
|
||||
|
||||
class LayoutAppMode : public Layout
|
||||
{
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include "layout.h"
|
||||
#include "layout_factory_impl.h"
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_2x4[] = {
|
||||
const LayoutOption OPTIONS_LAYOUT_2x4[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
{"Panel1 background", ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{" Color", ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{"Panel2 background", ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{" Color", ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{STR_DEF(STR_PANEL1_BACKGROUND), ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{STR_DEF(STR_PANEL_COLOR), ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{STR_DEF(STR_PANEL2_BACKGROUND), ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{STR_DEF(STR_PANEL_COLOR), ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
LAYOUT_OPTIONS_END};
|
||||
|
||||
class Layout2x4 : public Layout
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
// 4x2 layout: 4 rows, 2 columns
|
||||
// Suitable for portrait screens and vertical screen usage
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_4x2[] = {
|
||||
const LayoutOption OPTIONS_LAYOUT_4x2[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
{"Panel1 background", ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{" Color", ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{"Panel2 background", ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{" Color", ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{STR_DEF(STR_PANEL1_BACKGROUND), ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{STR_DEF(STR_PANEL_COLOR), ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
{STR_DEF(STR_PANEL2_BACKGROUND), ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{STR_DEF(STR_PANEL_COLOR), ZoneOption::Color, RGB2FLAGS(77, 112, 203)},
|
||||
LAYOUT_OPTIONS_END};
|
||||
|
||||
class Layout4x2 : public Layout
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
// 6x1 layout: 6 rows, 1 column
|
||||
// Single column with 6 vertical zones
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_6x1[] = {
|
||||
const LayoutOption OPTIONS_LAYOUT_6x1[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
{"Background", ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{" Color", ZoneOption::Color, RGB2FLAGS(50, 50, 50)},
|
||||
{STR_DEF(STR_PANEL_BACKGROUND), ZoneOption::Bool, OPTION_VALUE_BOOL(true)},
|
||||
{STR_DEF(STR_PANEL_COLOR), ZoneOption::Color, RGB2FLAGS(50, 50, 50)},
|
||||
LAYOUT_OPTIONS_END};
|
||||
|
||||
class Layout6x1 : public Layout
|
||||
|
||||
@@ -109,11 +109,19 @@ TextButton::TextButton(Window* parent, const rect_t& rect, std::string text,
|
||||
ButtonBase(parent, rect, pressHandler, button_create),
|
||||
text(std::move(text))
|
||||
{
|
||||
label = lv_label_create(lvobj);
|
||||
label = etx_label_create(lvobj);
|
||||
lv_label_set_text(label, this->text.c_str());
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
void TextButton::setText(std::string value)
|
||||
{
|
||||
if (value != text) {
|
||||
text = std::move(value);
|
||||
lv_label_set_text(label, text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IconButton::IconButton(Window* parent, EdgeTxIcon icon, coord_t x, coord_t y,
|
||||
@@ -137,7 +145,7 @@ MomentaryButton::MomentaryButton(Window* parent, const rect_t& rect, std::string
|
||||
releaseHandler(std::move(releaseHandler)),
|
||||
text(std::move(text))
|
||||
{
|
||||
label = lv_label_create(lvobj);
|
||||
label = etx_label_create(lvobj);
|
||||
lv_label_set_text(label, this->text.c_str());
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,15 @@ class ButtonBase : public FormField
|
||||
std::function<void(void)> checkHandler;
|
||||
};
|
||||
|
||||
class OverlayButton : public ButtonBase
|
||||
{
|
||||
public:
|
||||
OverlayButton(Window* parent, std::function<uint8_t(void)> pressHandler = nullptr) :
|
||||
ButtonBase(parent, {0, 0, LV_PCT(100), LV_PCT(100)}, pressHandler, window_create)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class Button : public ButtonBase
|
||||
{
|
||||
public:
|
||||
@@ -86,13 +95,7 @@ class TextButton : public ButtonBase
|
||||
std::string getName() const override { return "TextButton \"" + text + "\""; }
|
||||
#endif
|
||||
|
||||
void setText(std::string value)
|
||||
{
|
||||
if (value != text) {
|
||||
text = std::move(value);
|
||||
lv_label_set_text(label, text.c_str());
|
||||
}
|
||||
}
|
||||
void setText(std::string value);
|
||||
|
||||
void setFont(FontIndex font)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ ChoiceBase::ChoiceBase(Window* parent, const rect_t& rect,
|
||||
lv_obj_set_pos(img, 0, PAD_TINY);
|
||||
|
||||
// Add label
|
||||
label = lv_label_create(lvobj);
|
||||
label = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(label, type == CHOICE_TYPE_DROPOWN ? ICON_W - 2 : ICON_W, PAD_TINY);
|
||||
etx_font(label, FONT_XS_INDEX, LV_STATE_USER_1);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*********************/
|
||||
#include "etx_lv_theme.h"
|
||||
|
||||
#include "window.h"
|
||||
#include "../colors.h"
|
||||
#include "fonts.h"
|
||||
|
||||
@@ -314,6 +315,14 @@ void EdgeTxStyles::init()
|
||||
applyColors();
|
||||
}
|
||||
|
||||
void EdgeTxStyles::setFonts()
|
||||
{
|
||||
// Fonts
|
||||
for (int i = FONT_STD_INDEX; i < FONTS_COUNT; i += 1) {
|
||||
lv_style_set_text_font(&font[i], getFont(i << 8));
|
||||
}
|
||||
}
|
||||
|
||||
void EdgeTxStyles::applyColors()
|
||||
{
|
||||
// Always update colors in case theme changes
|
||||
@@ -353,6 +362,14 @@ static EdgeTxStyles* mainStyles = nullptr;
|
||||
static EdgeTxStyles* previewStyles = nullptr;
|
||||
EdgeTxStyles* styles = nullptr;
|
||||
|
||||
#if defined(ALL_LANGS)
|
||||
void setAllFonts()
|
||||
{
|
||||
if (mainStyles) mainStyles->setFonts();
|
||||
if (previewStyles) previewStyles->setFonts();
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
@@ -382,6 +399,18 @@ void useMainStyle()
|
||||
|
||||
// Object constructor helpers
|
||||
|
||||
lv_obj_t* etx_label_create(lv_obj_t* parent, FontIndex fontIdx)
|
||||
{
|
||||
lv_obj_t* lvobj = lv_label_create(parent);
|
||||
etx_obj_add_style(lvobj, styles->font[fontIdx], LV_PART_MAIN);
|
||||
return lvobj;
|
||||
}
|
||||
|
||||
lv_obj_t* etx_label_create(Window* parent, FontIndex fontIdx)
|
||||
{
|
||||
return etx_label_create(parent->getLvObj(), fontIdx);
|
||||
}
|
||||
|
||||
void etx_solid_bg(lv_obj_t* obj, LcdColorIndex bg_color,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "colors.h"
|
||||
#include "fonts.h"
|
||||
|
||||
class Window;
|
||||
|
||||
/*********************
|
||||
* Layout
|
||||
*********************/
|
||||
@@ -180,6 +182,9 @@ void etx_remove_img_color(lv_obj_t* obj, lv_style_selector_t selector = LV_PART_
|
||||
void etx_img_color(lv_obj_t* obj, LcdColorIndex colorIdx,
|
||||
lv_style_selector_t selector = LV_PART_MAIN);
|
||||
|
||||
lv_obj_t* etx_label_create(lv_obj_t* parent, FontIndex fontIdx = FONT_STD_INDEX);
|
||||
lv_obj_t* etx_label_create(Window* parent, FontIndex fontIdx);
|
||||
|
||||
// Create a style with a single property
|
||||
#define LV_STYLE_CONST_SINGLE_INIT(var_name, prop, value) \
|
||||
const lv_style_t var_name = {.v_p = {.value1 = {.num = value}}, \
|
||||
@@ -262,6 +267,7 @@ class EdgeTxStyles
|
||||
|
||||
void init();
|
||||
void applyColors();
|
||||
void setFonts();
|
||||
|
||||
static LAYOUT_VAL_SCALED(STD_FONT_HEIGHT, 21)
|
||||
static LAYOUT_VAL_SCALED(UI_ELEMENT_HEIGHT, 32)
|
||||
@@ -274,6 +280,7 @@ class EdgeTxStyles
|
||||
};
|
||||
|
||||
extern EdgeTxStyles* styles;
|
||||
extern void setAllFonts();
|
||||
|
||||
#define etx_obj_add_style(obj, style, part) \
|
||||
lv_obj_add_style(obj, (lv_style_t*)&(style), part)
|
||||
|
||||
@@ -94,3 +94,11 @@ Window* Layer::walk(std::function<bool(Window* w)> check)
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Window* Layer::getPageGroup()
|
||||
{
|
||||
Window* w = Layer::walk([=](Window *w) mutable -> bool {
|
||||
return w->isPageGroup();
|
||||
});
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -36,5 +36,6 @@ class Layer
|
||||
|
||||
static Window* back();
|
||||
static Window* getFirstOpaque();
|
||||
static Window* getPageGroup();
|
||||
static Window* walk(std::function<bool(Window* w)> check);
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ InputMixButtonBase::~InputMixButtonBase()
|
||||
void InputMixButtonBase::setWeight(gvar_t value, gvar_t min, gvar_t max)
|
||||
{
|
||||
if (!weight) {
|
||||
weight = lv_label_create(lvobj);
|
||||
weight = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(weight, WGT_X, WGT_Y);
|
||||
lv_obj_set_size(weight, WGT_W, WGT_H);
|
||||
etx_font(weight, FONT_XS_INDEX, LV_STATE_USER_1);
|
||||
@@ -96,7 +96,7 @@ void InputMixButtonBase::setWeight(gvar_t value, gvar_t min, gvar_t max)
|
||||
void InputMixButtonBase::setSource(mixsrc_t idx)
|
||||
{
|
||||
if (!source) {
|
||||
source = lv_label_create(lvobj);
|
||||
source = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(source, SRC_X, SRC_Y);
|
||||
lv_obj_set_size(source, SRC_W, SRC_H);
|
||||
etx_font(source, FONT_XS_INDEX, LV_STATE_USER_1);
|
||||
@@ -114,7 +114,7 @@ void InputMixButtonBase::setSource(mixsrc_t idx)
|
||||
void InputMixButtonBase::setOpts(const char* s)
|
||||
{
|
||||
if (!opts) {
|
||||
opts = lv_label_create(lvobj);
|
||||
opts = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(opts, OPT_X, OPT_Y);
|
||||
lv_obj_set_size(opts, OPT_W, OPT_H);
|
||||
etx_font(opts, FONT_XS_INDEX, LV_STATE_USER_1);
|
||||
@@ -226,8 +226,7 @@ InputMixGroupBase::InputMixGroupBase(Window* parent, mixsrc_t idx) :
|
||||
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICKABLE);
|
||||
padAll(PAD_ZERO);
|
||||
|
||||
label = lv_label_create(lvobj);
|
||||
etx_font(label, FONT_STD_INDEX);
|
||||
label = etx_label_create(lvobj);
|
||||
}
|
||||
|
||||
void InputMixGroupBase::adjustHeight()
|
||||
|
||||
@@ -56,7 +56,7 @@ MenuToolbarButton::MenuToolbarButton(Window* parent, const rect_t& rect,
|
||||
|
||||
lv_obj_add_event_cb(lvobj, toolbar_btn_defocus, LV_EVENT_DEFOCUSED, nullptr);
|
||||
|
||||
auto label = lv_label_create(lvobj);
|
||||
auto label = etx_label_create(lvobj);
|
||||
lv_label_set_text(label, picto);
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -110,15 +110,10 @@ void Page::deleteLater(bool detach, bool trash)
|
||||
|
||||
void Page::openMenu()
|
||||
{
|
||||
PageGroup* p = nullptr;
|
||||
PageGroup* p = (PageGroup*)Layer::getPageGroup();
|
||||
QuickMenu::SubMenu subMenu = QuickMenu::NONE;
|
||||
Window* w = Layer::walk([=](Window *w) mutable -> bool {
|
||||
return w->isPageGroup();
|
||||
});
|
||||
if (w) {
|
||||
p = (PageGroup*)w;
|
||||
if (p)
|
||||
subMenu = p->getCurrentTab()->subMenu();
|
||||
}
|
||||
quickMenu = QuickMenu::openQuickMenu([=]() { quickMenu = nullptr; },
|
||||
[=](bool close) {
|
||||
onCancel();
|
||||
|
||||
@@ -149,7 +149,7 @@ class BubbleDialog : public Window
|
||||
|
||||
lv_obj_set_parent(lvobj, lv_layer_top());
|
||||
|
||||
auto label = lv_label_create(lvobj);
|
||||
auto label = etx_label_create(lvobj);
|
||||
lv_label_set_text(label, message);
|
||||
lv_obj_center(label);
|
||||
lv_obj_set_width(label, lv_pct(100));
|
||||
|
||||
@@ -33,6 +33,7 @@ LV_STYLE_CONST_MULTI_INIT(table_cell, table_cell_props);
|
||||
static void table_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj)
|
||||
{
|
||||
etx_obj_add_style(obj, styles->pad_zero, LV_PART_MAIN);
|
||||
etx_font(obj, FONT_STD_INDEX);
|
||||
|
||||
etx_scrollbar(obj);
|
||||
|
||||
|
||||
@@ -207,12 +207,12 @@ class TextViewer
|
||||
escape_chars[escape - 1] = c;
|
||||
|
||||
if (escape == 2 && !strncmp(escape_chars, "up", 2)) {
|
||||
*ptr++ = STR_CHAR_UP[0];
|
||||
c = STR_CHAR_UP[1];
|
||||
*ptr++ = CHAR_UP[0];
|
||||
c = CHAR_UP[1];
|
||||
escape = 0;
|
||||
} else if (escape == 2 && !strncmp(escape_chars, "dn", 2)) {
|
||||
*ptr++ = STR_CHAR_DOWN[0];
|
||||
c = STR_CHAR_DOWN[1];
|
||||
*ptr++ = CHAR_DOWN[0];
|
||||
c = CHAR_DOWN[1];
|
||||
escape = 0;
|
||||
} else if (escape == 3) {
|
||||
int val = atoi(escape_chars);
|
||||
@@ -429,7 +429,7 @@ class ViewChecklistWindow : public Page, public TextViewer
|
||||
checkBoxes.push_back(cb);
|
||||
}
|
||||
|
||||
auto lbl = lv_label_create(row);
|
||||
auto lbl = etx_label_create(row);
|
||||
lv_obj_set_width(lbl, w);
|
||||
lv_label_set_long_mode(lbl, LV_LABEL_LONG_WRAP);
|
||||
lv_label_set_text_static(lbl, &buffer[cur]);
|
||||
|
||||
@@ -511,7 +511,7 @@ class SetupTextButton : public TextButton
|
||||
{
|
||||
public:
|
||||
SetupTextButton(Window* parent, const rect_t& rect, PageButtonDef& entry) :
|
||||
TextButton(parent, rect, entry.title)
|
||||
TextButton(parent, rect, STR_VAL(entry.title))
|
||||
{
|
||||
setPressHandler([=] {
|
||||
entry.createPage();
|
||||
@@ -599,7 +599,11 @@ coord_t SetupLine::showLines(Window* parent, coord_t y, coord_t col2, PaddingSiz
|
||||
Window* w;
|
||||
|
||||
for (int i = 0; i < lineCount; i += 1) {
|
||||
#if !defined(ALL_LANGS)
|
||||
w = new SetupLine(parent, y, col2, padding, setupLines[i].title, setupLines[i].createEdit);
|
||||
#else
|
||||
w = new SetupLine(parent, y, col2, padding, setupLines[i].title(), setupLines[i].createEdit);
|
||||
#endif
|
||||
y += w->height() + padding;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "definitions.h"
|
||||
#include "LvglWrapper.h"
|
||||
#include "bitmapbuffer.h"
|
||||
#include "libopenui_defines.h"
|
||||
@@ -255,12 +256,13 @@ class NavWindow : public Window
|
||||
};
|
||||
|
||||
struct PageButtonDef {
|
||||
const char* title;
|
||||
STR_TYP title;
|
||||
std::function<void()> createPage;
|
||||
std::function<bool()> isActive;
|
||||
std::function<bool()> enabled;
|
||||
|
||||
PageButtonDef(const char* title,
|
||||
PageButtonDef(
|
||||
STR_TYP title,
|
||||
std::function<void()> createPage,
|
||||
std::function<bool()> isActive = nullptr,
|
||||
std::function<bool()> enabled = nullptr) :
|
||||
@@ -280,7 +282,7 @@ class SetupButtonGroup : public Window
|
||||
};
|
||||
|
||||
struct SetupLineDef {
|
||||
const char* title;
|
||||
STR_TYP title;
|
||||
std::function<void(Window*, coord_t, coord_t)> createEdit;
|
||||
};
|
||||
|
||||
|
||||
@@ -440,6 +440,8 @@
|
||||
|
||||
#if !defined(BOOT)
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
||||
#if defined(TRANSLATIONS_CN)
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_cn_STD)
|
||||
#define LV_FONT_DEFAULT &lv_font_cn_STD
|
||||
@@ -466,6 +468,12 @@
|
||||
#define LV_FONT_DEFAULT &lv_font_en_STD
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* Simulator font */
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_en_STD)
|
||||
#define LV_FONT_DEFAULT &lv_font_en_STD
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* Bootloader font */
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_bl)
|
||||
@@ -523,7 +531,11 @@
|
||||
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
*The direction will be processed according to the Unicode Bidirectional Algorithm:
|
||||
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#if defined(SIMU)
|
||||
#define LV_USE_BIDI 1
|
||||
#else
|
||||
#define LV_USE_BIDI TRANSLATION_IS_RTL
|
||||
#endif
|
||||
#if LV_USE_BIDI
|
||||
/*Set the default direction. Supported values:
|
||||
*`LV_BASE_DIR_LTR` Left-to-Right
|
||||
|
||||
@@ -77,6 +77,5 @@ typedef struct {
|
||||
// Pointers to cmaps, compressed data and buffer for uncompressed data
|
||||
const etxFontCmap* cmaps;
|
||||
const uint8_t* compressed;
|
||||
uint8_t* lvglFontBuf;
|
||||
uint32_t lvglFontBufSize;
|
||||
} etxLz4Font;
|
||||
|
||||
@@ -23,9 +23,17 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "definitions.h"
|
||||
#include "dataconstants.h"
|
||||
#include "widgets_container.h"
|
||||
|
||||
struct LayoutOption
|
||||
{
|
||||
STR_TYP name;
|
||||
ZoneOption::Type type;
|
||||
ZoneOptionValue deflt;
|
||||
};
|
||||
|
||||
#define MAX_LAYOUT_ZONES 10
|
||||
#define MAX_LAYOUT_OPTIONS 10
|
||||
|
||||
@@ -49,7 +57,7 @@ class LayoutFactory
|
||||
|
||||
virtual const MaskBitmap* getBitmap() const = 0;
|
||||
|
||||
virtual const ZoneOption* getLayoutOptions() const = 0;
|
||||
virtual const LayoutOption* getLayoutOptions() const = 0;
|
||||
|
||||
virtual WidgetsContainer* create(
|
||||
Window* parent, LayoutPersistentData* persistentData) const = 0;
|
||||
|
||||
@@ -108,5 +108,5 @@ void Layout::checkEvents()
|
||||
}
|
||||
}
|
||||
|
||||
const ZoneOption defaultZoneOptions[] = {LAYOUT_COMMON_OPTIONS,
|
||||
LAYOUT_OPTIONS_END};
|
||||
const LayoutOption defaultZoneOptions[] = {LAYOUT_COMMON_OPTIONS,
|
||||
LAYOUT_OPTIONS_END};
|
||||
|
||||
@@ -33,18 +33,18 @@
|
||||
#include <memory>
|
||||
|
||||
#define LAYOUT_COMMON_OPTIONS \
|
||||
{STR_TOP_BAR, ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_FLIGHT_MODE, ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_SLIDERS, ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_TRIMS, ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_MIRROR, ZoneOption::Bool, OPTION_VALUE_BOOL(false)}
|
||||
{STR_DEF(STR_TOP_BAR), ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_DEF(STR_FLIGHT_MODE), ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_DEF(STR_SLIDERS), ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_DEF(STR_TRIMS), ZoneOption::Bool, OPTION_VALUE_BOOL(true)}, \
|
||||
{STR_DEF(STR_MIRROR), ZoneOption::Bool, OPTION_VALUE_BOOL(false)}
|
||||
|
||||
#define LAYOUT_OPTIONS_END \
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
|
||||
typedef WidgetsContainerImpl<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS> LayoutBase;
|
||||
|
||||
extern const ZoneOption defaultZoneOptions[];
|
||||
extern const LayoutOption defaultZoneOptions[];
|
||||
|
||||
#define LAYOUT_MAP_DIV 60
|
||||
#define LAYOUT_MAP_0 0
|
||||
@@ -132,7 +132,7 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
{
|
||||
public:
|
||||
BaseLayoutFactory(const char * id, const char * name,
|
||||
const ZoneOption * options, uint8_t zoneCount, uint8_t* zoneMap):
|
||||
const LayoutOption * options, uint8_t zoneCount, uint8_t* zoneMap):
|
||||
LayoutFactory(id, name),
|
||||
options(options),
|
||||
zoneCount(zoneCount),
|
||||
@@ -179,7 +179,7 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
|
||||
const MaskBitmap* getBitmap() const override { return bitmap; }
|
||||
|
||||
const ZoneOption * getLayoutOptions() const override
|
||||
const LayoutOption * getLayoutOptions() const override
|
||||
{
|
||||
return options;
|
||||
}
|
||||
@@ -212,9 +212,9 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
}
|
||||
if (options) {
|
||||
int i = 0;
|
||||
for (const ZoneOption* option = options; option->name; option++, i++) {
|
||||
for (const LayoutOption* option = options; option->name; option++, i++) {
|
||||
TRACE("LayoutFactory::initPersistentData() setting option '%s'",
|
||||
option->name);
|
||||
STR_VAL(option->name));
|
||||
// TODO compiler bug? The CPU freezes ... persistentData->options[i++]
|
||||
// = option->deflt;
|
||||
auto optVal = &persistentData->options[i];
|
||||
@@ -228,7 +228,7 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
|
||||
protected:
|
||||
MaskBitmap * bitmap = nullptr;
|
||||
const ZoneOption * options;
|
||||
const LayoutOption * options;
|
||||
uint8_t zoneCount;
|
||||
uint8_t* zoneMap;
|
||||
};
|
||||
|
||||
@@ -251,7 +251,7 @@ void ScreenSetupPage::buildLayoutOptions()
|
||||
|
||||
// Option label
|
||||
auto line = layoutOptions->newLine(grid);
|
||||
new StaticText(line, rect_t{}, option->name);
|
||||
new StaticText(line, rect_t{}, STR_VAL(option->name));
|
||||
|
||||
// Option value
|
||||
switch (option->type) {
|
||||
|
||||
@@ -184,21 +184,19 @@ MainView6POS::MainView6POS(Window* parent, uint8_t idx) :
|
||||
coord_t x = MULTIPOS_W_SPACING / 4 + MainViewSlider::SLIDER_BAR_SIZE / 4;
|
||||
for (uint8_t value = 0; value < XPOTS_MULTIPOS_COUNT; value++) {
|
||||
num[0] = value + '1';
|
||||
auto p = lv_label_create(lvobj);
|
||||
auto p = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
lv_label_set_text(p, num);
|
||||
lv_obj_set_size(p, MULTIPOS_SZ, MULTIPOS_SZ);
|
||||
lv_obj_set_pos(p, x, 0);
|
||||
etx_txt_color(p, COLOR_THEME_SECONDARY1_INDEX, LV_PART_MAIN);
|
||||
etx_font(p, FONT_XS_INDEX, LV_PART_MAIN);
|
||||
x += MULTIPOS_W_SPACING;
|
||||
}
|
||||
|
||||
posIcon = new SliderIcon(this);
|
||||
posVal = lv_label_create(posIcon->getLvObj());
|
||||
posVal = etx_label_create(posIcon->getLvObj(), FONT_BOLD_INDEX);
|
||||
lv_obj_set_pos(posVal, PAD_THREE, -PAD_TINY);
|
||||
lv_obj_set_size(posVal, MULTIPOS_SZ, MULTIPOS_SZ);
|
||||
etx_txt_color(posVal, COLOR_THEME_PRIMARY2_INDEX, LV_PART_MAIN);
|
||||
etx_font(posVal, FONT_BOLD_INDEX, LV_PART_MAIN);
|
||||
|
||||
checkEvents();
|
||||
}
|
||||
|
||||
@@ -66,37 +66,37 @@ class LogicalSwitchDisplayFooter : public Window
|
||||
lv_obj_set_style_pad_row(lvobj, 0, 0);
|
||||
lv_obj_set_style_pad_column(lvobj, PAD_TINY, 0);
|
||||
|
||||
lsFunc = lv_label_create(lvobj);
|
||||
lsFunc = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsFunc, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color(lsFunc, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_grid_cell(lsFunc, LV_GRID_ALIGN_STRETCH, 0, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
lsV1 = lv_label_create(lvobj);
|
||||
lsV1 = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsV1, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color(lsV1, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_grid_cell(lsV1, LV_GRID_ALIGN_STRETCH, 1, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
lsV2 = lv_label_create(lvobj);
|
||||
lsV2 = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsV2, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color(lsV2, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_grid_cell(lsV2, LV_GRID_ALIGN_STRETCH, 2, V2_COL_CNT,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
lsAnd = lv_label_create(lvobj);
|
||||
lsAnd = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsAnd, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color(lsAnd, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_grid_cell(lsAnd, LV_GRID_ALIGN_STRETCH, ANDSW_COL, 1,
|
||||
LV_GRID_ALIGN_CENTER, ANDSW_ROW, 1);
|
||||
|
||||
lsDuration = lv_label_create(lvobj);
|
||||
lsDuration = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsDuration, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color(lsDuration, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_grid_cell(lsDuration, LV_GRID_ALIGN_STRETCH, ANDSW_COL + 1, 1,
|
||||
LV_GRID_ALIGN_CENTER, ANDSW_ROW, 1);
|
||||
|
||||
lsDelay = lv_label_create(lvobj);
|
||||
lsDelay = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsDelay, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color(lsDelay, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_grid_cell(lsDelay, LV_GRID_ALIGN_STRETCH, ANDSW_COL + 2, 1,
|
||||
@@ -277,7 +277,7 @@ void LogicalSwitchesViewPage::build(Window* window)
|
||||
} else {
|
||||
if (btnHeight > EdgeTxStyles::STD_FONT_HEIGHT)
|
||||
y += (btnHeight - EdgeTxStyles::STD_FONT_HEIGHT) / 2;
|
||||
auto lbl = lv_label_create(window->getLvObj());
|
||||
auto lbl = etx_label_create(window->getLvObj());
|
||||
lv_obj_set_size(lbl, BTN_WIDTH, btnHeight);
|
||||
lv_obj_set_pos(lbl, x, y);
|
||||
etx_obj_add_style(lbl, styles->text_align_center, LV_PART_MAIN);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
const char* _fct_sw_start[] = {STR_CHAR_UP, STR_CHAR_DOWN, STR_LAST};
|
||||
const char* _fct_sw_start[] = {CHAR_UP, CHAR_DOWN, STR_LAST};
|
||||
|
||||
const char* edgetx_fs_manual_url =
|
||||
"https://edgetx.gitbook.io/edgetx-user-manual/b-and-w-radios/model-select/"
|
||||
@@ -45,7 +45,7 @@ class FunctionSwitch : public Window
|
||||
{
|
||||
padAll(PAD_TINY);
|
||||
|
||||
std::string s(STR_CHAR_SWITCH);
|
||||
std::string s(CHAR_SWITCH);
|
||||
s += switchGetDefaultName(switchIndex);
|
||||
|
||||
new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::STD_FONT_HEIGHT}, s);
|
||||
|
||||
@@ -110,7 +110,7 @@ class GVarButton : public ListLineButton
|
||||
|
||||
currentFlightMode = getFlightMode();
|
||||
|
||||
auto nm = lv_label_create(lvobj);
|
||||
auto nm = etx_label_create(lvobj);
|
||||
lv_label_set_text(nm, getGVarString(index));
|
||||
lv_obj_set_pos(nm, PAD_TINY, GVAR_NM_Y);
|
||||
lv_obj_set_size(nm, GVAR_NAME_SIZE, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
@@ -128,7 +128,7 @@ class GVarButton : public ListLineButton
|
||||
updateValueText(flightMode);
|
||||
}
|
||||
} else {
|
||||
valueTexts[0] = lv_label_create(lvobj);
|
||||
valueTexts[0] = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(valueTexts[0], GVAR_NAME_SIZE + PAD_MEDIUM, (BTN_H - EdgeTxStyles::STD_FONT_HEIGHT - PAD_SMALL) / 2);
|
||||
|
||||
updateValueText(0);
|
||||
|
||||
@@ -318,42 +318,42 @@ class LogicalSwitchButton : public ListLineButton
|
||||
{
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
lsName = lv_label_create(lvobj);
|
||||
lsName = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsName, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lsName, NM_X, NM_Y);
|
||||
lv_obj_set_size(lsName, NM_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
lsFunc = lv_label_create(lvobj);
|
||||
lsFunc = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsFunc, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lsFunc, FN_X, FN_Y);
|
||||
lv_obj_set_size(lsFunc, FN_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
lv_obj_set_style_text_font(lsFunc, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||
|
||||
lsV1 = lv_label_create(lvobj);
|
||||
lsV1 = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsV1, styles->text_align_center, LV_PART_MAIN);
|
||||
etx_font(lsV1, FONT_XS_INDEX, ETX_STATE_V1_SMALL_FONT);
|
||||
lv_obj_set_pos(lsV1, V1_X, V1_Y);
|
||||
lv_obj_set_size(lsV1, V1_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
lv_obj_set_style_text_font(lsV1, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||
|
||||
lsV2 = lv_label_create(lvobj);
|
||||
lsV2 = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsV2, styles->text_align_center, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lsV2, V2_X, V2_Y);
|
||||
lv_obj_set_size(lsV2, V2_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
lv_obj_set_style_text_font(lsV2, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||
|
||||
lsAnd = lv_label_create(lvobj);
|
||||
lsAnd = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsAnd, styles->text_align_center, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lsAnd, AND_X, AND_Y);
|
||||
lv_obj_set_size(lsAnd, AND_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
lv_obj_set_style_text_font(lsAnd, getFont(FONT(BOLD)), LV_STATE_USER_1);
|
||||
|
||||
lsDuration = lv_label_create(lvobj);
|
||||
lsDuration = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsDuration, styles->text_align_center, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lsDuration, DUR_X, DUR_Y);
|
||||
lv_obj_set_size(lsDuration, DUR_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
lsDelay = lv_label_create(lvobj);
|
||||
lsDelay = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lsDelay, styles->text_align_center, LV_PART_MAIN);
|
||||
lv_obj_set_pos(lsDelay, DEL_X, DEL_Y);
|
||||
lv_obj_set_size(lsDelay, DEL_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
@@ -190,7 +190,7 @@ class ScriptLineButton : public ListLineButton
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
auto lbl = lv_label_create(lvobj);
|
||||
auto lbl = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lbl, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_grid_cell(lbl, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER,
|
||||
0, 1);
|
||||
@@ -201,7 +201,7 @@ class ScriptLineButton : public ListLineButton
|
||||
if (runtimeData) {
|
||||
char s[20];
|
||||
|
||||
lbl = lv_label_create(lvobj);
|
||||
lbl = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lbl, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_grid_cell(lbl, LV_GRID_ALIGN_START, 1, 1, LV_GRID_ALIGN_CENTER,
|
||||
0, 1);
|
||||
@@ -209,7 +209,7 @@ class ScriptLineButton : public ListLineButton
|
||||
strAppend(s, scriptData.name, LEN_SCRIPT_NAME);
|
||||
lv_label_set_text(lbl, s);
|
||||
|
||||
lbl = lv_label_create(lvobj);
|
||||
lbl = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lbl, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_grid_cell(lbl, LV_GRID_ALIGN_START, 2, 1, LV_GRID_ALIGN_CENTER,
|
||||
0, 1);
|
||||
@@ -217,7 +217,7 @@ class ScriptLineButton : public ListLineButton
|
||||
strAppend(s, scriptData.file, LEN_SCRIPT_FILENAME);
|
||||
lv_label_set_text(lbl, s);
|
||||
|
||||
lbl = lv_label_create(lvobj);
|
||||
lbl = etx_label_create(lvobj);
|
||||
etx_obj_add_style(lbl, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_grid_cell(lbl, LV_GRID_ALIGN_START, 3, 1, LV_GRID_ALIGN_CENTER,
|
||||
0, 1);
|
||||
|
||||
@@ -180,8 +180,7 @@ class MixGroup : public InputMixGroupBase
|
||||
lv_obj_t* chText = nullptr;
|
||||
if (idx >= MIXSRC_FIRST_CH && idx <= MIXSRC_LAST_CH &&
|
||||
g_model.limitData[idx - MIXSRC_FIRST_CH].name[0] != '\0') {
|
||||
chText = lv_label_create(lvobj);
|
||||
etx_font(chText, FONT_XS_INDEX);
|
||||
chText = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
char chanStr[10];
|
||||
char* s = strAppend(chanStr, STR_CH);
|
||||
strAppendUnsigned(s, idx - MIXSRC_FIRST_CH + 1);
|
||||
|
||||
@@ -46,7 +46,7 @@ class OutputLineButton : public ListLineButton
|
||||
{
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
source = lv_label_create(lvobj);
|
||||
source = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(source, SRC_X, SRC_Y);
|
||||
lv_obj_set_size(source, SRC_W, SRC_H);
|
||||
|
||||
@@ -56,24 +56,24 @@ class OutputLineButton : public ListLineButton
|
||||
lv_obj_set_style_text_line_space(source, -PAD_THREE, ETX_STATE_NAME_FONT_SMALL);
|
||||
#endif
|
||||
|
||||
min = lv_label_create(lvobj);
|
||||
min = etx_label_create(lvobj);
|
||||
etx_obj_add_style(min, styles->text_align_right, LV_PART_MAIN);
|
||||
etx_font(min, FONT_BOLD_INDEX, ETX_STATE_MINMAX_BOLD);
|
||||
lv_obj_set_pos(min, MIN_X, MIN_Y);
|
||||
lv_obj_set_size(min, MIN_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
max = lv_label_create(lvobj);
|
||||
max = etx_label_create(lvobj);
|
||||
etx_obj_add_style(max, styles->text_align_right, LV_PART_MAIN);
|
||||
etx_font(max, FONT_BOLD_INDEX, ETX_STATE_MINMAX_BOLD);
|
||||
lv_obj_set_pos(max, MAX_X, MAX_Y);
|
||||
lv_obj_set_size(max, MAX_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
offset = lv_label_create(lvobj);
|
||||
offset = etx_label_create(lvobj);
|
||||
etx_obj_add_style(offset, styles->text_align_right, LV_PART_MAIN);
|
||||
lv_obj_set_pos(offset, OFF_X, OFF_Y);
|
||||
lv_obj_set_size(offset, OFF_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
center = lv_label_create(lvobj);
|
||||
center = etx_label_create(lvobj);
|
||||
etx_obj_add_style(center, styles->text_align_right, LV_PART_MAIN);
|
||||
lv_obj_set_pos(center, CTR_X, CTR_Y);
|
||||
lv_obj_set_size(center, CTR_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
@@ -148,7 +148,7 @@ class OutputLineButton : public ListLineButton
|
||||
lv_label_set_text(offset, s);
|
||||
|
||||
lv_label_set_text_fmt(center, "%d%s", PPM_CENTER + output->ppmCenter,
|
||||
output->symetrical ? " =" : STR_CHAR_DELTA);
|
||||
output->symetrical ? " =" : CHAR_DELTA);
|
||||
|
||||
curve->show(output->curve);
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ static void viewOption(Window* parent, coord_t x, coord_t y,
|
||||
|
||||
static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
{
|
||||
STR_RADIO_MENU_TABS, nullptr,
|
||||
STR_DEF(STR_RADIO_MENU_TABS), nullptr,
|
||||
},
|
||||
{
|
||||
STR_MAIN_MENU_THEMES,
|
||||
STR_DEF(STR_MAIN_MENU_THEMES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.radioThemesDisabled),
|
||||
@@ -85,7 +85,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENUSPECIALFUNCS,
|
||||
STR_DEF(STR_MENUSPECIALFUNCS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.radioGFDisabled),
|
||||
@@ -93,7 +93,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENUTRAINER,
|
||||
STR_DEF(STR_MENUTRAINER),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.radioTrainerDisabled),
|
||||
@@ -101,11 +101,11 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MODEL_MENU_TABS, nullptr,
|
||||
STR_DEF(STR_MODEL_MENU_TABS), nullptr,
|
||||
},
|
||||
#if defined(HELI)
|
||||
{
|
||||
STR_MENUHELISETUP,
|
||||
STR_DEF(STR_MENUHELISETUP),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelHeliDisabled),
|
||||
@@ -115,7 +115,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
#endif
|
||||
#if defined(FLIGHT_MODES)
|
||||
{
|
||||
STR_MENUFLIGHTMODES,
|
||||
STR_DEF(STR_MENUFLIGHTMODES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelFMDisabled),
|
||||
@@ -125,7 +125,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
#endif
|
||||
#if defined(GVARS)
|
||||
{
|
||||
STR_MENU_GLOBAL_VARS,
|
||||
STR_DEF(STR_MENU_GLOBAL_VARS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelGVDisabled),
|
||||
@@ -134,7 +134,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
},
|
||||
#endif
|
||||
{
|
||||
STR_MENUCURVES,
|
||||
STR_DEF(STR_MENUCURVES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelCurvesDisabled),
|
||||
@@ -142,7 +142,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENULOGICALSWITCHES,
|
||||
STR_DEF(STR_MENULOGICALSWITCHES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelLSDisabled),
|
||||
@@ -150,7 +150,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENUCUSTOMFUNC,
|
||||
STR_DEF(STR_MENUCUSTOMFUNC),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelSFDisabled),
|
||||
@@ -159,7 +159,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
},
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
{
|
||||
STR_MENUCUSTOMSCRIPTS,
|
||||
STR_DEF(STR_MENUCUSTOMSCRIPTS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelCustomScriptsDisabled),
|
||||
@@ -168,7 +168,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
},
|
||||
#endif
|
||||
{
|
||||
STR_MENUTELEMETRY,
|
||||
STR_DEF(STR_MENUTELEMETRY),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.modelTelemetryDisabled),
|
||||
@@ -259,14 +259,14 @@ struct CenterBeepsMatrix : public ButtonMatrix {
|
||||
|
||||
static SetupLineDef otherPageSetupLines[] = {
|
||||
{
|
||||
STR_JITTER_FILTER,
|
||||
STR_DEF(STR_JITTER_FILTER),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_ADCFILTERVALUES, 0, 2,
|
||||
GET_SET_DEFAULT(g_model.jitterFilter));
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_BEEPCTR, [](Window* parent, coord_t x, coord_t y) {}
|
||||
STR_DEF(STR_BEEPCTR), [](Window* parent, coord_t x, coord_t y) {}
|
||||
},
|
||||
{
|
||||
nullptr,
|
||||
@@ -280,7 +280,7 @@ static SetupLineDef otherPageSetupLines[] = {
|
||||
static SetupLineDef setupLines[] = {
|
||||
{
|
||||
// Model name
|
||||
STR_MODELNAME,
|
||||
STR_DEF(STR_MODELNAME),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ModelTextEdit(parent, {x, y, ModelSetupPage::NAM_W, 0},
|
||||
g_model.header.name, sizeof(g_model.header.name),
|
||||
@@ -295,7 +295,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Model labels
|
||||
STR_LABELS,
|
||||
STR_DEF(STR_LABELS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto curmod = modelslist.getCurrentModel();
|
||||
TextButton* btn = new TextButton(parent, {x, y, 0, 0}, modelslabels.getBulletLabelString(curmod, STR_UNLABELEDMODEL));
|
||||
@@ -328,7 +328,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Model bitmap
|
||||
STR_BITMAP,
|
||||
STR_DEF(STR_BITMAP),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new FileChoice(parent, {x, y, 0, 0}, BITMAPS_PATH, BITMAPS_EXT, LEN_BITMAP_NAME,
|
||||
[=]() {
|
||||
@@ -353,27 +353,27 @@ void ModelSetupPage::build(Window * window)
|
||||
|
||||
new SetupButtonGroup(window, {0, y, LCD_W - padding * 2, 0}, nullptr, BTN_COLS, PAD_TINY, {
|
||||
// Modules
|
||||
{STR_INTERNALRF, []() { new ModulePage(INTERNAL_MODULE); }, []() { return g_model.moduleData[INTERNAL_MODULE].type > 0; }},
|
||||
{STR_EXTERNALRF, []() { new ModulePage(EXTERNAL_MODULE); }, []() { return g_model.moduleData[EXTERNAL_MODULE].type > 0; }},
|
||||
{STR_TRAINER, []() { new TrainerPage(); }, []() { return g_model.trainerData.mode > 0; }},
|
||||
{STR_DEF(STR_INTERNALRF), []() { new ModulePage(INTERNAL_MODULE); }, []() { return g_model.moduleData[INTERNAL_MODULE].type > 0; }},
|
||||
{STR_DEF(STR_EXTERNALRF), []() { new ModulePage(EXTERNAL_MODULE); }, []() { return g_model.moduleData[EXTERNAL_MODULE].type > 0; }},
|
||||
{STR_DEF(STR_TRAINER), []() { new TrainerPage(); }, []() { return g_model.trainerData.mode > 0; }},
|
||||
// Timer buttons
|
||||
{STR_TIMER_1, []() { new TimerWindow(0); }, []() { return g_model.timers[0].mode > 0; }},
|
||||
{STR_TIMER_2, []() { new TimerWindow(1); }, []() { return g_model.timers[1].mode > 0; }},
|
||||
{STR_TIMER_3, []() { new TimerWindow(2); }, []() { return g_model.timers[2].mode > 0; }},
|
||||
{STR_DEF(STR_TIMER_1), []() { new TimerWindow(0); }, []() { return g_model.timers[0].mode > 0; }},
|
||||
{STR_DEF(STR_TIMER_2), []() { new TimerWindow(1); }, []() { return g_model.timers[1].mode > 0; }},
|
||||
{STR_DEF(STR_TIMER_3), []() { new TimerWindow(2); }, []() { return g_model.timers[2].mode > 0; }},
|
||||
|
||||
{STR_PREFLIGHT, []() { new PreflightChecks(); }},
|
||||
{STR_TRIMS, []() { new TrimsSetup(); }},
|
||||
{STR_THROTTLE_LABEL, []() { new ThrottleParams(); }},
|
||||
{STR_ENABLED_FEATURES, []() { new SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
{STR_DEF(STR_PREFLIGHT), []() { new PreflightChecks(); }},
|
||||
{STR_DEF(STR_TRIMS), []() { new TrimsSetup(); }},
|
||||
{STR_DEF(STR_THROTTLE_LABEL), []() { new ThrottleParams(); }},
|
||||
{STR_DEF(STR_ENABLED_FEATURES), []() { new SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
#if defined(USBJ_EX)
|
||||
{STR_USBJOYSTICK_LABEL, []() { new ModelUSBJoystickPage(); }},
|
||||
{STR_DEF(STR_USBJOYSTICK_LABEL), []() { new ModelUSBJoystickPage(); }},
|
||||
#endif
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
{STR_FUNCTION_SWITCHES, []() { new ModelFunctionSwitches(); }},
|
||||
{STR_DEF(STR_FUNCTION_SWITCHES), []() { new ModelFunctionSwitches(); }},
|
||||
#endif
|
||||
{STR_MENU_OTHER, []() { new SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_MENU_OTHER, otherPageSetupLines, DIM(otherPageSetupLines)); }},
|
||||
{STR_DEF(STR_MENU_OTHER), []() { new SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_MENU_OTHER, otherPageSetupLines, DIM(otherPageSetupLines)); }},
|
||||
#if defined(HELI)
|
||||
{STR_MENUHELISETUP, []() { return new ModelHeliPage(); }, nullptr, modelHeliEnabled},
|
||||
{STR_DEF(STR_MENUHELISETUP), []() { return new ModelHeliPage(); }, nullptr, modelHeliEnabled},
|
||||
#endif
|
||||
}, BTN_H);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ TemplatePage::TemplatePage() : Page(ICON_MODEL_SELECT, PAD_ZERO)
|
||||
lv_obj_set_grid_cell(listWindow->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 1,
|
||||
LV_GRID_ALIGN_START, 0, 1);
|
||||
|
||||
infoLabel = lv_label_create(line->getLvObj());
|
||||
infoLabel = etx_label_create(line->getLvObj());
|
||||
lv_label_set_text(infoLabel, "");
|
||||
lv_obj_set_height(infoLabel, body->height() - PAD_SMALL * 2);
|
||||
etx_obj_add_style(infoLabel, styles->text_align_left, LV_PART_MAIN);
|
||||
|
||||
@@ -380,7 +380,7 @@ class USBChannelLineButton : public ListLineButton
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
m_chn = lv_label_create(lvobj);
|
||||
m_chn = etx_label_create(lvobj);
|
||||
lv_obj_set_grid_cell(m_chn, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER,
|
||||
0, USBCH_CHN_ROWS);
|
||||
|
||||
@@ -390,21 +390,21 @@ class USBChannelLineButton : public ListLineButton
|
||||
lv_obj_set_grid_cell(m_inverse->getLvObj(), LV_GRID_ALIGN_START, 1, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
m_mode = lv_label_create(lvobj);
|
||||
m_mode = etx_label_create(lvobj);
|
||||
lv_obj_set_grid_cell(m_mode, LV_GRID_ALIGN_START, 2, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
m_param = lv_label_create(lvobj);
|
||||
m_param = etx_label_create(lvobj);
|
||||
etx_txt_color(m_param, COLOR_THEME_WARNING_INDEX, ETX_STATE_COLLISION_WARN);
|
||||
etx_font(m_param, FONT_BOLD_INDEX, ETX_STATE_COLLISION_WARN);
|
||||
lv_obj_set_grid_cell(m_param, LV_GRID_ALIGN_START, 3, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
m_btn_mode = lv_label_create(lvobj);
|
||||
m_btn_mode = etx_label_create(lvobj);
|
||||
lv_obj_set_grid_cell(m_btn_mode, LV_GRID_ALIGN_START, USBCH_BTN_MODE_COL, 1,
|
||||
LV_GRID_ALIGN_CENTER, USBCH_BTN_MODE_ROW, 1);
|
||||
|
||||
m_btns = lv_label_create(lvobj);
|
||||
m_btns = etx_label_create(lvobj);
|
||||
lv_obj_set_grid_cell(m_btns, LV_GRID_ALIGN_START, USBCH_BTN_MODE_COL + 1, 1,
|
||||
LV_GRID_ALIGN_CENTER, USBCH_BTN_MODE_ROW, 1);
|
||||
|
||||
|
||||
@@ -90,19 +90,19 @@ void FunctionLineButton::delayedInit()
|
||||
{
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
sfName = lv_label_create(lvobj);
|
||||
sfName = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(sfName, NM_X, NM_Y);
|
||||
lv_obj_set_size(sfName, NM_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
sfSwitch = lv_label_create(lvobj);
|
||||
sfSwitch = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(sfSwitch, SW_X, SW_Y);
|
||||
lv_obj_set_size(sfSwitch, SW_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
sfFunc = lv_label_create(lvobj);
|
||||
sfFunc = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(sfFunc, FN_X, FN_Y);
|
||||
lv_obj_set_size(sfFunc, FN_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
sfRepeat = lv_label_create(lvobj);
|
||||
sfRepeat = etx_label_create(lvobj);
|
||||
lv_obj_set_pos(sfRepeat, RP_X, RP_Y);
|
||||
lv_obj_set_size(sfRepeat, RP_W, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
static SetupLineDef setupLines[] = {
|
||||
{
|
||||
// Throttle reversed
|
||||
STR_THROTTLEREVERSE,
|
||||
STR_DEF(STR_THROTTLEREVERSE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_DEFAULT(g_model.throttleReversed));
|
||||
}
|
||||
},
|
||||
{
|
||||
// Throttle source
|
||||
STR_TTRACE,
|
||||
STR_DEF(STR_TTRACE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto sc = new SourceChoice(parent, {x, y, 0, 0}, 0, MIXSRC_LAST_CH,
|
||||
[]() {return throttleSource2Source(g_model.thrTraceSrc); },
|
||||
@@ -52,14 +52,14 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Throttle trim
|
||||
STR_TTRIM,
|
||||
STR_DEF(STR_TTRIM),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_DEFAULT(g_model.thrTrim));
|
||||
}
|
||||
},
|
||||
{
|
||||
// Throttle trim source
|
||||
STR_TTRIM_SW,
|
||||
STR_DEF(STR_TTRIM_SW),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new SourceChoice(
|
||||
parent, {x, y, 0, 0}, MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM,
|
||||
|
||||
@@ -41,7 +41,7 @@ static SetupLineDef setupLines[] = {
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
{
|
||||
// Hats mode for NV14/EL18
|
||||
STR_HATSMODE,
|
||||
STR_DEF(STR_HATSMODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, TrimsSetup::HATSMODE_W, 0}, STR_HATSOPT, HATSMODE_TRIMS_ONLY, HATSMODE_GLOBAL,
|
||||
GET_SET_DEFAULT(g_model.hatsMode));
|
||||
@@ -55,7 +55,7 @@ static SetupLineDef setupLines[] = {
|
||||
#endif
|
||||
{
|
||||
// Trim step
|
||||
STR_TRIMINC,
|
||||
STR_DEF(STR_TRIMINC),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_VTRIMINC, -2, 2,
|
||||
GET_SET_DEFAULT(g_model.trimInc));
|
||||
@@ -63,7 +63,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Extended trims
|
||||
STR_ETRIMS,
|
||||
STR_DEF(STR_ETRIMS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_DEFAULT(g_model.extendedTrims));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static SetupLineDef setupLines[] = {
|
||||
{
|
||||
// Display trims
|
||||
// TODO: move to "Screen setup" ?
|
||||
STR_DISPLAY_TRIMS,
|
||||
STR_DEF(STR_DISPLAY_TRIMS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_VDISPLAYTRIMS, 0, 2,
|
||||
GET_SET_DEFAULT(g_model.displayTrims));
|
||||
|
||||
@@ -42,7 +42,7 @@ class RadioFunctionSwitch : public Window
|
||||
{
|
||||
padAll(PAD_TINY);
|
||||
|
||||
std::string s(STR_CHAR_SWITCH);
|
||||
std::string s(CHAR_SWITCH);
|
||||
s += switchGetDefaultName(switchIndex);
|
||||
|
||||
new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::STD_FONT_HEIGHT}, s);
|
||||
|
||||
@@ -67,17 +67,17 @@ class RadioCustSwitchesDiagsWindow : public Window
|
||||
for (uint8_t i = 0, r = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||
if (switchIsCustomSwitch(i)) {
|
||||
coord_t y = (r + 2) * EdgeTxStyles::STD_FONT_HEIGHT;
|
||||
std::string s(STR_CHAR_SWITCH);
|
||||
std::string s(CHAR_SWITCH);
|
||||
s += switchGetDefaultName(i);
|
||||
new StaticText(this, {PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT}, s);
|
||||
new DynamicText(
|
||||
this, {FS_1ST_COLUMN + PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
||||
[=]() {
|
||||
return getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP;
|
||||
return getFSPhysicalState(i) ? CHAR_DOWN : CHAR_UP;
|
||||
});
|
||||
new DynamicText(
|
||||
this, {FS_2ND_COLUMN + 10, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
||||
[=]() { return g_model.cfsState(i) ? STR_CHAR_DOWN : STR_CHAR_UP; });
|
||||
[=]() { return g_model.cfsState(i) ? CHAR_DOWN : CHAR_UP; });
|
||||
|
||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||
colorBox[r] = new ColorSwatch(this, {FS_3RD_COLUMN, y, FS_COLOR_WIDTH,
|
||||
|
||||
@@ -101,22 +101,22 @@ class RadioKeyDiagsWindow : public Window
|
||||
for (i = 0; i < keysGetMaxKeys(); i++) {
|
||||
auto k = get_ith_key(i);
|
||||
|
||||
auto lbl = lv_label_create(obj);
|
||||
auto lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, keysGetLabel(k));
|
||||
lv_obj_set_pos(lbl, 0, i * EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
lbl = lv_label_create(obj);
|
||||
lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, "");
|
||||
lv_obj_set_pos(lbl, KVAL_X, i * EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
keyValues[i] = lbl;
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
auto lbl = lv_label_create(obj);
|
||||
auto lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, STR_ROTARY_ENCODER);
|
||||
lv_obj_set_pos(lbl, 0, (i + 1) * EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
reValue = lv_label_create(obj);
|
||||
reValue = etx_label_create(obj);
|
||||
lv_label_set_text(reValue, "");
|
||||
lv_obj_set_pos(reValue, KVAL_X, (i + 1) * EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
#endif
|
||||
@@ -132,7 +132,7 @@ class RadioKeyDiagsWindow : public Window
|
||||
// SWITCHES
|
||||
for (i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||
if (SWITCH_EXISTS(i) && !switchIsCustomSwitch(i)) {
|
||||
auto lbl = lv_label_create(obj);
|
||||
auto lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, "");
|
||||
lv_obj_set_pos(lbl, 0, row * EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
switchValues[i] = lbl;
|
||||
@@ -147,29 +147,29 @@ class RadioKeyDiagsWindow : public Window
|
||||
lv_obj_t *obj = form->getLvObj();
|
||||
char s[10];
|
||||
|
||||
auto lbl = lv_label_create(obj);
|
||||
auto lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, STR_TRIMS);
|
||||
lv_obj_set_pos(lbl, 0, 0);
|
||||
lbl = lv_label_create(obj);
|
||||
lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, "-");
|
||||
lv_obj_set_pos(lbl, TRIM_MINUS_X, 0);
|
||||
lbl = lv_label_create(obj);
|
||||
lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, "+");
|
||||
lv_obj_set_pos(lbl, TRIM_PLUS_X, 0);
|
||||
|
||||
// TRIMS
|
||||
for (uint8_t i = 0; i < keysGetMaxTrims(); i++) {
|
||||
lbl = lv_label_create(obj);
|
||||
lbl = etx_label_create(obj);
|
||||
formatNumberAsString(s, 10, i + 1, 0, 10, "T");
|
||||
lv_label_set_text(lbl, s);
|
||||
lv_obj_set_pos(lbl, PAD_SMALL, i * EdgeTxStyles::STD_FONT_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
|
||||
lbl = lv_label_create(obj);
|
||||
lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, "");
|
||||
lv_obj_set_pos(lbl, TRIM_MINUS_X - PAD_TINY, i * EdgeTxStyles::STD_FONT_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
trimValues[i * 2] = lbl;
|
||||
|
||||
lbl = lv_label_create(obj);
|
||||
lbl = etx_label_create(obj);
|
||||
lv_label_set_text(lbl, "");
|
||||
lv_obj_set_pos(lbl, TRIM_PLUS_X, i * EdgeTxStyles::STD_FONT_HEIGHT + EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
trimValues[i * 2 + 1] = lbl;
|
||||
|
||||
@@ -94,7 +94,7 @@ class BatCalEdit : public NumberEdit
|
||||
static SetupLineDef setupLines[] = {
|
||||
{
|
||||
// Batt meter range - Range 3.0v to 16v
|
||||
STR_BATTERY_RANGE,
|
||||
STR_DEF(STR_BATTERY_RANGE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto batMin = new NumberEdit(
|
||||
parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, -60 + 90, g_eeGeneral.vBatMax + 29 + 90,
|
||||
@@ -121,14 +121,14 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Bat calibration
|
||||
STR_BATT_CALIB,
|
||||
STR_DEF(STR_BATT_CALIB),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new BatCalEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0});
|
||||
}
|
||||
},
|
||||
{
|
||||
// RTC Batt check enable
|
||||
STR_RTC_CHECK,
|
||||
STR_DEF(STR_RTC_CHECK),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0},
|
||||
GET_SET_INVERTED(g_eeGeneral.disableRtcWarning));
|
||||
@@ -143,7 +143,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// ADC filter
|
||||
STR_JITTER_FILTER,
|
||||
STR_DEF(STR_JITTER_FILTER),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_INVERTED(g_eeGeneral.noJitterFilter));
|
||||
}
|
||||
@@ -151,7 +151,7 @@ static SetupLineDef setupLines[] = {
|
||||
#if defined(AUDIO_MUTE_GPIO)
|
||||
{
|
||||
// Mute audio
|
||||
STR_AUDIO_MUTE,
|
||||
STR_DEF(STR_AUDIO_MUTE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_DEFAULT(g_eeGeneral.audioMuteEnable));
|
||||
}
|
||||
@@ -187,21 +187,21 @@ void RadioHardwarePage::build(Window* window)
|
||||
|
||||
// Calibration
|
||||
new SetupButtonGroup(window, {0, 0, LCD_W - padding * 2, 0}, STR_INPUTS, BTN_COLS, PAD_ZERO, {
|
||||
{STR_MENUCALIBRATION, []() { new RadioCalibrationPage(); }},
|
||||
{STR_STICKS, []() { new HWInputDialog<HWSticks>(STR_STICKS); }},
|
||||
{STR_POTS, []() { new HWInputDialog<HWPots>(STR_POTS, HWPots::POTS_WINDOW_WIDTH); }},
|
||||
{STR_SWITCHES, []() { new HWInputDialog<HWSwitches>(STR_SWITCHES, HWSwitches::SW_WINDOW_WIDTH); }},
|
||||
{STR_DEF(STR_MENUCALIBRATION), []() { new RadioCalibrationPage(); }},
|
||||
{STR_DEF(STR_STICKS), []() { new HWInputDialog<HWSticks>(STR_STICKS); }},
|
||||
{STR_DEF(STR_POTS), []() { new HWInputDialog<HWPots>(STR_POTS, HWPots::POTS_WINDOW_WIDTH); }},
|
||||
{STR_DEF(STR_SWITCHES), []() { new HWInputDialog<HWSwitches>(STR_SWITCHES, HWSwitches::SW_WINDOW_WIDTH); }},
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
{STR_FUNCTION_SWITCHES, []() { new RadioFunctionSwitches(); }},
|
||||
{STR_DEF(STR_FUNCTION_SWITCHES), []() { new RadioFunctionSwitches(); }},
|
||||
#endif
|
||||
});
|
||||
|
||||
// Debugs
|
||||
new SetupButtonGroup(window, {0, 0, LCD_W - padding * 2, 0}, STR_DEBUG, FS_BTN_COLS, PAD_ZERO, {
|
||||
{STR_ANALOGS_BTN, [=]() { new RadioAnalogsDiagsViewPageGroup(quickMenuId); }},
|
||||
{STR_KEYS_BTN, []() { new RadioKeyDiagsPage(); }},
|
||||
{STR_DEF(STR_ANALOGS_BTN), [=]() { new RadioAnalogsDiagsViewPageGroup(quickMenuId); }},
|
||||
{STR_DEF(STR_KEYS_BTN), []() { new RadioKeyDiagsPage(); }},
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
{STR_FS_BTN, []() { new RadioCustSwitchesDiagsPage(); }},
|
||||
{STR_DEF(STR_FS_BTN), []() { new RadioCustSwitchesDiagsPage(); }},
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ class DateTimeWindow : public Window
|
||||
static SetupLineDef soundPageSetupLines[] = {
|
||||
{
|
||||
// Beeps mode
|
||||
STR_MODE,
|
||||
STR_DEF(STR_MODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_VBEEPMODE, -2, 1,
|
||||
GET_SET_DEFAULT(g_eeGeneral.beepMode));
|
||||
@@ -199,7 +199,7 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Main volume
|
||||
STR_VOLUME,
|
||||
STR_DEF(STR_VOLUME),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -VOLUME_LEVEL_DEF,
|
||||
VOLUME_LEVEL_MAX - VOLUME_LEVEL_DEF,
|
||||
@@ -208,7 +208,7 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Beeps volume
|
||||
STR_BEEP_VOLUME,
|
||||
STR_DEF(STR_BEEP_VOLUME),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.beepVolume)))->setPos(x, y);
|
||||
@@ -216,7 +216,7 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Beeps length
|
||||
STR_BEEP_LENGTH,
|
||||
STR_DEF(STR_BEEP_LENGTH),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.beepLength)))->setPos(x, y);
|
||||
@@ -224,7 +224,7 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Beeps pitch
|
||||
STR_BEEP_PITCH,
|
||||
STR_DEF(STR_BEEP_PITCH),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(parent, rect_t{x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, 300,
|
||||
GET_DEFAULT(15 * g_eeGeneral.speakerPitch),
|
||||
@@ -239,7 +239,7 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Wav volume
|
||||
STR_WAV_VOLUME,
|
||||
STR_DEF(STR_WAV_VOLUME),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.wavVolume)))->setPos(x, y);
|
||||
@@ -247,7 +247,7 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Background volume
|
||||
STR_BG_VOLUME,
|
||||
STR_DEF(STR_BG_VOLUME),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.backgroundVolume)))->setPos(x, y);
|
||||
@@ -260,14 +260,14 @@ static SetupLineDef soundPageSetupLines[] = {
|
||||
static SetupLineDef varioPageSetupLines[] = {
|
||||
{
|
||||
// Vario volume
|
||||
STR_VOLUME,
|
||||
STR_DEF(STR_VOLUME),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.varioVolume)))->setPos(x, y);
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_PITCH_AT_ZERO,
|
||||
STR_DEF(STR_PITCH_AT_ZERO),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(
|
||||
parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400,
|
||||
@@ -279,7 +279,7 @@ static SetupLineDef varioPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_PITCH_AT_MAX,
|
||||
STR_DEF(STR_PITCH_AT_MAX),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(
|
||||
parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 900, 2500,
|
||||
@@ -294,7 +294,7 @@ static SetupLineDef varioPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_REPEAT_AT_ZERO,
|
||||
STR_DEF(STR_REPEAT_AT_ZERO),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(
|
||||
parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 200, 1000,
|
||||
@@ -312,7 +312,7 @@ static SetupLineDef varioPageSetupLines[] = {
|
||||
static SetupLineDef hapticPageSetupLines[] = {
|
||||
{
|
||||
// Haptic mode
|
||||
STR_MODE,
|
||||
STR_DEF(STR_MODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_VBEEPMODE, -2, 1,
|
||||
GET_SET_DEFAULT(g_eeGeneral.hapticMode));
|
||||
@@ -320,7 +320,7 @@ static SetupLineDef hapticPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Haptic duration
|
||||
STR_LENGTH,
|
||||
STR_DEF(STR_LENGTH),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.hapticLength)))->setPos(x, y);
|
||||
@@ -328,7 +328,7 @@ static SetupLineDef hapticPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Haptic strength
|
||||
STR_STRENGTH,
|
||||
STR_DEF(STR_STRENGTH),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
(new Slider(parent, lv_pct(50), -2, +2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.hapticStrength)))->setPos(x, y);
|
||||
@@ -340,7 +340,7 @@ static SetupLineDef hapticPageSetupLines[] = {
|
||||
static SetupLineDef alarmsPageSetupLines[] = {
|
||||
{
|
||||
// Battery warning
|
||||
STR_BATTERYWARNING,
|
||||
STR_DEF(STR_BATTERYWARNING),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 30, 120,
|
||||
GET_SET_DEFAULT(g_eeGeneral.vBatWarn), PREC1);
|
||||
@@ -349,7 +349,7 @@ static SetupLineDef alarmsPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Inactivity alarm
|
||||
STR_INACTIVITYALARM,
|
||||
STR_DEF(STR_INACTIVITYALARM),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW * 3 / 2, 0}, 0, 250,
|
||||
GET_SET_DEFAULT(g_eeGeneral.inactivityTimer));
|
||||
@@ -380,7 +380,7 @@ static SetupLineDef alarmsPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Alarms warning
|
||||
STR_ALARMWARNING,
|
||||
STR_DEF(STR_ALARMWARNING),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0},
|
||||
GET_SET_INVERTED(g_eeGeneral.disableAlarmWarning));
|
||||
@@ -388,7 +388,7 @@ static SetupLineDef alarmsPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// RSSI shutdown alarm
|
||||
STR_RSSI_SHUTDOWN_ALARM,
|
||||
STR_DEF(STR_RSSI_SHUTDOWN_ALARM),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0},
|
||||
GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm));
|
||||
@@ -396,7 +396,7 @@ static SetupLineDef alarmsPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Trainer shutdown alarm
|
||||
STR_TRAINER_SHUTDOWN_ALARM,
|
||||
STR_DEF(STR_TRAINER_SHUTDOWN_ALARM),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0},
|
||||
GET_SET_INVERTED(g_eeGeneral.disableTrainerPoweroffAlarm));
|
||||
@@ -534,7 +534,7 @@ class BacklightPage : public SubPage
|
||||
static SetupLineDef gpsPageSetupLines[] = {
|
||||
{
|
||||
// Timezone
|
||||
STR_TIMEZONE,
|
||||
STR_DEF(STR_TIMEZONE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto tz = new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, minTimezone(), maxTimezone(),
|
||||
[]() {
|
||||
@@ -551,14 +551,14 @@ static SetupLineDef gpsPageSetupLines[] = {
|
||||
},
|
||||
{
|
||||
// Adjust RTC (from telemetry)
|
||||
STR_ADJUST_RTC,
|
||||
STR_DEF(STR_ADJUST_RTC),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_DEFAULT(g_eeGeneral.adjustRTC));
|
||||
}
|
||||
},
|
||||
{
|
||||
// GPS format
|
||||
STR_GPS_COORDS_FORMAT,
|
||||
STR_DEF(STR_GPS_COORDS_FORMAT),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_GPSFORMAT, 0, 1,
|
||||
GET_SET_DEFAULT(g_eeGeneral.gpsFormat));
|
||||
@@ -581,10 +581,10 @@ static void viewOption(Window* parent, coord_t x, coord_t y,
|
||||
|
||||
static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
{
|
||||
STR_RADIO_MENU_TABS, nullptr,
|
||||
STR_DEF(STR_RADIO_MENU_TABS), nullptr,
|
||||
},
|
||||
{
|
||||
STR_MAIN_MENU_THEMES,
|
||||
STR_DEF(STR_MAIN_MENU_THEMES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.radioThemesDisabled),
|
||||
@@ -592,7 +592,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENUSPECIALFUNCS,
|
||||
STR_DEF(STR_MENUSPECIALFUNCS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.radioGFDisabled),
|
||||
@@ -600,7 +600,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENUTRAINER,
|
||||
STR_DEF(STR_MENUTRAINER),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.radioTrainerDisabled),
|
||||
@@ -608,11 +608,11 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MODEL_MENU_TABS, nullptr,
|
||||
STR_DEF(STR_MODEL_MENU_TABS), nullptr,
|
||||
},
|
||||
#if defined(HELI)
|
||||
{
|
||||
STR_MENUHELISETUP,
|
||||
STR_DEF(STR_MENUHELISETUP),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelHeliDisabled),
|
||||
@@ -622,7 +622,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
#endif
|
||||
#if defined(FLIGHT_MODES)
|
||||
{
|
||||
STR_MENUFLIGHTMODES,
|
||||
STR_DEF(STR_MENUFLIGHTMODES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelFMDisabled),
|
||||
@@ -632,7 +632,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
#endif
|
||||
#if defined(GVARS)
|
||||
{
|
||||
STR_MENU_GLOBAL_VARS,
|
||||
STR_DEF(STR_MENU_GLOBAL_VARS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelGVDisabled),
|
||||
@@ -641,7 +641,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
},
|
||||
#endif
|
||||
{
|
||||
STR_MENUCURVES,
|
||||
STR_DEF(STR_MENUCURVES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelCurvesDisabled),
|
||||
@@ -649,7 +649,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENULOGICALSWITCHES,
|
||||
STR_DEF(STR_MENULOGICALSWITCHES),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelLSDisabled),
|
||||
@@ -657,7 +657,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
}
|
||||
},
|
||||
{
|
||||
STR_MENUCUSTOMFUNC,
|
||||
STR_DEF(STR_MENUCUSTOMFUNC),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelSFDisabled),
|
||||
@@ -666,7 +666,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
},
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
{
|
||||
STR_MENUCUSTOMSCRIPTS,
|
||||
STR_DEF(STR_MENUCUSTOMSCRIPTS),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelCustomScriptsDisabled),
|
||||
@@ -675,7 +675,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
},
|
||||
#endif
|
||||
{
|
||||
STR_MENUTELEMETRY,
|
||||
STR_DEF(STR_MENUTELEMETRY),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.modelTelemetryDisabled),
|
||||
@@ -739,7 +739,7 @@ class ManageModelsSetupPage : public SubPage
|
||||
static SetupLineDef setupLines[] = {
|
||||
{
|
||||
// Splash screen
|
||||
STR_SPLASHSCREEN,
|
||||
STR_DEF(STR_SPLASHSCREEN),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(
|
||||
parent, {x, y, 0, 0}, STR_SPLASHSCREEN_DELAYS, 0, 7,
|
||||
@@ -752,7 +752,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Play startup sound
|
||||
STR_PLAY_HELLO,
|
||||
STR_DEF(STR_PLAY_HELLO),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_INVERTED(g_eeGeneral.dontPlayHello));
|
||||
}
|
||||
@@ -760,7 +760,7 @@ static SetupLineDef setupLines[] = {
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
{
|
||||
// Pwr Off Delay
|
||||
STR_PWR_OFF_DELAY,
|
||||
STR_DEF(STR_PWR_OFF_DELAY),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(
|
||||
parent, {x, y, 0, 0}, STR_PWR_OFF_DELAYS, 0, 4,
|
||||
@@ -774,7 +774,7 @@ static SetupLineDef setupLines[] = {
|
||||
|
||||
// Pwr Off If Inactive
|
||||
{
|
||||
STR_PWR_AUTO_OFF,
|
||||
STR_DEF(STR_PWR_AUTO_OFF),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit = new NumberEdit(parent,{x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, EdgeTxStyles::UI_ELEMENT_HEIGHT}, 0,
|
||||
255, GET_SET_DEFAULT(g_eeGeneral.pwrOffIfInactive));
|
||||
@@ -785,7 +785,7 @@ static SetupLineDef setupLines[] = {
|
||||
#if defined(HAPTIC)
|
||||
{
|
||||
// Power on/off haptic alarm
|
||||
STR_PWR_ON_OFF_HAPTIC,
|
||||
STR_DEF(STR_PWR_ON_OFF_HAPTIC),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new ToggleSwitch(parent, {x, y, 0, 0}, GET_SET_INVERTED(g_eeGeneral.disablePwrOnOffHaptic));
|
||||
}
|
||||
@@ -794,7 +794,7 @@ static SetupLineDef setupLines[] = {
|
||||
#if defined(PXX2)
|
||||
{
|
||||
// Owner ID
|
||||
STR_OWNER_ID,
|
||||
STR_DEF(STR_OWNER_ID),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new RadioTextEdit(parent, {x, y, 0, 0}, g_eeGeneral.ownerRegistrationID,
|
||||
PXX2_LEN_REGISTRATION_ID);
|
||||
@@ -803,7 +803,7 @@ static SetupLineDef setupLines[] = {
|
||||
#endif
|
||||
{
|
||||
// Country code
|
||||
STR_COUNTRY_CODE,
|
||||
STR_DEF(STR_COUNTRY_CODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_COUNTRY_CODES, 0, 2,
|
||||
GET_SET_DEFAULT(g_eeGeneral.countryCode));
|
||||
@@ -811,7 +811,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Audio language
|
||||
STR_VOICE_LANGUAGE,
|
||||
STR_DEF(STR_VOICE_LANGUAGE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto choice =
|
||||
new Choice(parent, {x, y, 0, 0}, 0, DIM(languagePacks) - 2,
|
||||
@@ -820,14 +820,41 @@ static SetupLineDef setupLines[] = {
|
||||
currentLanguagePack = languagePacks[currentLanguagePackIdx];
|
||||
strncpy(g_eeGeneral.ttsLanguage, currentLanguagePack->id, 2);
|
||||
SET_DIRTY();
|
||||
#if defined(ALL_LANGS)
|
||||
currentLangStrings = langStrings[currentLanguagePackIdx];
|
||||
extern void setLanguageFont(int idx);
|
||||
setLanguageFont(currentLanguagePackIdx);
|
||||
PageGroup* pg = (PageGroup*)Layer::getPageGroup();
|
||||
coord_t y = pg->getScrollY();
|
||||
pg->onCancel();
|
||||
PageGroup::RadioMenu();
|
||||
pg = (PageGroup*)Layer::getPageGroup();
|
||||
pg->setScrollY(y);
|
||||
// Force QM rebuild for language change
|
||||
QuickMenu::shutdownQuickMenu();
|
||||
#endif
|
||||
});
|
||||
#if !defined(ALL_LANGS)
|
||||
choice->setTextHandler(
|
||||
[](uint8_t value) { return languagePacks[value]->name; });
|
||||
#else
|
||||
choice->setTextHandler(
|
||||
[](uint8_t value) {
|
||||
// TODO: language name should always be in the language of the name, not
|
||||
// the current UI language. Needs translation characters to be
|
||||
// always available for all language names in the base font.
|
||||
// temp solution - prepend language id to name.
|
||||
std::string s(languagePacks[value]->id);
|
||||
s += " - ";
|
||||
s += languagePacks[value]->name();
|
||||
return s;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
},
|
||||
{
|
||||
// Imperial units
|
||||
STR_UNITS_SYSTEM,
|
||||
STR_DEF(STR_UNITS_SYSTEM),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_VUNITSSYSTEM, 0, 1,
|
||||
GET_SET_DEFAULT(g_eeGeneral.imperial));
|
||||
@@ -835,7 +862,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// PPM units
|
||||
STR_UNITS_PPM,
|
||||
STR_DEF(STR_UNITS_PPM),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_PPMUNIT, PPM_PERCENT_PREC0, PPM_US,
|
||||
GET_SET_DEFAULT(g_eeGeneral.ppmunit));
|
||||
@@ -843,7 +870,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Switches delay
|
||||
STR_SWITCHES_DELAY,
|
||||
STR_DEF(STR_SWITCHES_DELAY),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto edit =
|
||||
new NumberEdit(parent, {x, y, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, 0}, 0, 100,
|
||||
@@ -855,7 +882,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// USB mode
|
||||
STR_USBMODE,
|
||||
STR_DEF(STR_USBMODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_USBMODES, USB_UNSELECTED_MODE, USB_MAX_MODE,
|
||||
GET_SET_DEFAULT(g_eeGeneral.USBMode));
|
||||
@@ -863,7 +890,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
{
|
||||
STR_ROTARY_ENC_MODE,
|
||||
STR_DEF(STR_ROTARY_ENC_MODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, 0, 0}, STR_ROTARY_ENC_OPT, ROTARY_ENCODER_MODE_NORMAL,
|
||||
ROTARY_ENCODER_MODE_INVERT_BOTH,
|
||||
@@ -873,7 +900,7 @@ static SetupLineDef setupLines[] = {
|
||||
#endif
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
{
|
||||
STR_HATSMODE,
|
||||
STR_DEF(STR_HATSMODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(parent, {x, y, RadioSetupPage::HATS_MODE_W, 0}, STR_HATSOPT, HATSMODE_TRIMS_ONLY,
|
||||
HATSMODE_SWITCHABLE, GET_SET_DEFAULT(g_eeGeneral.hatsMode));
|
||||
@@ -887,7 +914,7 @@ static SetupLineDef setupLines[] = {
|
||||
#endif
|
||||
{
|
||||
// RX channel order
|
||||
STR_DEF_CHAN_ORD,
|
||||
STR_DEF(STR_DEF_CHAN_ORD),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
uint8_t mains = adcGetMaxInputs(ADC_INPUT_MAIN);
|
||||
auto max_order = inputMappingGetMaxChannelOrder() - 1;
|
||||
@@ -905,7 +932,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
{
|
||||
// Stick mode
|
||||
STR_MODE,
|
||||
STR_DEF(STR_MODE),
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
auto choice = new Choice(parent, {x, y, 0, 0}, 0, 3, GET_DEFAULT(g_eeGeneral.stickMode),
|
||||
[=](uint8_t newValue) {
|
||||
@@ -940,19 +967,19 @@ void RadioSetupPage::build(Window* window)
|
||||
// Sub-pages
|
||||
w = new SetupButtonGroup(window, {0, y, LCD_W - padding * 2, 0}, nullptr, BTN_COLS, PAD_TINY, {
|
||||
#if defined(AUDIO)
|
||||
{STR_SOUND_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_SOUND_LABEL, soundPageSetupLines, DIM(soundPageSetupLines)); }},
|
||||
{STR_DEF(STR_SOUND_LABEL), []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_SOUND_LABEL, soundPageSetupLines, DIM(soundPageSetupLines)); }},
|
||||
#endif
|
||||
#if defined(VARIO)
|
||||
{STR_VARIO, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_VARIO, varioPageSetupLines, DIM(varioPageSetupLines)); }},
|
||||
{STR_DEF(STR_VARIO), []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_VARIO, varioPageSetupLines, DIM(varioPageSetupLines)); }},
|
||||
#endif
|
||||
#if defined(HAPTIC)
|
||||
{STR_HAPTIC_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_HAPTIC_LABEL, hapticPageSetupLines, DIM(hapticPageSetupLines)); }},
|
||||
{STR_DEF(STR_HAPTIC_LABEL), []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_HAPTIC_LABEL, hapticPageSetupLines, DIM(hapticPageSetupLines)); }},
|
||||
#endif
|
||||
{STR_ALARMS_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_ALARMS_LABEL, alarmsPageSetupLines, DIM(alarmsPageSetupLines)); }},
|
||||
{STR_BACKLIGHT_LABEL, []() { new BacklightPage(); }},
|
||||
{STR_GPS, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_GPS, gpsPageSetupLines, DIM(gpsPageSetupLines)); }},
|
||||
{STR_ENABLED_FEATURES, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
{STR_MAIN_MENU_MANAGE_MODELS, []() { new ManageModelsSetupPage(); }},
|
||||
{STR_DEF(STR_ALARMS_LABEL), []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_ALARMS_LABEL, alarmsPageSetupLines, DIM(alarmsPageSetupLines)); }},
|
||||
{STR_DEF(STR_BACKLIGHT_LABEL), []() { new BacklightPage(); }},
|
||||
{STR_DEF(STR_GPS), []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_GPS, gpsPageSetupLines, DIM(gpsPageSetupLines)); }},
|
||||
{STR_DEF(STR_ENABLED_FEATURES), []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
{STR_DEF(STR_MAIN_MENU_MANAGE_MODELS), []() { new ManageModelsSetupPage(); }},
|
||||
}, BTN_H);
|
||||
y += w->height() + padding;
|
||||
|
||||
|
||||
@@ -36,23 +36,23 @@
|
||||
#include "view_text.h"
|
||||
|
||||
PageDef modelMenuItems[] = {
|
||||
{ ICON_MODEL_SETUP, STR_QM_GEN_SETTINGS, STR_MAIN_MENU_SETTINGS, PAGE_CREATE, QuickMenu::MODEL_SETUP, [](PageDef& pageDef) { return new ModelSetupPage(pageDef); }},
|
||||
{ ICON_MODEL_SETUP, STR_DEF(STR_QM_GEN_SETTINGS), STR_DEF(STR_MAIN_MENU_SETTINGS), PAGE_CREATE, QuickMenu::MODEL_SETUP, [](PageDef& pageDef) { return new ModelSetupPage(pageDef); }},
|
||||
#if defined(FLIGHT_MODES)
|
||||
{ ICON_MODEL_FLIGHT_MODES, STR_QM_FLIGHT_MODES, STR_MENUFLIGHTMODES, PAGE_CREATE, QuickMenu::MODEL_FLIGHTMODES, [](PageDef& pageDef) { return new ModelFlightModesPage(pageDef); }, modelFMEnabled},
|
||||
{ ICON_MODEL_FLIGHT_MODES, STR_DEF(STR_QM_FLIGHT_MODES), STR_DEF(STR_MENUFLIGHTMODES), PAGE_CREATE, QuickMenu::MODEL_FLIGHTMODES, [](PageDef& pageDef) { return new ModelFlightModesPage(pageDef); }, modelFMEnabled},
|
||||
#endif
|
||||
{ ICON_MODEL_INPUTS, STR_QM_INPUTS, STR_MENUINPUTS, PAGE_CREATE, QuickMenu::MODEL_INPUTS, [](PageDef& pageDef) { return new ModelInputsPage(pageDef); }},
|
||||
{ ICON_MODEL_MIXER, STR_QM_MIXES, STR_MIXES, PAGE_CREATE, QuickMenu::MODEL_MIXES, [](PageDef& pageDef) { return new ModelMixesPage(pageDef); }},
|
||||
{ ICON_MODEL_OUTPUTS, STR_QM_OUTPUTS, STR_MENULIMITS, PAGE_CREATE, QuickMenu::MODEL_OUTPUTS, [](PageDef& pageDef) { return new ModelOutputsPage(pageDef); }},
|
||||
{ ICON_MODEL_CURVES, STR_QM_CURVES, STR_MENUCURVES, PAGE_CREATE, QuickMenu::MODEL_CURVES, [](PageDef& pageDef) { return new ModelCurvesPage(pageDef); }, modelCurvesEnabled},
|
||||
{ ICON_MODEL_INPUTS, STR_DEF(STR_QM_INPUTS), STR_DEF(STR_MENUINPUTS), PAGE_CREATE, QuickMenu::MODEL_INPUTS, [](PageDef& pageDef) { return new ModelInputsPage(pageDef); }},
|
||||
{ ICON_MODEL_MIXER, STR_DEF(STR_QM_MIXES), STR_DEF(STR_MIXES), PAGE_CREATE, QuickMenu::MODEL_MIXES, [](PageDef& pageDef) { return new ModelMixesPage(pageDef); }},
|
||||
{ ICON_MODEL_OUTPUTS, STR_DEF(STR_QM_OUTPUTS), STR_DEF(STR_MENULIMITS), PAGE_CREATE, QuickMenu::MODEL_OUTPUTS, [](PageDef& pageDef) { return new ModelOutputsPage(pageDef); }},
|
||||
{ ICON_MODEL_CURVES, STR_DEF(STR_QM_CURVES), STR_DEF(STR_MENUCURVES), PAGE_CREATE, QuickMenu::MODEL_CURVES, [](PageDef& pageDef) { return new ModelCurvesPage(pageDef); }, modelCurvesEnabled},
|
||||
#if defined(GVARS)
|
||||
{ ICON_MODEL_GVARS, STR_QM_GLOBAL_VARS, STR_MENU_GLOBAL_VARS, PAGE_CREATE, QuickMenu::MODEL_GVARS, [](PageDef& pageDef) { return new ModelGVarsPage(pageDef); }, modelGVEnabled},
|
||||
{ ICON_MODEL_GVARS, STR_DEF(STR_QM_GLOBAL_VARS), STR_DEF(STR_MENU_GLOBAL_VARS), PAGE_CREATE, QuickMenu::MODEL_GVARS, [](PageDef& pageDef) { return new ModelGVarsPage(pageDef); }, modelGVEnabled},
|
||||
#endif
|
||||
{ ICON_MODEL_LOGICAL_SWITCHES, STR_QM_LOGICAL_SW, STR_MENULOGICALSWITCHES, PAGE_CREATE, QuickMenu::MODEL_LS, [](PageDef& pageDef) { return new ModelLogicalSwitchesPage(pageDef); }, modelLSEnabled},
|
||||
{ ICON_MODEL_SPECIAL_FUNCTIONS, STR_QM_SPEC_FUNC, STR_MENUCUSTOMFUNC, PAGE_CREATE, QuickMenu::MODEL_SF, [](PageDef& pageDef) { return new SpecialFunctionsPage(pageDef); }, modelSFEnabled},
|
||||
{ ICON_MODEL_LOGICAL_SWITCHES, STR_DEF(STR_QM_LOGICAL_SW), STR_DEF(STR_MENULOGICALSWITCHES), PAGE_CREATE, QuickMenu::MODEL_LS, [](PageDef& pageDef) { return new ModelLogicalSwitchesPage(pageDef); }, modelLSEnabled},
|
||||
{ ICON_MODEL_SPECIAL_FUNCTIONS, STR_DEF(STR_QM_SPEC_FUNC), STR_DEF(STR_MENUCUSTOMFUNC), PAGE_CREATE, QuickMenu::MODEL_SF, [](PageDef& pageDef) { return new SpecialFunctionsPage(pageDef); }, modelSFEnabled},
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
{ ICON_MODEL_LUA_SCRIPTS, STR_QM_CUSTOM_LUA, STR_MENUCUSTOMSCRIPTS, PAGE_CREATE, QuickMenu::MODEL_SCRIPTS, [](PageDef& pageDef) { return new ModelMixerScriptsPage(pageDef); }, modelCustomScriptsEnabled},
|
||||
{ ICON_MODEL_LUA_SCRIPTS, STR_DEF(STR_QM_CUSTOM_LUA), STR_DEF(STR_MENUCUSTOMSCRIPTS), PAGE_CREATE, QuickMenu::MODEL_SCRIPTS, [](PageDef& pageDef) { return new ModelMixerScriptsPage(pageDef); }, modelCustomScriptsEnabled},
|
||||
#endif
|
||||
{ ICON_MODEL_TELEMETRY, STR_QM_TELEM, STR_MENUTELEMETRY, PAGE_CREATE, QuickMenu::MODEL_TELEMETRY, [](PageDef& pageDef) { return new ModelTelemetryPage(pageDef); }, modelTelemetryEnabled},
|
||||
{ ICON_MODEL_NOTES, STR_MAIN_MENU_MODEL_NOTES, STR_MAIN_MENU_MODEL_NOTES, PAGE_CREATE, QuickMenu::MODEL_NOTES, [](PageDef& pageDef) { return new ModelNotesPage(pageDef); }, modelHasNotes},
|
||||
{ ICON_MODEL_TELEMETRY, STR_DEF(STR_QM_TELEM), STR_DEF(STR_MENUTELEMETRY), PAGE_CREATE, QuickMenu::MODEL_TELEMETRY, [](PageDef& pageDef) { return new ModelTelemetryPage(pageDef); }, modelTelemetryEnabled},
|
||||
{ ICON_MODEL_NOTES, STR_DEF(STR_MAIN_MENU_MODEL_NOTES), STR_DEF(STR_MAIN_MENU_MODEL_NOTES), PAGE_CREATE, QuickMenu::MODEL_NOTES, [](PageDef& pageDef) { return new ModelNotesPage(pageDef); }, modelHasNotes},
|
||||
{ EDGETX_ICONS_COUNT }
|
||||
};
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#include "special_functions.h"
|
||||
|
||||
PageDef radioMenuItems[] = {
|
||||
{ ICON_RADIO_SETUP, STR_QM_GEN_SETTINGS, STR_MAIN_MENU_SETTINGS, PAGE_CREATE, QuickMenu::RADIO_SETUP, [](PageDef& pageDef) { return new RadioSetupPage(pageDef); }},
|
||||
{ ICON_RADIO_GLOBAL_FUNCTIONS, STR_QM_GLOB_FUNC, STR_MENUSPECIALFUNCS, PAGE_CREATE, QuickMenu::RADIO_GF, [](PageDef& pageDef) { return new GlobalFunctionsPage(pageDef); }, radioGFEnabled},
|
||||
{ ICON_RADIO_TRAINER, STR_QM_TRAINER, STR_MENUTRAINER, PAGE_CREATE, QuickMenu::RADIO_TRAINER, [](PageDef& pageDef) { return new RadioTrainerPage(pageDef); }, radioTrainerEnabled},
|
||||
{ ICON_RADIO_HARDWARE, STR_QM_HARDWARE, STR_HARDWARE, PAGE_CREATE, QuickMenu::RADIO_HARDWARE, [](PageDef& pageDef) { return new RadioHardwarePage(pageDef); }},
|
||||
{ ICON_RADIO_VERSION, STR_QM_ABOUT, STR_MAIN_MENU_ABOUT_EDGETX, PAGE_CREATE, QuickMenu::RADIO_VERSION, [](PageDef& pageDef) { return new RadioVersionPage(pageDef); }},
|
||||
{ ICON_RADIO_SETUP, STR_DEF(STR_QM_GEN_SETTINGS), STR_DEF(STR_MAIN_MENU_SETTINGS), PAGE_CREATE, QuickMenu::RADIO_SETUP, [](PageDef& pageDef) { return new RadioSetupPage(pageDef); }},
|
||||
{ ICON_RADIO_GLOBAL_FUNCTIONS, STR_DEF(STR_QM_GLOB_FUNC), STR_DEF(STR_MENUSPECIALFUNCS), PAGE_CREATE, QuickMenu::RADIO_GF, [](PageDef& pageDef) { return new GlobalFunctionsPage(pageDef); }, radioGFEnabled},
|
||||
{ ICON_RADIO_TRAINER, STR_DEF(STR_QM_TRAINER), STR_DEF(STR_MENUTRAINER), PAGE_CREATE, QuickMenu::RADIO_TRAINER, [](PageDef& pageDef) { return new RadioTrainerPage(pageDef); }, radioTrainerEnabled},
|
||||
{ ICON_RADIO_HARDWARE, STR_DEF(STR_QM_HARDWARE), STR_DEF(STR_HARDWARE), PAGE_CREATE, QuickMenu::RADIO_HARDWARE, [](PageDef& pageDef) { return new RadioHardwarePage(pageDef); }},
|
||||
{ ICON_RADIO_VERSION, STR_DEF(STR_QM_ABOUT), STR_DEF(STR_MAIN_MENU_ABOUT_EDGETX), PAGE_CREATE, QuickMenu::RADIO_VERSION, [](PageDef& pageDef) { return new RadioVersionPage(pageDef); }},
|
||||
{ EDGETX_ICONS_COUNT }
|
||||
};
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
#include "quick_menu.h"
|
||||
|
||||
PageDef screensMenuItems[] = {
|
||||
{ ICON_RADIO_EDIT_THEME, STR_QM_THEMES, STR_MAIN_MENU_THEMES, PAGE_CREATE, QuickMenu::UI_THEMES, [](PageDef& pageDef) { return new ThemeSetupPage(pageDef); }, radioThemesEnabled},
|
||||
{ ICON_THEME_SETUP, STR_QM_TOP_BAR, STR_USER_INTERFACE, PAGE_CREATE, QuickMenu::UI_SETUP, [](PageDef& pageDef) { return new ScreenUserInterfacePage(pageDef); }},
|
||||
{ ICON_THEME_VIEW1, STR_QM_SCREEN_1, STR_MAIN_VIEW_1, PAGE_CREATE, QuickMenu::UI_SCREEN1, [](PageDef& pageDef) { return new ScreenSetupPage(0, pageDef); }},
|
||||
{ ICON_THEME_VIEW2, STR_QM_SCREEN_2, STR_MAIN_VIEW_2, PAGE_CREATE, QuickMenu::UI_SCREEN2, [](PageDef& pageDef) { return new ScreenSetupPage(1, pageDef); }, []() { return customScreens[1] != nullptr; }},
|
||||
{ ICON_THEME_VIEW3, STR_QM_SCREEN_3, STR_MAIN_VIEW_3, PAGE_CREATE, QuickMenu::UI_SCREEN3, [](PageDef& pageDef) { return new ScreenSetupPage(2, pageDef); }, []() { return customScreens[2] != nullptr; }},
|
||||
{ ICON_THEME_VIEW4, STR_QM_SCREEN_4, STR_MAIN_VIEW_4, PAGE_CREATE, QuickMenu::UI_SCREEN4, [](PageDef& pageDef) { return new ScreenSetupPage(3, pageDef); }, []() { return customScreens[3] != nullptr; }},
|
||||
{ ICON_THEME_VIEW5, STR_QM_SCREEN_5, STR_MAIN_VIEW_5, PAGE_CREATE, QuickMenu::UI_SCREEN5, [](PageDef& pageDef) { return new ScreenSetupPage(4, pageDef); }, []() { return customScreens[4] != nullptr; }},
|
||||
{ ICON_THEME_VIEW6, STR_QM_SCREEN_6, STR_MAIN_VIEW_6, PAGE_CREATE, QuickMenu::UI_SCREEN6, [](PageDef& pageDef) { return new ScreenSetupPage(5, pageDef); }, []() { return customScreens[5] != nullptr; }},
|
||||
{ ICON_THEME_VIEW7, STR_QM_SCREEN_7, STR_MAIN_VIEW_7, PAGE_CREATE, QuickMenu::UI_SCREEN7, [](PageDef& pageDef) { return new ScreenSetupPage(6, pageDef); }, []() { return customScreens[6] != nullptr; }},
|
||||
{ ICON_THEME_VIEW8, STR_QM_SCREEN_8, STR_MAIN_VIEW_8, PAGE_CREATE, QuickMenu::UI_SCREEN8, [](PageDef& pageDef) { return new ScreenSetupPage(7, pageDef); }, []() { return customScreens[7] != nullptr; }},
|
||||
{ ICON_THEME_VIEW9, STR_QM_SCREEN_9, STR_MAIN_VIEW_9, PAGE_CREATE, QuickMenu::UI_SCREEN9, [](PageDef& pageDef) { return new ScreenSetupPage(8, pageDef); }, []() { return customScreens[8] != nullptr; }},
|
||||
{ ICON_THEME_VIEW10, STR_QM_SCREEN_10, STR_MAIN_VIEW_10, PAGE_CREATE, QuickMenu::UI_SCREEN10, [](PageDef& pageDef) { return new ScreenSetupPage(9, pageDef); }, []() { return customScreens[9] != nullptr; }},
|
||||
{ ICON_THEME_ADD_VIEW, STR_QM_ADD_SCREEN, nullptr, PAGE_ACTION, QuickMenu::UI_ADD_PG, nullptr, []() { return customScreens[9] == nullptr; },
|
||||
{ ICON_RADIO_EDIT_THEME, STR_DEF(STR_QM_THEMES), STR_DEF(STR_MAIN_MENU_THEMES), PAGE_CREATE, QuickMenu::UI_THEMES, [](PageDef& pageDef) { return new ThemeSetupPage(pageDef); }, radioThemesEnabled},
|
||||
{ ICON_THEME_SETUP, STR_DEF(STR_QM_TOP_BAR), STR_DEF(STR_USER_INTERFACE), PAGE_CREATE, QuickMenu::UI_SETUP, [](PageDef& pageDef) { return new ScreenUserInterfacePage(pageDef); }},
|
||||
{ ICON_THEME_VIEW1, STR_DEF(STR_QM_SCREEN_1), STR_DEF(STR_MAIN_VIEW_1), PAGE_CREATE, QuickMenu::UI_SCREEN1, [](PageDef& pageDef) { return new ScreenSetupPage(0, pageDef); }},
|
||||
{ ICON_THEME_VIEW2, STR_DEF(STR_QM_SCREEN_2), STR_DEF(STR_MAIN_VIEW_2), PAGE_CREATE, QuickMenu::UI_SCREEN2, [](PageDef& pageDef) { return new ScreenSetupPage(1, pageDef); }, []() { return customScreens[1] != nullptr; }},
|
||||
{ ICON_THEME_VIEW3, STR_DEF(STR_QM_SCREEN_3), STR_DEF(STR_MAIN_VIEW_3), PAGE_CREATE, QuickMenu::UI_SCREEN3, [](PageDef& pageDef) { return new ScreenSetupPage(2, pageDef); }, []() { return customScreens[2] != nullptr; }},
|
||||
{ ICON_THEME_VIEW4, STR_DEF(STR_QM_SCREEN_4), STR_DEF(STR_MAIN_VIEW_4), PAGE_CREATE, QuickMenu::UI_SCREEN4, [](PageDef& pageDef) { return new ScreenSetupPage(3, pageDef); }, []() { return customScreens[3] != nullptr; }},
|
||||
{ ICON_THEME_VIEW5, STR_DEF(STR_QM_SCREEN_5), STR_DEF(STR_MAIN_VIEW_5), PAGE_CREATE, QuickMenu::UI_SCREEN5, [](PageDef& pageDef) { return new ScreenSetupPage(4, pageDef); }, []() { return customScreens[4] != nullptr; }},
|
||||
{ ICON_THEME_VIEW6, STR_DEF(STR_QM_SCREEN_6), STR_DEF(STR_MAIN_VIEW_6), PAGE_CREATE, QuickMenu::UI_SCREEN6, [](PageDef& pageDef) { return new ScreenSetupPage(5, pageDef); }, []() { return customScreens[5] != nullptr; }},
|
||||
{ ICON_THEME_VIEW7, STR_DEF(STR_QM_SCREEN_7), STR_DEF(STR_MAIN_VIEW_7), PAGE_CREATE, QuickMenu::UI_SCREEN7, [](PageDef& pageDef) { return new ScreenSetupPage(6, pageDef); }, []() { return customScreens[6] != nullptr; }},
|
||||
{ ICON_THEME_VIEW8, STR_DEF(STR_QM_SCREEN_8), STR_DEF(STR_MAIN_VIEW_8), PAGE_CREATE, QuickMenu::UI_SCREEN8, [](PageDef& pageDef) { return new ScreenSetupPage(7, pageDef); }, []() { return customScreens[7] != nullptr; }},
|
||||
{ ICON_THEME_VIEW9, STR_DEF(STR_QM_SCREEN_9), STR_DEF(STR_MAIN_VIEW_9), PAGE_CREATE, QuickMenu::UI_SCREEN9, [](PageDef& pageDef) { return new ScreenSetupPage(8, pageDef); }, []() { return customScreens[8] != nullptr; }},
|
||||
{ ICON_THEME_VIEW10, STR_DEF(STR_QM_SCREEN_10), STR_DEF(STR_MAIN_VIEW_10), PAGE_CREATE, QuickMenu::UI_SCREEN10, [](PageDef& pageDef) { return new ScreenSetupPage(9, pageDef); }, []() { return customScreens[9] != nullptr; }},
|
||||
{ ICON_THEME_ADD_VIEW, STR_DEF(STR_QM_ADD_SCREEN), nullptr, PAGE_ACTION, QuickMenu::UI_ADD_PG, nullptr, []() { return customScreens[9] == nullptr; },
|
||||
[](QuickSubMenu* subMenu) {
|
||||
int newIdx = 1;
|
||||
for (; newIdx < MAX_CUSTOM_SCREENS; newIdx += 1)
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include "view_channels.h"
|
||||
|
||||
PageDef toolsMenuItems[] = {
|
||||
{ ICON_TOOLS_APPS, STR_QM_APPS, STR_MAIN_MENU_APPS, PAGE_CREATE, QuickMenu::TOOLS_APPS, [](PageDef& pageDef) { return new RadioToolsPage(pageDef); }},
|
||||
{ ICON_RADIO_SD_MANAGER, STR_QM_STORAGE, STR_SD_CARD, PAGE_CREATE, QuickMenu::TOOLS_STORAGE, [](PageDef& pageDef) { return new RadioSdManagerPage(pageDef); }},
|
||||
{ ICON_TOOLS_RESET, STR_QM_RESET, nullptr, PAGE_ACTION, QuickMenu::TOOLS_RESET, nullptr, nullptr,
|
||||
{ ICON_TOOLS_APPS, STR_DEF(STR_QM_APPS), STR_DEF(STR_MAIN_MENU_APPS), PAGE_CREATE, QuickMenu::TOOLS_APPS, [](PageDef& pageDef) { return new RadioToolsPage(pageDef); }},
|
||||
{ ICON_RADIO_SD_MANAGER, STR_DEF(STR_QM_STORAGE), STR_DEF(STR_SD_CARD), PAGE_CREATE, QuickMenu::TOOLS_STORAGE, [](PageDef& pageDef) { return new RadioSdManagerPage(pageDef); }},
|
||||
{ ICON_TOOLS_RESET, STR_DEF(STR_QM_RESET), nullptr, PAGE_ACTION, QuickMenu::TOOLS_RESET, nullptr, nullptr,
|
||||
[](QuickSubMenu* subMenu) {
|
||||
subMenu->onSelect(true);
|
||||
Menu* resetMenu = new Menu();
|
||||
@@ -40,14 +40,14 @@ PageDef toolsMenuItems[] = {
|
||||
resetMenu->addLine(STR_RESET_TELEMETRY, []() { telemetryReset(); });
|
||||
}
|
||||
},
|
||||
{ ICON_MONITOR, STR_QM_CHAN_MON, nullptr, PAGE_ACTION, QuickMenu::TOOLS_CHAN_MON, nullptr, nullptr,
|
||||
{ ICON_MONITOR, STR_DEF(STR_QM_CHAN_MON), nullptr, PAGE_ACTION, QuickMenu::TOOLS_CHAN_MON, nullptr, nullptr,
|
||||
[](QuickSubMenu* subMenu) {
|
||||
subMenu->onSelect(true);
|
||||
new ChannelsViewMenu();
|
||||
}
|
||||
},
|
||||
{ ICON_MONITOR_LOGICAL_SWITCHES, STR_QM_LS_MON, STR_MONITOR_SWITCHES, PAGE_CREATE, QuickMenu::TOOLS_LS_MON, [](PageDef& pageDef) { return new LogicalSwitchesViewPage(pageDef); }},
|
||||
{ ICON_STATS, STR_QM_STATS, STR_MAIN_MENU_STATISTICS, PAGE_CREATE, QuickMenu::TOOLS_STATS, [](PageDef& pageDef) { return new StatisticsViewPage(pageDef); }},
|
||||
{ ICON_STATS_DEBUG, STR_QM_DEBUG, STR_DEBUG, PAGE_CREATE, QuickMenu::TOOLS_DEBUG, [](PageDef& pageDef) { return new DebugViewPage(pageDef); }},
|
||||
{ ICON_MONITOR_LOGICAL_SWITCHES, STR_DEF(STR_QM_LS_MON), STR_DEF(STR_MONITOR_SWITCHES), PAGE_CREATE, QuickMenu::TOOLS_LS_MON, [](PageDef& pageDef) { return new LogicalSwitchesViewPage(pageDef); }},
|
||||
{ ICON_STATS, STR_DEF(STR_QM_STATS), STR_DEF(STR_MAIN_MENU_STATISTICS), PAGE_CREATE, QuickMenu::TOOLS_STATS, [](PageDef& pageDef) { return new StatisticsViewPage(pageDef); }},
|
||||
{ ICON_STATS_DEBUG, STR_DEF(STR_QM_DEBUG), STR_DEF(STR_DEBUG), PAGE_CREATE, QuickMenu::TOOLS_DEBUG, [](PageDef& pageDef) { return new DebugViewPage(pageDef); }},
|
||||
{ EDGETX_ICONS_COUNT }
|
||||
};
|
||||
|
||||
@@ -61,13 +61,13 @@ PageGroupHeaderBase::PageGroupHeaderBase(Window* parent, coord_t height, EdgeTxI
|
||||
|
||||
new HeaderBackIcon(this);
|
||||
|
||||
parentLabel = lv_label_create(lvobj);
|
||||
parentLabel = etx_label_create(lvobj);
|
||||
etx_txt_color(parentLabel, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_pos(parentLabel, PageGroup::PAGE_TOP_BAR_H + PAD_LARGE, PageHeader::PAGE_TITLE_TOP);
|
||||
lv_obj_set_size(parentLabel, LCD_W - PageGroup::PAGE_TOP_BAR_H * 4 - PAD_LARGE * 2, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
lv_label_set_text(parentLabel, parentTitle);
|
||||
|
||||
titleLabel = lv_label_create(lvobj);
|
||||
titleLabel = etx_label_create(lvobj);
|
||||
etx_txt_color(titleLabel, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_pos(titleLabel, PageGroup::PAGE_TOP_BAR_H + PAD_LARGE, PageHeader::PAGE_TITLE_TOP + EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
lv_obj_set_size(titleLabel, LCD_W - PageGroup::PAGE_TOP_BAR_H * 4 - PAD_LARGE * 2, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||
@@ -315,6 +315,16 @@ bool PageGroupBase::hasSubMenu(QuickMenu::SubMenu subMenu)
|
||||
return header->hasSubMenu(subMenu);
|
||||
}
|
||||
|
||||
coord_t PageGroupBase::getScrollY()
|
||||
{
|
||||
return lv_obj_get_scroll_y(body->getLvObj());
|
||||
}
|
||||
|
||||
void PageGroupBase::setScrollY(coord_t y)
|
||||
{
|
||||
lv_obj_scroll_to_y(body->getLvObj(), y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
PageGroup::PageGroup(EdgeTxIcon icon, const char* title, PageDef* pages) :
|
||||
@@ -355,6 +365,7 @@ void PageGroup::openMenu()
|
||||
}
|
||||
|
||||
PageGroup* PageGroup::ScreenMenu() { return new PageGroup(ICON_THEME, STR_MAIN_MENU_SCREEN_SETTINGS, screensMenuItems); }
|
||||
PageGroup* PageGroup::RadioMenu() { return new PageGroup(ICON_RADIO, STR_MAIN_MENU_RADIO_SETTINGS, radioMenuItems); }
|
||||
PageGroup* PageGroup::ToolsMenu() { return new PageGroup(ICON_RADIO_TOOLS, STR_QM_TOOLS, toolsMenuItems); }
|
||||
PageGroup* PageGroup::ModelMenu() { return new PageGroup(ICON_MODEL, STR_MAIN_MENU_MODEL_SETTINGS, modelMenuItems); }
|
||||
|
||||
@@ -431,15 +442,10 @@ TabsGroup::TabsGroup(EdgeTxIcon icon, const char* parentLabel) :
|
||||
|
||||
void TabsGroup::openMenu()
|
||||
{
|
||||
PageGroup* p = nullptr;
|
||||
PageGroup* p = (PageGroup*)Layer::getPageGroup();
|
||||
QuickMenu::SubMenu subMenu = QuickMenu::NONE;
|
||||
Window* w = Layer::walk([=](Window *w) mutable -> bool {
|
||||
return w->isPageGroup();
|
||||
});
|
||||
if (w) {
|
||||
p = (PageGroup*)w;
|
||||
if (p)
|
||||
subMenu = p->getCurrentTab()->subMenu();
|
||||
}
|
||||
quickMenu = QuickMenu::openQuickMenu([=]() { quickMenu = nullptr; },
|
||||
[=](bool close) {
|
||||
onCancel();
|
||||
|
||||
@@ -37,8 +37,8 @@ enum PageDefAction {
|
||||
|
||||
struct PageDef {
|
||||
EdgeTxIcon icon;
|
||||
const char* qmTitle;
|
||||
const char* title;
|
||||
STR_TYP qmTitle;
|
||||
STR_TYP title;
|
||||
PageDefAction pageAction;
|
||||
QuickMenu::SubMenu subMenu;
|
||||
std::function<PageGroupItem*(PageDef& pageDef)> create;
|
||||
@@ -61,7 +61,7 @@ class PageGroupItem
|
||||
{}
|
||||
|
||||
PageGroupItem(PageDef& pageDef, PaddingSize padding = PAD_SMALL) :
|
||||
title(std::move(pageDef.title)), icon(pageDef.icon), quickMenuId(pageDef.subMenu),
|
||||
title(STR_VAL(pageDef.title)), icon(pageDef.icon), quickMenuId(pageDef.subMenu),
|
||||
padding(padding)
|
||||
{}
|
||||
|
||||
@@ -151,6 +151,9 @@ class PageGroupBase : public NavWindow
|
||||
|
||||
bool hasSubMenu(QuickMenu::SubMenu n);
|
||||
|
||||
coord_t getScrollY();
|
||||
void setScrollY(coord_t y);
|
||||
|
||||
protected:
|
||||
PageGroupHeaderBase* header = nullptr;
|
||||
Window* body = nullptr;
|
||||
@@ -197,6 +200,7 @@ class PageGroup : public PageGroupBase
|
||||
bool isPageGroup() override { return true; }
|
||||
|
||||
static PageGroup* ScreenMenu();
|
||||
static PageGroup* RadioMenu();
|
||||
static PageGroup* ToolsMenu();
|
||||
static PageGroup* ModelMenu();
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ void QuickSubMenu::buildSubMenu()
|
||||
subMenu = new QuickMenuGroup(parent);
|
||||
|
||||
for (int i = 0; items[i].icon < EDGETX_ICONS_COUNT; i += 1) {
|
||||
subMenu->addButton(items[i].icon, items[i].qmTitle,
|
||||
subMenu->addButton(items[i].icon, STR_VAL(items[i].qmTitle),
|
||||
std::bind(&QuickSubMenu::onPress, this, i),
|
||||
[=]() { return items[i].enabled ? items[i].enabled() : true; },
|
||||
[=]() { QuickMenu::setCurrentPage(items[i].subMenu); });
|
||||
|
||||
@@ -137,12 +137,11 @@ StandaloneLuaWindow::StandaloneLuaWindow(bool useLvgl, int initFn, int runFn) :
|
||||
padAll(PAD_ZERO);
|
||||
etx_scrollbar(lvobj);
|
||||
|
||||
lv_obj_t* lbl = lv_label_create(lvobj);
|
||||
lv_obj_t* lbl = etx_label_create(lvobj, FONT_XL_INDEX);
|
||||
lv_obj_set_pos(lbl, 0, 0);
|
||||
lv_obj_set_size(lbl, LCD_W, LCD_H);
|
||||
etx_solid_bg(lbl, COLOR_THEME_PRIMARY1_INDEX);
|
||||
etx_txt_color(lbl, COLOR_THEME_PRIMARY2_INDEX);
|
||||
etx_font(lbl, FONT_XL_INDEX);
|
||||
lv_obj_set_style_text_align(lbl, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_top(lbl, (LCD_H - EdgeTxStyles::STD_FONT_HEIGHT) / 2, LV_PART_MAIN);
|
||||
lv_label_set_text(lbl, STR_LOADING);
|
||||
@@ -396,20 +395,18 @@ void StandaloneLuaWindow::showError(bool firstCall, const char* title, const cha
|
||||
lv_obj_set_size(errorModal, LCD_W, LCD_H);
|
||||
etx_bg_color(errorModal, COLOR_BLACK_INDEX);
|
||||
etx_obj_add_style(errorModal, styles->bg_opacity_75, LV_PART_MAIN);
|
||||
errorTitle = lv_label_create(errorModal);
|
||||
errorTitle = etx_label_create(errorModal, FONT_L_INDEX);
|
||||
lv_obj_set_pos(errorTitle, ERR_TTL_X, ERR_TTL_Y);
|
||||
lv_obj_set_size(errorTitle, LCD_W - ERR_TTL_X * 2, EdgeTxStyles::UI_ELEMENT_HEIGHT);
|
||||
etx_txt_color(errorTitle, COLOR_THEME_PRIMARY2_INDEX);
|
||||
etx_solid_bg(errorTitle, COLOR_THEME_SECONDARY1_INDEX);
|
||||
etx_font(errorTitle, FONT_L_INDEX);
|
||||
etx_obj_add_style(errorTitle, styles->text_align_center, LV_PART_MAIN);
|
||||
errorMsg = lv_label_create(errorModal);
|
||||
errorMsg = etx_label_create(errorModal);
|
||||
lv_obj_set_pos(errorMsg, ERR_TTL_X, ERR_MSG_Y);
|
||||
lv_obj_set_size(errorMsg, LCD_W - ERR_TTL_X * 2, LCD_H - ERR_MSG_HO);
|
||||
lv_obj_set_style_pad_all(errorMsg, PAD_SMALL, LV_PART_MAIN);
|
||||
etx_txt_color(errorMsg, COLOR_THEME_PRIMARY1_INDEX);
|
||||
etx_solid_bg(errorMsg, COLOR_THEME_SECONDARY3_INDEX);
|
||||
etx_font(errorMsg, FONT_STD_INDEX);
|
||||
etx_obj_add_style(errorMsg, styles->text_align_center, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
|
||||
@@ -491,19 +491,17 @@ void ThemePersistance::insertDefaultTheme()
|
||||
HeaderDateTime::HeaderDateTime(Window* parent, coord_t x, coord_t y) :
|
||||
Window(parent, {x, y, HDR_DATE_WIDTH, HDR_DATE_LINE2 + HDR_DATE_HEIGHT + 2})
|
||||
{
|
||||
date = lv_label_create(lvobj);
|
||||
date = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
lv_obj_set_pos(date, 0, 0);
|
||||
lv_obj_set_size(date, HDR_DATE_WIDTH, HDR_DATE_HEIGHT);
|
||||
lv_obj_set_style_text_align(date, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
|
||||
etx_txt_color(date, COLOR_THEME_PRIMARY2_INDEX);
|
||||
etx_font(date, FONT_XS_INDEX);
|
||||
|
||||
time = lv_label_create(lvobj);
|
||||
time = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
lv_obj_set_pos(time, 0, HDR_DATE_LINE2);
|
||||
lv_obj_set_size(time, HDR_DATE_WIDTH, HDR_DATE_HEIGHT);
|
||||
lv_obj_set_style_text_align(time, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
|
||||
etx_txt_color(time, COLOR_THEME_PRIMARY2_INDEX);
|
||||
etx_font(time, FONT_XS_INDEX);
|
||||
|
||||
lv_obj_add_flag(lvobj, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICKABLE);
|
||||
|
||||
@@ -60,15 +60,13 @@ class ChannelValue : public Window
|
||||
lv_obj_set_size(bar, 0, ROW_HEIGHT - 1);
|
||||
etx_bg_color_from_flags(bar, barColor);
|
||||
|
||||
valueLabel = lv_label_create(lvobj);
|
||||
etx_font(valueLabel, FONT_XS_INDEX);
|
||||
valueLabel = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
etx_obj_add_style(valueLabel, styles->text_align_right, LV_PART_MAIN);
|
||||
etx_txt_color_from_flags(valueLabel, txtColor);
|
||||
lv_obj_add_style(valueLabel, &style, LV_PART_MAIN);
|
||||
lv_label_set_text(valueLabel, "");
|
||||
|
||||
chanLabel = lv_label_create(lvobj);
|
||||
etx_font(chanLabel, FONT_XS_INDEX);
|
||||
chanLabel = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
etx_obj_add_style(chanLabel, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_txt_color_from_flags(chanLabel, txtColor);
|
||||
lv_label_set_text(chanLabel, "");
|
||||
|
||||
@@ -41,12 +41,12 @@ class TextWidget : public Widget
|
||||
lv_style_set_width(&style, lv_pct(100));
|
||||
lv_style_set_height(&style, lv_pct(100));
|
||||
|
||||
shadow = lv_label_create(lvobj);
|
||||
shadow = etx_label_create(lvobj);
|
||||
lv_obj_add_style(shadow, &style, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(shadow, lv_color_black(), LV_PART_MAIN);
|
||||
lv_obj_set_pos(shadow, 1, 1);
|
||||
|
||||
label = lv_label_create(lvobj);
|
||||
label = etx_label_create(lvobj);
|
||||
lv_obj_add_style(label, &style, LV_PART_MAIN);
|
||||
|
||||
update();
|
||||
|
||||
@@ -52,10 +52,9 @@ class TimerWidget : public Widget
|
||||
timerIcon = new StaticIcon(this, PAD_THREE, PAD_SMALL, ICON_TIMER, COLOR_THEME_SECONDARY1_INDEX);
|
||||
|
||||
// Timer name
|
||||
nameLabel = lv_label_create(lvobj);
|
||||
nameLabel = etx_label_create(lvobj, FONT_XS_INDEX);
|
||||
lv_label_set_text(nameLabel, "");
|
||||
lv_obj_add_style(nameLabel, &style, LV_PART_MAIN);
|
||||
etx_font(nameLabel, FONT_XS_INDEX);
|
||||
etx_obj_add_style(nameLabel, styles->text_align_left, LV_PART_MAIN);
|
||||
etx_obj_add_style(nameLabel, styles->text_align_right,
|
||||
LV_PART_MAIN | EXT_NAME_ALIGN_RIGHT);
|
||||
@@ -66,7 +65,7 @@ class TimerWidget : public Widget
|
||||
LV_PART_MAIN | ETX_NAME_COLOR_WHITE);
|
||||
|
||||
// Timer value - on small size widgets
|
||||
valLabel = lv_label_create(lvobj);
|
||||
valLabel = etx_label_create(lvobj);
|
||||
lv_label_set_text(valLabel, "");
|
||||
lv_obj_add_style(valLabel, &style, LV_PART_MAIN);
|
||||
etx_txt_color(valLabel, COLOR_THEME_PRIMARY2_INDEX);
|
||||
@@ -286,7 +285,7 @@ class TimerWidget : public Widget
|
||||
|
||||
lv_obj_t* createUnitLabel()
|
||||
{
|
||||
auto lbl = lv_label_create(lvobj);
|
||||
auto lbl = etx_label_create(lvobj);
|
||||
lv_label_set_text(lbl, "");
|
||||
lv_obj_add_style(lbl, &style, LV_PART_MAIN);
|
||||
etx_txt_color(lbl, COLOR_THEME_SECONDARY1_INDEX);
|
||||
|
||||
@@ -46,29 +46,27 @@ class ValueWidget : public Widget
|
||||
lv_style_set_width(&valueStyle, lv_pct(100));
|
||||
lv_style_set_height(&valueStyle, lv_pct(100));
|
||||
|
||||
labelShadow = lv_label_create(lvobj);
|
||||
labelShadow = etx_label_create(lvobj);
|
||||
lv_obj_add_style(labelShadow, &labelStyle, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(labelShadow, lv_color_black(), LV_PART_MAIN);
|
||||
lv_label_set_text(labelShadow, "");
|
||||
|
||||
label = lv_label_create(lvobj);
|
||||
label = etx_label_create(lvobj);
|
||||
lv_obj_add_style(label, &labelStyle, LV_PART_MAIN);
|
||||
etx_txt_color(label, COLOR_THEME_WARNING_INDEX, ETX_STATE_TIMER_ELAPSED);
|
||||
etx_txt_color(label, COLOR_THEME_DISABLED_INDEX, ETX_STATE_TELEM_STALE);
|
||||
lv_label_set_text(label, "");
|
||||
|
||||
valueShadow = lv_label_create(lvobj);
|
||||
valueShadow = etx_label_create(lvobj, FONT_L_INDEX);
|
||||
lv_obj_add_style(valueShadow, &valueStyle, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_color(valueShadow, lv_color_black(), LV_PART_MAIN);
|
||||
etx_font(valueShadow, FONT_L_INDEX);
|
||||
etx_font(valueShadow, FONT_XL_INDEX, ETX_STATE_LARGE_FONT);
|
||||
lv_label_set_text(valueShadow, "");
|
||||
|
||||
value = lv_label_create(lvobj);
|
||||
value = etx_label_create(lvobj, FONT_L_INDEX);
|
||||
lv_obj_add_style(value, &valueStyle, LV_PART_MAIN);
|
||||
etx_txt_color(value, COLOR_THEME_WARNING_INDEX, ETX_STATE_TIMER_ELAPSED);
|
||||
etx_txt_color(value, COLOR_THEME_DISABLED_INDEX, ETX_STATE_TELEM_STALE);
|
||||
etx_font(value, FONT_L_INDEX);
|
||||
etx_font(value, FONT_XL_INDEX, ETX_STATE_LARGE_FONT);
|
||||
lv_label_set_text(value, "");
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void menuCommonCalibOptions(event_t event)
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
LcdFlags attr = (sub == k) ? INVERS : 0;
|
||||
|
||||
lcdDrawTextIndented(y, STR_CHAR_STICK);
|
||||
lcdDrawTextIndented(y, CHAR_STICK);
|
||||
lcdDrawText(lcdNextPos, y, analogGetCanonicalName(ADC_INPUT_MAIN, i), 0);
|
||||
bool stickInversion = getStickInversion(i);
|
||||
lcdDrawChar(LCD_W / 3 * 2, y, stickInversion ? 127 : 126, attr);
|
||||
|
||||
@@ -287,7 +287,7 @@ void drawGVarName(coord_t x, coord_t y, int8_t idx, LcdFlags flags)
|
||||
void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event,
|
||||
LcdFlags flags, uint8_t old_editMode)
|
||||
{
|
||||
lcdDrawTextIndented(y, STR_CHAR_STICK);
|
||||
lcdDrawTextIndented(y, CHAR_STICK);
|
||||
lcdDrawText(lcdNextPos, y, analogGetCanonicalName(ADC_INPUT_MAIN, idx), 0);
|
||||
|
||||
if (analogHasCustomLabel(ADC_INPUT_MAIN, idx) || (flags && s_editMode > 0))
|
||||
@@ -600,7 +600,7 @@ void drawSource(coord_t x, coord_t y, mixsrc_t idx, LcdFlags att)
|
||||
const char* s = getSourceString(idx);
|
||||
#if LCD_W < 212
|
||||
if (idx >= MIXSRC_FIRST_TELEM && idx <= MIXSRC_LAST_TELEM)
|
||||
s += strlen(STR_CHAR_TELEMETRY);
|
||||
s += strlen(CHAR_TELEMETRY);
|
||||
#endif
|
||||
lcdDrawText(x, y, s, att);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "fonts.h"
|
||||
#include "debug.h"
|
||||
|
||||
/*
|
||||
Strings in EdgeTX are encoded using UTF8. Latin characters are single byte in the range 32 - 127.
|
||||
@@ -47,7 +48,25 @@
|
||||
(7) - uses the 5x7 Language font characters (not bold)
|
||||
*/
|
||||
|
||||
const unsigned char font_5x7[] = {
|
||||
#if !defined(BOOT)
|
||||
|
||||
const uint8_t font_3x5[] = {
|
||||
#include "font_03x05.lbm"
|
||||
};
|
||||
|
||||
const uint8_t font_5x7_B[] = {
|
||||
#include "font_05x07_B_compressed.lbm"
|
||||
};
|
||||
|
||||
const uint8_t font_22x38_num[] = {
|
||||
#include "font_22x38_num.lbm"
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(ALL_LANGS) || defined(BOOT)
|
||||
|
||||
const uint8_t font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
@@ -78,11 +97,8 @@ const unsigned char font_5x7[] = {
|
||||
};
|
||||
|
||||
#if !defined(BOOT)
|
||||
const unsigned char font_5x7_B[] = {
|
||||
#include "font_05x07_B_compressed.lbm"
|
||||
};
|
||||
|
||||
const unsigned char font_10x14[] = {
|
||||
const uint8_t font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
@@ -112,11 +128,7 @@ const unsigned char font_10x14[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const unsigned char font_3x5[] = {
|
||||
#include "font_03x05.lbm"
|
||||
};
|
||||
|
||||
const unsigned char font_4x6[] = {
|
||||
const uint8_t font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
@@ -146,7 +158,7 @@ const unsigned char font_4x6[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const unsigned char font_8x10[] = {
|
||||
const uint8_t font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_08x10.lbm"
|
||||
@@ -175,8 +187,375 @@ const unsigned char font_8x10[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const unsigned char font_22x38_num[] = {
|
||||
#include "font_22x38_num.lbm"
|
||||
#endif // !defined(BOOT)
|
||||
|
||||
#else
|
||||
|
||||
const uint8_t en_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
};
|
||||
const uint8_t en_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
};
|
||||
const uint8_t en_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
};
|
||||
const uint8_t en_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
};
|
||||
|
||||
#endif // !defined(BOOT)
|
||||
const uint8_t cz_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_cz_04x06.lbm"
|
||||
};
|
||||
const uint8_t cz_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_cz_05x07.lbm"
|
||||
};
|
||||
const uint8_t cz_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_cz_08x10.lbm"
|
||||
};
|
||||
const uint8_t cz_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_cz_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t da_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_da_04x06.lbm"
|
||||
};
|
||||
const uint8_t da_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_da_05x07.lbm"
|
||||
};
|
||||
const uint8_t da_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_da_08x10.lbm"
|
||||
};
|
||||
const uint8_t da_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_da_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t de_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_de_04x06.lbm"
|
||||
};
|
||||
const uint8_t de_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_de_05x07.lbm"
|
||||
};
|
||||
const uint8_t de_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_de_08x10.lbm"
|
||||
};
|
||||
const uint8_t de_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_de_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t es_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_es_04x06.lbm"
|
||||
};
|
||||
const uint8_t es_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_es_05x07.lbm"
|
||||
};
|
||||
const uint8_t es_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_es_08x10.lbm"
|
||||
};
|
||||
const uint8_t es_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_es_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t fi_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_fi_04x06.lbm"
|
||||
};
|
||||
const uint8_t fi_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_fi_05x07.lbm"
|
||||
};
|
||||
const uint8_t fi_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_fi_08x10.lbm"
|
||||
};
|
||||
const uint8_t fi_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_fi_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t fr_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_fr_04x06.lbm"
|
||||
};
|
||||
const uint8_t fr_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_fr_05x07.lbm"
|
||||
};
|
||||
const uint8_t fr_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_fr_08x10.lbm"
|
||||
};
|
||||
const uint8_t fr_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_fr_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t it_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_it_04x06.lbm"
|
||||
};
|
||||
const uint8_t it_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_it_05x07.lbm"
|
||||
};
|
||||
const uint8_t it_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_it_08x10.lbm"
|
||||
};
|
||||
const uint8_t it_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_it_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t pl_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_pl_04x06.lbm"
|
||||
};
|
||||
const uint8_t pl_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_pl_05x07.lbm"
|
||||
};
|
||||
const uint8_t pl_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_pl_08x10.lbm"
|
||||
};
|
||||
const uint8_t pl_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_pl_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t pt_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_pt_04x06.lbm"
|
||||
};
|
||||
const uint8_t pt_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_pt_05x07.lbm"
|
||||
};
|
||||
const uint8_t pt_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_pt_08x10.lbm"
|
||||
};
|
||||
const uint8_t pt_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_pt_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t ru_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_ru_04x06.lbm"
|
||||
};
|
||||
const uint8_t ru_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_ru_05x07.lbm"
|
||||
};
|
||||
const uint8_t ru_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_ru_08x10.lbm"
|
||||
};
|
||||
const uint8_t ru_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_ru_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t se_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_se_04x06.lbm"
|
||||
};
|
||||
const uint8_t se_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_se_05x07.lbm"
|
||||
};
|
||||
const uint8_t se_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_se_08x10.lbm"
|
||||
};
|
||||
const uint8_t se_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_se_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t ua_font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#include "font_04x06_extra.lbm"
|
||||
#include "font_ua_04x06.lbm"
|
||||
};
|
||||
const uint8_t ua_font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#include "font_05x07_extra.lbm"
|
||||
#include "font_ua_05x07.lbm"
|
||||
};
|
||||
const uint8_t ua_font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#include "font_ua_08x10.lbm"
|
||||
};
|
||||
const uint8_t ua_font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#include "font_10x14_extra.lbm"
|
||||
#include "font_ua_10x14.lbm"
|
||||
};
|
||||
|
||||
const uint8_t* const font4x6table[] = {
|
||||
en_font_4x6,
|
||||
cz_font_4x6,
|
||||
da_font_4x6,
|
||||
de_font_4x6,
|
||||
en_font_4x6,
|
||||
es_font_4x6,
|
||||
fi_font_4x6,
|
||||
fr_font_4x6,
|
||||
en_font_4x6,
|
||||
en_font_4x6,
|
||||
it_font_4x6,
|
||||
en_font_4x6,
|
||||
en_font_4x6,
|
||||
en_font_4x6,
|
||||
pl_font_4x6,
|
||||
pt_font_4x6,
|
||||
ru_font_4x6,
|
||||
se_font_4x6,
|
||||
en_font_4x6,
|
||||
en_font_4x6,
|
||||
ua_font_4x6,
|
||||
};
|
||||
|
||||
const uint8_t* const font5x7table[] = {
|
||||
en_font_5x7,
|
||||
cz_font_5x7,
|
||||
da_font_5x7,
|
||||
de_font_5x7,
|
||||
en_font_5x7,
|
||||
es_font_5x7,
|
||||
fi_font_5x7,
|
||||
fr_font_5x7,
|
||||
en_font_5x7,
|
||||
en_font_5x7,
|
||||
it_font_5x7,
|
||||
en_font_5x7,
|
||||
en_font_5x7,
|
||||
en_font_5x7,
|
||||
pl_font_5x7,
|
||||
pt_font_5x7,
|
||||
ru_font_5x7,
|
||||
se_font_5x7,
|
||||
en_font_5x7,
|
||||
en_font_5x7,
|
||||
ua_font_5x7,
|
||||
};
|
||||
|
||||
const uint8_t* const font8x10table[] = {
|
||||
en_font_8x10,
|
||||
cz_font_8x10,
|
||||
da_font_8x10,
|
||||
de_font_8x10,
|
||||
en_font_8x10,
|
||||
es_font_8x10,
|
||||
fi_font_8x10,
|
||||
fr_font_8x10,
|
||||
en_font_8x10,
|
||||
en_font_8x10,
|
||||
it_font_8x10,
|
||||
en_font_8x10,
|
||||
en_font_8x10,
|
||||
en_font_8x10,
|
||||
pl_font_8x10,
|
||||
pt_font_8x10,
|
||||
ru_font_8x10,
|
||||
se_font_8x10,
|
||||
en_font_8x10,
|
||||
en_font_8x10,
|
||||
ua_font_8x10,
|
||||
};
|
||||
|
||||
const uint8_t* const font10x14table[] = {
|
||||
en_font_10x14,
|
||||
cz_font_10x14,
|
||||
da_font_10x14,
|
||||
de_font_10x14,
|
||||
en_font_10x14,
|
||||
es_font_10x14,
|
||||
fi_font_10x14,
|
||||
fr_font_10x14,
|
||||
en_font_10x14,
|
||||
en_font_10x14,
|
||||
it_font_10x14,
|
||||
en_font_10x14,
|
||||
en_font_10x14,
|
||||
en_font_10x14,
|
||||
pl_font_10x14,
|
||||
pt_font_10x14,
|
||||
ru_font_10x14,
|
||||
se_font_10x14,
|
||||
en_font_10x14,
|
||||
en_font_10x14,
|
||||
ua_font_10x14,
|
||||
};
|
||||
|
||||
const uint8_t* font_4x6 = en_font_4x6;
|
||||
const uint8_t* font_5x7 = en_font_5x7;
|
||||
const uint8_t* font_8x10 = en_font_8x10;
|
||||
const uint8_t* font_10x14 = en_font_10x14;
|
||||
|
||||
void setLanguageFont(int n)
|
||||
{
|
||||
font_4x6 = font4x6table[n];
|
||||
font_5x7 = font5x7table[n];
|
||||
font_8x10 = font8x10table[n];
|
||||
font_10x14 = font10x14table[n];
|
||||
extern void setLanguageUTF(int n);
|
||||
setLanguageUTF(n);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
constexpr int FONT_BASE_START = 0x20;
|
||||
constexpr int FONT_SYMS_START = 0x80;
|
||||
constexpr int FONT_LANG_START = 0x95;
|
||||
@@ -32,10 +34,22 @@ constexpr int FONT_SYMS_CNT = 21; // Max # of extra symbols (based on 5x7
|
||||
constexpr int FONT_SYMS_CNT_4x6 = 4; // # of extra symbols in 4x6 font (adjust if font is changed)
|
||||
constexpr int FONT_SYMS_CNT_10x14 = 4; // # of extra symbols in 10x14 font (adjust if font is changed)
|
||||
|
||||
extern const unsigned char font_5x7[];
|
||||
extern const unsigned char font_5x7_B[];
|
||||
extern const unsigned char font_3x5[];
|
||||
extern const unsigned char font_4x6[];
|
||||
extern const unsigned char font_8x10[];
|
||||
extern const unsigned char font_10x14[];
|
||||
extern const unsigned char font_22x38_num[];
|
||||
extern const uint8_t font_3x5[];
|
||||
extern const uint8_t font_5x7_B[];
|
||||
extern const uint8_t font_22x38_num[];
|
||||
|
||||
#if !defined(ALL_LANGS) || defined(BOOT)
|
||||
|
||||
extern const uint8_t font_4x6[];
|
||||
extern const uint8_t font_5x7[];
|
||||
extern const uint8_t font_8x10[];
|
||||
extern const uint8_t font_10x14[];
|
||||
|
||||
#else
|
||||
|
||||
extern const uint8_t* font_4x6;
|
||||
extern const uint8_t* font_5x7;
|
||||
extern const uint8_t* font_8x10;
|
||||
extern const uint8_t* font_10x14;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "hal/adc_driver.h"
|
||||
#include "input_mapping.h"
|
||||
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
#define _STRING_MAX(x) "/" #x
|
||||
#define STRING_MAX(x) _STRING_MAX(x)
|
||||
|
||||
uint8_t getExposCount()
|
||||
{
|
||||
@@ -365,7 +365,7 @@ void menuModelExposAll(event_t event)
|
||||
}
|
||||
|
||||
lcdDrawNumber(FW*strlen(STR_MENUINPUTS)+FW+FW/2, 0, getExposCount(), RIGHT);
|
||||
lcdDrawText(FW*strlen(STR_MENUINPUTS)+FW+FW/2, 0, STR_MAX(MAX_EXPOS));
|
||||
lcdDrawText(FW*strlen(STR_MENUINPUTS)+FW+FW/2, 0, STRING_MAX(MAX_EXPOS));
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
// Value
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "input_mapping.h"
|
||||
#include "mixes.h"
|
||||
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
#define _STRING_MAX(x) "/" #x
|
||||
#define STRING_MAX(x) _STRING_MAX(x)
|
||||
|
||||
bool reachMixesLimit()
|
||||
{
|
||||
@@ -280,7 +280,7 @@ void menuModelMixAll(event_t event)
|
||||
}
|
||||
|
||||
lcdDrawNumber(FW*strlen(STR_MIXES)+FW/2, 0, getMixCount(), 0);
|
||||
lcdDrawText(lcdNextPos, 0, STR_MAX(MAX_MIXERS));
|
||||
lcdDrawText(lcdNextPos, 0, STRING_MAX(MAX_MIXERS));
|
||||
|
||||
// Value
|
||||
uint8_t index = mixAddress(s_currIdx)->destCh;
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include "edgetx.h"
|
||||
#include "usb_joystick.h"
|
||||
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
#if LCD_W >= 212
|
||||
#define MODE_POS 5*FW
|
||||
#define SUBMODE_POS MODE_POS+2*FW
|
||||
|
||||
@@ -148,7 +148,7 @@ extern void menuCFSColor(coord_t y, RGBLedColor& color, const char* title, LcdFl
|
||||
|
||||
static void menuRadioCFSOne(event_t event)
|
||||
{
|
||||
std::string s(STR_CHAR_SWITCH);
|
||||
std::string s(CHAR_SWITCH);
|
||||
s += switchGetDefaultName(swIndex);
|
||||
|
||||
int config = g_eeGeneral.switchType(swIndex);
|
||||
@@ -662,7 +662,7 @@ void menuRadioHardware(event_t event)
|
||||
|
||||
// draw hw name
|
||||
LcdFlags flags = menuHorizontalPosition < 0 ? attr : 0;
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_POT, flags);
|
||||
lcdDrawText(INDENT_WIDTH, y, CHAR_POT, flags);
|
||||
lcdDrawText(lcdNextPos, y, adcGetInputLabel(ADC_INPUT_FLEX, idx), flags);
|
||||
|
||||
// draw custom name
|
||||
@@ -696,7 +696,7 @@ void menuRadioHardware(event_t event)
|
||||
int config = g_eeGeneral.switchType(index);
|
||||
|
||||
LcdFlags flags = menuHorizontalPosition < 0 ? attr : 0;
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_SWITCH, flags);
|
||||
lcdDrawText(INDENT_WIDTH, y, CHAR_SWITCH, flags);
|
||||
lcdDrawText(lcdNextPos, y, switchGetDefaultName(index), flags);
|
||||
|
||||
if (switchIsFlex(index)) {
|
||||
@@ -752,7 +752,7 @@ void menuRadioHardware(event_t event)
|
||||
int index = k - ITEM_RADIO_HARDWARE_CFS;
|
||||
int config = g_eeGeneral.switchType(index);
|
||||
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_SWITCH, attr);
|
||||
lcdDrawText(INDENT_WIDTH, y, CHAR_SWITCH, attr);
|
||||
lcdDrawText(lcdNextPos, y, switchGetDefaultName(index), attr);
|
||||
|
||||
lcdDrawText(HW_SETTINGS_COLUMN2, y, STR_SWTYPES[config]);
|
||||
|
||||
@@ -25,148 +25,146 @@
|
||||
#include "definitions.h"
|
||||
#include "translations/translations.h"
|
||||
|
||||
#define FR_LUT L'é', L'è', L'à', L'î', L'ç'
|
||||
#define FR_SUB_LUT L'Â', L'A', L'À', L'A', L'Ê', L'E', L'É', L'E', L'È', L'E'
|
||||
#define DA_LUT L'å', L'æ', L'ø', L'Å', L'Æ', L'Ø'
|
||||
#define DE_LUT L'Ä', L'ä', L'Ö', L'ö', L'Ü', L'ü', L'ß'
|
||||
#define CZ_LUT L'á', L'č', L'é', L'ě', L'í', L'ó', L'ř', L'š', L'ú', L'ů', L'ý', L'Á', L'Í', L'Ř', L'Ý', L'ž', L'É', L'ň'
|
||||
#define CZ_SUB_LUT L'Ě', L'ě', L'Š', L'š', L'Č', L'č', L'Ž', L'ž', L'Ú', L'ú', L'Ů', L'ů', L'Ó', L'ó', L'Ň', L'ň'
|
||||
#define ES_LUT L'Ñ', L'ñ', L'Á', L'á', L'É', L'é', L'Í', L'í', L'Ó', L'ó', L'ú'
|
||||
#define PT_LUT L'Á', L'á', L'Â', L'â', L'Ã', L'ã', L'À', L'à', L'Ç', L'ç', L'É', L'é', L'Ê', L'ê', L'Í', L'í', L'Ó', L'ó', L'Ô', L'ô', L'Õ', L'õ', L'Ú', L'ú'
|
||||
#define FI_LUT L'å', L'ä', L'ö', L'Å', L'Ä', L'Ö'
|
||||
#define IT_LUT L'à', L'ù'
|
||||
#define PL_LUT L'ą', L'ć', L'ę', L'ł', L'ń', L'ó', L'ś', L'ż', L'ź', L'Ą', L'Ć', L'Ę', L'Ł', L'Ń', L'Ó', L'Ś', L'Ż', L'Ź'
|
||||
#define RU_LUT L'А', L'Б', L'В', L'Г', L'Д', L'Е', L'Ж', L'З', L'И', L'Й', L'К', L'Л', L'М', L'Н', \
|
||||
L'О', L'П', L'Р', L'С', L'Т', L'У', L'Ф', L'Х', L'Ц', L'Ч', L'Ш', L'Щ', L'Ъ', L'Ы', \
|
||||
L'Ь', L'Э', L'Ю', L'Я', L'а', L'б', L'в', L'г', L'д', L'е', L'ж', L'з', L'и', L'й', \
|
||||
L'к', L'л', L'м', L'н', L'о', L'п', L'р', L'с', L'т', L'у', L'ф', L'х', L'ц', L'ч', \
|
||||
L'ш', L'щ', L'ъ', L'ы', L'ь', L'э', L'ю', L'я'
|
||||
#define UA_LUT L'Б', L'Г', L'Ґ', L'Д', L'Є', L'Ж', L'З', L'И', L'Ї', L'Й', L'Л', L'П', L'У', L'Ф', \
|
||||
L'Ц', L'Ч', L'Ш', L'Щ', L'Ь', L'Ю', L'Я', L'б', L'в', L'г', L'ґ', L'д', L'є', L'ж', \
|
||||
L'з', L'и', L'ї', L'й', L'к', L'л', L'м', L'н', L'п', L'т', L'ф', L'ц', L'ч', L'ш', \
|
||||
L'щ', L'ь', L'ю', L'я'
|
||||
#define UA_SUB_LUT L'А', L'A', L'а', L'a', L'В', L'B', L'С', L'C', L'с', L'c', L'Е', L'E', L'е', L'e', L'Н', L'H', \
|
||||
L'К', L'K', L'М', L'M', L'І', L'I', L'і', L'i', L'О', L'O', L'о', L'o', L'о', L'o', L'Р', L'P', \
|
||||
L'р', L'p', L'Т', L'T', L'Х', L'X', L'х', L'x', L'у', L'y'
|
||||
#define SE_LUT L'å', L'ä', L'ö', L'Å', L'Ä', L'Ö'
|
||||
|
||||
#if !defined(ALL_LANGS) || defined(BOOT)
|
||||
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'é', L'è', L'à', L'î', L'ç',
|
||||
};
|
||||
|
||||
static const uint16_t _utf8_lut[] = { FR_LUT };
|
||||
#define UTF8_SUBS_LUT
|
||||
static uint16_t _utf8_substitution_lut[] = {
|
||||
L'Â', L'A',
|
||||
L'À', L'A',
|
||||
L'Ê', L'E',
|
||||
L'É', L'E',
|
||||
L'È', L'E',
|
||||
/* Existing but virtually unsused
|
||||
L'Ä', L'A',
|
||||
L'Ë', L'E',
|
||||
L'Ï', L'I',
|
||||
L'Ö', L'O',
|
||||
L'Ü', L'U',
|
||||
L'Û', L'U',
|
||||
L'Ù', L'U',
|
||||
*/
|
||||
};
|
||||
static const uint16_t _utf8_substitution_lut[] = { FR_SUB_LUT };
|
||||
#elif defined(TRANSLATIONS_DA)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'å', L'æ', L'ø', L'Å', L'Æ', L'Ø',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { DA_LUT };
|
||||
#elif defined(TRANSLATIONS_DE)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'Ä', L'ä', L'Ö', L'ö', L'Ü', L'ü', L'ß',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { DE_LUT };
|
||||
#elif defined(TRANSLATIONS_CZ)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'á', L'č', L'é', L'ě', L'í', L'ó', L'ř',
|
||||
L'š', L'ú', L'ů', L'ý', L'Á', L'Í', L'Ř',
|
||||
L'Ý', L'ž', L'É', L'ň',
|
||||
};
|
||||
|
||||
static const uint16_t _utf8_lut[] = { CZ_LUT };
|
||||
#define UTF8_SUBS_LUT
|
||||
static uint16_t _utf8_substitution_lut[] = {
|
||||
L'Ě', L'ě',
|
||||
L'Š', L'š',
|
||||
L'Č', L'č',
|
||||
L'Ž', L'ž',
|
||||
L'Ú', L'ú',
|
||||
L'Ů', L'ů',
|
||||
L'Ó', L'ó',
|
||||
L'Ň', L'ň',
|
||||
};
|
||||
static const uint16_t _utf8_substitution_lut[] = { CZ_SUB_LUT };
|
||||
#elif defined(TRANSLATIONS_ES) && !defined(BOOT)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'Ñ', L'ñ', L'Á', L'á', L'É', L'é', L'Í',
|
||||
L'í', L'Ó', L'ó', L'ú',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { ES_LUT };
|
||||
#elif defined(TRANSLATIONS_PT)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'Á', L'á', L'Â', L'â', L'Ã', L'ã', L'À',
|
||||
L'à', L'Ç', L'ç', L'É', L'é', L'Ê', L'ê',
|
||||
L'Í', L'í', L'Ó', L'ó', L'Ô', L'ô', L'Õ',
|
||||
L'õ', L'Ú', L'ú',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { PT_LUT };
|
||||
#elif defined(TRANSLATIONS_FI) && !defined(BOOT)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'å', L'ä', L'ö', L'Å', L'Ä', L'Ö',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { FI_LUT };
|
||||
#elif defined(TRANSLATIONS_IT)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'à', L'ù',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { IT_LUT };
|
||||
#elif defined(TRANSLATIONS_PL)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'ą', L'ć', L'ę', L'ł', L'ń', L'ó', L'ś',
|
||||
L'ż', L'ź', L'Ą', L'Ć', L'Ę', L'Ł', L'Ń',
|
||||
L'Ó', L'Ś', L'Ż', L'Ź',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { PL_LUT };
|
||||
#elif defined(TRANSLATIONS_RU) && !defined(BOOT)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'А', L'Б', L'В', L'Г', L'Д', L'Е', L'Ж',
|
||||
L'З', L'И', L'Й', L'К', L'Л', L'М', L'Н',
|
||||
L'О', L'П', L'Р', L'С', L'Т', L'У', L'Ф',
|
||||
L'Х', L'Ц', L'Ч', L'Ш', L'Щ', L'Ъ', L'Ы',
|
||||
L'Ь', L'Э', L'Ю', L'Я', L'а', L'б', L'в',
|
||||
L'г', L'д', L'е', L'ж', L'з', L'и', L'й',
|
||||
L'к', L'л', L'м', L'н', L'о', L'п', L'р',
|
||||
L'с', L'т', L'у', L'ф', L'х', L'ц', L'ч',
|
||||
L'ш', L'щ', L'ъ', L'ы', L'ь', L'э', L'ю',
|
||||
L'я',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { RU_LUT };
|
||||
#elif defined(TRANSLATIONS_UA) && !defined(BOOT)
|
||||
static const uint16_t _utf8_lut[] = { UA_LUT };
|
||||
#define UTF8_SUBS_LUT
|
||||
// Warning, albeit the following table looks useless
|
||||
// It does translate Cyrillic to Latin
|
||||
static uint16_t _utf8_substitution_lut[] = {
|
||||
L'А', L'A',
|
||||
L'а', L'a',
|
||||
L'В', L'B',
|
||||
L'С', L'C',
|
||||
L'с', L'c',
|
||||
L'Е', L'E',
|
||||
L'е', L'e',
|
||||
L'Н', L'H',
|
||||
L'К', L'K',
|
||||
L'М', L'M',
|
||||
L'І', L'I',
|
||||
L'і', L'i',
|
||||
L'О', L'O',
|
||||
L'о', L'o',
|
||||
L'о', L'o',
|
||||
L'Р', L'P',
|
||||
L'р', L'p',
|
||||
L'Т', L'T',
|
||||
L'Х', L'X',
|
||||
L'х', L'x',
|
||||
L'у', L'y'
|
||||
};
|
||||
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'Б', L'Г', L'Ґ', L'Д', L'Є', L'Ж', L'З',
|
||||
L'И', L'Ї', L'Й', L'Л', L'П', L'У', L'Ф',
|
||||
L'Ц', L'Ч', L'Ш', L'Щ', L'Ь', L'Ю', L'Я',
|
||||
L'б', L'в', L'г', L'ґ', L'д', L'є', L'ж',
|
||||
L'з', L'и', L'ї', L'й', L'к', L'л', L'м',
|
||||
L'н', L'п', L'т', L'ф', L'ц', L'ч', L'ш',
|
||||
L'щ', L'ь', L'ю', L'я'
|
||||
};
|
||||
static const uint16_t _utf8_substitution_lut[] = { UA_SUB_LUT };
|
||||
#elif defined(TRANSLATIONS_SE)
|
||||
static uint16_t _utf8_lut[] = {
|
||||
L'å', L'ä', L'ö', L'Å', L'Ä', L'Ö',
|
||||
};
|
||||
static const uint16_t _utf8_lut[] = { SE_LUT};
|
||||
#else
|
||||
#define NO_UTF8_LUT
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
static const uint16_t fr_utf8_lut[] = { FR_LUT, 0 };
|
||||
static const uint16_t fr_utf8_substitution_lut[] = { FR_SUB_LUT, 0 };
|
||||
static const uint16_t da_utf8_lut[] = { DA_LUT, 0 };
|
||||
static const uint16_t de_utf8_lut[] = { DE_LUT, 0 };
|
||||
static const uint16_t cz_utf8_lut[] = { CZ_LUT, 0 };
|
||||
static const uint16_t cz_utf8_substitution_lut[] = { CZ_SUB_LUT, 0 };
|
||||
static const uint16_t es_utf8_lut[] = { ES_LUT, 0 };
|
||||
static const uint16_t pt_utf8_lut[] = { PT_LUT, 0 };
|
||||
static const uint16_t fi_utf8_lut[] = { FI_LUT, 0 };
|
||||
static const uint16_t it_utf8_lut[] = { IT_LUT, 0 };
|
||||
static const uint16_t pl_utf8_lut[] = { PL_LUT, 0 };
|
||||
static const uint16_t ru_utf8_lut[] = { RU_LUT, 0 };
|
||||
static const uint16_t ua_utf8_lut[] = { UA_LUT, 0 };
|
||||
static const uint16_t ua_utf8_substitution_lut[] = { UA_SUB_LUT, 0 };
|
||||
static const uint16_t se_utf8_lut[] = { SE_LUT, 0 };
|
||||
|
||||
struct LangUtf {
|
||||
const uint16_t* lut;
|
||||
const uint16_t* substitution_lut;
|
||||
};
|
||||
|
||||
static const LangUtf langUtf[] = {
|
||||
{ nullptr, nullptr },
|
||||
{ cz_utf8_lut, cz_utf8_substitution_lut },
|
||||
{ da_utf8_lut, nullptr },
|
||||
{ de_utf8_lut, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ es_utf8_lut, nullptr },
|
||||
{ fi_utf8_lut, nullptr },
|
||||
{ fr_utf8_lut, fr_utf8_substitution_lut },
|
||||
{ nullptr, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ it_utf8_lut, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ pl_utf8_lut, nullptr },
|
||||
{ pt_utf8_lut, nullptr },
|
||||
{ ru_utf8_lut, nullptr },
|
||||
{ se_utf8_lut, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ nullptr, nullptr },
|
||||
{ ua_utf8_lut, ua_utf8_substitution_lut },
|
||||
};
|
||||
|
||||
static const uint16_t* _utf8_lut = nullptr;
|
||||
static const uint16_t* _utf8_substitution_lut = nullptr;
|
||||
|
||||
void setLanguageUTF(int n)
|
||||
{
|
||||
_utf8_lut = langUtf[n].lut;
|
||||
_utf8_substitution_lut = langUtf[n].substitution_lut;
|
||||
}
|
||||
#define UTF8_SUBS_LUT
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(NO_UTF8_LUT)
|
||||
#if !defined(ALL_LANGS) || defined(BOOT)
|
||||
#define MAX_TRANSLATED_CHARS 107
|
||||
static_assert(sizeof(_utf8_lut) / sizeof(_utf8_lut[0]) <= MAX_TRANSLATED_CHARS, "Number of translated chars exceeds the limit");
|
||||
#endif
|
||||
|
||||
static unsigned char lookup_utf8_mapping(wchar_t w)
|
||||
{
|
||||
for (uint32_t i=0; i < DIM(_utf8_lut); i++) {
|
||||
#if !defined(ALL_LANGS) || defined(BOOT)
|
||||
for (int i=0; i < DIM(_utf8_lut); i++) {
|
||||
if (w == _utf8_lut[i])
|
||||
return FONT_LANG_START + (uint8_t)i;
|
||||
}
|
||||
#else
|
||||
if (_utf8_lut == nullptr) return w;
|
||||
for (int i=0; _utf8_lut[i]; i++) {
|
||||
if (w == _utf8_lut[i])
|
||||
return FONT_LANG_START + (uint8_t)i;
|
||||
}
|
||||
#endif
|
||||
return 0x20; // return 'space' for unknown chars
|
||||
}
|
||||
#endif
|
||||
@@ -174,10 +172,18 @@ static unsigned char lookup_utf8_mapping(wchar_t w)
|
||||
#if defined(UTF8_SUBS_LUT)
|
||||
static uint16_t lookup_utf8_substitution(wchar_t w)
|
||||
{
|
||||
for (uint32_t i=0; i < DIM(_utf8_substitution_lut); i+=2) {
|
||||
#if !defined(ALL_LANGS) || defined(BOOT)
|
||||
for (int i=0; i < DIM(_utf8_substitution_lut); i+=2) {
|
||||
if (w == _utf8_substitution_lut[i])
|
||||
return _utf8_substitution_lut[i+1];
|
||||
}
|
||||
#else
|
||||
if (!_utf8_substitution_lut) return w;
|
||||
for (int i=0; _utf8_substitution_lut[i]; i+=2) {
|
||||
if (w == _utf8_substitution_lut[i])
|
||||
return _utf8_substitution_lut[i+1];
|
||||
}
|
||||
#endif
|
||||
return w;
|
||||
}
|
||||
#endif
|
||||
@@ -205,9 +211,9 @@ unsigned char map_utf8_char(const char*& s, uint8_t& len)
|
||||
return (unsigned char)w;
|
||||
}
|
||||
if(w == L'≥')
|
||||
return STR_CHAR_BW_GREATEREQUAL;
|
||||
return CHAR_BW_GREATEREQUAL;
|
||||
if(w == L'°')
|
||||
return STR_CHAR_BW_DEGREE;
|
||||
return CHAR_BW_DEGREE;
|
||||
#if defined(UTF8_SUBS_LUT)
|
||||
auto w_map = lookup_utf8_substitution(w);
|
||||
if (w_map> FONT_LANG_START)
|
||||
|
||||
@@ -54,12 +54,12 @@ static void sdReadTextFile(const char * filename, char lines[TEXT_VIEWER_LINES][
|
||||
else if (c != '\\' && escape > 0 && escape < sizeof(escape_chars)) {
|
||||
escape_chars[escape - 1] = c;
|
||||
if (escape == 2 && !strncmp(escape_chars, "up", 2)) {
|
||||
lines[current_line-menuVerticalOffset][line_length++] = STR_CHAR_UP[0];
|
||||
c = STR_CHAR_UP[1];
|
||||
lines[current_line-menuVerticalOffset][line_length++] = CHAR_UP[0];
|
||||
c = CHAR_UP[1];
|
||||
}
|
||||
else if (escape == 2 && !strncmp(escape_chars, "dn", 2)) {
|
||||
lines[current_line-menuVerticalOffset][line_length++] = STR_CHAR_DOWN[0];
|
||||
c = STR_CHAR_DOWN[1];
|
||||
lines[current_line-menuVerticalOffset][line_length++] = CHAR_DOWN[0];
|
||||
c = CHAR_DOWN[1];
|
||||
}
|
||||
else if (escape == 3) {
|
||||
int val = atoi(escape_chars);
|
||||
|
||||
@@ -1256,7 +1256,7 @@ const char * getMultiOptionTitleStatic(uint8_t moduleIdx)
|
||||
{
|
||||
const uint8_t multi_proto = g_model.moduleData[moduleIdx].multi.rfProtocol;
|
||||
const mm_protocol_definition * pdef = getMultiProtocolDefinition(multi_proto);
|
||||
return pdef->optionsstr;
|
||||
return STR_VAL(pdef->optionsstr);
|
||||
}
|
||||
|
||||
const char * getMultiOptionTitle(uint8_t moduleIdx)
|
||||
@@ -1267,7 +1267,7 @@ const char * getMultiOptionTitle(uint8_t moduleIdx)
|
||||
if (status.optionDisp >= getMaxMultiOptions()) {
|
||||
status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option)
|
||||
}
|
||||
return mm_options_strings::options[status.optionDisp];
|
||||
return STR_VAL(mm_options_strings::options[status.optionDisp]);
|
||||
}
|
||||
|
||||
return getMultiOptionTitleStatic(moduleIdx);
|
||||
@@ -1278,7 +1278,7 @@ const char * getMultiOptionTitle(uint8_t moduleIdx)
|
||||
uint8_t expandableSection(coord_t y, const char* title, uint8_t value, uint8_t attr, event_t event)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, title);
|
||||
lcdDrawText(LCD_W == 128 ? 120 : 200, y, value ? STR_CHAR_UP : STR_CHAR_DOWN, attr);
|
||||
lcdDrawText(LCD_W == 128 ? 120 : 200, y, value ? CHAR_UP : CHAR_DOWN, attr);
|
||||
if (attr && (event == EVT_KEY_BREAK(KEY_ENTER))) {
|
||||
value = !value;
|
||||
s_editMode = 0;
|
||||
|
||||
Reference in New Issue
Block a user