Now uses the external libopenui
This commit is contained in:
@@ -2,7 +2,6 @@ set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
lcd.cpp
|
||||
splash.cpp
|
||||
fonts.cpp
|
||||
popups.cpp
|
||||
widgets.cpp
|
||||
startup_shutdown.cpp
|
||||
|
||||
@@ -1,140 +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
|
||||
};
|
||||
|
||||
const unsigned char font_5x7_B[] = {
|
||||
#include "font_05x07_B_compressed.lbm"
|
||||
};
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
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)
|
||||
@@ -213,8 +213,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)
|
||||
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0);
|
||||
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);
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "timers.h"
|
||||
#include "common/stdlcd/fonts.h"
|
||||
|
||||
#if (defined(PCBX9E) || defined(PCBX9DP)) && defined(LCD_DUAL_BUFFER)
|
||||
display_t displayBuf1[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
display_t displayBuf2[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
display_t * displayBuf = displayBuf1;
|
||||
pixel_t displayBuf1[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
pixel_t displayBuf2[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
pixel_t * displayBuf = displayBuf1;
|
||||
#else
|
||||
display_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
pixel_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
#endif
|
||||
|
||||
inline bool lcdIsPointOutside(coord_t x, coord_t y)
|
||||
@@ -36,7 +36,7 @@ inline bool lcdIsPointOutside(coord_t x, coord_t y)
|
||||
|
||||
void lcdClear()
|
||||
{
|
||||
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE * sizeof(display_t));
|
||||
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE * sizeof(pixel_t));
|
||||
}
|
||||
|
||||
coord_t lcdLastRightPos;
|
||||
@@ -505,7 +505,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(12*FW, 0, att);
|
||||
if (g_model.timers[0].mode) {
|
||||
@@ -581,7 +581,7 @@ void putsVBat(coord_t x, coord_t y, LcdFlags att)
|
||||
putsVolts(x, y, g_vbat100mV, att);
|
||||
}
|
||||
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
void drawStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
uint8_t length = STR_VSRCRAW[0];
|
||||
lcdDrawSizedText(x, y, STR_VSRCRAW+2+length*(idx+1), length-1, att);
|
||||
@@ -681,7 +681,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;
|
||||
|
||||
@@ -21,14 +21,8 @@
|
||||
#ifndef _LCD_H_
|
||||
#define _LCD_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 31
|
||||
#define CENTER "\015"
|
||||
@@ -92,11 +86,11 @@ typedef uint8_t display_t;
|
||||
#define DISPLAY_BUFFER_SIZE (LCD_W*LCD_H*4/8)
|
||||
|
||||
#if (defined(PCBX9E) || defined(PCBX9DP)) && defined(LCD_DUAL_BUFFER)
|
||||
extern display_t displayBuf1[DISPLAY_BUFFER_SIZE];
|
||||
extern display_t displayBuf2[DISPLAY_BUFFER_SIZE];
|
||||
extern display_t * displayBuf;
|
||||
extern pixel_t displayBuf1[DISPLAY_BUFFER_SIZE];
|
||||
extern pixel_t displayBuf2[DISPLAY_BUFFER_SIZE];
|
||||
extern pixel_t * displayBuf;
|
||||
#else
|
||||
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
extern pixel_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
extern coord_t lcdLastRightPos;
|
||||
@@ -122,9 +116,9 @@ void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode=0);
|
||||
|
||||
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);
|
||||
void drawSwitch(coord_t x, coord_t y, int32_t swtch, LcdFlags att=0);
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||
void drawStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||
void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att=0);
|
||||
void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
void drawTimerMode(coord_t x, coord_t y, swsrc_t mode, LcdFlags att=0);
|
||||
@@ -181,13 +175,13 @@ uint8_t * lcdLoadBitmap(uint8_t * dest, const char * filename, uint16_t width, u
|
||||
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
|
||||
#endif
|
||||
|
||||
inline display_t getPixel(unsigned int x, unsigned int y)
|
||||
inline pixel_t getPixel(unsigned int x, unsigned int y)
|
||||
{
|
||||
if (x>=LCD_W || y>=LCD_H) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
display_t * p = &displayBuf[y / 2 * LCD_W + x];
|
||||
pixel_t * p = &displayBuf[y / 2 * LCD_W + x];
|
||||
return (y & 1) ? (*p >> 4) : (*p & 0x0F);
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -264,7 +264,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);
|
||||
lcdDrawNumber(20*FW, y, eeModelSize(k), RIGHT);
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+menuVerticalOffset!=(vertpos_t)sub))
|
||||
lcdDrawChar(1, y, '*');
|
||||
|
||||
@@ -382,7 +382,7 @@ void menuModelSetup(event_t event)
|
||||
});
|
||||
|
||||
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, 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));
|
||||
@@ -507,11 +507,11 @@ void menuModelSetup(event_t event)
|
||||
#endif
|
||||
|
||||
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+3*FW, y, STR_RESET_BTN, (menuHorizontalPosition>0 && !NO_HIGHLIGHT()) ? attr : 0);
|
||||
if (attr && menuHorizontalPosition>0) {
|
||||
s_editMode = 0;
|
||||
@@ -539,7 +539,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:
|
||||
@@ -556,7 +556,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:
|
||||
@@ -564,11 +564,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(PCBX9E)
|
||||
@@ -1277,7 +1277,7 @@ void menuModelSetup(event_t event)
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
if (isModuleR9MNonAccess(moduleIdx)) {
|
||||
lcdDrawTextAlignedLeft(y, TR_RFPOWER);
|
||||
lcdDrawTextAlignedLeft(y, TR_RF_POWER);
|
||||
if (isModuleR9M_FCC_VARIANT(moduleIdx)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9M_FCC_POWER_VALUES, g_model.moduleData[moduleIdx].pxx.power, LEFT | attr);
|
||||
if (attr)
|
||||
|
||||
@@ -222,7 +222,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:
|
||||
|
||||
@@ -219,7 +219,7 @@ void menuModelSensor(event_t event)
|
||||
}
|
||||
else {
|
||||
if (sensor->unit == UNIT_RPMS) {
|
||||
lcdDrawTextAlignedLeft(y, NO_INDENT(STR_BLADES));
|
||||
lcdDrawTextAlignedLeft(y, STR_BLADES);
|
||||
if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 1, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
|
||||
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr);
|
||||
break;
|
||||
@@ -287,26 +287,26 @@ 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();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ void drawPotsBars()
|
||||
if (IS_POT_SLIDER_AVAILABLE(i)) {
|
||||
uint8_t len = ((calibratedAnalogs[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||
V_BAR(x, LCD_H-8, len);
|
||||
putsStickName(x-2, LCD_H-6, i, TINSIZE);
|
||||
drawStickName(x-2, LCD_H-6, i, TINSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ const unsigned char sticks[] = {
|
||||
#define RADIO_SETUP_DATE_COLUMN RADIO_SETUP_2ND_COLUMN + 4*FWNUM
|
||||
#define RADIO_SETUP_TIME_COLUMN RADIO_SETUP_2ND_COLUMN + 2*FWNUM
|
||||
|
||||
#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, 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)
|
||||
@@ -121,7 +121,7 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, MENU_RADIO_SETUP, ITEM_RADIO_SETUP_MAX, {
|
||||
MENU(STR_RADIO_SETUP, menuTabGeneral, MENU_RADIO_SETUP, ITEM_RADIO_SETUP_MAX, {
|
||||
2, // date
|
||||
2, // time
|
||||
0, // battery calibration
|
||||
@@ -279,7 +279,7 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
case ITEM_RADIO_SETUP_GENERAL_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, b, VOLUME_LEVEL_MAX, attr);
|
||||
if (attr) {
|
||||
@@ -292,23 +292,27 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
@@ -323,25 +327,26 @@ void menuRadioSetup(event_t event)
|
||||
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);
|
||||
@@ -354,15 +359,18 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_HAPTIC_MODE:
|
||||
g_eeGeneral.hapticMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, INDENT TR_MODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event);
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_MODE);
|
||||
g_eeGeneral.hapticMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, nullptr, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, 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
|
||||
|
||||
@@ -380,34 +388,37 @@ 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
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_MEMORY_WARNING:
|
||||
{
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_MEMORYWARNING);
|
||||
uint8_t b = 1 - g_eeGeneral.disableMemoryWarning;
|
||||
g_eeGeneral.disableMemoryWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_MEMORYWARNING, attr, event);
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
@@ -418,11 +429,13 @@ 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;
|
||||
|
||||
#if defined(PXX2)
|
||||
@@ -432,14 +445,14 @@ void menuRadioSetup(event_t event)
|
||||
#endif
|
||||
|
||||
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;
|
||||
@@ -450,7 +463,7 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(PCBX9DP) || defined(PCBX9E)
|
||||
case ITEM_RADIO_SETUP_BACKLIGHT_COLOR:
|
||||
lcdDrawTextAlignedLeft(y, STR_BLCOLOR);
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_BLCOLOR);
|
||||
drawSlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 20, attr);
|
||||
if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 20, EE_GENERAL | NO_INCDEC_MARKS);
|
||||
break;
|
||||
@@ -492,28 +505,30 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_TIMEZONE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TIMEZONE);
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_TIMEZONE);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_ADJUST_RTC:
|
||||
g_eeGeneral.adjustRTC = editCheckBox(g_eeGeneral.adjustRTC, RADIO_SETUP_2ND_COLUMN, y, STR_ADJUST_RTC, attr, event);
|
||||
lcdDrawText(INDENT_WIDTH, 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);
|
||||
lcdDrawText(INDENT_WIDTH, 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);
|
||||
@@ -525,7 +540,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)
|
||||
@@ -570,7 +585,7 @@ void menuRadioSetup(event_t event)
|
||||
case ITEM_RADIO_SETUP_STICK_MODE:
|
||||
lcdDrawChar(2*FW, y, '1'+reusableBuffer.generalSettings.stickMode, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
putsStickName((6+4*i)*FW, y, *(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i), 0);
|
||||
drawStickName((6+4*i)*FW, y, *(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i), 0);
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
CHECK_INCDEC_GENVAR(event, reusableBuffer.generalSettings.stickMode, 0, 3);
|
||||
|
||||
@@ -495,7 +495,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);
|
||||
|
||||
// Trims sliders
|
||||
displayTrims(mode);
|
||||
|
||||
@@ -83,7 +83,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;
|
||||
|
||||
Reference in New Issue
Block a user