Now uses the external libopenui

This commit is contained in:
Bertrand Songis
2019-10-02 14:41:52 +02:00
parent 5b568cd40c
commit 3e2cb83991
250 changed files with 76326 additions and 11869 deletions
-1
View File
@@ -2,7 +2,6 @@ set(GUI_SRC
${GUI_SRC}
lcd.cpp
splash.cpp
fonts.cpp
popups.cpp
widgets.cpp
startup_shutdown.cpp
-143
View File
@@ -1,143 +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 "opentx.h"
const unsigned char font_5x7[] = {
#include "font_05x07.lbm"
#if defined(TRANSLATIONS_DE)
#include "font_de_05x07.lbm"
#elif defined(TRANSLATIONS_CZ)
#include "font_cz_05x07.lbm"
#elif defined(TRANSLATIONS_ES)
#include "font_es_05x07.lbm"
#elif defined(TRANSLATIONS_FI)
#include "font_fi_05x07.lbm"
#elif defined(TRANSLATIONS_FR)
#include "font_fr_05x07.lbm"
#elif defined(TRANSLATIONS_IT)
#include "font_it_05x07.lbm"
#elif defined(TRANSLATIONS_PL)
#include "font_pl_05x07.lbm"
#elif defined(TRANSLATIONS_PT)
#include "font_pt_05x07.lbm"
#elif defined(TRANSLATIONS_SE)
#include "font_se_05x07.lbm"
#endif
};
#if defined(BOLD_SPECIFIC_FONT)
const unsigned char font_5x7_B[] = {
#include "font_05x07_B_compressed.lbm"
};
#endif
#if !defined(BOOT)
const unsigned char font_10x14[] = {
#include "font_10x14_compressed.lbm"
#if defined(TRANSLATIONS_DE)
#include "font_de_10x14.lbm"
#elif defined(TRANSLATIONS_CZ)
#include "font_cz_10x14.lbm"
#elif defined(TRANSLATIONS_ES)
#include "font_es_10x14.lbm"
#elif defined(TRANSLATIONS_FI)
#include "font_fi_10x14.lbm"
#elif defined(TRANSLATIONS_FR)
#include "font_fr_10x14.lbm"
#elif defined(TRANSLATIONS_IT)
#include "font_it_10x14.lbm"
#elif defined(TRANSLATIONS_PL)
#include "font_pl_10x14.lbm"
#elif defined(TRANSLATIONS_PT)
#include "font_pt_10x14.lbm"
#elif defined(TRANSLATIONS_SE)
#include "font_se_10x14.lbm"
#endif
};
#endif
#if !defined(BOOT)
const unsigned char font_3x5[] = {
#include "font_03x05.lbm"
};
const unsigned char font_4x6[] = {
#include "font_04x06.lbm"
#if defined(TRANSLATIONS_DE)
#include "font_de_04x06.lbm"
#elif defined(TRANSLATIONS_CZ)
#include "font_cz_04x06.lbm"
#elif defined(TRANSLATIONS_ES)
#include "font_es_04x06.lbm"
#elif defined(TRANSLATIONS_FI)
#include "font_fi_04x06.lbm"
#elif defined(TRANSLATIONS_FR)
#include "font_fr_04x06.lbm"
#elif defined(TRANSLATIONS_IT)
#include "font_it_04x06.lbm"
#elif defined(TRANSLATIONS_PL)
#include "font_pl_04x06.lbm"
#elif defined(TRANSLATIONS_PT)
#include "font_pt_04x06.lbm"
#elif defined(TRANSLATIONS_SE)
#include "font_se_04x06.lbm"
#endif
};
const unsigned char font_8x10[] = {
#include "font_08x10.lbm"
#if defined(TRANSLATIONS_DE)
#include "font_de_08x10.lbm"
#elif defined(TRANSLATIONS_CZ)
#include "font_cz_08x10.lbm"
#elif defined(TRANSLATIONS_ES)
#include "font_es_08x10.lbm"
#elif defined(TRANSLATIONS_FI)
#include "font_fi_08x10.lbm"
#elif defined(TRANSLATIONS_FR)
#include "font_fr_08x10.lbm"
#elif defined(TRANSLATIONS_IT)
#include "font_it_08x10.lbm"
#elif defined(TRANSLATIONS_PL)
#include "font_pl_08x10.lbm"
#elif defined(TRANSLATIONS_PT)
#include "font_pt_08x10.lbm"
#elif defined(TRANSLATIONS_SE)
#include "font_se_08x10.lbm"
#endif
};
const unsigned char font_22x38_num[] = {
#include "font_22x38_num.lbm"
};
const unsigned char font_4x6_extra[] = {
#include "font_04x06_extra.lbm"
};
const unsigned char font_5x7_extra[] = {
#include "font_05x07_extra.lbm"
};
const unsigned char font_10x14_extra[] = {
#include "font_10x14_extra.lbm"
};
#endif // !defined(BOOT)
-2
View File
@@ -187,8 +187,6 @@ choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char * label, LcdFlags attr, event_t event);
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
#if defined(GVARS)
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, editflags, event)
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);
+4 -5
View File
@@ -19,8 +19,9 @@
*/
#include "opentx.h"
#include "gui/common/stdlcd/fonts.h"
display_t displayBuf[DISPLAY_BUFFER_SIZE];
pixel_t displayBuf[DISPLAY_BUFFER_SIZE];
void lcdClear()
{
@@ -264,12 +265,10 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
q = &font_3x5[((uint16_t)c-0x20)*3];
lcdPutPattern(x, y, q, 3, 5, flags);
}
#if defined(BOLD_FONT)
else if (flags & BOLD) {
q = &font_5x7_B[c_remapped*5];
lcdPutPattern(x, y, q, 5, 7, flags);
}
#endif
else
#endif
{
@@ -604,7 +603,7 @@ void lcdDrawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat,
void drawTelemetryTopBar()
{
putsModelName(0, 0, g_model.header.name, g_eeGeneral.currModel, 0);
drawModelName(0, 0, g_model.header.name, g_eeGeneral.currModel, 0);
uint8_t att = (IS_TXBATT_WARNING() ? BLINK : 0);
putsVBat(14*FW,0,att);
if (g_model.timers[0].mode) {
@@ -776,7 +775,7 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
lcdDrawTextAtIndex(x, y, STR_RETA123, idx-1, att);
}
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
void drawModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
{
uint8_t len = sizeof(g_model.header.name);
while (len>0 && !name[len-1]) --len;
+7 -17
View File
@@ -23,14 +23,8 @@
#include <inttypes.h>
typedef int coord_t;
struct point_t
{
coord_t x;
coord_t y;
};
typedef uint32_t LcdFlags;
typedef uint8_t display_t;
typedef uint8_t pixel_t;
#define BOX_WIDTH 23
#define CENTER
@@ -48,11 +42,7 @@ typedef uint8_t display_t;
/* lcdDrawText flags */
#define BLINK 0x01
#define INVERS 0x02
#if defined(BOLD_FONT)
#define BOLD 0x40
#else
#define BOLD 0x00
#endif
#define BOLD 0x40
#define LEFT 0x00 /* fake */
#define RIGHT 0x04 /* align right */
#define CENTERED 0x20
@@ -95,7 +85,7 @@ typedef uint8_t display_t;
#define DISPLAY_BUFFER_SIZE (LCD_W*((LCD_H+7)/8))
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
extern pixel_t displayBuf[DISPLAY_BUFFER_SIZE];
extern coord_t lcdLastRightPos;
extern coord_t lcdLastLeftPos;
extern coord_t lcdNextPos;
@@ -127,7 +117,7 @@ void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags mode, uint8_t len);
void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags mode=0);
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val);
void putsModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att);
void drawModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att);
#if !defined(BOOT) // TODO not here ...
void drawSwitch(coord_t x, coord_t y, swsrc_t swtch, LcdFlags att=0);
void drawSource(coord_t x, coord_t y, mixsrc_t idx, LcdFlags att=0);
@@ -190,14 +180,14 @@ uint8_t * lcdLoadBitmap(uint8_t * dest, const char * filename, uint8_t width, ui
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
#endif
inline display_t getPixel(uint8_t x, uint8_t y)
inline pixel_t getPixel(uint8_t x, uint8_t y)
{
if (x>=LCD_W || y>=LCD_H) {
return 0;
}
display_t pixel = displayBuf[(y / 8) * LCD_W + x];
display_t mask = 1 << (y & 7);
pixel_t pixel = displayBuf[(y / 8) * LCD_W + x];
pixel_t mask = 1 << (y & 7);
return ((pixel & mask) ? 0xf : 0);
}
+1 -1
View File
@@ -247,7 +247,7 @@ void menuModelFlightModesAll(event_t event)
if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;
lcdDrawTextAlignedLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
lcdDrawText(LCD_W/2, (LCD_LINES-1)*FH+1, STR_CHECKTRIMS, CENTERED);
drawFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1);
if (sub==MAX_FLIGHT_MODES && !trimsCheckTimer) {
lcdInvertLastLine();
+1 -1
View File
@@ -103,7 +103,7 @@ void menuModelGVarOne(event_t event)
break;
case GVAR_FIELD_POPUP:
ON_OFF_MENU_ITEM(gvar->popup, GVAR_2ND_COLUMN, y, STR_POPUP, attr, event);
gvar->popup = editCheckBox(gvar->popup, GVAR_2ND_COLUMN, y, STR_POPUP, attr, event);
break;
default:
+1 -1
View File
@@ -307,7 +307,7 @@ void menuModelSelect(event_t event)
k %= MAX_MODELS;
if (eeModelExists(k)) {
putsModelName(4*FW, y, modelHeaders[k].name, k, 0);
drawModelName(4*FW, y, modelHeaders[k].name, k, 0);
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+menuVerticalOffset!=(vertpos_t)sub)) {
lcdDrawChar(1, y, '*');
}
+8 -8
View File
@@ -372,7 +372,7 @@ void menuModelSetup(event_t event)
#endif
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE + ITEM_MODEL_SETUP_LINES_COUNT);
title(STR_MENUSETUP);
title(STR_MENU_MODEL_SETUP);
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) {
memclear(&reusableBuffer.moduleSetup, sizeof(reusableBuffer.moduleSetup));
@@ -499,11 +499,11 @@ void menuModelSetup(event_t event)
}
case ITEM_MODEL_SETUP_EXTENDED_LIMITS:
ON_OFF_MENU_ITEM(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
g_model.extendedLimits = editCheckBox(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
break;
case ITEM_MODEL_SETUP_EXTENDED_TRIMS:
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
g_model.extendedTrims = editCheckBox(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_RESET_BTN, (menuHorizontalPosition>0 && !NO_HIGHLIGHT()) ? attr : 0);
if (attr && menuHorizontalPosition>0) {
s_editMode = 0;
@@ -527,7 +527,7 @@ void menuModelSetup(event_t event)
break;
case ITEM_MODEL_SETUP_THROTTLE_REVERSED:
ON_OFF_MENU_ITEM(g_model.throttleReversed, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLEREVERSE, attr, event ) ;
g_model.throttleReversed = editCheckBox(g_model.throttleReversed, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLEREVERSE, attr, event ) ;
break;
case ITEM_MODEL_SETUP_THROTTLE_TRACE:
@@ -544,7 +544,7 @@ void menuModelSetup(event_t event)
}
case ITEM_MODEL_SETUP_THROTTLE_TRIM:
ON_OFF_MENU_ITEM(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, STR_TTRIM, attr, event);
g_model.thrTrim = editCheckBox(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, STR_TTRIM, attr, event);
break;
case ITEM_MODEL_SETUP_PREFLIGHT_LABEL:
@@ -552,11 +552,11 @@ void menuModelSetup(event_t event)
break;
case ITEM_MODEL_SETUP_CHECKLIST_DISPLAY:
ON_OFF_MENU_ITEM(g_model.displayChecklist, MODEL_SETUP_2ND_COLUMN, y, STR_CHECKLIST, attr, event);
g_model.displayChecklist = editCheckBox(g_model.displayChecklist, MODEL_SETUP_2ND_COLUMN, y, STR_CHECKLIST, attr, event);
break;
case ITEM_MODEL_SETUP_THROTTLE_WARNING:
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLEWARNING, attr, event);
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLE_WARNING, attr, event);
break;
#if defined(PCBTARANIS)
@@ -1455,7 +1455,7 @@ void menuModelSetup(event_t event)
auto & module = g_model.moduleData[moduleIdx];
// Lite FCC / Lite FLEX / Lite Pro Flex
if (isModuleTypeR9MNonAccess(module.type)) {
lcdDrawTextAlignedLeft(y, STR_RFPOWER);
lcdDrawTextAlignedLeft(y, STR_RF_POWER);
if (isModuleR9M_FCC_VARIANT(moduleIdx)) {
// FCC and FLEX modes ...
if (isModuleTypeR9MLiteNonPro(module.type)) { // R9M lite FCC has only one power value, so displayed for info only
+2 -2
View File
@@ -188,7 +188,7 @@ void menuModelTelemetry(event_t event)
#if defined(REVX)
case ITEM_TELEMETRY_INVERTED_SERIAL:
ON_OFF_MENU_ITEM(g_model.moduleData[EXTERNAL_MODULE].invertedSerial, TELEM_COL2, y, STR_INVERTED_SERIAL, attr, event);
g_model.moduleData[EXTERNAL_MODULE].invertedSerial = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].invertedSerial, TELEM_COL2, y, STR_INVERTED_SERIAL, attr, event);
break;
#endif
@@ -231,7 +231,7 @@ void menuModelTelemetry(event_t event)
break;
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
g_model.ignoreSensorIds = editCheckBox(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
break;
case ITEM_TELEMETRY_RSSI_LABEL:
@@ -205,7 +205,7 @@ void menuModelSensor(event_t event)
}
else {
if (sensor->unit == UNIT_RPMS) {
lcdDrawTextAlignedLeft(y, NO_INDENT(STR_BLADES));
lcdDrawTextAlignedLeft(y, STR_BLADES);
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 1, 30000);
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr);
break;
@@ -273,31 +273,30 @@ void menuModelSensor(event_t event)
}
case SENSOR_FIELD_AUTOOFFSET:
ON_OFF_MENU_ITEM(sensor->autoOffset, SENSOR_2ND_COLUMN, y, STR_AUTOOFFSET, attr, event);
sensor->autoOffset = editCheckBox(sensor->autoOffset, SENSOR_2ND_COLUMN, y, STR_AUTOOFFSET, attr, event);
break;
case SENSOR_FIELD_ONLYPOSITIVE:
ON_OFF_MENU_ITEM(sensor->onlyPositive, SENSOR_2ND_COLUMN, y, STR_ONLYPOSITIVE, attr, event);
sensor->onlyPositive = editCheckBox(sensor->onlyPositive, SENSOR_2ND_COLUMN, y, STR_ONLYPOSITIVE, attr, event);
break;
case SENSOR_FIELD_FILTER:
ON_OFF_MENU_ITEM(sensor->filter, SENSOR_2ND_COLUMN, y, STR_FILTER, attr, event);
sensor->filter = editCheckBox(sensor->filter, SENSOR_2ND_COLUMN, y, STR_FILTER, attr, event);
break;
case SENSOR_FIELD_PERSISTENT:
ON_OFF_MENU_ITEM(sensor->persistent, SENSOR_2ND_COLUMN, y, NO_INDENT(STR_PERSISTENT), attr, event);
sensor->persistent = editCheckBox(sensor->persistent, SENSOR_2ND_COLUMN, y, NO_INDENT(STR_PERSISTENT), attr, event);
if (checkIncDec_Ret && !sensor->persistent) {
sensor->persistentValue = 0;
}
break;
case SENSOR_FIELD_LOGS:
ON_OFF_MENU_ITEM(sensor->logs, SENSOR_2ND_COLUMN, y, STR_LOGS, attr, event);
sensor->logs = editCheckBox(sensor->logs, SENSOR_2ND_COLUMN, y, STR_LOGS, attr, event);
if (attr && checkIncDec_Ret) {
logsClose();
}
break;
}
}
}
+54 -34
View File
@@ -28,10 +28,10 @@ const unsigned char sticks[] = {
#define RADIO_SETUP_2ND_COLUMN 79
#define SLIDER_5POS(y, value, label, event, attr) { \
#define SLIDER_5POS(y, value, event, attr) { \
int8_t tmp = value; \
drawSlider(RADIO_SETUP_2ND_COLUMN, y, LCD_W - 2 - RADIO_SETUP_2ND_COLUMN, 2+tmp, 4, attr); \
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, nullptr, tmp, -2, +2, attr, event); \
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, nullptr, nullptr, tmp, -2, +2, attr, event); \
}
#if defined(SPLASH)
@@ -134,7 +134,7 @@ void menuRadioSetup(event_t event)
}
#endif
MENU(STR_MENURADIOSETUP, menuTabGeneral, MENU_RADIO_SETUP, HEADER_LINE+ITEM_RADIO_SETUP_MAX, {
MENU(STR_RADIO_SETUP, menuTabGeneral, MENU_RADIO_SETUP, HEADER_LINE+ITEM_RADIO_SETUP_MAX, {
HEADER_LINE_COLUMNS CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1)
LABEL(SOUND), CASE_AUDIO(0)
CASE_BUZZER(0)
@@ -281,7 +281,7 @@ void menuRadioSetup(event_t event)
#if defined(VOICE)
case ITEM_RADIO_SETUP_SPEAKER_VOLUME:
{
lcdDrawTextAlignedLeft(y, STR_SPEAKER_VOLUME);
lcdDrawText(INDENT_WIDTH, y, STR_VOLUME);
uint8_t b = g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF;
drawSlider(RADIO_SETUP_2ND_COLUMN, y, LCD_W - 2 - RADIO_SETUP_2ND_COLUMN, b, VOLUME_LEVEL_MAX, attr);
if (attr) {
@@ -295,22 +295,28 @@ void menuRadioSetup(event_t event)
#endif
case ITEM_RADIO_SETUP_BEEP_VOLUME:
SLIDER_5POS(y, g_eeGeneral.beepVolume, STR_BEEP_VOLUME, event, attr);
lcdDrawTextAlignedLeft(y, STR_BEEP_VOLUME);
SLIDER_5POS(y, g_eeGeneral.beepVolume, event, attr);
break;
case ITEM_RADIO_SETUP_WAV_VOLUME:
SLIDER_5POS(y, g_eeGeneral.wavVolume, STR_WAV_VOLUME, event, attr);
lcdDrawTextAlignedLeft(y, STR_WAV_VOLUME);
SLIDER_5POS(y, g_eeGeneral.wavVolume, event, attr);
break;
case ITEM_RADIO_SETUP_BACKGROUND_VOLUME:
SLIDER_5POS(y, g_eeGeneral.backgroundVolume, STR_BG_VOLUME, event, attr);
lcdDrawTextAlignedLeft(y, STR_BG_VOLUME);
SLIDER_5POS(y, g_eeGeneral.backgroundVolume, event, attr);
break;
case ITEM_RADIO_SETUP_BEEP_LENGTH:
SLIDER_5POS(y, g_eeGeneral.beepLength, STR_BEEP_LENGTH, event, attr);
lcdDrawText(INDENT_WIDTH, y, STR_BEEP_LENGTH);
SLIDER_5POS(y, g_eeGeneral.beepLength, event, attr);
break;
#if defined(AUDIO)
case ITEM_RADIO_SETUP_SPEAKER_PITCH:
lcdDrawTextAlignedLeft( y, STR_SPKRPITCH);
lcdDrawText(INDENT_WIDTH, y, STR_BEEP_PITCH);
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
lcdDrawText(lcdLastRightPos, y, "Hz", attr);
@@ -324,23 +330,28 @@ void menuRadioSetup(event_t event)
case ITEM_RADIO_SETUP_VARIO_LABEL:
lcdDrawTextAlignedLeft(y, STR_VARIO);
break;
case ITEM_RADIO_SETUP_VARIO_VOLUME:
SLIDER_5POS(y, g_eeGeneral.varioVolume, TR_SPEAKER_VOLUME, event, attr);
lcdDrawText(INDENT_WIDTH, y, STR_VOLUME);
SLIDER_5POS(y, g_eeGeneral.varioVolume, event, attr);
break;
case ITEM_RADIO_SETUP_VARIO_PITCH:
lcdDrawTextAlignedLeft(y, STR_PITCH_AT_ZERO);
lcdDrawText(INDENT_WIDTH, y, STR_PITCH_AT_ZERO);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT);
lcdDrawText(lcdLastRightPos, y, "Hz", attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40);
break;
case ITEM_RADIO_SETUP_VARIO_RANGE:
lcdDrawTextAlignedLeft(y, STR_PITCH_AT_MAX);
lcdDrawText(INDENT_WIDTH, y, STR_PITCH_AT_MAX);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT);
lcdDrawText(lcdLastRightPos, y, "Hz", attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80);
break;
case ITEM_RADIO_SETUP_VARIO_REPEAT:
lcdDrawTextAlignedLeft(y, STR_REPEAT_AT_ZERO);
lcdDrawText(INDENT_WIDTH, y, STR_REPEAT_AT_ZERO);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT);
lcdDrawText(lcdLastRightPos, y, STR_MS, attr);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50);
@@ -357,11 +368,13 @@ void menuRadioSetup(event_t event)
break;
case ITEM_RADIO_SETUP_HAPTIC_LENGTH:
SLIDER_5POS(y, g_eeGeneral.hapticLength, STR_LENGTH, event, attr);
lcdDrawText(INDENT_WIDTH, y, STR_LENGTH);
SLIDER_5POS(y, g_eeGeneral.hapticLength, event, attr);
break;
case ITEM_RADIO_SETUP_HAPTIC_STRENGTH:
SLIDER_5POS(y, g_eeGeneral.hapticStrength, STR_HAPTICSTRENGTH, event, attr);
lcdDrawText(INDENT_WIDTH, y, STR_STRENGTH);
SLIDER_5POS(y, g_eeGeneral.hapticStrength, event, attr);
break;
#endif
@@ -409,29 +422,32 @@ void menuRadioSetup(event_t event)
break;
case ITEM_RADIO_SETUP_BATTERY_WARNING:
lcdDrawTextAlignedLeft(y, STR_BATTERYWARNING);
lcdDrawText(INDENT_WIDTH, y, STR_BATTERYWARNING);
putsVolts(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.vBatWarn, attr|LEFT);
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
break;
case ITEM_RADIO_SETUP_MEMORY_WARNING:
{
uint8_t b = 1-g_eeGeneral.disableMemoryWarning;
g_eeGeneral.disableMemoryWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_MEMORYWARNING, attr, event);
lcdDrawText(INDENT_WIDTH, y, STR_MEMORYWARNING);
uint8_t b = 1 - g_eeGeneral.disableMemoryWarning;
g_eeGeneral.disableMemoryWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, nullptr, attr, event);
break;
}
case ITEM_RADIO_SETUP_ALARM_WARNING:
{
lcdDrawText(INDENT_WIDTH, y, STR_ALARMWARNING);
uint8_t b = 1 - g_eeGeneral.disableAlarmWarning;
g_eeGeneral.disableAlarmWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_ALARMWARNING, attr, event);
g_eeGeneral.disableAlarmWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, nullptr, attr, event);
break;
}
case ITEM_RADIO_SETUP_RSSI_POWEROFF_ALARM:
{
lcdDrawText(INDENT_WIDTH, y, STR_RSSI_SHUTDOWN_ALARM);
uint8_t b = 1 - g_eeGeneral.disableRssiPoweroffAlarm;
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, nullptr, attr, event);
break;
}
@@ -444,7 +460,7 @@ void menuRadioSetup(event_t event)
#endif
case ITEM_RADIO_SETUP_INACTIVITY_ALARM:
lcdDrawTextAlignedLeft(y, STR_INACTIVITYALARM);
lcdDrawText(INDENT_WIDTH, y, STR_INACTIVITYALARM);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT);
lcdDrawChar(lcdLastRightPos, y, 'm');
if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
@@ -455,22 +471,24 @@ void menuRadioSetup(event_t event)
break;
case ITEM_RADIO_SETUP_BACKLIGHT_MODE:
g_eeGeneral.backlightMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, INDENT TR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
lcdDrawText(INDENT_WIDTH, y, STR_MODE);
g_eeGeneral.backlightMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, nullptr, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
break;
case ITEM_RADIO_SETUP_FLASH_BEEP:
g_eeGeneral.alarmsFlash = editCheckBox(g_eeGeneral.alarmsFlash, RADIO_SETUP_2ND_COLUMN, y, STR_ALARM, attr, event ) ;
lcdDrawText(INDENT_WIDTH, y, STR_ALARM);
g_eeGeneral.alarmsFlash = editCheckBox(g_eeGeneral.alarmsFlash, RADIO_SETUP_2ND_COLUMN, y, nullptr, attr, event ) ;
break;
case ITEM_RADIO_SETUP_BACKLIGHT_DELAY:
lcdDrawTextAlignedLeft(y, STR_BLDELAY);
lcdDrawText(INDENT_WIDTH, y, STR_DURATION);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT);
lcdDrawChar(lcdLastRightPos, y, 's');
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
break;
case ITEM_RADIO_SETUP_BRIGHTNESS:
lcdDrawTextAlignedLeft(y, STR_BRIGHTNESS);
lcdDrawText(INDENT_WIDTH, y, STR_BRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
if (attr) {
uint8_t b = 100 - g_eeGeneral.backlightBright;
@@ -481,13 +499,13 @@ void menuRadioSetup(event_t event)
#if defined(PWM_BACKLIGHT)
case ITEM_RADIO_SETUP_BACKLIGHT_BRIGHTNESS_OFF:
lcdDrawTextAlignedLeft(y, STR_BLOFFBRIGHTNESS);
lcdDrawText(INDENT_WIDTH, y, STR_BLOFFBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 0, 15);
break;
case ITEM_RADIO_SETUP_BACKLIGHT_BRIGHTNESS_ON:
lcdDrawTextAlignedLeft(y, STR_BLONBRIGHTNESS);
lcdDrawText(INDENT_WIDTH, y, STR_BLONBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 15-g_eeGeneral.blOnBright, attr|LEFT);
if (attr) g_eeGeneral.blOnBright = 15 - checkIncDecGen(event, 15-g_eeGeneral.blOnBright, 0, 15);
break;
@@ -539,22 +557,24 @@ void menuRadioSetup(event_t event)
break;
case ITEM_RADIO_SETUP_ADJUST_RTC:
g_eeGeneral.adjustRTC = editCheckBox(g_eeGeneral.adjustRTC, RADIO_SETUP_2ND_COLUMN, y, STR_ADJUST_RTC, attr, event);
lcdDrawTextAlignedLeft(y, STR_ADJUST_RTC);
g_eeGeneral.adjustRTC = editCheckBox(g_eeGeneral.adjustRTC, RADIO_SETUP_2ND_COLUMN, y, nullptr, attr, event);
break;
case ITEM_RADIO_SETUP_GPSFORMAT:
g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
lcdDrawTextAlignedLeft(y, STR_GPS_COORDS_FORMAT);
g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, nullptr, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
break;
#endif
#if defined(PXX1)
case ITEM_RADIO_SETUP_COUNTRYCODE:
g_eeGeneral.countryCode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODE, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event);
g_eeGeneral.countryCode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRY_CODE, STR_COUNTRY_CODES, g_eeGeneral.countryCode, 0, 2, attr, event);
break;
#endif
case ITEM_RADIO_SETUP_LANGUAGE:
lcdDrawTextAlignedLeft(y, STR_VOICELANG);
lcdDrawTextAlignedLeft(y, STR_VOICE_LANGUAGE);
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr);
if (attr) {
currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL);
@@ -566,7 +586,7 @@ void menuRadioSetup(event_t event)
break;
case ITEM_RADIO_SETUP_IMPERIAL:
g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_UNITS_SYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
break;
#if defined(FAI_CHOICE)
@@ -597,7 +617,7 @@ void menuRadioSetup(event_t event)
#if defined(JACK_DETECT_GPIO)
case ITEM_RADIO_SETUP_JACK_MODE:
g_eeGeneral.jackMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_JACKMODE, STR_JACKMODES, g_eeGeneral.jackMode, JACK_UNSELECTED_MODE, JACK_MAX_MODE, attr, event);
g_eeGeneral.jackMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_JACK_MODE, STR_JACK_MODES, g_eeGeneral.jackMode, JACK_UNSELECTED_MODE, JACK_MAX_MODE, attr, event);
break;
#endif
+1 -1
View File
@@ -403,7 +403,7 @@ void menuMainView(event_t event)
lcdDrawSizedText(PHASE_X, PHASE_Y, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|PHASE_FLAGS);
// Model Name
putsModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE);
drawModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE);
// Main Voltage (or alarm if any)
displayVoltageOrAlarm();
+3 -1
View File
@@ -72,7 +72,9 @@ void title(const char * s)
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable)
{
drawFieldLabel(x, y, label);
if (label) {
drawFieldLabel(x, y, label);
}
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL, isValueAvailable);
return value;