Cosmetics

This commit is contained in:
Bertrand Songis
2019-10-19 13:03:08 +02:00
parent 5e111dd00c
commit e2f84b8047
108 changed files with 791 additions and 1035 deletions
+18 -28
View File
@@ -273,7 +273,7 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
#endif
{
#if !defined(BOOT)
q = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5];
q = (c < 0x80) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0x80)*5];
#else
q = &font_5x7[(c-0x20)*5];
#endif
@@ -291,7 +291,7 @@ uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
{
uint8_t width = 0;
for (int i=0; len==0 || i<len; ++i) {
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
unsigned char c = *s;
if (!c) {
break;
}
@@ -323,17 +323,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
bool setx = false;
while (len--) {
unsigned char c;
switch (flags & ZCHAR) {
#if !defined(BOOT)
case ZCHAR:
c = zchar2char(*s);
break;
#endif
default:
c = *s;
break;
}
unsigned char c = *s;
if (setx) {
x = c;
@@ -419,7 +409,7 @@ void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFla
{
uint8_t length;
length = *(s++);
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
lcdDrawSizedText(x, y, s+length*idx, length, flags);
}
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
@@ -688,8 +678,8 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_INPUT) {
lcdDrawChar(x+2, y+1, CHR_INPUT, TINSIZE);
lcdDrawSolidFilledRect(x, y, 7, 7);
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT]))
lcdDrawSizedText(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, ZCHAR|att);
if (g_model.inputNames[idx-MIXSRC_FIRST_INPUT][0])
lcdDrawSizedText(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, att);
else
lcdDrawNumber(x+8, y, idx, att|LEADING0|LEFT, 2);
}
@@ -712,14 +702,14 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
#endif
else if (idx <= MIXSRC_LAST_POT) {
idx = idx - MIXSRC_Rud;
if (ZEXIST(g_eeGeneral.anaNames[idx])) {
if (g_eeGeneral.anaNames[idx][0]) {
if (idx < MIXSRC_FIRST_POT-MIXSRC_Rud )
lcdDrawChar(x, y, '\307', att); // stick symbol
lcdDrawChar(x, y, '\207', att); // stick symbol
else if (idx <= MIXSRC_LAST_POT-MIXSRC_Rud )
lcdDrawChar(x, y, '\310', att); // pot symbol
lcdDrawChar(x, y, '\210', att); // pot symbol
else
lcdDrawChar(x, y, '\311', att); // slider symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, ZCHAR|att);
lcdDrawChar(x, y, '\211', att); // slider symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx + 1, att);
@@ -728,8 +718,8 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) {
idx = idx-MIXSRC_FIRST_SWITCH;
if (ZEXIST(g_eeGeneral.switchNames[idx])) {
lcdDrawChar(x, y, '\312', att); //switch symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, ZCHAR|att);
lcdDrawChar(x, y, '\212', att); //switch symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx + MIXSRC_FIRST_SWITCH - MIXSRC_Rud + 1, att);
@@ -745,7 +735,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
drawStringWithIndex(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
lcdDrawChar(lcdLastRightPos, y, ' ', att|SMLSIZE);
lcdDrawSizedText(lcdLastRightPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att|SMLSIZE);
lcdDrawSizedText(lcdLastRightPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, att|SMLSIZE);
}
}
else if (idx <= MIXSRC_LAST_GVAR) {
@@ -756,7 +746,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
}
else if (idx <= MIXSRC_LAST_TIMER) {
if(ZEXIST(g_model.timers[idx-MIXSRC_FIRST_TIMER].name)) {
lcdDrawSizedText(x, y, g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME, ZCHAR|att);
lcdDrawSizedText(x, y, g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME, att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
@@ -765,7 +755,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else {
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
lcdDrawSizedText(x, y, g_model.telemetrySensors[qr.quot].label, TELEM_LABEL_LEN, ZCHAR|att);
lcdDrawSizedText(x, y, g_model.telemetrySensors[qr.quot].label, TELEM_LABEL_LEN, att);
if (qr.rem) lcdDrawChar(lcdLastRightPos, y, qr.rem==2 ? '+' : '-', att);
}
}
@@ -783,7 +773,7 @@ void drawModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
drawStringWithIndex(x, y, STR_MODEL, id+1, att|LEADING0);
}
else {
lcdDrawSizedText(x, y, name, sizeof(g_model.header.name), ZCHAR|att);
lcdDrawSizedText(x, y, name, sizeof(g_model.header.name), att);
}
}
@@ -995,7 +985,7 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
uint8_t msk = bfBit<uint8_t>(y % 8);
while (w--) {
if(pat&1) {
if(pat & 1) {
lcdMaskPoint(p, msk, att);
pat = (pat >> 1) | 0x80;
}
+1 -1
View File
@@ -113,7 +113,7 @@ void menuModelExpoOne(event_t event)
case EXPO_FIELD_WEIGHT:
lcdDrawTextAlignedLeft(y, STR_WEIGHT);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, RIGHT | attr, 0, event);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, -100, 100, RIGHT | attr, 0, event);
break;
case EXPO_FIELD_OFFSET:
+3 -3
View File
@@ -249,7 +249,7 @@ void menuModelExpoOne(event_t event)
case EXPO_FIELD_WEIGHT:
lcdDrawTextAlignedLeft(y, STR_WEIGHT);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr, 0, event);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, -100, 100, attr, 0, event);
break;
case EXPO_FIELD_EXPO:
@@ -410,7 +410,7 @@ void menuModelMixOne(event_t event)
drawFieldLabel(COLUMN_X, y, STR_OFFSET);
u_int8int16_t offset;
MD_OFFSET_TO_UNION(md2, offset);
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, MIX_OFFSET_MIN, MIX_OFFSET_MAX, attr|LEFT, 0, event);
MD_UNION_TO_OFFSET(offset, md2);
drawOffsetBar(COLUMN_X+MIXES_2ND_COLUMN+22, y, md2);
break;
@@ -771,7 +771,7 @@ void menuModelExpoMix(uint8_t expo, event_t event)
if (menuVerticalOffset < cur && cur-menuVerticalOffset < 8) {
uint8_t attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
if (expo) {
ed->weight = GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, event);
ed->weight = GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, -100, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, event);
displayExpoLine(y, ed);
if (ed->mode!=3) {
lcdDrawChar(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? 126 : 127);
+1 -1
View File
@@ -125,7 +125,7 @@ void menuModelMixOne(event_t event)
lcdDrawTextAlignedLeft(y, STR_OFFSET);
u_int8int16_t offset;
MD_OFFSET_TO_UNION(md2, offset);
offset.word = GVAR_MENU_ITEM(MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
offset.word = GVAR_MENU_ITEM(MIXES_2ND_COLUMN, y, offset.word, MIX_OFFSET_MIN, MIX_OFFSET_MAX, attr|LEFT, 0, event);
MD_UNION_TO_OFFSET(offset, md2);
drawOffsetBar(MIXES_2ND_COLUMN+22, y, md2);
break;
+2 -2
View File
@@ -181,7 +181,7 @@ void menuModelLimitsOne(event_t event)
#if defined(PPM_LIMITS_SYMETRICAL)
case ITEM_OUTPUTONE_SYMETRICAL:
lcdDrawTextAlignedLeft(y, TR_LIMITS_HEADERS_SUBTRIMMODE);
lcdDrawChar(LIMITS_ONE_2ND_COLUMN, y, ld->symetrical ? '=' : '\306', attr);
lcdDrawChar(LIMITS_ONE_2ND_COLUMN, y, ld->symetrical ? '=' : '\206', attr);
if (active) {
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);
}
@@ -326,7 +326,7 @@ void menuModelLimits(event_t event)
break;
case ITEM_OUTPUTS_SYMETRICAL:
lcdDrawChar(LCD_W-FW, y, ld->symetrical ? '=' : '\306', 0);
lcdDrawChar(LCD_W-FW, y, ld->symetrical ? '=' : '\206', 0);
break;
}
}
+1 -1
View File
@@ -124,7 +124,7 @@ void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags fl
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event)
{
uint16_t delta = GV_GET_GV1_VALUE(max);
uint16_t delta = GV_GET_GV1_VALUE(min, max);
bool invers = (attr & INVERS);
// TRACE("editGVarFieldValue(val=%d min=%d max=%d)", value, min, max);
+16 -20
View File
@@ -209,7 +209,7 @@ void getCharPattern(PatternData * pattern, unsigned char c, LcdFlags flags)
else {
pattern->width = 5;
pattern->height = 7;
pattern->data = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5];
pattern->data = (c < 0x80) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0x80)*5];
}
}
@@ -244,7 +244,7 @@ uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
{
uint8_t width = 0;
for (int i=0; len==0 || i<len; ++i) {
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
unsigned char c = *s;
if (!c) {
break;
}
@@ -275,11 +275,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
#endif
while (len--) {
#if defined(BOOT)
unsigned char c = *s;
#else
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
#endif
if (setx) {
x = c;
@@ -376,7 +372,7 @@ void lcdDrawTextAlignedLeft(coord_t y, const char * s)
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags flags)
{
uint8_t length = *(s++);
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
lcdDrawSizedText(x, y, s+length*idx, length, flags);
}
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
@@ -596,7 +592,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
lcdDrawChar(x+2, y+1, CHR_INPUT, TINSIZE);
lcdDrawFilledRect(x, y, 7, 7);
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT]))
lcdDrawSizedText(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, ZCHAR|att);
lcdDrawSizedText(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, att);
else
lcdDrawNumber(x+8, y, idx, att|LEADING0|LEFT, 2);
}
@@ -619,23 +615,23 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_POT) {
idx = idx-MIXSRC_Rud;
if (ZEXIST(g_eeGeneral.anaNames[idx])) {
if (g_eeGeneral.anaNames[idx][0]) {
if (idx < MIXSRC_FIRST_POT-MIXSRC_Rud )
lcdDrawChar(x, y, '\307', att); //stick symbol
lcdDrawChar(x, y, '\207', att); //stick symbol
else if (idx < MIXSRC_FIRST_SLIDER-MIXSRC_Rud )
lcdDrawChar(x, y, '\310', att); //pot symbol
lcdDrawChar(x, y, '\210', att); //pot symbol
else
lcdDrawChar(x, y, '\311', att); //slider symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, ZCHAR|att);
lcdDrawChar(x, y, '\211', att); //slider symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, att);
}
else
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx+1, att);
}
else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) {
idx = idx - MIXSRC_FIRST_SWITCH;
if (ZEXIST(g_eeGeneral.switchNames[idx])) {
lcdDrawChar(x, y, '\312', att); //switch symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, ZCHAR|att);
if (g_eeGeneral.switchNames[idx][0]) {
lcdDrawChar(x, y, '\212', att); //switch symbol
lcdDrawSizedText(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx + MIXSRC_FIRST_SWITCH - MIXSRC_Rud + 1, att);
@@ -651,7 +647,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
drawStringWithIndex(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
lcdDrawChar(lcdLastRightPos, y, ' ', att|SMLSIZE);
lcdDrawSizedText(lcdLastRightPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att|SMLSIZE);
lcdDrawSizedText(lcdLastRightPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, att|SMLSIZE);
}
}
else if (idx <= MIXSRC_LAST_GVAR) {
@@ -662,7 +658,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
}
else if (idx <= MIXSRC_LAST_TIMER) {
if(ZEXIST(g_model.timers[idx-MIXSRC_FIRST_TIMER].name)) {
lcdDrawSizedText(x, y, g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME, ZCHAR|att);
lcdDrawSizedText(x, y, g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME, att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
@@ -671,7 +667,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else {
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
lcdDrawSizedText(x, y, g_model.telemetrySensors[qr.quot].label, TELEM_LABEL_LEN, ZCHAR|att);
lcdDrawSizedText(x, y, g_model.telemetrySensors[qr.quot].label, TELEM_LABEL_LEN, att);
if (qr.rem) lcdDrawChar(lcdLastRightPos, y, qr.rem==2 ? '+' : '-', att);
}
}
@@ -689,7 +685,7 @@ void drawModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
drawStringWithIndex(x, y, STR_MODEL, id+1, att|LEADING0);
}
else {
lcdDrawSizedText(x, y, name, sizeof(g_model.header.name), ZCHAR|att);
lcdDrawSizedText(x, y, name, sizeof(g_model.header.name), att);
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ void menuModelExpoOne(event_t event)
case EXPO_FIELD_WEIGHT:
lcdDrawTextAlignedLeft(y, STR_WEIGHT);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, LEFT|attr, 0, event);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, -100, 100, LEFT|attr, 0, event);
break;
case EXPO_FIELD_OFFSET:
+1 -1
View File
@@ -124,7 +124,7 @@ void menuModelMixOne(event_t event)
lcdDrawTextAlignedLeft(y, STR_OFFSET);
u_int8int16_t offset;
MD_OFFSET_TO_UNION(md2, offset);
offset.word = GVAR_MENU_ITEM(MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
offset.word = GVAR_MENU_ITEM(MIXES_2ND_COLUMN, y, offset.word, MIX_OFFSET_MIN, MIX_OFFSET_MAX, attr|LEFT, 0, event);
MD_UNION_TO_OFFSET(offset, md2);
drawOffsetBar(MIXES_2ND_COLUMN+35, y, md2);
break;
+1 -1
View File
@@ -227,7 +227,7 @@ void menuModelLimits(event_t event)
#if defined(PPM_LIMITS_SYMETRICAL)
case ITEM_LIMITS_SYMETRICAL:
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\206', attr);
if (active) {
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);
}
+1 -1
View File
@@ -124,7 +124,7 @@ void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags fl
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event)
{
uint16_t delta = GV_GET_GV1_VALUE(max);
uint16_t delta = GV_GET_GV1_VALUE(min, max);
bool invers = (attr & INVERS);
// TRACE("editGVarFieldValue(val=%d min=%d max=%d)", value, min, max);
+8 -8
View File
@@ -1,13 +1,13 @@
include_directories(
${RADIO_SRC_DIRECTORY}/gui/colorlcd
${RADIO_SRC_DIRECTORY}/gui/colorlcd/layouts
${RADIO_SRC_DIRECTORY}/fonts/truetype
${RADIO_SRC_DIRECTORY}/thirdparty/libopenui/src
${RADIO_SRC_DIR}/gui/colorlcd
${RADIO_SRC_DIR}/gui/colorlcd/layouts
${CMAKE_CURRENT_BINARY_DIR}/fonts
${RADIO_SRC_DIR}/thirdparty/libopenui/src
)
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/colorlcd ${RADIO_SRC_DIRECTORY}/gui/colorlcd/themes/*.cpp)
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/colorlcd ${RADIO_SRC_DIRECTORY}/gui/colorlcd/layouts/*.cpp)
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/colorlcd ${RADIO_SRC_DIRECTORY}/gui/colorlcd/widgets/*.cpp)
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/themes/*.cpp)
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/layouts/*.cpp)
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/widgets/*.cpp)
set(GUI_SRC
${GUI_SRC}
@@ -86,7 +86,7 @@ set(SRC
)
# includes libopenui
include(${RADIO_SRC_DIRECTORY}/thirdparty/libopenui/src/CMakeLists.txt)
include(${RADIO_SRC_DIR}/thirdparty/libopenui/src/CMakeLists.txt)
include_directories(gui/libopenui)
add_definitions(-DLIBOPENUI)
foreach(LIBOPENUI_FILE ${LIBOPENUI_SRC})
@@ -1,83 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "choice.h"
#include "menu.h"
#include "draw_functions.h"
#include "strhelpers.h"
#include "opentx.h"
extern const uint8_t LBM_DROPDOWN[];
CustomCurveChoice::CustomCurveChoice(Window * parent, const rect_t &rect, int16_t vmin, int16_t vmax,
std::function<int16_t()> getValue, std::function<void(int16_t)> setValue, LcdFlags flags) :
FormField(parent, rect),
vmin(vmin),
vmax(vmax),
getValue(std::move(getValue)),
setValue(std::move(setValue)),
flags(flags)
{
}
void CustomCurveChoice::paint(BitmapBuffer * dc)
{
bool hasFocus = this->hasFocus();
char s[8];
int16_t value = getValue();
LcdFlags textColor = 0;
LcdFlags lineColor = DISABLE_COLOR;
if (hasFocus) {
textColor = FOCUS_BGCOLOR;
lineColor = FOCUS_BGCOLOR;
}
dc->drawText(3, 2, getCurveString(s, value), flags | textColor);
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, lineColor);
dc->drawBitmapPattern(rect.w - 14, (rect.h - 5) / 2, LBM_DROPDOWN, lineColor);
}
#if defined(HARDWARE_TOUCH)
bool CustomCurveChoice::onTouchEnd(coord_t x, coord_t y)
{
auto menu = new Menu();
auto value = getValue();
int count = 0;
int current = -1;
char s[8];
for (int i = vmin; i <= vmax; ++i) {
menu->addLine(getCurveString(s, i), [=]() {
setValue(i);
});
if (value == i) {
current = count;
}
++count;
}
if (current >= 0) {
menu->select(current);
}
setFocus();
return true;
}
#endif
@@ -1,52 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _CHOICE_H_
#define _CHOICE_H_
#include "form.h"
#include <string>
class CustomCurveChoice : public FormField {
public:
CustomCurveChoice(Window * parent, const rect_t & rect, int16_t vmin, int16_t vmax, std::function<int16_t()> getValue, std::function<void(int16_t)> setValue, LcdFlags flags = 0);
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
return "CustomCurveChoice";
}
#endif
void paint(BitmapBuffer * dc) override;
#if defined(HARDWARE_TOUCH)
bool onTouchEnd(coord_t x, coord_t y) override;
#endif
protected:
int16_t vmin;
int16_t vmax;
std::function<int16_t()> getValue;
std::function<void(int16_t)> setValue;
LcdFlags flags;
};
#endif // _CHOICE_H_
+19 -14
View File
@@ -186,9 +186,15 @@ void drawGVarValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t gvar, gvar_t
drawValueWithUnit(dc, x, y, value, g_model.gvars[gvar].unit ? UNIT_PERCENT : UNIT_RAW, flags);
}
void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, LcdFlags flags)
void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, gvar_t vmin, gvar_t vmax, LcdFlags flags)
{
dc->drawNumber(x, y, value, flags, 0, nullptr, "%");
if (GV_IS_GV_VALUE(value, vmin, vmax)) {
int index = GV_INDEX_CALC_DELTA(value, GV_GET_GV1_VALUE(vmin, vmax));
dc->drawText(x, y, getGVarString(index), flags);
}
else {
dc->drawNumber(x, y, value, flags, 0, nullptr, "%");
}
}
void drawSleepBitmap()
@@ -249,13 +255,13 @@ void drawCurveRef(BitmapBuffer * dc, coord_t x, coord_t y, const CurveRef & curv
if (curve.value != 0) {
switch (curve.type) {
case CURVE_REF_DIFF:
dc->drawText(x, y, "D", flags);
drawValueOrGVar(dc, lcdNextPos + 1, y + 2, curve.value, LEFT|SMLSIZE|flags);
x = dc->drawText(x, y, "D", flags);
drawValueOrGVar(dc, x + 1, y + 2, curve.value, -100, 100, LEFT | SMLSIZE | flags);
break;
case CURVE_REF_EXPO:
dc->drawText(x, y, "E", flags);
drawValueOrGVar(dc, lcdNextPos + 1, y + 2, curve.value, LEFT|SMLSIZE|flags);
x = dc->drawText(x, y, "E", flags);
drawValueOrGVar(dc, x + 1, y + 2, curve.value, -100, 100, LEFT | SMLSIZE | flags);
break;
case CURVE_REF_FUNC:
@@ -494,11 +500,11 @@ void drawSourceCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, source_t sou
#if defined(INTERNAL_GPS)
else if (source == MIXSRC_TX_GPS) {
if (gpsData.fix) {
drawGPSPosition(x, y, gpsData.longitude, gpsData.latitude, flags);
drawGPSPosition(dc, x, y, gpsData.longitude, gpsData.latitude, flags);
}
else {
lcdDrawText(x, y, "sats: ", flags);
dc->drawNumber(lcdNextPos, y, gpsData.numSat, flags);
x = dc->drawText(x, y, "sats: ", flags);
dc->drawNumber(x, y, gpsData.numSat, flags);
}
}
#endif
@@ -534,10 +540,9 @@ void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t
void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags)
{
for (int i=12; i>=0; i-=4) {
char c = (val >> i) & 0xf;
c = c>9 ? c+'A'-10 : c+'0';
dc->drawSizedText(x, y, &c, 1, flags);
x = lcdNextPos;
for (int i = 12; i >= 0; i -= 4) {
char c = (val >> i) & 0x0F;
c += (c >= 10 ? 'A' - 10 : '0');
x = dc->drawSizedText(x, y, &c, 1, flags);
}
}
+3 -2
View File
@@ -62,10 +62,11 @@ void drawVerticalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t d
void drawVerticalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
void drawHorizontalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t gvar, LcdFlags flags = 0);
void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, gvar_t vmin, gvar_t vmax, LcdFlags flags = 0);
void drawGVarValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags = 0);
void drawSourceCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, source_t source, int32_t value, LcdFlags flags);
void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags = 0);
void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags = 0);
void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags = 0);
void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags = 0);
void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags = 0);
+2 -2
View File
@@ -33,8 +33,8 @@ const uint8_t __alpha_button_off[] {
Bitmap ALPHA_BUTTON_OFF(BMP_ARGB4444, (const uint16_t*)__alpha_button_off);
FabButton::FabButton(Window * parent, coord_t x, coord_t y, uint8_t icon, std::function<uint8_t(void)> pressHandler, uint8_t flags):
Button(parent, { x - 34, y - 34, 68, 68 }, pressHandler, flags),
FabButton::FabButton(FormGroup * parent, coord_t x, coord_t y, uint8_t icon, std::function<uint8_t(void)> pressHandler, WindowFlags windowFlags):
Button(parent, { x - 34, y - 34, 68, 68 }, pressHandler, windowFlags),
icon(icon)
{
}
+1 -1
View File
@@ -24,7 +24,7 @@
class FabButton: public Button {
public:
FabButton(Window * parent, coord_t x, coord_t y, uint8_t icon, std::function<uint8_t(void)> pressHandler, uint8_t flags=0);
FabButton(FormGroup * parent, coord_t x, coord_t y, uint8_t icon, std::function<uint8_t(void)> pressHandler, WindowFlags windowFlags = 0);
#if defined(DEBUG_WINDOWS)
std::string getName() override
+119
View File
@@ -0,0 +1,119 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef _GVAR_NUMBEREDIT_H_
#define _GVAR_NUMBEREDIT_H_
#include "form.h"
#include "numberedit.h"
#include "gvars.h"
constexpr coord_t GVAR_BUTTON_WIDTH = 30;
#if !defined(GVARS)
typedef NumberEdit GVarNumberEdit;
#else
class GVarNumberEdit: public FormGroup
{
public:
GVarNumberEdit(FormGroup * parent, const rect_t & rect, int32_t vmin, int32_t vmax, std::function<int32_t()> getValue, std::function<void(int32_t)> setValue) :
FormGroup(parent, rect, FORWARD_SCROLL | FORM_FORWARD_FOCUS),
vmin(vmin),
vmax(vmax),
getValue(getValue),
setValue(setValue)
{
update();
}
void switchGVarMode()
{
int32_t value = getValue();
setValue(GV_IS_GV_VALUE(value, vmin, vmax) ? GET_GVAR(value, vmin, vmax, mixerCurrentFlightMode) : GV_GET_GV1_VALUE(vmin, vmax));
update();
}
void setSuffix(std::string value)
{
suffix = std::move(value);
update();
}
#if defined(HARDWARE_KEYS)
void onEvent(event_t event) override
{
if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
switchGVarMode();
field->setFocus();
}
else {
FormGroup::onEvent(event);
}
}
#endif
protected:
FormField * field = nullptr;
int32_t vmin;
int32_t vmax;
std::function<int32_t()> getValue;
std::function<void(int32_t)> setValue;
std::string suffix;
void update()
{
clear();
// The main field
int32_t value = getValue();
if (GV_IS_GV_VALUE(value, vmin, vmax)) {
auto result = new Choice(this, {0, 0, width() - GVAR_BUTTON_WIDTH, height()}, nullptr, -MAX_GVARS, MAX_GVARS - 1,
[=]() {
uint16_t gvar1 = GV_GET_GV1_VALUE(vmin, vmax);
return GV_INDEX_CALC_DELTA(getValue(), gvar1);
},
[=](int idx) {
uint16_t gvar1 = GV_GET_GV1_VALUE(vmin, vmax);
if (idx < 0)
setValue(GV_CALC_VALUE_IDX_NEG(idx, gvar1));
else
setValue(GV_CALC_VALUE_IDX_POS(idx, gvar1));
});
result->setTextHandler([=](int32_t value) {
return getGVarString(value);
});
field = result;
}
else {
auto result = new NumberEdit(this, {0, 0, width() - GVAR_BUTTON_WIDTH, height()}, vmin, vmax, getValue, setValue);
result->setSuffix(suffix);
field = result;
}
// The GVAR button
new TextButton(this, {width() - GVAR_BUTTON_WIDTH, 0, GVAR_BUTTON_WIDTH, height()}, STR_GV, [=]() {
switchGVarMode();
return 0;
}, BUTTON_BACKGROUND | FORM_DETACHED);
}
};
#endif
#endif // _GVAR_NUMBEREDIT_H_
+6 -7
View File
@@ -40,14 +40,14 @@ class CurveEditWindow : public Page {
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUCURVE, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUCURVE, 0, MENU_COLOR);
char s[16];
strAppendStringWithIndex(s, STR_CV, index + 1);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, s, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, s, 0, MENU_COLOR);
}
#if LCD_W > LCD_H
void buildBody(Window * window)
void buildBody(FormWindow * window)
{
coord_t curveWidth = window->height() - 2 * PAGE_PADDING;
@@ -125,7 +125,7 @@ class CurveEditWindow : public Page {
grid.nextLine();
}
#else
void buildBody(Window * window)
void buildBody(FormWindow * window)
{
FormGridLayout grid;
grid.setMarginLeft(20);
@@ -204,7 +204,7 @@ class CurveEditWindow : public Page {
class CurveButton : public Button {
public:
CurveButton(Window * parent, const rect_t &rect, uint8_t index) :
CurveButton(FormGroup * parent, const rect_t &rect, uint8_t index) :
Button(parent, rect),
index(index)
{
@@ -269,7 +269,7 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
if (isCurveUsed(index)) {
// Curve label
new StaticText(window, grid.getLabelSlot(), getCurveString(1 + index), BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), getCurveString(1 + index), BUTTON_BACKGROUND, CENTERED);
// Curve drawing
Button * button = new CurveButton(window, grid.getFieldSlot(), index);
@@ -326,6 +326,5 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
}
}
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+6 -14
View File
@@ -71,9 +71,6 @@ void ModelFlightModesPage::build(FormWindow * window)
for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
auto group = new FlightModeGroup(window, i, { 2, y, LCD_W - 10, 0 });
if (i == 0) {
window->setFirstField(group);
}
FormGridLayout grid;
grid.setMarginRight(15);
@@ -87,8 +84,7 @@ void ModelFlightModesPage::build(FormWindow * window)
// Flight mode name
new StaticText(group, grid.getLabelSlot(true), STR_NAME);
auto nameEdit = new TextEdit(group, grid.getFieldSlot(), g_model.flightModeData[i].name, LEN_FLIGHT_MODE_NAME);
group->setFirstField(nameEdit);
new TextEdit(group, grid.getFieldSlot(), g_model.flightModeData[i].name, LEN_FLIGHT_MODE_NAME);
grid.nextLine();
// Flight mode switch
@@ -121,29 +117,26 @@ void ModelFlightModesPage::build(FormWindow * window)
"+7"
"=8"
"+8";
for (int t=0; t<NUM_TRIMS; t++) {
for (int t = 0; t < NUM_TRIMS; t++) {
// TODO isTrimModeAvailable to avoid +{{CURRENT}}
new Choice(group, grid.getFieldSlot(NUM_TRIMS, t), STR_VTRIMS_MODES, -1, 2*MAX_FLIGHT_MODES-1,
GET_DEFAULT(g_model.flightModeData[i].trim[t].mode==TRIM_MODE_NONE ? -1 : g_model.flightModeData[i].trim[t].mode),
SET_DEFAULT(g_model.flightModeData[i].trim[t].mode),
STDSIZE);
SET_DEFAULT(g_model.flightModeData[i].trim[t].mode));
}
grid.nextLine();
// Flight mode fade in / out
new StaticText(group, grid.getLabelSlot(true), "Fade in/out");
auto edit = new NumberEdit(group, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
new NumberEdit(group, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(g_model.flightModeData[i].fadeIn),
SET_VALUE(g_model.flightModeData[i].fadeIn, newValue),
PREC1);
edit = new NumberEdit(group, grid.getFieldSlot(2, 1), 0, DELAY_MAX,
new NumberEdit(group, grid.getFieldSlot(2, 1), 0, DELAY_MAX,
GET_DEFAULT(g_model.flightModeData[i].fadeOut),
SET_VALUE(g_model.flightModeData[i].fadeOut, newValue),
PREC1);
grid.nextLine();
group->setLastField(FormField::getCurrentField());
grid.spacer();
coord_t height = grid.getWindowHeight();
group->setHeight(height);
@@ -154,7 +147,7 @@ void ModelFlightModesPage::build(FormWindow * window)
sprintf(label, "Check FM Trims");
// TODO rather use a centered slot?
// TODO dynamic text with FM index for the button text
auto button = new TextButton(window, { 60, y + 5, LCD_W - 120, PAGE_LINE_HEIGHT }, label,
new TextButton(window, { 60, y + 5, LCD_W - 120, PAGE_LINE_HEIGHT }, label,
[&]() -> uint8_t {
if (trimsCheckTimer)
trimsCheckTimer = 0;
@@ -164,5 +157,4 @@ void ModelFlightModesPage::build(FormWindow * window)
});
window->setInnerHeight(y + 40);
window->setLastField(button);
}
+17 -20
View File
@@ -27,7 +27,7 @@
#define TEXT_LEFT_MARGIN 2
#define GVAR_NAME_SIZE 50
GVarButton::GVarButton(Window * parent, const rect_t &rect, uint8_t gvar) :
GVarButton::GVarButton(FormGroup * parent, const rect_t &rect, uint8_t gvar) :
Button(parent, rect),
gvarIdx(gvar)
{
@@ -56,6 +56,7 @@ void GVarButton::checkEvents()
void GVarButton::paint(BitmapBuffer * dc)
{
GVarData * gvar = &g_model.gvars[gvarIdx];
// The bounding rect
int nameRectW = TEXT_LEFT_MARGIN + GVAR_NAME_SIZE;
coord_t x = TEXT_LEFT_MARGIN;
@@ -115,7 +116,7 @@ void GVarButton::paint(BitmapBuffer * dc)
}
}
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? FOCUS_BGCOLOR : DISABLE_COLOR);
}
void GVarButton::drawFlightMode(BitmapBuffer * dc, coord_t x, coord_t y, int fm, LcdFlags attr)
@@ -164,11 +165,9 @@ bool GVarRenderer::isUpdated()
return true;
}
const std::string GVarEditWindow::unitPercent = "%";
void GVarEditWindow::buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_GLOBAL_VAR, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_GLOBAL_VAR, 0, MENU_COLOR);
gVarInHeader = new GVarRenderer(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, index);
}
@@ -176,9 +175,8 @@ void GVarEditWindow::checkEvents()
{
Page::checkEvents();
if (gVarInHeader && gVarInHeader->isUpdated()) {
for (int fm = 0; fm < MAX_FLIGHT_MODES; fm++) {
if (!values[fm]) continue;
values[fm]->invalidate();
for (auto & value : values) {
value->invalidate();
}
}
}
@@ -188,9 +186,9 @@ void GVarEditWindow::setProperties(int onlyForFlightMode)
GVarData * gvar = &g_model.gvars[index];
int32_t minValue = GVAR_MIN + gvar->min;
int32_t maxValue = GVAR_MAX - gvar->max;
std::string suffix;
LcdFlags prec = gvar->prec ? PREC1 : 0;
if (gvar->unit) suffix = GVarEditWindow::unitPercent;
const char * suffix = gvar->unit ? "%" : "";
// TODO needed? LcdFlags prec = gvar->prec ? PREC1 : 0;
if (min && max) {
min->setMax(maxValue);
max->setMin(minValue);
@@ -208,8 +206,6 @@ void GVarEditWindow::setProperties(int onlyForFlightMode)
for (int fm = 0; fm < MAX_FLIGHT_MODES; fm++) {
if (onlyForFlightMode >= 0 && fm != onlyForFlightMode)
continue;
if (!values[fm])
continue;
fmData = &g_model.flightModeData[fm];
// custom value
@@ -232,7 +228,7 @@ void GVarEditWindow::setProperties(int onlyForFlightMode)
}
values[fm]->setSuffix(suffix);
//TODO values[fm]->setLcdFlags(prec);
// TODO values[fm]->setLcdFlags(prec);
values[fm]->invalidate();
}
if (gVarInHeader) gVarInHeader->invalidate();
@@ -309,20 +305,19 @@ void GVarEditWindow::buildBody(FormWindow * window)
if (flightMode > 0) {
auto cb = new CheckBox(window, grid.getFieldSlot(2, 0),
[=] { return fmData->gvars[index] <= GVAR_MAX; }, [=](uint8_t checked) {
if (!values[flightMode])
return;
fmData->gvars[index] = checked ? 0 : GVAR_MAX + 1;
setProperties(flightMode);
});
cb->setLabel(STR_OWN);
}
values[flightMode] = new NumberEdit(window, grid.getFieldSlot(2, 1), GVAR_MIN + gvar->min, GVAR_MAX + MAX_FLIGHT_MODES - 1,
GET_SET_DEFAULT(fmData->gvars[index]));
grid.nextLine();
}
setProperties();
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
@@ -337,8 +332,9 @@ void ModelGVarsPage::rebuild(FormWindow * window)
void ModelGVarsPage::build(FormWindow * window)
{
FormGridLayout grid;
grid.spacer(8);
grid.spacer(PAGE_PADDING);
grid.setLabelWidth(70);
for (uint8_t index = 0; index < MAX_GVARS; index++) {
Button * button = new GVarButton(window, grid.getLineSlot(), index);
button->setPressHandler([=]() -> uint8_t {
@@ -350,13 +346,14 @@ void ModelGVarsPage::build(FormWindow * window)
});
});
menu->addLine(STR_CLEAR, [=]() {
for (int i = 0; i < MAX_FLIGHT_MODES; i++) {
g_model.flightModeData[i].gvars[index] = 0;
for (auto & flightMode : g_model.flightModeData) {
flightMode.gvars[index] = 0;
}
storageDirty(EE_MODEL);
});
return 0;
});
grid.nextLine(button->getHeight());
}
window->setInnerHeight(grid.getWindowHeight());
+6 -9
View File
@@ -27,7 +27,7 @@
class GVarButton : public Button {
public:
GVarButton(Window * parent, const rect_t & rect, uint8_t gvar);
GVarButton(FormGroup * parent, const rect_t & rect, uint8_t gvar);
void checkEvents() override;
void paint(BitmapBuffer * dc) override;
@@ -72,27 +72,24 @@ class GVarEditWindow : public Page {
Page(ICON_MODEL_GVARS),
index(gvarIndex)
{
values = new NumberEdit*[MAX_FLIGHT_MODES];
buildHeader(&header);
buildBody(&body);
}
~GVarEditWindow()
~GVarEditWindow() override
{
delete[] values;
}
void checkEvents() override;
protected:
uint8_t index;
NumberEdit * min = nullptr;
NumberEdit * max = nullptr;
NumberEdit * values[MAX_FLIGHT_MODES] = {};
GVarRenderer * gVarInHeader;
void buildHeader(Window * window);
void buildBody(FormWindow * window);
void setProperties(int onlyForFlightMode = -1);
NumberEdit* min;
NumberEdit* max;
NumberEdit** values;
GVarRenderer * gVarInHeader;
static const std::string unitPercent;
};
#endif
+2 -3
View File
@@ -36,7 +36,7 @@ void ModelHeliPage::build(FormWindow * window)
// Swash type
new StaticText(window, grid.getLabelSlot(), STR_SWASHTYPE);
auto first = new Choice(window, grid.getFieldSlot(), STR_VSWASHTYPE, 0, SWASH_TYPE_MAX, GET_SET_DEFAULT(g_model.swashR.type));
new Choice(window, grid.getFieldSlot(), STR_VSWASHTYPE, 0, SWASH_TYPE_MAX, GET_SET_DEFAULT(g_model.swashR.type));
grid.nextLine();
// Swash ring
@@ -71,8 +71,7 @@ void ModelHeliPage::build(FormWindow * window)
// Collective weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT);
auto last = new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.collectiveWeight));
FormField::link(last, first);
new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.collectiveWeight));
grid.nextLine();
+58 -59
View File
@@ -20,6 +20,7 @@
#include "model_inputs.h"
#include "opentx.h"
#include "gvar_numberedit.h"
#define SET_DIRTY() storageDirty(EE_MODEL)
@@ -95,7 +96,7 @@ class InputEditWindow: public Page {
Page(ICON_MODEL_INPUTS),
input(input),
index(index),
preview(this, {LCD_W - 158, 0, 158, 158},
preview(this, {INPUT_EDIT_CURVE_LEFT, INPUT_EDIT_CURVE_TOP, INPUT_EDIT_CURVE_WIDTH, INPUT_EDIT_CURVE_HEIGHT},
[=](int x) -> int {
ExpoData * line = expoAddress(index);
int16_t anas[MAX_INPUTS] = {0};
@@ -106,6 +107,11 @@ class InputEditWindow: public Page {
return getValue(expoAddress(index)->srcRaw);
})
{
#if LCD_W > LCD_H
body.setWidth(LCD_W - 170);
#else
body.setRect({0, INPUT_EDIT_CURVE_TOP + INPUT_EDIT_CURVE_HEIGHT, LCD_W, LCD_H - INPUT_EDIT_CURVE_TOP - INPUT_EDIT_CURVE_HEIGHT});
#endif
buildBody(&body);
buildHeader(&header);
}
@@ -115,68 +121,60 @@ class InputEditWindow: public Page {
uint8_t index;
Curve preview;
Choice * trimChoice = nullptr;
Window * updateCurvesWindow = nullptr;
Choice * curveTypeChoice = nullptr;
FormGroup * curveParamField = nullptr;
void buildHeader(Window * window) {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUINPUTS, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_FIRST_INPUT + input), MENU_COLOR);
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUINPUTS, 0, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_FIRST_INPUT + input), 0, MENU_COLOR);
}
void updateCurves() {
FormGridLayout grid;
grid.setLabelWidth(INPUT_EDIT_LABELS_WIDTH);
// TODO share this code with MIXER
void updateCurveParamField(ExpoData * line)
{
curveParamField->clear();
updateCurvesWindow->clear();
ExpoData * line = expoAddress(index) ;
new StaticText(updateCurvesWindow, grid.getLabelSlot(), STR_CURVE);
curveTypeChoice = new Choice(updateCurvesWindow, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, CURVE_REF_CUSTOM,
GET_DEFAULT(line->curve.type),
[=](int32_t newValue) {
line->curve.type = newValue;
line->curve.value = 0;
SET_DIRTY();
updateCurves();
curveTypeChoice->setFocus();
});
const rect_t rect = {0, 0, curveParamField->width(), curveParamField->height()};
switch (line->curve.type) {
case CURVE_REF_DIFF:
case CURVE_REF_EXPO: {
// TODO GVAR
NumberEdit * edit = new NumberEdit(updateCurvesWindow, grid.getFieldSlot(2, 1), -100, 100,
GET_SET_DEFAULT(line->curve.value));
case CURVE_REF_EXPO:
{
GVarNumberEdit * edit = new GVarNumberEdit(curveParamField, rect, -100, 100, GET_SET_DEFAULT(line->curve.value));
edit->setSuffix("%");
break;
}
case CURVE_REF_FUNC:
new Choice(updateCurvesWindow, grid.getFieldSlot(2, 1), STR_VCURVEFUNC, 0, CURVE_BASE-1, GET_SET_DEFAULT(line->curve.value));
new Choice(curveParamField, rect, STR_VCURVEFUNC, 0, CURVE_BASE - 1, GET_SET_DEFAULT(line->curve.value));
break;
case CURVE_REF_CUSTOM:
#warning "TODO Custom Curve Choice"
// new CustomCurveChoice(updateCurvesWindow, grid.getFieldSlot(2, 1), -MAX_CURVES, MAX_CURVES, GET_SET_DEFAULT(line->curve.value));
{
auto choice = new Choice(curveParamField, rect, nullptr, -MAX_CURVES, MAX_CURVES, GET_SET_DEFAULT(line->curve.value));
choice->setTextHandler([](int value) {
return getCurveString(value);
});
break;
}
}
}
void buildBody(FormWindow * window)
{
NumberEdit * edit;
FormGridLayout grid;
grid.setLabelWidth(INPUT_EDIT_LABELS_WIDTH);
grid.spacer(PAGE_PADDING);
ExpoData * line = expoAddress(index) ;
grid.setMarginRight(163);
#if LCD_W > LCD_H
grid.setMarginRight(180);
#endif
// Input Name
new StaticText(window, grid.getLabelSlot(), STR_INPUTNAME);
auto name = new TextEdit(window, grid.getFieldSlot(), g_model.inputNames[line->chn], sizeof(g_model.inputNames[line->chn]));
window->setFirstField(name);
new TextEdit(window, grid.getFieldSlot(), g_model.inputNames[line->chn], sizeof(g_model.inputNames[line->chn]));
grid.nextLine();
// Switch
@@ -196,10 +194,6 @@ class InputEditWindow: public Page {
});
grid.nextLine();
#if LCD_H > LCD_W
grid.setMarginRight(10);
#endif
// Name
new StaticText(window, grid.getLabelSlot(), STR_EXPONAME);
new TextEdit(window, grid.getFieldSlot(), line->name, sizeof(line->name));
@@ -232,15 +226,14 @@ class InputEditWindow: public Page {
// Weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT);
// TODO GVAR ?
edit = new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->weight));
edit->setSuffix("%");
auto gvar = new GVarNumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->weight));
gvar->setSuffix("%");
grid.nextLine();
// Offset
new StaticText(window, grid.getLabelSlot(), STR_OFFSET);
edit = new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->offset));
edit->setSuffix("%");
gvar = new GVarNumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->offset));
gvar->setSuffix("%");
grid.nextLine();
// Trim
@@ -253,21 +246,27 @@ class InputEditWindow: public Page {
});
grid.nextLine();
// grid.setMarginRight(10);
// Curve
updateCurvesWindow = new Window(window, { 0, grid.getWindowHeight(), LCD_W - 162, 0 });
updateCurves();
grid.addWindow(updateCurvesWindow);
new StaticText(&body, grid.getLabelSlot(), STR_CURVE);
new Choice(&body, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, CURVE_REF_CUSTOM,
GET_DEFAULT(line->curve.type),
[=](int32_t newValue) {
line->curve.type = newValue;
line->curve.value = 0;
SET_DIRTY();
updateCurveParamField(line);
});
curveParamField = new FormGroup(&body, grid.getFieldSlot(2, 1), FORM_FORWARD_FOCUS);
updateCurveParamField(line);
grid.nextLine();
// Flight modes
new StaticText(window, grid.getLabelSlot(), STR_FLMODE);
TextButton * flightmode = nullptr;
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
char fm[2] = { char('0' + i), '\0'};
if (i > 0 && (i % 4) == 0)
grid.nextLine();
flightmode = new TextButton(window, grid.getFieldSlot(4, i % 4), fm,
new TextButton(window, grid.getFieldSlot(4, i % 4), fm,
[=]() -> uint8_t {
BFBIT_FLIP(line->flightModes, bfBit<uint32_t>(i));
SET_DIRTY();
@@ -276,7 +275,7 @@ class InputEditWindow: public Page {
bfSingleBitGet(line->flightModes, i) ? 0 : BUTTON_CHECKED);
}
grid.nextLine();
window->setLastField(flightmode);
window->setInnerHeight(grid.getWindowHeight());
}
};
@@ -319,12 +318,12 @@ void CommonInputOrMixButton::paint(BitmapBuffer * dc)
class InputLineButton : public CommonInputOrMixButton {
public:
InputLineButton(Window * parent, const rect_t & rect, uint8_t index):
InputLineButton(FormGroup * parent, const rect_t & rect, uint8_t index):
CommonInputOrMixButton(parent, rect, index)
{
const ExpoData & line = g_model.expoData[index];
if (line.swtch || line.curve.value != 0 || line.flightModes) {
setHeight(getHeight() + 20);
setHeight(getHeight() + PAGE_LINE_HEIGHT);
}
}
@@ -338,7 +337,7 @@ class InputLineButton : public CommonInputOrMixButton {
const ExpoData & line = g_model.expoData[index];
// first line ...
drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight);
drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight, -100, 100);
drawSource(dc, 60, FIELD_PADDING_TOP, line.srcRaw);
if (line.name[0]) {
@@ -348,7 +347,7 @@ class InputLineButton : public CommonInputOrMixButton {
// second line ...
if (line.swtch) {
dc->drawMask(3, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, mixerSetupSwitchIcon, DEFAULT_COLOR);
dc->drawMask(3, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP + 2, mixerSetupSwitchIcon, DEFAULT_COLOR);
drawSwitch(dc, 21, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, line.swtch);
}
@@ -394,9 +393,9 @@ void ModelInputsPage::build(FormWindow * window, int8_t focusIndex)
int inputIndex = 0;
ExpoData * line = g_model.expoData;
for (uint8_t input=0; input<MAX_INPUTS; input++) {
for (uint8_t input = 0; input < MAX_INPUTS; input++) {
if (inputIndex < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) {
new StaticText(window, grid.getLabelSlot(), getSourceString(MIXSRC_FIRST_INPUT + input), BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), getSourceString(MIXSRC_FIRST_INPUT + input), BUTTON_BACKGROUND, CENTERED);
while (inputIndex < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) {
Button * button = new InputLineButton(window, grid.getFieldSlot(), inputIndex);
if (focusIndex == inputIndex)
@@ -497,7 +496,7 @@ void ModelInputsPage::build(FormWindow * window, int8_t focusIndex)
grid.nextLine();
window->setLastField();
// window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+1 -1
View File
@@ -41,7 +41,7 @@ class ModelInputsPage: public PageTab {
class CommonInputOrMixButton : public Button {
public:
CommonInputOrMixButton(Window * parent, const rect_t & rect, uint8_t index):
CommonInputOrMixButton(FormGroup * parent, const rect_t & rect, uint8_t index):
Button(parent, rect),
index(index)
{
@@ -64,14 +64,14 @@ class LogicalSwitchEditPage: public Page {
{
Page::checkEvents();
if (active != isActive()) {
headerSwitchName->setFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
headerSwitchName->setTextFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
active = !active;
}
}
void buildHeader(Window * window) {
new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, STR_MENULOGICALSWITCHES, MENU_COLOR);
headerSwitchName = new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, getSwitchPositionName(SWSRC_SW1 + index), MENU_COLOR);
new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, STR_MENULOGICALSWITCHES, 0, MENU_COLOR);
headerSwitchName = new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, getSwitchPositionName(SWSRC_SW1 + index), 0, MENU_COLOR);
}
void updateLogicalSwitchOneWindow(FormField * functionChoice)
@@ -82,8 +82,6 @@ class LogicalSwitchEditPage: public Page {
LogicalSwitchData * cs = lswAddress(index);
uint8_t cstate = lswFamily(cs->func);
FormField::setCurrentField(functionChoice);
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1);
auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v1));
@@ -190,7 +188,7 @@ class LogicalSwitchEditPage: public Page {
}
grid.nextLine();
FormField::link(FormField::getCurrentField(), functionChoice);
// FormField::link(FormField::getCurrentField(), functionChoice);
}
void buildBody(FormWindow * window)
@@ -237,7 +235,7 @@ static constexpr coord_t col3 = ((LCD_W - 100) / 3) * 2 + col1;
class LogicalSwitchButton : public Button {
public:
LogicalSwitchButton(Window * parent, const rect_t & rect, int lsIndex):
LogicalSwitchButton(FormGroup * parent, const rect_t & rect, int lsIndex):
Button(parent, rect),
lsIndex(lsIndex),
active(isActive())
@@ -362,7 +360,7 @@ void ModelLogicalSwitchesPage::build(FormWindow * window, int8_t focusIndex)
grid.spacer(button->height() + 5);
}
else {
new StaticText(window, grid.getLabelSlot(), getSwitchPositionName(SWSRC_SW1 + i), BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), getSwitchPositionName(SWSRC_SW1 + i), BUTTON_BACKGROUND, CENTERED);
auto button = new LogicalSwitchButton(window, grid.getFieldSlot(), i);
button->setPressHandler([=]() {
@@ -401,6 +399,6 @@ void ModelLogicalSwitchesPage::build(FormWindow * window, int8_t focusIndex)
grid.nextLine();
window->setLastField();
// window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+57 -55
View File
@@ -23,6 +23,7 @@
#include "libopenui.h"
#include "bitfield.h"
#include "model_inputs.h"
#include "gvar_numberedit.h"
#define SET_DIRTY() storageDirty(EE_MODEL)
@@ -67,52 +68,15 @@ class MixEditWindow : public Page {
protected:
uint8_t channel;
uint8_t mixIndex;
Window * updateCurvesWindow = nullptr;
Choice * curveTypeChoice = nullptr;
FormGroup * curveParamField = nullptr;
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MIXER, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MIXER, 0, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), 0, MENU_COLOR);
}
void updateCurves()
{
FormGridLayout grid;
updateCurvesWindow->clear();
MixData * line = mixAddress(mixIndex);
new StaticText(updateCurvesWindow, grid.getLabelSlot(), STR_CURVE);
curveTypeChoice = new Choice(updateCurvesWindow, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, CURVE_REF_CUSTOM,
GET_DEFAULT(line->curve.type),
[=](int32_t newValue) {
line->curve.type = newValue;
line->curve.value = 0;
SET_DIRTY();
updateCurves();
curveTypeChoice->setFocus();
});
switch (line->curve.type) {
case CURVE_REF_DIFF:
case CURVE_REF_EXPO: {
// TODO GVAR
NumberEdit * edit = new NumberEdit(updateCurvesWindow, grid.getFieldSlot(2, 1), -100, 100,
GET_SET_DEFAULT(line->curve.value));
edit->setSuffix("%");
break;
}
case CURVE_REF_FUNC:
new Choice(updateCurvesWindow, grid.getFieldSlot(2, 1), STR_VCURVEFUNC, 0, CURVE_BASE - 1, GET_SET_DEFAULT(line->curve.value));
break;
case CURVE_REF_CUSTOM:
//new CustomCurveChoice(updateCurvesWindow, grid.getFieldSlot(2, 1), -MAX_CURVES, MAX_CURVES, GET_SET_DEFAULT(line->curve.value));
break;
}
}
void buildBody(Window * window)
void buildBody(FormWindow * window)
{
FormGridLayout grid;
grid.spacer(8);
@@ -131,15 +95,14 @@ class MixEditWindow : public Page {
// Weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT);
// TODO GVAR ?
NumberEdit * edit = new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(mix->weight));
edit->setSuffix("%");
auto gvar = new GVarNumberEdit(window, grid.getFieldSlot(), MIX_WEIGHT_MIN, MIX_WEIGHT_MAX, GET_SET_DEFAULT(mix->weight));
gvar->setSuffix("%");
grid.nextLine();
// Offset
new StaticText(window, grid.getLabelSlot(), STR_OFFSET);
edit = new NumberEdit(window, grid.getFieldSlot(), GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, GET_SET_DEFAULT(mix->offset));
edit->setSuffix("%");
gvar = new GVarNumberEdit(window, grid.getFieldSlot(), MIX_OFFSET_MIN, MIX_OFFSET_MAX, GET_SET_DEFAULT(mix->offset));
gvar->setSuffix("%");
grid.nextLine();
// Trim
@@ -148,9 +111,18 @@ class MixEditWindow : public Page {
grid.nextLine();
// Curve
updateCurvesWindow = new Window(window, {0, grid.getWindowHeight(), LCD_W, 0});
updateCurves();
grid.addWindow(updateCurvesWindow);
new StaticText(&body, grid.getLabelSlot(), STR_CURVE);
new Choice(&body, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, CURVE_REF_CUSTOM,
GET_DEFAULT(mix->curve.type),
[=](int32_t newValue) {
mix->curve.type = newValue;
mix->curve.value = 0;
SET_DIRTY();
updateCurveParamField(mix);
});
curveParamField = new FormGroup(&body, grid.getFieldSlot(2, 1), FORM_FORWARD_FOCUS);
updateCurveParamField(mix);
grid.nextLine();
// Flight modes
new StaticText(window, grid.getLabelSlot(), STR_FLMODE);
@@ -175,7 +147,7 @@ class MixEditWindow : public Page {
// Warning
new StaticText(window, grid.getLabelSlot(), STR_MIXWARNING);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, 3, GET_SET_DEFAULT(mix->mixWarn));
auto edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, 3, GET_SET_DEFAULT(mix->mixWarn));
edit->setZeroText(STR_OFF);
grid.nextLine();
@@ -224,11 +196,42 @@ class MixEditWindow : public Page {
window->setInnerHeight(grid.getWindowHeight());
}
// TODO share this code with INPUT
void updateCurveParamField(MixData * line)
{
curveParamField->clear();
const rect_t rect = {0, 0, curveParamField->width(), curveParamField->height()};
switch (line->curve.type) {
case CURVE_REF_DIFF:
case CURVE_REF_EXPO:
{
GVarNumberEdit * edit = new GVarNumberEdit(curveParamField, rect, -100, 100, GET_SET_DEFAULT(line->curve.value));
edit->setSuffix("%");
break;
}
case CURVE_REF_FUNC:
new Choice(curveParamField, rect, STR_VCURVEFUNC, 0, CURVE_BASE - 1, GET_SET_DEFAULT(line->curve.value));
break;
case CURVE_REF_CUSTOM:
{
auto choice = new Choice(curveParamField, rect, nullptr, -MAX_CURVES, MAX_CURVES, GET_SET_DEFAULT(line->curve.value));
choice->setTextHandler([](int value) {
return getCurveString(value);
});
break;
}
}
}
};
class MixLineButton : public CommonInputOrMixButton {
public:
MixLineButton(Window * parent, const rect_t &rect, uint8_t index) :
MixLineButton(FormGroup * parent, const rect_t &rect, uint8_t index) :
CommonInputOrMixButton(parent, rect, index)
{
const MixData & mix = g_model.mixData[index];
@@ -247,11 +250,11 @@ class MixLineButton : public CommonInputOrMixButton {
const MixData & line = g_model.mixData[index];
// first line ...
drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight);
drawValueOrGVar(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, line.weight, MIX_WEIGHT_MIN, MIX_WEIGHT_MAX);
drawSource(dc, 60, FIELD_PADDING_TOP, line.srcRaw);
if (line.name[0]) {
dc->drawBitmap(146, FIELD_PADDING_TOP, mixerSetupLabelBitmap);
dc->drawBitmap(146, 2 + FIELD_PADDING_TOP, mixerSetupLabelBitmap);
dc->drawSizedText(166, FIELD_PADDING_TOP, line.name, sizeof(line.name));
}
@@ -330,7 +333,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
MixData * mix = g_model.mixData;
for (uint8_t ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) {
if (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) {
new StaticText(window, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch), BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch), BUTTON_BACKGROUND, CENTERED);
uint8_t count = 0;
while (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) {
Button * button = new MixLineButton(window, grid.getFieldSlot(), mixIndex);
@@ -436,7 +439,6 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
grid.nextLine();
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+5 -6
View File
@@ -39,11 +39,11 @@ class OutputEditWindow : public Page {
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENULIMITS, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENULIMITS, 0, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), 0, MENU_COLOR);
}
void buildBody(Window * window)
void buildBody(FormWindow * window)
{
FormGridLayout grid;
grid.spacer(8);
@@ -109,7 +109,7 @@ class OutputEditWindow : public Page {
class OutputLineButton : public Button {
public:
OutputLineButton(Window * parent, const rect_t &rect, LimitData * output) :
OutputLineButton(FormGroup * parent, const rect_t &rect, LimitData * output) :
Button(parent, rect),
output(output)
{
@@ -171,7 +171,7 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
LimitData * output = limitAddress(ch);
// Channel label
new StaticText(window, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch), BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch), BUTTON_BACKGROUND, CENTERED);
// Channel settings
Button * button = new OutputLineButton(window, grid.getFieldSlot(), output);
@@ -213,7 +213,6 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
grid.nextLine();
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+26 -58
View File
@@ -36,6 +36,7 @@ class ChannelFailsafeBargraph: public Window {
void checkEvents() override
{
invalidate();
Window::checkEvents();
}
void paint(BitmapBuffer * dc) override
@@ -63,10 +64,10 @@ class ChannelFailsafeBargraph: public Window {
uint8_t channel;
};
class FailSafeBody : public Window {
class FailSafeBody : public FormGroup {
public:
FailSafeBody(Window * parent, const rect_t &rect, uint8_t moduleIdx) :
Window(parent, rect),
FailSafeBody(FormGroup * parent, const rect_t & rect, uint8_t moduleIdx) :
FormGroup(parent, rect),
moduleIdx(moduleIdx)
{
build();
@@ -75,6 +76,7 @@ class FailSafeBody : public Window {
void checkEvents() override
{
invalidate();
FormGroup::checkEvents();
}
void build()
@@ -118,7 +120,7 @@ class FailSafeBody : public Window {
class FailSafeFooter : public Window {
public:
FailSafeFooter(Window * parent, const rect_t &rect) :
FailSafeFooter(Window * parent, const rect_t & rect) :
Window(parent, rect)
{
}
@@ -128,18 +130,14 @@ class FailSafeFooter : public Window {
}
};
class FailSafePage : public PageTab {
class FailSafePage : public Page {
public:
explicit FailSafePage(uint8_t moduleIdx) :
PageTab("FAILSAFE", ICON_STATS_ANALOGS),
Page(ICON_STATS_ANALOGS),
moduleIdx(moduleIdx)
{
}
void build(FormWindow * window) override
{
new FailSafeBody(window, {0, 0, LCD_W, window->height() - footerHeight}, moduleIdx );
new FailSafeFooter(window, {0, window->height() - footerHeight, LCD_W, footerHeight});
new FailSafeBody(&body, {0, 0, LCD_W, height() - footerHeight}, moduleIdx);
new FailSafeFooter(&body, {0, height() - footerHeight, LCD_W, footerHeight});
}
protected:
@@ -147,12 +145,6 @@ class FailSafePage : public PageTab {
uint8_t moduleIdx;
};
FailSafeMenu::FailSafeMenu(uint8_t moduleIdx) :
TabsGroup(ICON_MODEL)
{
addTab(new FailSafePage(moduleIdx));
}
class RegisterDialog: public Dialog {
public:
explicit RegisterDialog(uint8_t moduleIdx):
@@ -206,7 +198,7 @@ class RegisterDialog: public Dialog {
if (!rxName && reusableBuffer.moduleSetup.pxx2.registerStep >= REGISTER_RX_NAME_RECEIVED) {
rect_t rect = waiting->getRect();
waiting->deleteLater();
FormField::clearCurrentField();
rxName = new TextEdit(this, rect, reusableBuffer.moduleSetup.pxx2.registerRxName, PXX2_LEN_RX_NAME);
rect = exitButton->getRect();
auto okButton = new TextButton(this, rect, "OK",
@@ -334,7 +326,7 @@ void BindWaitDialog::checkEvents()
class ReceiverButton: public TextButton {
public:
ReceiverButton(Window * parent, rect_t rect, uint8_t moduleIdx, uint8_t receiverIdx):
ReceiverButton(FormGroup * parent, rect_t rect, uint8_t moduleIdx, uint8_t receiverIdx):
TextButton(parent, rect, STR_BIND, [=]() {
if (g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx][0] == '\0') {
startBind();
@@ -428,10 +420,10 @@ class ReceiverButton: public TextButton {
uint8_t receiverIdx;
};
class ModuleWindow : public Window {
class ModuleWindow : public FormGroup {
public:
ModuleWindow(Window * parent, const rect_t &rect, uint8_t moduleIdx) :
Window(parent, rect, FORWARD_SCROLL),
ModuleWindow(FormWindow * parent, const rect_t &rect, uint8_t moduleIdx) :
FormGroup(parent, rect, FORWARD_SCROLL | FORM_FORWARD_FOCUS),
moduleIdx(moduleIdx)
{
update();
@@ -446,7 +438,6 @@ class ModuleWindow : public Window {
uint8_t moduleIdx;
Choice * moduleChoice = nullptr;
Choice * rfChoice = nullptr;
FormField * lastField = nullptr; // moduleChoice is always the firstField
TextButton * bindButton = nullptr;
TextButton * rangeButton = nullptr;
TextButton * registerButton = nullptr;
@@ -488,12 +479,7 @@ class ModuleWindow : public Window {
{
FormGridLayout grid;
grid.setLabelWidth(175);
FormField * previousField = moduleChoice ? moduleChoice->getPreviousField() : moduleChoice->getCurrentField();
FormField * nextField = lastField ? lastField->getNextField() : nullptr;
clear();
FormField::clearCurrentField();
// Module Type
new StaticText(this, grid.getLabelSlot(true), STR_MODE);
@@ -510,7 +496,6 @@ class ModuleWindow : public Window {
moduleChoice->setAvailableHandler([=](int8_t moduleType) {
return moduleIdx == INTERNAL_MODULE ? isInternalModuleAvailable(moduleType) : isExternalModuleAvailable(moduleType);
});
FormField::link(previousField, moduleChoice);
// Module parameters
if (isModuleXJT(moduleIdx)) {
@@ -754,7 +739,7 @@ class ModuleWindow : public Window {
if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_CUSTOM) {
new TextButton(this, grid.getFieldSlot(2, 1), STR_SET,
[=]() -> uint8_t {
new FailSafeMenu(moduleIdx);
new FailSafePage(moduleIdx);
return 1;
});
}
@@ -812,10 +797,6 @@ class ModuleWindow : public Window {
getParent()->moveWindowsTop(top(), adjustHeight());
getParent()->invalidate(); // TODO should be automatically done
lastField = FormField::getCurrentField();
if (nextField)
FormField::link(lastField, nextField);
}
};
@@ -860,8 +841,7 @@ void ModelSetupPage::build(FormWindow * window)
// Model name
new StaticText(window, grid.getLabelSlot(), STR_MODELNAME);
auto first = new TextEdit(window, grid.getFieldSlot(), g_model.header.name, sizeof(g_model.header.name));
window->setFirstField(first);
new TextEdit(window, grid.getFieldSlot(), g_model.header.name, sizeof(g_model.header.name));
grid.nextLine();
// Bitmap
@@ -891,8 +871,7 @@ void ModelSetupPage::build(FormWindow * window)
// Timer name
new StaticText(window, grid.getLabelSlot(true), STR_NAME);
grid.nextLine();
auto nameEdit = new TextEdit(group, timerGrid.getSlot(), timer->name, LEN_TIMER_NAME);
group->setFirstField(nameEdit);
new TextEdit(group, timerGrid.getSlot(), timer->name, LEN_TIMER_NAME);
timerGrid.nextLine();
// Timer mode
@@ -924,8 +903,7 @@ void ModelSetupPage::build(FormWindow * window)
// Timer persistent
new StaticText(window, grid.getLabelSlot(true), STR_PERSISTENT);
grid.nextLine();
auto persistentChoice = new Choice(group, timerGrid.getSlot(), STR_VPERSISTENT, 0, 2, GET_SET_DEFAULT(timer->persistent));
group->setLastField(persistentChoice);
new Choice(group, timerGrid.getSlot(), STR_VPERSISTENT, 0, 2, GET_SET_DEFAULT(timer->persistent));
timerGrid.nextLine();
coord_t height = timerGrid.getWindowHeight() - 1;
@@ -1019,10 +997,6 @@ void ModelSetupPage::build(FormWindow * window)
button->setText(getSwitchWarningString(i));
return newstate > 0;
});
if (i == 0)
group->setFirstField(button);
else if (i == NUM_SWITCHES - 1)
group->setLastField(button);
}
grid.addWindow(group);
}
@@ -1037,17 +1011,13 @@ void ModelSetupPage::build(FormWindow * window)
if (i > 0 && (i % 6) == 0)
centerGrid.nextLine();
auto button = new TextButton(group, centerGrid.getSlot(6, i % 6), getStringAtIndex(s, STR_RETA123, i),
[=]() -> uint8_t {
BFBIT_FLIP(g_model.beepANACenter, bfBit<BeepANACenter>(i));
SET_DIRTY();
return bfSingleBitGet<BeepANACenter>(g_model.beepANACenter, i);
},
bfSingleBitGet(g_model.beepANACenter, i) ? BUTTON_CHECKED : 0);
if (i == 0)
group->setFirstField(button);
else if (i == NUM_STICKS + NUM_POTS + NUM_SLIDERS - 1)
group->setLastField(button);
new TextButton(group, centerGrid.getSlot(6, i % 6), getStringAtIndex(s, STR_RETA123, i),
[=]() -> uint8_t {
BFBIT_FLIP(g_model.beepANACenter, bfBit<BeepANACenter>(i));
SET_DIRTY();
return bfSingleBitGet<BeepANACenter>(g_model.beepANACenter, i);
},
bfSingleBitGet(g_model.beepANACenter, i) ? BUTTON_CHECKED : 0);
}
grid.addWindow(group);
}
@@ -1071,8 +1041,6 @@ void ModelSetupPage::build(FormWindow * window)
grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, EXTERNAL_MODULE));
}
FormField::link(FormField::getCurrentField(), first);
grid.nextLine();
window->setInnerHeight(grid.getWindowHeight());
-8
View File
@@ -20,14 +20,6 @@
#include "tabsgroup.h"
class FailSafeMenu: public TabsGroup {
public:
FailSafeMenu(uint8_t moduleIndex);
};
class TextButton;
class ModuleWindow;
class ModelSetupPage: public PageTab {
public:
ModelSetupPage();
+15 -24
View File
@@ -50,7 +50,7 @@ class SensorSourceChoice : public SourceChoice {
class SensorButton : public Button {
public:
SensorButton(Window * parent, const rect_t &rect, uint8_t index, uint8_t number) :
SensorButton(FormGroup * parent, const rect_t &rect, uint8_t index, uint8_t number) :
Button(parent, rect),
index(index),
number(number)
@@ -121,13 +121,13 @@ class SensorEditWindow : public Page {
protected:
uint8_t index;
Window * sensorParametersWindow = nullptr;
FormWindow * sensorParametersWindow = nullptr;
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_SENSOR + std::to_string(index + 1), MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_SENSOR + std::to_string(index + 1), 0, MENU_COLOR);
// dynamic display of sensor value ?
//new StaticText(window, {70, 28, 100, 20}, "SF" + std::to_string(index), MENU_COLOR);
//new StaticText(window, {70, 28, 100, 20}, "SF" + std::to_string(index), 0, MENU_COLOR);
}
void updateSensorParametersWindow()
@@ -164,9 +164,9 @@ class SensorEditWindow : public Page {
}
else {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ID);
auto hex = new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 0), 0, 0xffff, GET_SET_DEFAULT(sensor->id));
auto hex = new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 0), 0, 0xFFFF, GET_SET_DEFAULT(sensor->id));
hex->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
drawHexNumber(dc, 2, 2, value, 0);
drawHexNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, 0);
});
new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 1), 0, 0xff, GET_SET_DEFAULT(sensor->instance));
grid.nextLine();
@@ -329,8 +329,7 @@ class SensorEditWindow : public Page {
// Sensor name
new StaticText(window, grid.getLabelSlot(), STR_NAME);
auto edit = new TextEdit(window, grid.getFieldSlot(), sensor->label, sizeof(sensor->label));
window->setFirstField(edit);
new TextEdit(window, grid.getFieldSlot(), sensor->label, sizeof(sensor->label));
grid.nextLine();
// Type
@@ -349,7 +348,7 @@ class SensorEditWindow : public Page {
});
grid.nextLine();
sensorParametersWindow = new Window(window, {0, grid.getWindowHeight(), LCD_W, 0});
sensorParametersWindow = new FormWindow(window, {0, grid.getWindowHeight(), LCD_W, 0});
updateSensorParametersWindow();
grid.addWindow(sensorParametersWindow);
@@ -394,7 +393,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
{
FormGridLayout grid;
grid.spacer(8);
grid.setLabelWidth(250);
grid.setLabelWidth(170);
this->window = window;
@@ -411,7 +410,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getWarningRssi(), flags);
});
window->setFirstField(edit);
// window->setFirstField(edit);
grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_CRITICALALARM);
@@ -432,9 +431,9 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
// Sensors columns titles
uint8_t sensorsCount = getTelemetrySensorsCount();
if (sensorsCount > 0) {
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, SMLSIZE | TEXT_DISABLE_COLOR);
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, 0, SMLSIZE | TEXT_DISABLE_COLOR);
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL()) {
new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, SMLSIZE | TEXT_DISABLE_COLOR);
new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, 0, SMLSIZE | TEXT_DISABLE_COLOR);
}
}
@@ -479,12 +478,8 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
}
}
grid.setLabelWidth(250);
// Autodiscover button
auto rect = grid.getLabelSlot(true);
rect.w -= MENUS_MARGIN_LEFT;
auto discover = new TextButton(window, rect, STR_DISCOVER_SENSORS);
auto discover = new TextButton(window, grid.getFieldSlot(2, 0), STR_DISCOVER_SENSORS);
discover->setPressHandler([=]() {
allowNewSensors = !allowNewSensors;
if (allowNewSensors) {
@@ -498,7 +493,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
});
// New sensor button
new TextButton(window, grid.getFieldSlot(), STR_TELEMETRY_NEWSENSOR,
new TextButton(window, grid.getFieldSlot(2, 1), STR_TELEMETRY_NEWSENSOR,
[=]() -> uint8_t {
int idx = availableTelemetryIndex();
if (idx >= 0)
@@ -509,7 +504,6 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
});
grid.nextLine();
grid.setLabelWidth(PAGE_PADDING + PAGE_INDENT_WIDTH);
if (sensorsCount > 0) {
// Delete all sensors button
new TextButton(window, grid.getFieldSlot(), STR_DELETE_ALL_SENSORS,
@@ -525,7 +519,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
}
// Ignore instance button
grid.setLabelWidth(250);
grid.setLabelWidth(170);
new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.ignoreSensorIds));
grid.nextLine();
@@ -557,8 +551,5 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
new Choice(window, grid.getFieldSlot(3, 2), STR_VVARIOCENTER, 0, 1, GET_SET_DEFAULT(g_model.varioData.centerSilent));
grid.nextLine();
grid.nextLine();
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+9 -2
View File
@@ -23,7 +23,7 @@
#include "opentx.h"
PageHeader::PageHeader(Page * parent, uint8_t icon):
Window(parent, { 0, 0, LCD_W, MENU_HEADER_HEIGHT }, OPAQUE),
FormGroup(parent, { 0, 0, LCD_W, MENU_HEADER_HEIGHT }, OPAQUE),
icon(icon)
#if defined(HARDWARE_TOUCH)
, back(this, { 0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH }, ICON_BACK,
@@ -35,6 +35,13 @@ PageHeader::PageHeader(Page * parent, uint8_t icon):
{
}
PageHeader::~PageHeader()
{
#if defined(HARDWARE_TOUCH)
back.detach();
#endif
}
void PageHeader::paint(BitmapBuffer * dc)
{
static_cast<ThemeBase *>(theme)->drawMenuBackground(dc, getIcon(), "");
@@ -47,7 +54,7 @@ Page::Page(unsigned icon):
body(this, { 0, MENU_HEADER_HEIGHT, LCD_W, LCD_H - MENU_HEADER_HEIGHT }),
previousFocus(focusWindow)
{
setFocus();
clearFocus();
}
Page::~Page()
+3 -1
View File
@@ -25,10 +25,12 @@
class Page;
class PageHeader: public Window {
class PageHeader: public FormGroup {
public:
PageHeader(Page * parent, uint8_t icon);
~PageHeader();
void paint(BitmapBuffer * dc) override;
uint8_t getIcon() const
@@ -169,6 +169,5 @@ void RadioHardwarePage::build(FormWindow * window)
});
grid.nextLine();
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+6 -12
View File
@@ -28,19 +28,11 @@ RadioSdManagerPage::RadioSdManagerPage() :
{
}
void RadioSdManagerPage::rebuild(FormWindow *window)
{
coord_t scrollPosition = window->getScrollPositionY();
window->clear();
build(window);
window->setScrollPositionY(scrollPosition);
}
// TODO elsewhere
extern bool compare_nocase(const std::string &first, const std::string &second);
char *getFullPath(const std::string &filename)
char * getFullPath(const std::string &filename)
{
static char full_path[FF_MAX_LFN + 1]; // TODO optimize that!
f_getcwd(full_path, FF_MAX_LFN);
@@ -118,7 +110,7 @@ class FlashModuleDialog: public FullScreenDialog
Progress progress;
};
void RadioSdManagerPage::build(FormWindow *window)
void RadioSdManagerPage::build(FormWindow * window)
{
FormGridLayout grid;
grid.spacer(PAGE_PADDING);
@@ -224,7 +216,10 @@ void RadioSdManagerPage::build(FormWindow *window)
});
menu->addLine(STR_DELETE_FILE, [=]() {
f_unlink(getFullPath(name));
rebuild(window);
// coord_t scrollPosition = window->getScrollPositionY();
window->clear();
build(window);
// window->setScrollPositionY(scrollPosition);
});
}
return 0;
@@ -236,7 +231,6 @@ void RadioSdManagerPage::build(FormWindow *window)
}
}
window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
preview->setHeight(max(window->height(), grid.getWindowHeight()));
}
+23 -30
View File
@@ -25,22 +25,22 @@
#define SET_DIRTY() storageDirty(EE_GENERAL)
class DateTimeWindow : public Window {
class DateTimeWindow : public FormGroup {
public:
DateTimeWindow(Window * parent, const rect_t &rect) :
Window(parent, rect, FORWARD_SCROLL)
DateTimeWindow(FormGroup * parent, const rect_t & rect) :
FormGroup(parent, rect, FORWARD_SCROLL | FORM_FORWARD_FOCUS)
{
build();
}
~DateTimeWindow()
~DateTimeWindow() override
{
deleteChildren();
}
void checkEvents() override
{
Window::checkEvents();
FormGroup::checkEvents();
if (get_tmr10ms() - lastRefresh > 100) {
invalidate();
@@ -48,14 +48,8 @@ class DateTimeWindow : public Window {
}
}
FormField * getFirstField()
{
return firstField;
}
protected:
tmr10ms_t lastRefresh = 0;
FormField * firstField = nullptr;
void build()
{
@@ -63,7 +57,7 @@ class DateTimeWindow : public Window {
// Date
new StaticText(this, grid.getLabelSlot(), STR_DATE);
firstField = new NumberEdit(this, grid.getFieldSlot(3, 0), 2018, 2100,
new NumberEdit(this, grid.getFieldSlot(3, 0), 2018, 2100,
[=]() -> int32_t {
struct gtm t;
gettime(&t);
@@ -114,8 +108,7 @@ class DateTimeWindow : public Window {
});
grid.nextLine();
//Time
// Time
new StaticText(this, grid.getLabelSlot(), STR_TIME);
auto hour = new NumberEdit(this, grid.getFieldSlot(3, 0), 0, 24,
[=]() -> int32_t {
@@ -164,6 +157,7 @@ class DateTimeWindow : public Window {
seconds->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
});
grid.nextLine();
getParent()->moveWindowsTop(top(), adjustHeight());
}
@@ -182,7 +176,6 @@ void RadioSetupPage::build(FormWindow * window)
// Date and Time
auto timeWindow = new DateTimeWindow(window, {0, grid.getWindowHeight(), LCD_W, 0});
grid.addWindow(timeWindow);
window->setFirstField(timeWindow->getFirstField());
// Batt meter range - Range 3.0v to 16v
new StaticText(window, grid.getLabelSlot(), STR_BATTERY_RANGE);
@@ -251,22 +244,23 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine();
#if defined(VARIO)
new Subtitle(window, grid.getLabelSlot(), STR_VARIO);
grid.nextLine();
{
new Subtitle(window, grid.getLabelSlot(), STR_VARIO);
grid.nextLine();
// Vario volume
new StaticText(window, grid.getLabelSlot(true), TR_VOLUME);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_ZERO);
edit = new NumberEdit(window, grid.getFieldSlot(), VARIO_FREQUENCY_ZERO-400, VARIO_FREQUENCY_ZERO+400,
GET_DEFAULT(VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)),
SET_VALUE(g_eeGeneral.varioPitch, (newValue - VARIO_FREQUENCY_ZERO) / 10));
edit->setStep(10);
edit->setSuffix("Hz");
grid.nextLine();
// Vario volume
new StaticText(window, grid.getLabelSlot(true), TR_VOLUME);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_ZERO);
edit = new NumberEdit(window, grid.getFieldSlot(), VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400,
GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10)),
SET_VALUE(g_eeGeneral.varioPitch, (newValue - VARIO_FREQUENCY_ZERO) / 10));
edit->setStep(10);
edit->setSuffix("Hz");
grid.nextLine();
}
#endif
#if defined(HAPTIC)
@@ -465,6 +459,5 @@ void RadioSetupPage::build(FormWindow * window)
});
grid.nextLine();
FormField::link(FormField::getCurrentField(), timeWindow->getFirstField());
window->setInnerHeight(grid.getWindowHeight());
}
+5 -5
View File
@@ -155,7 +155,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
*ext = '\0';
label = getBasename(path);
}
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), label, [=]() -> uint8_t {
f_chdir("/SCRIPTS/TOOLS/");
//luaExec(path);
@@ -170,7 +170,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
#if defined(PXX2)
// PXX2 modules tools
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT, [=]() -> uint8_t {
new RadioSpectrumAnalyser(INTERNAL_MODULE);
return 0;
@@ -179,7 +179,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
}
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_POWER_METER_INT, [=]() -> uint8_t {
// new RadioPowerMeter(INTERNAL_MODULE);
return 0;
@@ -188,7 +188,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
}
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_EXT, [=]() -> uint8_t {
new RadioSpectrumAnalyser(EXTERNAL_MODULE);
return 0;
@@ -197,7 +197,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
}
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER)) {
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), "access", BUTTON_BACKGROUND, CENTERED);
new TextButton(window, grid.getFieldSlot(1), STR_POWER_METER_EXT, [=]() -> uint8_t {
// new RadioPowerMeter(EXTERNAL_MODULE);
return 0;
+7 -11
View File
@@ -42,14 +42,10 @@ void RadioTrainerPage::build(FormWindow * window)
for (uint8_t i=0; i<NUM_STICKS; i++) {
uint8_t chan = channelOrder(i+1);
TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1];
new StaticText(window, grid.getLabelSlot(), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)));
auto mode = new Choice(window, grid.getFieldSlot(3,0), STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode));
if(i == 0) {
window->setFirstField(mode);
}
auto perc = new NumberEdit(window, grid.getFieldSlot(3, 1), -125, 125, GET_SET_DEFAULT(td->studWeight));
perc->setSuffix("%");
new Choice(window, grid.getFieldSlot(3,0), STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode));
auto weight = new NumberEdit(window, grid.getFieldSlot(3, 1), -125, 125, GET_SET_DEFAULT(td->studWeight));
weight->setSuffix("%");
new Choice(window, grid.getFieldSlot(3,2), STR_TRNCHN, 0, 3, GET_SET_DEFAULT(td->srcChn));
grid.nextLine();
}
@@ -66,11 +62,11 @@ void RadioTrainerPage::build(FormWindow * window)
// Trainer calibration
new StaticText(window, grid.getLabelSlot(), STR_CAL);
for (int i=0; i<4; i++) {
#if defined (PPM_UNIT_PERCENT_PREC1)
auto calib = new NumberEdit(window, grid.getFieldSlot(4,i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2; }, nullptr, LEFT|PREC1);
for (int i = 0; i < NUM_STICKS; i++) {
#if defined (PPM_UNIT_PERCENT_PREC1)
auto calib = new NumberEdit(window, grid.getFieldSlot(4, i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i]) * 2; }, nullptr, LEFT|PREC1);
#else
auto calib = new NumberEdit(window, grid.getFieldSlot(4,i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i])/5; }, nullptr, LEFT);
auto calib = new NumberEdit(window, grid.getFieldSlot(4, i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i]) / 5; }, nullptr, LEFT);
#endif
calib->setWindowFlags(REFRESH_ALWAYS);
+3 -3
View File
@@ -149,7 +149,7 @@ void ScreenSetupPage::build(FormWindow * window)
grid.nextLine();
// Dynamic options window...
optionsWindow = new Window(window, {0, grid.getWindowHeight(), LCD_W, 0}, FORWARD_SCROLL);
optionsWindow = new FormGroup(window, {0, grid.getWindowHeight(), LCD_W, 0}, FORWARD_SCROLL);
grid.addWindow(optionsWindow);
updateLayoutOptions();
}
@@ -158,7 +158,7 @@ void ScreenSetupPage::updateLayoutOptions()
{
FormGridLayout grid;
optionsWindow->clear();
FormField::setCurrentField(setupWidgetsButton); // next field will be linked to this button
// FormField::setCurrentField(setupWidgetsButton); // next field will be linked to this button
auto screen = customScreens[pageIndex];
@@ -203,5 +203,5 @@ void ScreenSetupPage::updateLayoutOptions()
optionsWindow->adjustHeight();
optionsWindow->getParent()->adjustInnerHeight();
FormField::link(FormField::getCurrentField(), layoutChoice);
// FormField::link(FormField::getCurrentField(), layoutChoice);
}
+1 -1
View File
@@ -40,7 +40,7 @@ class ScreenSetupPage: public PageTab {
protected:
ScreenMenu * menu;
uint8_t pageIndex;
Window * optionsWindow = nullptr;
FormGroup * optionsWindow = nullptr;
TextButton * setupWidgetsButton = nullptr;
FormField * layoutChoice = nullptr;
+7 -7
View File
@@ -37,7 +37,7 @@ class SpecialFunctionEditPage : public Page {
protected:
CustomFunctionData * functions;
uint8_t index;
Window * specialFunctionOneWindow = nullptr;
FormWindow * specialFunctionOneWindow = nullptr;
StaticText * headerSF = nullptr;
bool active = false;
@@ -51,7 +51,7 @@ class SpecialFunctionEditPage : public Page {
Page::checkEvents();
if (active != isActive()) {
invalidate();
headerSF->setFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
headerSF->setTextFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
active = !active;
}
}
@@ -70,7 +70,7 @@ class SpecialFunctionEditPage : public Page {
CustomFunctionData * cfn = &functions[index];
uint8_t func = CFN_FUNC(cfn);
FormField::setCurrentField(previousField);
// FormField::setCurrentField(previousField);
// Func param
switch (func) {
@@ -199,7 +199,7 @@ class SpecialFunctionEditPage : public Page {
});
}
FormField::link(FormField::getCurrentField(), nextField);
// FormField::link(FormField::getCurrentField(), nextField);
}
void buildBody(FormWindow * window)
@@ -235,7 +235,7 @@ class SpecialFunctionEditPage : public Page {
});
grid.nextLine();
specialFunctionOneWindow = new Window(window, {0, grid.getWindowHeight(), LCD_W, 0});
specialFunctionOneWindow = new FormWindow(window, {0, grid.getWindowHeight(), LCD_W, 0});
updateSpecialFunctionOneWindow(functionChoice, switchChoice);
grid.addWindow(specialFunctionOneWindow);
}
@@ -438,7 +438,7 @@ void SpecialFunctionsPage::build(FormWindow * window, int8_t focusIndex)
grid.spacer(button->height() + 5);
}
else {
new StaticText(window, grid.getLabelSlot(), s, BUTTON_BACKGROUND | CENTERED);
new StaticText(window, grid.getLabelSlot(), s, BUTTON_BACKGROUND, CENTERED);
auto button = new SpecialFunctionButton(window, grid.getFieldSlot(), functions, i);
button->setPressHandler([=]() {
@@ -494,6 +494,6 @@ void SpecialFunctionsPage::build(FormWindow * window, int8_t focusIndex)
grid.nextLine();
window->setLastField();
// window->setLastField();
window->setInnerHeight(grid.getWindowHeight());
}
+12 -3
View File
@@ -28,7 +28,7 @@
#include "opentx.h" // TODO for constants...
TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
Window(parent, { 0, 0, LCD_W, MENU_BODY_TOP }, OPAQUE),
FormGroup(parent, { 0, 0, LCD_W, MENU_BODY_TOP }, OPAQUE),
#if defined(HARDWARE_TOUCH)
back(this, { 0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH }, ICON_BACK,
[=]() -> uint8_t {
@@ -41,6 +41,14 @@ TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
{
}
TabsGroupHeader::~TabsGroupHeader()
{
#if defined(HARDWARE_TOUCH)
back.detach();
#endif
carousel.detach();
}
void TabsGroupHeader::paint(BitmapBuffer * dc)
{
static_cast<ThemeBase *>(theme)->drawMenuBackground(dc, icon, title);
@@ -123,14 +131,15 @@ void TabsGroup::removeAllTabs()
void TabsGroup::setVisibleTab(PageTab * tab)
{
if (tab != currentTab) {
setFocus();
FormField::clearCurrentField();
clearFocus();
body.clear();
#if defined(HARDWARE_TOUCH)
Keyboard::hide();
#endif
currentTab = tab;
tab->build(&body);
if (!focusWindow)
setFocus();
header.setTitle(tab->title.c_str());
invalidate();
}
+3 -1
View File
@@ -109,12 +109,14 @@ class TabsCarousel: public Window {
uint8_t currentIndex = 0;
};
class TabsGroupHeader: public Window {
class TabsGroupHeader: public FormGroup {
friend class TabsGroup;
public:
TabsGroupHeader(TabsGroup * menu, uint8_t icon);
~TabsGroupHeader();
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
+1 -1
View File
@@ -131,7 +131,7 @@ int getMainViewsCount()
ViewMain * ViewMain::instance = nullptr;
ViewMain::ViewMain(bool icons):
Window(&mainWindow, { 0, 0, LCD_W, LCD_H })
FormWindow(&mainWindow, { 0, 0, LCD_W, LCD_H })
{
instance = this;
focusWindow = this;
+2 -2
View File
@@ -21,9 +21,9 @@
#ifndef _VIEW_MAIN_H_
#define _VIEW_MAIN_H_
#include "window.h"
#include "form.h"
class ViewMain: public Window {
class ViewMain: public FormWindow {
public:
explicit ViewMain(bool icons = true);
@@ -206,7 +206,7 @@ void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t e
{
u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight);
weight.word = GVAR_MENU_ITEM(x, y, weight.word, GV_RANGELARGE_WEIGHT_NEG, GV_RANGELARGE_WEIGHT, attr, 0, event);
weight.word = GVAR_MENU_ITEM(x, y, weight.word, MIX_WEIGHT_MIN, MIX_WEIGHT_MAX, attr, 0, event);
MD_UNION_TO_WEIGHT(weight, md);
}
@@ -220,7 +220,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)
{
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || (flags && s_editMode > 0))
if (g_eeGeneral.anaNames[idx][0] || (flags && s_editMode > 0))
editName(x, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, flags);
else
lcdDrawMMM(x, y, flags);
+1 -1
View File
@@ -21,7 +21,7 @@
#include "opentx.h"
MenuHandlerFunc menuHandlers[5];
uint8_t menuEvent = 0;
event_t menuEvent = 0;
uint8_t menuVerticalPositions[4];
uint8_t menuLevel = 0;
+1 -1
View File
@@ -36,7 +36,7 @@ extern uint8_t menuCalibrationState;
extern MenuHandlerFunc menuHandlers[5];
extern uint8_t menuVerticalPositions[4];
extern uint8_t menuLevel;
extern uint8_t menuEvent;
extern event_t menuEvent;
void chainMenu(MenuHandlerFunc newMenu);
void pushMenu(MenuHandlerFunc newMenu);
+4 -3
View File
@@ -36,9 +36,10 @@ void drawCurve(coord_t offset)
do {
point_t point = getPoint(i);
i++;
if (point.x == 0) break;
lcdDrawFilledRect(point.x-offset, point.y-1, 3, 3, SOLID, FORCE); // do markup square
} while (1);
if (point.x == 0)
break;
lcdDrawFilledRect(point.x - offset, point.y - 1, 3, 3, SOLID, FORCE); // do markup square
} while (true);
}
void menuModelCurvesAll(event_t event)
+1 -1
View File
@@ -413,7 +413,7 @@ void menuModelExposAll(event_t event)
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
LcdFlags attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, RIGHT | attr | (isExpoActive(i) ? BOLD : 0), 0, 0);
GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, -100, 100, RIGHT | attr | (isExpoActive(i) ? BOLD : 0), 0, 0);
displayExpoLine(y, ed);
if (s_copyMode) {
@@ -398,7 +398,7 @@ void menuRadioHardware(event_t event)
uint8_t shift = (2*idx);
uint8_t mask = (0x03 << shift);
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
if (g_eeGeneral.anaNames[NUM_STICKS+idx][0] || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
editName(HW_SETTINGS_COLUMN1, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
else
lcdDrawMMM(HW_SETTINGS_COLUMN1, y, menuHorizontalPosition==0 ? attr : 0);