Now uses the external libopenui
@@ -2,7 +2,6 @@ set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
lcd.cpp
|
||||
splash.cpp
|
||||
fonts.cpp
|
||||
popups.cpp
|
||||
widgets.cpp
|
||||
startup_shutdown.cpp
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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, '*');
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,6 +2,7 @@ include_directories(
|
||||
${RADIO_SRC_DIRECTORY}/gui/colorlcd
|
||||
${RADIO_SRC_DIRECTORY}/gui/colorlcd/layouts
|
||||
${RADIO_SRC_DIRECTORY}/fonts/truetype
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty/libopenui/src
|
||||
)
|
||||
|
||||
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/colorlcd ${RADIO_SRC_DIRECTORY}/gui/colorlcd/themes/*.cpp)
|
||||
@@ -18,12 +19,11 @@ set(GUI_SRC
|
||||
|
||||
theme.cpp
|
||||
# topbar.cpp
|
||||
# layout.cpp
|
||||
layout.cpp
|
||||
# widget.cpp
|
||||
${THEMES_SRC}
|
||||
# ${LAYOUTS_SRC}
|
||||
${LAYOUTS_SRC}
|
||||
# ${WIDGETS_SRC}
|
||||
rle.cpp
|
||||
# popups.cpp
|
||||
draw_functions.cpp
|
||||
# menus.cpp
|
||||
@@ -48,6 +48,9 @@ set(GUI_SRC
|
||||
radio_hardware.cpp
|
||||
radio_calibration.cpp
|
||||
view_main.cpp
|
||||
menu_screen.cpp
|
||||
screen_setup.cpp
|
||||
|
||||
# view_statistics.cpp
|
||||
)
|
||||
|
||||
@@ -75,17 +78,30 @@ if(LUA STREQUAL YES)
|
||||
# TODO set(GUI_SRC ${GUI_SRC} model_custom_scripts.cpp)
|
||||
endif()
|
||||
|
||||
# gui/${GUI_DIR}/modelslist.cpp
|
||||
|
||||
set(SRC
|
||||
${SRC}
|
||||
stubs.cpp
|
||||
)
|
||||
|
||||
# includes libopenui
|
||||
include(gui/libopenui/CMakeLists.txt)
|
||||
include(${RADIO_SRC_DIRECTORY}/thirdparty/libopenui/src/CMakeLists.txt)
|
||||
include_directories(gui/libopenui)
|
||||
add_definitions(-DLIBOPENUI)
|
||||
foreach(LIBOPENUI_FILE ${LIBOPENUI_SRC})
|
||||
set(SRC ${SRC} gui/libopenui/${LIBOPENUI_FILE})
|
||||
set(SRC ${SRC} thirdparty/libopenui/src/${LIBOPENUI_FILE})
|
||||
endforeach()
|
||||
|
||||
add_gui_src(fullscreen_dialog.cpp)
|
||||
add_gui_src(confirm_dialog.cpp)
|
||||
add_gui_src(message_dialog.cpp)
|
||||
add_gui_src(timeedit.cpp)
|
||||
add_gui_src(curve.cpp)
|
||||
add_gui_src(sourcechoice.cpp)
|
||||
add_gui_src(switchchoice.cpp)
|
||||
add_gui_src(curveedit.cpp)
|
||||
|
||||
if(HARDWARE_TOUCH)
|
||||
add_gui_src(keyboard_curve.cpp)
|
||||
endif()
|
||||
|
||||
# gui/${GUI_DIR}/modelslist.cpp
|
||||
|
||||
@@ -21,12 +21,7 @@
|
||||
#ifndef _COLORS_H_
|
||||
#define _COLORS_H_
|
||||
|
||||
// remove windows default definitions
|
||||
#undef OPAQUE
|
||||
#undef RGB
|
||||
|
||||
#define RGB(r, g, b) (uint16_t)((((r) & 0xF8) << 8) + (((g) & 0xFC) << 3) + (((b) & 0xF8) >> 3))
|
||||
#define ARGB(a, r, g, b) (uint16_t)((((a) & 0xF0) << 8) + (((r) & 0xF0) << 4) + (((g) & 0xF0) << 0) + (((b) & 0xF0) >> 4))
|
||||
#include "libopenui_config.h"
|
||||
|
||||
#define WHITE RGB(0xFF, 0xFF, 0xFF)
|
||||
#define BLACK RGB(0, 0, 0)
|
||||
@@ -40,49 +35,6 @@
|
||||
#define DARKRED RGB(160, 0, 6)
|
||||
#define GREEN RGB(25, 150, 50)
|
||||
|
||||
#define OPACITY_MAX 0x0F
|
||||
#define OPACITY(x) ((x)<<24)
|
||||
|
||||
enum LcdColorIndex
|
||||
{
|
||||
TEXT_COLOR_INDEX,
|
||||
TEXT_BGCOLOR_INDEX,
|
||||
TEXT_INVERTED_COLOR_INDEX,
|
||||
TEXT_INVERTED_BGCOLOR_INDEX,
|
||||
TEXT_STATUSBAR_COLOR_INDEX,
|
||||
LINE_COLOR_INDEX,
|
||||
SCROLLBOX_COLOR_INDEX,
|
||||
MENU_TITLE_BGCOLOR_INDEX,
|
||||
MENU_TITLE_COLOR_INDEX,
|
||||
MENU_TITLE_DISABLE_COLOR_INDEX,
|
||||
HEADER_COLOR_INDEX,
|
||||
ALARM_COLOR_INDEX,
|
||||
WARNING_COLOR_INDEX,
|
||||
TEXT_DISABLE_COLOR_INDEX,
|
||||
CURVE_AXIS_COLOR_INDEX,
|
||||
CURVE_COLOR_INDEX,
|
||||
CURVE_CURSOR_COLOR_INDEX,
|
||||
HEADER_BGCOLOR_INDEX,
|
||||
HEADER_ICON_BGCOLOR_INDEX,
|
||||
HEADER_CURRENT_BGCOLOR_INDEX,
|
||||
TITLE_BGCOLOR_INDEX,
|
||||
TRIM_BGCOLOR_INDEX,
|
||||
TRIM_SHADOW_COLOR_INDEX,
|
||||
MAINVIEW_PANES_COLOR_INDEX,
|
||||
MAINVIEW_GRAPHICS_COLOR_INDEX,
|
||||
OVERLAY_COLOR_INDEX,
|
||||
CUSTOM_COLOR_INDEX,
|
||||
BARGRAPH1_COLOR_INDEX,
|
||||
BARGRAPH2_COLOR_INDEX,
|
||||
BARGRAPH_BGCOLOR_INDEX,
|
||||
LCD_COLOR_COUNT
|
||||
};
|
||||
|
||||
extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
|
||||
|
||||
#define COLOR(index) LcdFlags((index) << 16)
|
||||
#define COLOR_IDX(att) uint8_t((att) >> 16)
|
||||
|
||||
#define TEXT_COLOR COLOR(TEXT_COLOR_INDEX)
|
||||
#define TEXT_BGCOLOR COLOR(TEXT_BGCOLOR_INDEX)
|
||||
#define TEXT_INVERTED_COLOR COLOR(TEXT_INVERTED_COLOR_INDEX)
|
||||
@@ -106,7 +58,7 @@ extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
|
||||
#define TRIM_SHADOW_COLOR COLOR(TRIM_SHADOW_COLOR_INDEX)
|
||||
#define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX)
|
||||
#define HEADER_ICON_BGCOLOR COLOR(HEADER_ICON_BGCOLOR_INDEX)
|
||||
constexpr LcdFlags HEADER_CURRENT_BGCOLOR = COLOR(HEADER_CURRENT_BGCOLOR_INDEX);
|
||||
#define HEADER_CURRENT_BGCOLOR COLOR(HEADER_CURRENT_BGCOLOR_INDEX)
|
||||
#define MAINVIEW_PANES_COLOR COLOR(MAINVIEW_PANES_COLOR_INDEX)
|
||||
#define MAINVIEW_GRAPHICS_COLOR COLOR(MAINVIEW_GRAPHICS_COLOR_INDEX)
|
||||
#define OVERLAY_COLOR COLOR(OVERLAY_COLOR_INDEX)
|
||||
@@ -115,27 +67,4 @@ constexpr LcdFlags HEADER_CURRENT_BGCOLOR = COLOR(HEADER_CURRENT_BGCOLOR_INDEX)
|
||||
#define BARGRAPH_BGCOLOR COLOR(BARGRAPH_BGCOLOR_INDEX)
|
||||
#define CUSTOM_COLOR COLOR(CUSTOM_COLOR_INDEX)
|
||||
|
||||
#define ARGB_SPLIT(color, a, r, g, b) \
|
||||
uint16_t a = ((color) & 0xF000) >> 12; \
|
||||
uint16_t r = ((color) & 0x0F00) >> 8; \
|
||||
uint16_t g = ((color) & 0x00F0) >> 4; \
|
||||
uint16_t b = ((color) & 0x000F)
|
||||
|
||||
#define RGB_SPLIT(color, r, g, b) \
|
||||
uint16_t r = ((color) & 0xF800) >> 11; \
|
||||
uint16_t g = ((color) & 0x07E0) >> 5; \
|
||||
uint16_t b = ((color) & 0x001F)
|
||||
|
||||
#define RGB_JOIN(r, g, b) \
|
||||
(((r) << 11) + ((g) << 5) + (b))
|
||||
|
||||
#define GET_RED(color) \
|
||||
(((color) & 0xF800) >> 8)
|
||||
|
||||
#define GET_GREEN(color) \
|
||||
(((color) & 0x07E0) >> 3)
|
||||
|
||||
#define GET_BLUE(color) \
|
||||
(((color) & 0x001F) << 3)
|
||||
|
||||
#endif // _COLORS_H_
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 "confirm_dialog.h"
|
||||
#include "static.h"
|
||||
|
||||
ConfirmDialog::ConfirmDialog(const char *title, const char *message, std::function<void(void)> confirmHandler) :
|
||||
Dialog(title, {50, 73, LCD_W - 100, LCD_H - 146}),
|
||||
confirmHandler(std::move(confirmHandler))
|
||||
{
|
||||
new StaticText(this, {0, height() / 2, width(), PAGE_LINE_HEIGHT}, message, CENTERED);
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void ConfirmDialog::onKeyEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
confirmHandler();
|
||||
deleteLater();
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -18,23 +18,21 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _COLOREDIT_H_
|
||||
#define _COLOREDIT_H_
|
||||
#ifndef _CONFIRM_DIALOG_H_
|
||||
#define _CONFIRM_DIALOG_H_
|
||||
|
||||
#include "window.h"
|
||||
#include "dialog.h"
|
||||
|
||||
class ColorEdit : public Window {
|
||||
class ConfirmDialog: public Dialog {
|
||||
public:
|
||||
ColorEdit(Window * parent, const rect_t & rect, std::function<int32_t()> getValue, std::function<void(int32_t)> setValue = nullptr);
|
||||
ConfirmDialog(const char * title, const char * message, std::function<void(void)> confirmHandler);
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() override
|
||||
{
|
||||
return "ColorEdit";
|
||||
}
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
~ColorEdit() override;
|
||||
protected:
|
||||
std::function<void(void)> confirmHandler;
|
||||
};
|
||||
|
||||
#endif // _COLOREDIT_H_
|
||||
#endif // _CONFIRM_DIALOG_H_
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "lcd.h"
|
||||
#include "bitmaps.h"
|
||||
#include "strhelpers.h"
|
||||
#include "font.h"
|
||||
|
||||
void Curve::drawBackground(BitmapBuffer * dc)
|
||||
{
|
||||
@@ -40,7 +41,7 @@ void Curve::drawBackground(BitmapBuffer * dc)
|
||||
dc->drawHorizontalLine(0, height()*3/4, width(), STASHED, CURVE_AXIS_COLOR);
|
||||
|
||||
// Outside border
|
||||
// drawSolidRect(dc, 0, 0, width(), height(), 1, TEXT_COLOR);
|
||||
// dc->drawSolidRect(0, 0, width(), height(), 1, TEXT_COLOR);
|
||||
}
|
||||
|
||||
coord_t Curve::getPointX(int x)
|
||||
@@ -19,32 +19,33 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "font.h"
|
||||
|
||||
coord_t getCurveYCoord(FnFuncP fn, int x, int width)
|
||||
{
|
||||
return limit(-width, -divRoundClosest(fn(divRoundClosest(x * RESX, width)) * width, RESX), +width);
|
||||
}
|
||||
|
||||
void drawFunction(FnFuncP fn, int x, int y, int width)
|
||||
void drawFunction(BitmapBuffer * dc, FnFuncP fn, int x, int y, int width)
|
||||
{
|
||||
int left = x - width;
|
||||
int right = x + width;
|
||||
|
||||
// Axis
|
||||
lcdDrawSolidHorizontalLine(left, y, width*2+1, CURVE_AXIS_COLOR);
|
||||
lcdDrawSolidVerticalLine(x, y-width, width*2, CURVE_AXIS_COLOR);
|
||||
dc->drawSolidHorizontalLine(left, y, width*2+1, CURVE_AXIS_COLOR);
|
||||
dc->drawSolidVerticalLine(x, y-width, width*2, CURVE_AXIS_COLOR);
|
||||
|
||||
// Extra lines
|
||||
lcdDrawVerticalLine(left+width/2, y-width, width*2, STASHED, CURVE_AXIS_COLOR);
|
||||
lcdDrawVerticalLine(right-width/2, y-width, width*2, STASHED, CURVE_AXIS_COLOR);
|
||||
lcdDrawHorizontalLine(left, y-width/2, width*2+1, STASHED, CURVE_AXIS_COLOR);
|
||||
lcdDrawHorizontalLine(left, y+width/2, width*2+1, STASHED, CURVE_AXIS_COLOR);
|
||||
dc->drawVerticalLine(left+width/2, y-width, width*2, STASHED, CURVE_AXIS_COLOR);
|
||||
dc->drawVerticalLine(right-width/2, y-width, width*2, STASHED, CURVE_AXIS_COLOR);
|
||||
dc->drawHorizontalLine(left, y-width/2, width*2+1, STASHED, CURVE_AXIS_COLOR);
|
||||
dc->drawHorizontalLine(left, y+width/2, width*2+1, STASHED, CURVE_AXIS_COLOR);
|
||||
|
||||
// Outside border
|
||||
lcdDrawSolidVerticalLine(left, y-width, width*2, TEXT_COLOR);
|
||||
lcdDrawSolidVerticalLine(right, y-width, width*2, TEXT_COLOR);
|
||||
lcdDrawSolidHorizontalLine(left, y-width, width*2+1, TEXT_COLOR);
|
||||
lcdDrawSolidHorizontalLine(left, y+width, width*2+1, TEXT_COLOR);
|
||||
dc->drawSolidVerticalLine(left, y-width, width*2, TEXT_COLOR);
|
||||
dc->drawSolidVerticalLine(right, y-width, width*2, TEXT_COLOR);
|
||||
dc->drawSolidHorizontalLine(left, y-width, width*2+1, TEXT_COLOR);
|
||||
dc->drawSolidHorizontalLine(left, y+width, width*2+1, TEXT_COLOR);
|
||||
|
||||
coord_t prev_yv = (coord_t)-1;
|
||||
|
||||
@@ -53,12 +54,12 @@ void drawFunction(FnFuncP fn, int x, int y, int width)
|
||||
if (prev_yv != (coord_t)-1) {
|
||||
if (prev_yv < yv) {
|
||||
for (int y=prev_yv; y<=yv; y+=1) {
|
||||
lcdDrawBitmapPattern(x+xv-2, y-2, LBM_POINT, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(x+xv-2, y-2, LBM_POINT, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int y=yv; y<=prev_yv; y+=1) {
|
||||
lcdDrawBitmapPattern(x+xv-2, y-2, LBM_POINT, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(x+xv-2, y-2, LBM_POINT, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,31 +67,31 @@ void drawFunction(FnFuncP fn, int x, int y, int width)
|
||||
}
|
||||
}
|
||||
|
||||
void drawCurveVerticalScale(int x)
|
||||
void drawCurveVerticalScale(BitmapBuffer * dc, int x)
|
||||
{
|
||||
for (int i=0; i<=20; i++) {
|
||||
lcdDrawSolidHorizontalLine(x, CURVE_CENTER_Y-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, 10, TEXT_COLOR);
|
||||
dc->drawSolidHorizontalLine(x, CURVE_CENTER_Y-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, 10, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawCurveHorizontalScale()
|
||||
void drawCurveHorizontalScale(BitmapBuffer * dc)
|
||||
{
|
||||
for (int i=0; i<=20; i++) {
|
||||
lcdDrawSolidVerticalLine(CURVE_CENTER_X-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, CURVE_CENTER_Y+CURVE_SIDE_WIDTH+5, 10, TEXT_COLOR);
|
||||
dc->drawSolidVerticalLine(CURVE_CENTER_X-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH/10, CURVE_CENTER_Y+CURVE_SIDE_WIDTH+5, 10, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawCurveCoord(int x, int y, const char * text, bool active)
|
||||
void drawCurveCoord(BitmapBuffer * dc, int x, int y, const char * text, bool active)
|
||||
{
|
||||
lcd->drawSolidFilledRect(x, y, CURVE_COORD_WIDTH, CURVE_COORD_HEIGHT, CURVE_CURSOR_COLOR);
|
||||
lcdDrawText(x+3+(CURVE_COORD_WIDTH-1-getTextWidth(text, SMLSIZE))/2, y+1, text, LEFT|SMLSIZE|TEXT_BGCOLOR);
|
||||
dc->drawSolidFilledRect(x, y, CURVE_COORD_WIDTH, CURVE_COORD_HEIGHT, CURVE_CURSOR_COLOR);
|
||||
dc->drawText(x+3+(CURVE_COORD_WIDTH-1-getTextWidth(text, SMLSIZE))/2, y+1, text, LEFT|SMLSIZE|TEXT_BGCOLOR);
|
||||
if (active) {
|
||||
lcdDrawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawCurvePoint(int x, int y, LcdFlags color)
|
||||
void drawCurvePoint(BitmapBuffer * dc, int x, int y, LcdFlags color)
|
||||
{
|
||||
lcdDrawBitmapPattern(x, y, LBM_CURVE_POINT, color);
|
||||
lcdDrawBitmapPattern(x, y, LBM_CURVE_POINT_CENTER, TEXT_BGCOLOR);
|
||||
dc->drawBitmapPattern(x, y, LBM_CURVE_POINT, color);
|
||||
dc->drawBitmapPattern(x, y, LBM_CURVE_POINT_CENTER, TEXT_BGCOLOR);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void CustomCurveChoice::paint(BitmapBuffer * dc)
|
||||
lineColor = TEXT_INVERTED_BGCOLOR;
|
||||
}
|
||||
dc->drawText(3, 2, getCurveString(s, value), flags | textColor);
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 1, lineColor);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, lineColor);
|
||||
dc->drawBitmapPattern(rect.w - 14, (rect.h - 5) / 2, LBM_DROPDOWN, lineColor);
|
||||
}
|
||||
|
||||
@@ -20,99 +20,99 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
void drawStatusText(const char * text)
|
||||
void drawStatusText(BitmapBuffer * dc, const char * text)
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_FOOTER_TOP, text, TEXT_STATUSBAR_COLOR);
|
||||
dc->drawText(MENUS_MARGIN_LEFT, MENU_FOOTER_TOP, text, TEXT_STATUSBAR_COLOR);
|
||||
}
|
||||
|
||||
void drawColumnHeader(const char * const * headers, const char * const * descriptions, uint8_t index)
|
||||
void drawColumnHeader(BitmapBuffer * dc, const char * const * headers, const char * const * descriptions, uint8_t index)
|
||||
{
|
||||
lcdDrawText(LCD_W-MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, headers[index], RIGHT | SMLSIZE | MENU_TITLE_COLOR);
|
||||
dc->drawText(LCD_W-MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, headers[index], RIGHT | SMLSIZE | MENU_TITLE_COLOR);
|
||||
if (descriptions) {
|
||||
drawStatusText(descriptions[index]);
|
||||
drawStatusText(dc, descriptions[index]);
|
||||
}
|
||||
}
|
||||
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||
void drawCheckBox(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||
{
|
||||
if (attr) {
|
||||
lcdDrawSolidFilledRect(x-1, y+3, 14, 14, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawSolidFilledRect(x+1, y+5, 10, 10, TEXT_BGCOLOR);
|
||||
dc->drawSolidFilledRect(x-1, y+3, 14, 14, TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawSolidFilledRect(x+1, y+5, 10, 10, TEXT_BGCOLOR);
|
||||
if (value) {
|
||||
lcdDrawSolidFilledRect(x+2, y+6, 8, 8, TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawSolidFilledRect(x+2, y+6, 8, 8, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (value) {
|
||||
lcdDrawSolidFilledRect(x+2, y+6, 8, 8, SCROLLBOX_COLOR);
|
||||
lcdDrawSolidRect(x, y+4, 12, 12, 1, LINE_COLOR);
|
||||
dc->drawSolidFilledRect(x+2, y+6, 8, 8, SCROLLBOX_COLOR);
|
||||
dc->drawSolidRect(x, y+4, 12, 12, 1, LINE_COLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawSolidRect(x, y+4, 12, 12, 1, LINE_COLOR);
|
||||
dc->drawSolidRect(x, y+4, 12, 12, 1, LINE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
if (visible < count) {
|
||||
lcdDrawSolidVerticalLine(x, y, h, LINE_COLOR);
|
||||
dc->drawSolidVerticalLine(x, y, h, LINE_COLOR);
|
||||
coord_t yofs = (h*offset + count/2) / count;
|
||||
coord_t yhgt = (h*visible + count/2) / count;
|
||||
if (yhgt + yofs > h)
|
||||
yhgt = h - yofs;
|
||||
lcdDrawSolidFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
|
||||
dc->drawSolidFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawTrimSquare(coord_t x, coord_t y)
|
||||
void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y)
|
||||
{
|
||||
lcdDrawSolidFilledRect(x-2, y, 15, 15, TRIM_BGCOLOR);
|
||||
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TRIM_SHADOW_COLOR);
|
||||
dc->drawSolidFilledRect(x-2, y, 15, 15, TRIM_BGCOLOR);
|
||||
dc->drawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TRIM_SHADOW_COLOR);
|
||||
}
|
||||
|
||||
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
void drawHorizontalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
drawTrimSquare(dc, x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
dc->drawSolidVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawSolidVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
dc->drawSolidVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawSolidVerticalLine(xm, ym, 9, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
void drawVerticalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
drawTrimSquare(dc, x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
|
||||
dc->drawSolidHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawSolidHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
|
||||
dc->drawSolidHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawSolidHorizontalLine(xm-1, ym, 3, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
void drawVerticalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
val = limit(min, val, max);
|
||||
if (steps) {
|
||||
int delta = len / steps;
|
||||
for (int i = 0; i <= len; i += delta) {
|
||||
if ((options & OPTION_SLIDER_BIG_TICKS) && (i == 0 || i == len / 2 || i == len))
|
||||
lcdDrawSolidHorizontalLine(x, y + i, 13, TEXT_COLOR);
|
||||
dc->drawSolidHorizontalLine(x, y + i, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawSolidHorizontalLine(x + 2, y + i, 9, TEXT_COLOR);
|
||||
dc->drawSolidHorizontalLine(x + 2, y + i, 9, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x + 1, y, LBM_VTRIM_FRAME, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(x + 1, y, LBM_VTRIM_FRAME, TEXT_COLOR);
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
@@ -121,18 +121,18 @@ void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max
|
||||
}
|
||||
y += len - divRoundClosest(len * (val - min), max - min) - 5;
|
||||
if (options & OPTION_SLIDER_TRIM_BUTTON) {
|
||||
drawVerticalTrimPosition(x, y - 2, val);
|
||||
drawVerticalTrimPosition(dc, x, y - 2, val);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_NUMBER_BUTTON) {
|
||||
drawTrimSquare(x, y - 2);
|
||||
lcdDrawChar(x + 2, y - 1, '0' + val, SMLSIZE | TEXT_INVERTED_COLOR);
|
||||
drawTrimSquare(dc, x, y - 2);
|
||||
// TODO lcdDrawChar(x + 2, y - 1, '0' + val, SMLSIZE | TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else {
|
||||
drawTrimSquare(x, y - 2);
|
||||
drawTrimSquare(dc, x, y - 2);
|
||||
}
|
||||
}
|
||||
|
||||
void drawHorizontalSlider(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)
|
||||
{
|
||||
val = limit(min, val, max);
|
||||
int w = divRoundClosest(len * (val - min), max - min);
|
||||
@@ -141,27 +141,27 @@ void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int m
|
||||
int delta = len / steps;
|
||||
for (int i = 0; i <= len; i += delta) {
|
||||
if ((options & OPTION_SLIDER_BIG_TICKS) && (i == 0 || i == len / 2 || i == len))
|
||||
lcdDrawSolidVerticalLine(x + i, y, 13, TEXT_COLOR);
|
||||
dc->drawSolidVerticalLine(x + i, y, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawSolidVerticalLine(x + i, y + 2, 9, TEXT_COLOR);
|
||||
dc->drawSolidVerticalLine(x + i, y + 2, 9, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (options & OPTION_SLIDER_EMPTY_BAR) {
|
||||
lcdDrawBitmapPattern(x, y + 1, LBM_HTRIM_FRAME, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(x, y + 1, LBM_HTRIM_FRAME, TEXT_COLOR);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_DBL_COLOR) {
|
||||
lcdDrawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, w <= 0 ? LINE_COLOR : TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, w <= 0 ? LINE_COLOR : TEXT_INVERTED_BGCOLOR);
|
||||
if (w > 4)
|
||||
lcdDrawSolidFilledRect(x + 4, y + 8, w - 4, 4, TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawSolidFilledRect(x + 4, y + 8, w - 4, 4, TEXT_INVERTED_BGCOLOR);
|
||||
if (w < len - 4)
|
||||
lcdDrawSolidFilledRect(x + w, y + 8, len - w - 4, 4, LINE_COLOR);
|
||||
lcdDrawBitmapPattern(x + len - 4, y + 8, LBM_SLIDER_BAR_RIGHT, w >= len ? TEXT_INVERTED_BGCOLOR : LINE_COLOR);
|
||||
dc->drawSolidFilledRect(x + w, y + 8, len - w - 4, 4, LINE_COLOR);
|
||||
dc->drawBitmapPattern(x + len - 4, y + 8, LBM_SLIDER_BAR_RIGHT, w >= len ? TEXT_INVERTED_BGCOLOR : LINE_COLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, LINE_COLOR);
|
||||
lcdDrawSolidFilledRect(x + 4, y + 8, len - 8, 4, LINE_COLOR);
|
||||
lcdDrawBitmapPattern(x + len - 4, y + 8, LBM_SLIDER_BAR_RIGHT, LINE_COLOR);
|
||||
dc->drawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, LINE_COLOR);
|
||||
dc->drawSolidFilledRect(x + 4, y + 8, len - 8, 4, LINE_COLOR);
|
||||
dc->drawBitmapPattern(x + len - 4, y + 8, LBM_SLIDER_BAR_RIGHT, LINE_COLOR);
|
||||
//
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
@@ -171,21 +171,21 @@ void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int m
|
||||
}
|
||||
x += w - 5;
|
||||
if (options & OPTION_SLIDER_TRIM_BUTTON) {
|
||||
drawHorizontalTrimPosition(x, y - 1, val);
|
||||
drawHorizontalTrimPosition(dc, x, y - 1, val);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_NUMBER_BUTTON) {
|
||||
drawTrimSquare(x+2, y - 1);
|
||||
drawTrimSquare(dc, x+2, y - 1);
|
||||
char text[] = { (char)('0' + val), '\0' };
|
||||
lcdDrawText(x + 7, y - 1, text, SMLSIZE | CENTERED | TEXT_INVERTED_COLOR);
|
||||
dc->drawText(x + 7, y - 1, text, SMLSIZE | CENTERED | TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_SQUARE_BUTTON) {
|
||||
drawTrimSquare(x, y - 1);
|
||||
drawTrimSquare(dc, x, y - 1);
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_OUT, TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR);
|
||||
dc->drawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_OUT, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR);
|
||||
if ((options & INVERS) && (!(options & BLINK) || !BLINK_ON_PHASE))
|
||||
lcdDrawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
|
||||
#else
|
||||
void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, LcdFlags flags)
|
||||
{
|
||||
drawNumber(dc, x, y, value, flags, 0, nullptr, "%");
|
||||
dc->drawNumber(x, y, value, flags, 0, nullptr, "%");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -258,7 +258,7 @@ void drawSleepBitmap()
|
||||
lcd->clearClippingRect();
|
||||
lcd->clear();
|
||||
|
||||
const BitmapBuffer * bitmap = BitmapBuffer::load(getThemePath("sleep.bmp"));
|
||||
const BitmapBuffer * bitmap = BitmapBuffer::load(static_cast<ThemeBase *>(theme)->getFilePath("sleep.bmp"));
|
||||
if (bitmap) {
|
||||
lcd->drawBitmap((LCD_W-bitmap->getWidth())/2, (LCD_H-bitmap->getHeight())/2, bitmap);
|
||||
delete bitmap;
|
||||
@@ -274,21 +274,21 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration, const char
|
||||
return;
|
||||
|
||||
static uint32_t lastDuration = 0xffffffff;
|
||||
static const BitmapBuffer * shutdown = BitmapBuffer::load(getThemePath("shutdown.bmp"));
|
||||
static const BitmapBuffer * shutdown = BitmapBuffer::load(static_cast<ThemeBase *>(theme)->getFilePath("shutdown.bmp"));
|
||||
|
||||
if (shutdown) {
|
||||
if (duration < lastDuration) {
|
||||
theme->drawBackground(lcd);
|
||||
static_cast<ThemeBase *>(theme)->drawBackground(lcd);
|
||||
lcd->drawBitmap((LCD_W-shutdown->getWidth())/2, (LCD_H-shutdown->getHeight())/2, shutdown);
|
||||
lcdStoreBackupBuffer();
|
||||
}
|
||||
else {
|
||||
lcdRestoreBackupBuffer();
|
||||
int quarter = duration / (totalDuration / 5);
|
||||
if (quarter >= 1) lcdDrawBitmapPattern(LCD_W/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, 0, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 2) lcdDrawBitmapPattern(LCD_W/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 3) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 4) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER*3/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 1) lcd->drawBitmapPattern(LCD_W/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, 0, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 2) lcd->drawBitmapPattern(LCD_W/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 3) lcd->drawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (quarter >= 4) lcd->drawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER*3/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -320,7 +320,7 @@ void drawCurveRef(BitmapBuffer * dc, coord_t x, coord_t y, const CurveRef & curv
|
||||
break;
|
||||
|
||||
case CURVE_REF_FUNC:
|
||||
drawTextAtIndex(dc, x, y, STR_VCURVEFUNC, curve.value, flags);
|
||||
dc->drawTextAtIndex(x, y, STR_VCURVEFUNC, curve.value, flags);
|
||||
break;
|
||||
|
||||
case CURVE_REF_CUSTOM:
|
||||
@@ -330,13 +330,13 @@ void drawCurveRef(BitmapBuffer * dc, coord_t x, coord_t y, const CurveRef & curv
|
||||
}
|
||||
}
|
||||
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
void drawStickName(BitmapBuffer * dc, 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);
|
||||
dc->drawSizedText(x, y, STR_VSRCRAW+2+length*(idx+1), length-1, att);
|
||||
}
|
||||
|
||||
void putsModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att)
|
||||
void drawModelName(BitmapBuffer * dc, 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;
|
||||
@@ -344,15 +344,15 @@ void putsModelName(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);
|
||||
dc->drawSizedText(x, y, name, sizeof(g_model.header.name), att);
|
||||
}
|
||||
}
|
||||
|
||||
void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags flags)
|
||||
void drawCurveName(BitmapBuffer * dc, coord_t x, coord_t y, int8_t idx, LcdFlags flags)
|
||||
{
|
||||
char s[8];
|
||||
getCurveString(s, idx);
|
||||
lcdDrawText(x, y, s, flags);
|
||||
dc->drawText(x, y, s, flags);
|
||||
}
|
||||
|
||||
void drawSource(BitmapBuffer * dc, coord_t x, coord_t y, mixsrc_t idx, LcdFlags flags)
|
||||
@@ -390,33 +390,33 @@ void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetry
|
||||
if (att & DBLSIZE) {
|
||||
x -= 42;
|
||||
att &= ~FONTSIZE_MASK;
|
||||
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos-1, y, '-', att);
|
||||
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos-1, y, '-', att);
|
||||
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.year-2000, att|LEFT);
|
||||
dc->drawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||
dc->drawText(lcdNextPos-1, y, "-", att);
|
||||
dc->drawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||
dc->drawText(lcdNextPos-1, y, "-", att);
|
||||
dc->drawNumber(lcdNextPos-1, y, telemetryItem.datetime.year-2000, att|LEFT);
|
||||
y += FH;
|
||||
lcdDrawNumber(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos, y, ':', att);
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos, y, ':', att);
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
||||
dc->drawNumber(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
||||
dc->drawText(lcdNextPos, y, ":", att);
|
||||
dc->drawNumber(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
||||
dc->drawText(lcdNextPos, y, ":", att);
|
||||
dc->drawNumber(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos-1, y, '-', att);
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos-1, y, '-', att);
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.year-2000, att|LEFT);
|
||||
lcdDrawNumber(lcdNextPos+11, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos, y, ':', att);
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
||||
lcdDrawChar(lcdNextPos, y, ':', att);
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
||||
dc->drawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||
dc->drawText(lcdNextPos-1, y, "-", att);
|
||||
dc->drawNumber(lcdNextPos, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||
dc->drawText(lcdNextPos-1, y, "-", att);
|
||||
dc->drawNumber(lcdNextPos, y, telemetryItem.datetime.year-2000, att|LEFT);
|
||||
dc->drawNumber(lcdNextPos+11, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
||||
dc->drawText(lcdNextPos, y, ":", att);
|
||||
dc->drawNumber(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
||||
dc->drawText(lcdNextPos, y, ":", att);
|
||||
dc->drawNumber(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags flags, bool seconds=true)
|
||||
void drawGPSCoord(BitmapBuffer * dc, coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags flags, bool seconds=true)
|
||||
{
|
||||
char s[32];
|
||||
uint32_t absvalue = abs(value);
|
||||
@@ -445,27 +445,26 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
|
||||
}
|
||||
*tmp++ = direction[value>=0 ? 0 : 1];
|
||||
*tmp = '\0';
|
||||
lcdDrawText(x, y, s, flags);
|
||||
dc->drawText(x, y, s, flags);
|
||||
}
|
||||
|
||||
void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags)
|
||||
void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags)
|
||||
{
|
||||
if (flags & EXPANDED) {
|
||||
drawGPSCoord(x, y, latitude, "NS", flags, true);
|
||||
drawGPSCoord(x, y + FH, longitude, "EW", flags, true);
|
||||
drawGPSCoord(dc, x, y, latitude, "NS", flags, true);
|
||||
drawGPSCoord(dc, x, y + FH, longitude, "EW", flags, true);
|
||||
}
|
||||
else {
|
||||
drawGPSCoord(x, y, latitude, "NS", flags, false);
|
||||
drawGPSCoord(lcdNextPos+5, y, longitude, "EW", flags, false);
|
||||
drawGPSCoord(dc, x, y, latitude, "NS", flags, false);
|
||||
drawGPSCoord(dc, lcdNextPos+5, y, longitude, "EW", flags, false);
|
||||
}
|
||||
}
|
||||
|
||||
void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags)
|
||||
void drawGPSSensorValue(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags)
|
||||
{
|
||||
drawGPSPosition(x, y, telemetryItem.gps.longitude, telemetryItem.gps.latitude, flags);
|
||||
drawGPSPosition(dc, x, y, telemetryItem.gps.longitude, telemetryItem.gps.latitude, flags);
|
||||
}
|
||||
|
||||
|
||||
void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags)
|
||||
{
|
||||
if (sensor >= MAX_TELEMETRY_SENSORS) {
|
||||
@@ -480,14 +479,14 @@ void drawSensorCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t sens
|
||||
drawDate(dc, x, y, telemetryItem, flags);
|
||||
}
|
||||
else if (telemetrySensor.unit == UNIT_GPS) {
|
||||
drawGPSSensorValue(x, y, telemetryItem, flags);
|
||||
drawGPSSensorValue(dc, x, y, telemetryItem, flags);
|
||||
}
|
||||
else if (telemetrySensor.unit == UNIT_BITFIELD) {
|
||||
if (IS_FRSKY_SPORT_PROTOCOL()) {
|
||||
if (telemetrySensor.id >= RBOX_STATE_FIRST_ID && telemetrySensor.id <= RBOX_STATE_LAST_ID) {
|
||||
if (telemetrySensor.subId == 0) {
|
||||
if (value == 0) {
|
||||
lcdDrawText(x, y, "OK", flags);
|
||||
dc->drawText(x, y, "OK", flags);
|
||||
}
|
||||
else {
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
@@ -551,7 +550,7 @@ void drawSourceCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, source_t sou
|
||||
// TODO drawTimer(dc, x, y, value, flags);
|
||||
}
|
||||
else if (source == MIXSRC_TX_VOLTAGE) {
|
||||
lcdDrawNumber(x, y, value, flags|PREC1);
|
||||
dc->drawNumber(x, y, value, flags|PREC1);
|
||||
}
|
||||
#if defined(INTERNAL_GPS)
|
||||
else if (source == MIXSRC_TX_GPS) {
|
||||
@@ -560,7 +559,7 @@ void drawSourceCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, source_t sou
|
||||
}
|
||||
else {
|
||||
lcdDrawText(x, y, "sats: ", flags);
|
||||
lcdDrawNumber(lcdNextPos, y, gpsData.numSat, flags);
|
||||
dc->drawNumber(lcdNextPos, y, gpsData.numSat, flags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -570,26 +569,26 @@ void drawSourceCustomValue(BitmapBuffer * dc, coord_t x, coord_t y, source_t sou
|
||||
}
|
||||
#endif
|
||||
else if (source < MIXSRC_FIRST_CH) {
|
||||
lcdDrawNumber(x, y, calcRESXto100(value), flags);
|
||||
dc->drawNumber(x, y, calcRESXto100(value), flags);
|
||||
}
|
||||
else if (source <= MIXSRC_LAST_CH) {
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcdDrawNumber(x, y, calcRESXto1000(value), flags|PREC1);
|
||||
dc->drawNumber(x, y, calcRESXto1000(value), flags|PREC1);
|
||||
#else
|
||||
lcdDrawNumber(x, y, calcRESXto100(value), flags);
|
||||
dc->drawNumber(x, y, calcRESXto100(value), flags);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, value, flags);
|
||||
dc->drawNumber(x, y, value, flags);
|
||||
}
|
||||
}
|
||||
|
||||
void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags)
|
||||
{
|
||||
// convertUnit(val, unit);
|
||||
drawNumber(dc, x, y, val, flags & (~NO_UNIT));
|
||||
dc->drawNumber(x, y, val, flags & (~NO_UNIT));
|
||||
if (!(flags & NO_UNIT) && unit != UNIT_RAW) {
|
||||
drawTextAtIndex(dc, lcdNextPos/*+1*/, y, STR_VTELEMUNIT, unit, 0);
|
||||
dc->drawTextAtIndex(lcdNextPos/*+1*/, y, STR_VTELEMUNIT, unit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#ifndef _DRAW_FUNCTIONS_H_
|
||||
#define _DRAW_FUNCTIONS_H_
|
||||
|
||||
#include "opentx.h"
|
||||
#include "dataconstants.h"
|
||||
#include "telemetry/telemetry_sensors.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define OPTION_MENU_NO_FOOTER 0x01
|
||||
@@ -39,16 +40,33 @@
|
||||
#define OPTION_SLIDER_NUMBER_BUTTON 0x100
|
||||
#define OPTION_SLIDER_SQUARE_BUTTON 0x200
|
||||
|
||||
void drawStatusText(const char * text);
|
||||
void drawColumnHeader(const char * const * headers, const char * const * descriptions, uint8_t index);
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void drawProgressScreen(const char * title, const char * message, int num, int den);
|
||||
void drawTrimSquare(coord_t x, coord_t y);
|
||||
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir);
|
||||
void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir);
|
||||
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
|
||||
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix, const char * suffix);
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att);
|
||||
//int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable=nullptr);
|
||||
//uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event);
|
||||
//swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
|
||||
void drawFatalErrorScreen(const char * message);
|
||||
void runFatalErrorScreen(const char * message);
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att);
|
||||
//void lcdDrawMMM(coord_t x, coord_t y, LcdFlags flags);
|
||||
void drawSource(BitmapBuffer * dc, coord_t x, coord_t y, mixsrc_t idx, LcdFlags flags=0);
|
||||
void drawSwitch(BitmapBuffer * dc, coord_t x, coord_t y, int32_t idx, LcdFlags flags=0);
|
||||
void drawTrimMode(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags flags = 0);
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att);
|
||||
#endif
|
||||
|
||||
void drawStatusText(BitmapBuffer * dc, const char * text);
|
||||
void drawColumnHeader(BitmapBuffer * dc, const char * const * headers, const char * const * descriptions, uint8_t index);
|
||||
void drawCheckBox(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
void drawVerticalScrollbar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void drawProgressScreen(BitmapBuffer * dc, const char * title, const char * message, int num, int den);
|
||||
void drawTrimSquare(BitmapBuffer * dc, coord_t x, coord_t y);
|
||||
void drawHorizontalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir);
|
||||
void drawVerticalTrimPosition(BitmapBuffer * dc, coord_t x, coord_t y, int16_t dir);
|
||||
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 drawGVarValue(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags = 0);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "rle.h"
|
||||
|
||||
const uint16_t font_tinsize_specs[] = {
|
||||
#include "font_9.specs"
|
||||
@@ -30,6 +29,14 @@ const unsigned char font_tinsize[] = {
|
||||
};
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
const uint16_t font_stdsize_en_specs[] = {
|
||||
#include "font_17en.specs"
|
||||
};
|
||||
|
||||
const unsigned char font_stdsize_en[] = {
|
||||
#include "font_17en.lbm"
|
||||
};
|
||||
|
||||
const uint16_t font_smlsize_specs[] = {
|
||||
#include "font_15.specs"
|
||||
};
|
||||
@@ -54,6 +61,14 @@ const unsigned char font_stdsizebold[] = {
|
||||
#include "font_bold17.lbm"
|
||||
};
|
||||
#else
|
||||
const uint16_t font_stdsize_en_specs[] = {
|
||||
#include "font_16en.specs"
|
||||
};
|
||||
|
||||
const unsigned char font_stdsize_en[] = {
|
||||
#include "font_16en.lbm"
|
||||
};
|
||||
|
||||
const uint16_t font_smlsize_specs[] = {
|
||||
#include "font_13.specs"
|
||||
};
|
||||
@@ -103,7 +118,10 @@ const unsigned char font_xxlsize[] = {
|
||||
#include "font_64.lbm"
|
||||
};
|
||||
|
||||
#if !defined(BOOT)
|
||||
#if defined(BOOT)
|
||||
const uint16_t * const fontspecsTable[1] = { font_stdsize_en_specs };
|
||||
const uint8_t * fontsTable[1] = { font_stdsize_en };
|
||||
#else
|
||||
const uint16_t * const fontspecsTable[16] = {
|
||||
font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs,
|
||||
font_stdsizebold_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs
|
||||
@@ -113,9 +131,6 @@ const uint8_t * fontsTable[16] = {
|
||||
font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize,
|
||||
font_stdsizebold, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize
|
||||
};
|
||||
#else
|
||||
const uint16_t * const fontspecsTable[1] = { font_stdsize_specs };
|
||||
const uint8_t * fontsTable[1] = { font_stdsize };
|
||||
#endif
|
||||
|
||||
uint8_t * decompressFont(const uint8_t * font)
|
||||
@@ -127,9 +142,9 @@ uint8_t * decompressFont(const uint8_t * font)
|
||||
uint8_t* dec_buf = (uint8_t*)malloc(font_size + 4);
|
||||
|
||||
// copy width / height
|
||||
memcpy(dec_buf,font,4);
|
||||
memcpy(dec_buf, font,4);
|
||||
|
||||
rle_decode_8bit(dec_buf+4, font_size, font+4);
|
||||
RLEBitmap::decode(dec_buf+4, font_size, font+4);
|
||||
return dec_buf;
|
||||
}
|
||||
|
||||
@@ -139,12 +154,14 @@ void loadFonts()
|
||||
if (fonts_loaded) return;
|
||||
|
||||
#if !defined(BOOT)
|
||||
int i=0;
|
||||
for (; i<9; i++)
|
||||
int i = 0;
|
||||
for (; i < 9; i++) {
|
||||
fontsTable[i] = decompressFont(fontsTable[i]);
|
||||
|
||||
for (; i<16; i++)
|
||||
fontsTable[i] = fontsTable[i-9];
|
||||
}
|
||||
for (; i < 16; i++) {
|
||||
// the next fonts don't exist in BOLD today
|
||||
fontsTable[i] = fontsTable[i - 9];
|
||||
}
|
||||
#else
|
||||
fontsTable[0] = decompressFont(fontsTable[0]);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* 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 "fullscreen_dialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "opentx.h"
|
||||
|
||||
FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string message, std::string action, std::function<void(void)> confirmHandler):
|
||||
Dialog(title, {0, 0, LCD_W, LCD_H}),
|
||||
type(type),
|
||||
message(std::move(message)),
|
||||
action(std::move(action)),
|
||||
confirmHandler(confirmHandler)
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
new FabIconButton(this, LCD_W - 50, ALERT_BUTTON_TOP, ICON_NEXT,
|
||||
[=]() -> uint8_t {
|
||||
if (confirmHandler)
|
||||
confirmHandler();
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
FullScreenDialog::~FullScreenDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void FullScreenDialog::paint(BitmapBuffer * dc)
|
||||
{
|
||||
static_cast<ThemeBase *>(theme)->drawBackground(dc);
|
||||
|
||||
dc->drawFilledRect(0, ALERT_FRAME_TOP, LCD_W, ALERT_FRAME_HEIGHT, SOLID, TEXT_INVERTED_COLOR | OPACITY(8));
|
||||
|
||||
if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK)
|
||||
dc->drawBitmap(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP, static_cast<ThemeBase *>(theme)->asterisk);
|
||||
else if (type == WARNING_TYPE_INFO)
|
||||
dc->drawBitmap(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP, static_cast<ThemeBase *>(theme)->busy);
|
||||
else // confirmation
|
||||
dc->drawBitmap(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP, static_cast<ThemeBase *>(theme)->question);
|
||||
|
||||
if (type == WARNING_TYPE_ALERT) {
|
||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
|
||||
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
||||
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, title, ALARM_COLOR|DBLSIZE);
|
||||
#else
|
||||
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), ALARM_COLOR|DBLSIZE);
|
||||
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP + ALERT_TITLE_LINE_HEIGHT, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
||||
#endif
|
||||
}
|
||||
else if (!title.empty()) {
|
||||
dc->drawText(ALERT_TITLE_LEFT, ALERT_TITLE_TOP, title.c_str(), ALARM_COLOR|DBLSIZE);
|
||||
}
|
||||
|
||||
if (!message.empty()) {
|
||||
dc->drawText(ALERT_MESSAGE_LEFT, ALERT_MESSAGE_TOP, message.c_str(), BOLD);
|
||||
}
|
||||
|
||||
if (!action.empty()) {
|
||||
dc->drawText(LCD_W / 2, ALERT_ACTION_TOP, action.c_str(), CENTERED | BOLD);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void FullScreenDialog::onKeyEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
deleteLater();
|
||||
if (confirmHandler)
|
||||
confirmHandler();
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
bool FullScreenDialog::onTouchEnd(coord_t x, coord_t y)
|
||||
{
|
||||
Window::onTouchEnd(x, y);
|
||||
deleteLater();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void FullScreenDialog::checkEvents()
|
||||
{
|
||||
Window::checkEvents();
|
||||
if (closeCondition && closeCondition()) {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void FullScreenDialog::deleteLater()
|
||||
{
|
||||
if (previousFocus) {
|
||||
previousFocus->setFocus();
|
||||
}
|
||||
if (running) {
|
||||
running = false;
|
||||
}
|
||||
else {
|
||||
Window::deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void FullScreenDialog::runForever()
|
||||
{
|
||||
running = true;
|
||||
|
||||
while (running) {
|
||||
auto check = pwrCheck();
|
||||
if (check == e_power_off) {
|
||||
boardOff();
|
||||
}
|
||||
else if (check == e_power_press) {
|
||||
RTOS_WAIT_MS(20);
|
||||
continue;
|
||||
}
|
||||
|
||||
checkBacklight();
|
||||
wdt_reset();
|
||||
|
||||
RTOS_WAIT_MS(20);
|
||||
mainWindow.run(false);
|
||||
}
|
||||
|
||||
Window::deleteLater();
|
||||
}
|
||||
|
||||
void raiseAlert(const char * title, const char * msg, const char * action, uint8_t sound)
|
||||
{
|
||||
AUDIO_ERROR_MESSAGE(sound);
|
||||
auto dialog = new FullScreenDialog(WARNING_TYPE_ALERT, title ? title : "", msg ? msg : "", action ? action : "");
|
||||
dialog->runForever();
|
||||
}
|
||||
@@ -18,10 +18,10 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DIALOG_H_
|
||||
#define _DIALOG_H_
|
||||
#ifndef _FULLSCREEN_DIALOG_H_
|
||||
#define _FULLSCREEN_DIALOG_H_
|
||||
|
||||
#include "button.h"
|
||||
#include "dialog.h"
|
||||
|
||||
enum DialogType {
|
||||
WARNING_TYPE_ALERT,
|
||||
@@ -31,43 +31,9 @@ enum DialogType {
|
||||
WARNING_TYPE_INFO
|
||||
};
|
||||
|
||||
class Dialog: public Window {
|
||||
public:
|
||||
Dialog(std::string title, const rect_t rect);
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
void deleteLater();
|
||||
|
||||
protected:
|
||||
std::string title;
|
||||
Window * previousFocus;
|
||||
};
|
||||
|
||||
class MessageDialog: public Dialog {
|
||||
public:
|
||||
MessageDialog(const char * title, const char * message);
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ConfirmDialog: public Dialog {
|
||||
public:
|
||||
ConfirmDialog(const char * title, const char * message, std::function<void(void)> confirmHandler);
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
std::function<void(void)> confirmHandler;
|
||||
};
|
||||
|
||||
class FullScreenDialog : public Dialog {
|
||||
public:
|
||||
FullScreenDialog(uint8_t type, std::string title, std::string message="", std::function<void(void)> confirmHandler=nullptr);
|
||||
FullScreenDialog(uint8_t type, std::string title, std::string message = "", std::string action = "", std::function<void(void)> confirmHandler = nullptr);
|
||||
|
||||
~FullScreenDialog() override;
|
||||
|
||||
@@ -108,14 +74,10 @@ class FullScreenDialog : public Dialog {
|
||||
protected:
|
||||
uint8_t type;
|
||||
std::string message;
|
||||
std::string action;
|
||||
bool running = false;
|
||||
std::function<bool(void)> closeCondition;
|
||||
std::function<void(void)> confirmHandler;
|
||||
};
|
||||
|
||||
inline void POPUP_INFORMATION(const char * str)
|
||||
{
|
||||
new MessageDialog("Message", str);
|
||||
}
|
||||
|
||||
#endif // _CONFIRMATION_H_
|
||||
#endif // _FULLSCREEN_DIALOG_H_
|
||||
@@ -28,7 +28,7 @@ std::list<const LayoutFactory *> & getRegisteredLayouts()
|
||||
|
||||
void registerLayout(const LayoutFactory * factory)
|
||||
{
|
||||
TRACE("register layout %s", factory->getName());
|
||||
TRACE("register layout %s", factory->getId());
|
||||
getRegisteredLayouts().push_back(factory);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ const LayoutFactory * getLayoutFactory(const char * name)
|
||||
{
|
||||
std::list<const LayoutFactory *>::const_iterator it = getRegisteredLayouts().cbegin();
|
||||
for (; it != getRegisteredLayouts().cend(); ++it) {
|
||||
if (!strcmp(name, (*it)->getName())) {
|
||||
if (!strcmp(name, (*it)->getId())) {
|
||||
return (*it);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ Layout * loadLayout(const char * name, Layout::PersistentData * persistentData)
|
||||
|
||||
void loadCustomScreens()
|
||||
{
|
||||
for (unsigned int i=0; i<MAX_CUSTOM_SCREENS; i++) {
|
||||
for (unsigned int i = 0; i < MAX_CUSTOM_SCREENS; i++) {
|
||||
delete customScreens[i];
|
||||
char name[LAYOUT_NAME_LEN + 1];
|
||||
memset(name, 0, sizeof(name));
|
||||
@@ -66,7 +66,7 @@ void loadCustomScreens()
|
||||
customScreens[0] = getRegisteredLayouts().front()->create(&g_model.screenData[0].layoutData);
|
||||
}
|
||||
|
||||
if (topbar) {
|
||||
topbar->load();
|
||||
}
|
||||
// if (topbar) {
|
||||
// topbar->load();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -59,18 +59,21 @@ void registerLayout(const LayoutFactory * factory);
|
||||
class LayoutFactory
|
||||
{
|
||||
public:
|
||||
LayoutFactory(const char * name):
|
||||
LayoutFactory(const char * id, const char * name):
|
||||
id(id),
|
||||
name(name)
|
||||
{
|
||||
registerLayout(this);
|
||||
}
|
||||
const char * getId() const { return id; }
|
||||
const char * getName() const { return name; }
|
||||
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const = 0;
|
||||
virtual void drawThumb(BitmapBuffer * dc, uint16_t x, uint16_t y, LcdFlags flags) const = 0;
|
||||
virtual const ZoneOption * getOptions() const = 0;
|
||||
virtual Layout * create(Layout::PersistentData * persistentData) const = 0;
|
||||
virtual Layout * load(Layout::PersistentData * persistentData) const = 0;
|
||||
|
||||
protected:
|
||||
const char * id;
|
||||
const char * name;
|
||||
};
|
||||
|
||||
@@ -78,24 +81,24 @@ template<class T>
|
||||
class BaseLayoutFactory: public LayoutFactory
|
||||
{
|
||||
public:
|
||||
BaseLayoutFactory(const char * name, const uint8_t * bitmap, const ZoneOption * options):
|
||||
LayoutFactory(name),
|
||||
BaseLayoutFactory(const char * id, const char * name, const uint8_t * bitmap, const ZoneOption * options):
|
||||
LayoutFactory(id, name),
|
||||
bitmap(bitmap),
|
||||
options(options)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const
|
||||
void drawThumb(BitmapBuffer * dc, uint16_t x, uint16_t y, uint32_t flags) const override
|
||||
{
|
||||
lcdDrawBitmapPattern(x, y, bitmap, flags);
|
||||
dc->drawBitmapPattern(x, y, bitmap, flags);
|
||||
}
|
||||
|
||||
virtual const ZoneOption * getOptions() const
|
||||
const ZoneOption * getOptions() const override
|
||||
{
|
||||
return options;
|
||||
}
|
||||
|
||||
virtual Layout * create(Layout::PersistentData * persistentData) const
|
||||
Layout * create(Layout::PersistentData * persistentData) const override
|
||||
{
|
||||
Layout * layout = new T(this, persistentData);
|
||||
if (layout) {
|
||||
@@ -104,7 +107,7 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
return layout;
|
||||
}
|
||||
|
||||
virtual Layout * load(Layout::PersistentData * persistentData) const
|
||||
Layout * load(Layout::PersistentData * persistentData) const override
|
||||
{
|
||||
Layout * layout = new T(this, persistentData);
|
||||
if (layout) {
|
||||
|
||||
@@ -38,19 +38,19 @@ class Layout1x1: public Layout
|
||||
{
|
||||
}
|
||||
|
||||
virtual void create()
|
||||
void create() override
|
||||
{
|
||||
Layout::create();
|
||||
persistentData->options[0].boolValue = true;
|
||||
persistentData->options[1].boolValue = true;
|
||||
}
|
||||
|
||||
virtual unsigned int getZonesCount() const
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual Zone getZone(unsigned int index) const
|
||||
Zone getZone(unsigned int index) const override
|
||||
{
|
||||
Zone zone = { 10, 10, LCD_W - 2*10, LCD_H - 2*10 };
|
||||
if (persistentData->options[0].boolValue) {
|
||||
@@ -65,28 +65,28 @@ class Layout1x1: public Layout
|
||||
return zone;
|
||||
}
|
||||
|
||||
virtual void refresh();
|
||||
// virtual void refresh();
|
||||
};
|
||||
|
||||
void Layout1x1::refresh()
|
||||
{
|
||||
theme->drawBackground();
|
||||
//void Layout1x1::refresh()
|
||||
//{
|
||||
// theme->drawBackground();
|
||||
//
|
||||
// if (persistentData->options[0].boolValue) {
|
||||
// drawTopBar();
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[1].boolValue) {
|
||||
// // Sliders + Trims + Flight mode
|
||||
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE) / 2,
|
||||
// 232,
|
||||
// g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
|
||||
// drawMainPots();
|
||||
// drawTrims(mixerCurrentFlightMode);
|
||||
// }
|
||||
//
|
||||
// Layout::refresh();
|
||||
//}
|
||||
|
||||
if (persistentData->options[0].boolValue) {
|
||||
drawTopBar();
|
||||
}
|
||||
|
||||
if (persistentData->options[1].boolValue) {
|
||||
// Sliders + Trims + Flight mode
|
||||
lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE) / 2,
|
||||
232,
|
||||
g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
|
||||
drawMainPots();
|
||||
drawTrims(mixerCurrentFlightMode);
|
||||
}
|
||||
|
||||
Layout::refresh();
|
||||
}
|
||||
|
||||
BaseLayoutFactory<Layout1x1> layout1x1("Layout1x1", LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1);
|
||||
BaseLayoutFactory<Layout1x1> layout1x1("Layout1x1", "Fullscreen", LBM_LAYOUT_1x1, OPTIONS_LAYOUT_1x1);
|
||||
|
||||
@@ -29,7 +29,7 @@ const ZoneOption OPTIONS_LAYOUT_2P1[] = {
|
||||
{ "Flight mode", ZoneOption::Bool },
|
||||
{ "Sliders", ZoneOption::Bool },
|
||||
{ "Trims", ZoneOption::Bool },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
const Zone ZONES_LAYOUT_2P1[3] = {
|
||||
@@ -46,7 +46,7 @@ class Layout2P1: public Layout
|
||||
{
|
||||
}
|
||||
|
||||
virtual void create()
|
||||
void create() override
|
||||
{
|
||||
Layout::create();
|
||||
persistentData->options[0].boolValue = true;
|
||||
@@ -55,49 +55,49 @@ class Layout2P1: public Layout
|
||||
persistentData->options[3].boolValue = true;
|
||||
}
|
||||
|
||||
virtual unsigned int getZonesCount() const
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return DIM(ZONES_LAYOUT_2P1);
|
||||
}
|
||||
|
||||
virtual Zone getZone(unsigned int index) const
|
||||
Zone getZone(unsigned int index) const override
|
||||
{
|
||||
return ZONES_LAYOUT_2P1[index];
|
||||
}
|
||||
|
||||
virtual void refresh();
|
||||
// virtual void refresh();
|
||||
};
|
||||
|
||||
void Layout2P1::refresh()
|
||||
{
|
||||
theme->drawBackground();
|
||||
//void Layout2P1::refresh()
|
||||
//{
|
||||
// theme->drawBackground();
|
||||
//
|
||||
// if (persistentData->options[0].boolValue) {
|
||||
// drawTopBar();
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[1].boolValue) {
|
||||
// // Flight mode
|
||||
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
|
||||
// ZCHAR | SMLSIZE) / 2,
|
||||
// 232,
|
||||
// g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[2].boolValue) {
|
||||
// // Pots and rear sliders positions
|
||||
// drawMainPots();
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[3].boolValue) {
|
||||
// // Trims
|
||||
// drawTrims(mixerCurrentFlightMode);
|
||||
// }
|
||||
//
|
||||
// Layout::refresh();
|
||||
//}
|
||||
|
||||
if (persistentData->options[0].boolValue) {
|
||||
drawTopBar();
|
||||
}
|
||||
|
||||
if (persistentData->options[1].boolValue) {
|
||||
// Flight mode
|
||||
lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
|
||||
ZCHAR | SMLSIZE) / 2,
|
||||
232,
|
||||
g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
|
||||
}
|
||||
|
||||
if (persistentData->options[2].boolValue) {
|
||||
// Pots and rear sliders positions
|
||||
drawMainPots();
|
||||
}
|
||||
|
||||
if (persistentData->options[3].boolValue) {
|
||||
// Trims
|
||||
drawTrims(mixerCurrentFlightMode);
|
||||
}
|
||||
|
||||
Layout::refresh();
|
||||
}
|
||||
|
||||
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1);
|
||||
BaseLayoutFactory<Layout2P1> layout2P1("Layout2P1", "2 + 1", LBM_LAYOUT_2P1, OPTIONS_LAYOUT_2P1);
|
||||
const LayoutFactory * defaultLayout = &layout2P1;
|
||||
|
||||
@@ -37,18 +37,18 @@ class Layout2x1: public Layout
|
||||
{
|
||||
}
|
||||
|
||||
virtual void create()
|
||||
void create() override
|
||||
{
|
||||
Layout::create();
|
||||
persistentData->options[0].boolValue = true;
|
||||
}
|
||||
|
||||
virtual unsigned int getZonesCount() const
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
virtual Zone getZone(unsigned int index) const
|
||||
Zone getZone(unsigned int index) const override
|
||||
{
|
||||
Zone zone;
|
||||
zone.w = (LCD_W-3*10) / 2;
|
||||
@@ -64,18 +64,18 @@ class Layout2x1: public Layout
|
||||
return zone;
|
||||
}
|
||||
|
||||
virtual void refresh();
|
||||
// virtual void refresh();
|
||||
};
|
||||
|
||||
void Layout2x1::refresh()
|
||||
{
|
||||
theme->drawBackground();
|
||||
//void Layout2x1::refresh()
|
||||
//{
|
||||
// theme->drawBackground();
|
||||
//
|
||||
// if (persistentData->options[0].boolValue) {
|
||||
// drawTopBar();
|
||||
// }
|
||||
//
|
||||
// Layout::refresh();
|
||||
//}
|
||||
|
||||
if (persistentData->options[0].boolValue) {
|
||||
drawTopBar();
|
||||
}
|
||||
|
||||
Layout::refresh();
|
||||
}
|
||||
|
||||
BaseLayoutFactory<Layout2x1> Layout2x1("Layout2x1", LBM_LAYOUT_2x1, OPTIONS_LAYOUT_2x1);
|
||||
BaseLayoutFactory<Layout2x1> Layout2x1("Layout2x1", "2 x 1", LBM_LAYOUT_2x1, OPTIONS_LAYOUT_2x1);
|
||||
|
||||
@@ -26,7 +26,7 @@ const uint8_t LBM_LAYOUT_2x2[] = {
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_2x2[] = {
|
||||
{ "Top bar", ZoneOption::Bool },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
class Layout2x2: public Layout
|
||||
@@ -37,18 +37,18 @@ class Layout2x2: public Layout
|
||||
{
|
||||
}
|
||||
|
||||
virtual void create()
|
||||
void create() override
|
||||
{
|
||||
Layout::create();
|
||||
persistentData->options[0].boolValue = true;
|
||||
}
|
||||
|
||||
virtual unsigned int getZonesCount() const
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
virtual Zone getZone(unsigned int index) const
|
||||
Zone getZone(unsigned int index) const override
|
||||
{
|
||||
Zone zone;
|
||||
zone.w = (LCD_W-3*10) / 2;
|
||||
@@ -67,18 +67,18 @@ class Layout2x2: public Layout
|
||||
return zone;
|
||||
}
|
||||
|
||||
virtual void refresh();
|
||||
// virtual void refresh();
|
||||
};
|
||||
|
||||
void Layout2x2::refresh()
|
||||
{
|
||||
theme->drawBackground();
|
||||
//void Layout2x2::refresh()
|
||||
//{
|
||||
// theme->drawBackground();
|
||||
//
|
||||
// if (persistentData->options[0].boolValue) {
|
||||
// drawTopBar();
|
||||
// }
|
||||
//
|
||||
// Layout::refresh();
|
||||
//}
|
||||
|
||||
if (persistentData->options[0].boolValue) {
|
||||
drawTopBar();
|
||||
}
|
||||
|
||||
Layout::refresh();
|
||||
}
|
||||
|
||||
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", LBM_LAYOUT_2x2, OPTIONS_LAYOUT_2x2);
|
||||
BaseLayoutFactory<Layout2x2> layout2x2("Layout2x2", "2 x 2", LBM_LAYOUT_2x2, OPTIONS_LAYOUT_2x2);
|
||||
|
||||
@@ -44,7 +44,7 @@ class Layout2x4: public Layout
|
||||
{
|
||||
}
|
||||
|
||||
virtual void create()
|
||||
void create() override
|
||||
{
|
||||
Layout::create();
|
||||
persistentData->options[0].boolValue = true;
|
||||
@@ -57,12 +57,12 @@ class Layout2x4: public Layout
|
||||
persistentData->options[7].unsignedValue = RGB(77, 112, 203);
|
||||
}
|
||||
|
||||
virtual unsigned int getZonesCount() const
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
virtual Zone getZone(unsigned int index) const
|
||||
Zone getZone(unsigned int index) const override
|
||||
{
|
||||
Zone zone;
|
||||
zone.x = (index >= 4) ? 260 : 60;
|
||||
@@ -72,48 +72,48 @@ class Layout2x4: public Layout
|
||||
return zone;
|
||||
}
|
||||
|
||||
virtual void refresh();
|
||||
// virtual void refresh();
|
||||
};
|
||||
|
||||
void Layout2x4::refresh()
|
||||
{
|
||||
theme->drawBackground();
|
||||
//void Layout2x4::refresh()
|
||||
//{
|
||||
// theme->drawBackground();
|
||||
//
|
||||
// if (persistentData->options[0].boolValue) {
|
||||
// drawTopBar();
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[1].boolValue) {
|
||||
// // Flight mode
|
||||
// lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
|
||||
// ZCHAR | SMLSIZE) / 2,
|
||||
// 232,
|
||||
// g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
// sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[2].boolValue) {
|
||||
// // Pots and rear sliders positions
|
||||
// drawMainPots();
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[3].boolValue) {
|
||||
// // Trims
|
||||
// drawTrims(mixerCurrentFlightMode);
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[4].boolValue) {
|
||||
// lcdSetColor(persistentData->options[5].unsignedValue);
|
||||
// lcdDrawSolidFilledRect(50, 50, 180, 170, CUSTOM_COLOR);
|
||||
// }
|
||||
//
|
||||
// if (persistentData->options[6].boolValue) {
|
||||
// lcdSetColor(persistentData->options[7].unsignedValue);
|
||||
// lcdDrawSolidFilledRect(250, 50, 180, 170, CUSTOM_COLOR);
|
||||
// }
|
||||
//
|
||||
// Layout::refresh();
|
||||
//}
|
||||
|
||||
if (persistentData->options[0].boolValue) {
|
||||
drawTopBar();
|
||||
}
|
||||
|
||||
if (persistentData->options[1].boolValue) {
|
||||
// Flight mode
|
||||
lcdDrawSizedText(LCD_W / 2 - getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name),
|
||||
ZCHAR | SMLSIZE) / 2,
|
||||
232,
|
||||
g_model.flightModeData[mixerCurrentFlightMode].name,
|
||||
sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR | SMLSIZE);
|
||||
}
|
||||
|
||||
if (persistentData->options[2].boolValue) {
|
||||
// Pots and rear sliders positions
|
||||
drawMainPots();
|
||||
}
|
||||
|
||||
if (persistentData->options[3].boolValue) {
|
||||
// Trims
|
||||
drawTrims(mixerCurrentFlightMode);
|
||||
}
|
||||
|
||||
if (persistentData->options[4].boolValue) {
|
||||
lcdSetColor(persistentData->options[5].unsignedValue);
|
||||
lcdDrawSolidFilledRect(50, 50, 180, 170, CUSTOM_COLOR);
|
||||
}
|
||||
|
||||
if (persistentData->options[6].boolValue) {
|
||||
lcdSetColor(persistentData->options[7].unsignedValue);
|
||||
lcdDrawSolidFilledRect(250, 50, 180, 170, CUSTOM_COLOR);
|
||||
}
|
||||
|
||||
Layout::refresh();
|
||||
}
|
||||
|
||||
BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", LBM_LAYOUT_2x4, OPTIONS_LAYOUT_2x4);
|
||||
BaseLayoutFactory<Layout2x4> layout2x4("Layout2x4", "2 x 4", LBM_LAYOUT_2x4, OPTIONS_LAYOUT_2x4);
|
||||
|
||||
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 3.9 KiB |
@@ -18,17 +18,13 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "opentx.h"
|
||||
#include "strhelpers.h"
|
||||
|
||||
#if defined(SIMU)
|
||||
display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
pixel_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
uint16_t lcdColorTable[LCD_COLOR_COUNT];
|
||||
|
||||
coord_t lcdNextPos;
|
||||
|
||||
uint8_t getMappedChar(uint8_t c)
|
||||
@@ -73,15 +69,19 @@ uint8_t getMappedChar(uint8_t c)
|
||||
result = 207 + c - 0x80;
|
||||
}
|
||||
#endif
|
||||
else if (c == 0x21) // !
|
||||
result = 0;
|
||||
else if (c < 0xC0)
|
||||
result = c - 0x20;
|
||||
result = c - 0x20 - 2;
|
||||
else
|
||||
result = c - 0xC0 + 96;
|
||||
// TRACE("getMappedChar '%c' (%d) = %d", c, c, result);
|
||||
result = c - 0xC0 + 96 - 2;
|
||||
|
||||
// TRACE("getMappedChar '%c' (%x) = %d", c, c, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int getFontPatternWidth(const uint16_t * spec, uint8_t index)
|
||||
int getFontPatternWidth(const uint16_t * spec, int index)
|
||||
{
|
||||
return spec[index + 2] - spec[index + 1];
|
||||
}
|
||||
@@ -91,23 +91,6 @@ int getCharWidth(uint8_t c, const uint16_t * spec)
|
||||
return getFontPatternWidth(spec, getMappedChar(c));
|
||||
}
|
||||
|
||||
void lcdPutFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags)
|
||||
{
|
||||
coord_t offset = spec[index + 1];
|
||||
coord_t width = spec[index + 2] - offset;
|
||||
if (width > 0)
|
||||
lcdDrawBitmapPattern(x, y, font, flags, offset, width);
|
||||
lcdNextPos = x + width;
|
||||
}
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
|
||||
{
|
||||
uint32_t fontindex = FONTINDEX(flags);
|
||||
const unsigned char * font = fontsTable[fontindex];
|
||||
const uint16_t * fontspecs = fontspecsTable[fontindex];
|
||||
lcdPutFontPattern(x, y, font, fontspecs, getMappedChar(c), flags);
|
||||
}
|
||||
|
||||
uint8_t getFontHeight(LcdFlags flags)
|
||||
{
|
||||
uint32_t fontindex = FONTINDEX(flags);
|
||||
@@ -119,68 +102,32 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
|
||||
const uint16_t * specs = fontspecsTable[FONTINDEX(flags)];
|
||||
|
||||
int result = 0;
|
||||
for (int i=0; len==0 || i<len; ++i) {
|
||||
|
||||
#if !defined(BOOT)
|
||||
char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
|
||||
#else
|
||||
char c = *s;
|
||||
#endif
|
||||
if (c == '\0')
|
||||
for (int i=0; len == 0 || i < len; ++i) {
|
||||
unsigned int c = uint8_t(*s);
|
||||
if (!c) {
|
||||
break;
|
||||
result += getCharWidth(c, specs);
|
||||
}
|
||||
else if (c == 0x20) {
|
||||
result += 4;
|
||||
}
|
||||
else if (c >= 0xFE) {
|
||||
s++;
|
||||
c = uint8_t(*s) + ((c & 0x01) << 8) - 1;
|
||||
if (c >= 0x101)
|
||||
c -= 1;
|
||||
c += 187;
|
||||
result += getFontPatternWidth(specs, c);
|
||||
}
|
||||
else if (c >= 0x20) {
|
||||
result += getCharWidth(c, specs);
|
||||
}
|
||||
|
||||
++s;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags)
|
||||
{
|
||||
uint8_t length;
|
||||
length = *(s++);
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
|
||||
}
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t len, const char * prefix, const char * suffix)
|
||||
{
|
||||
char str[48+1]; // max=16 for the prefix, 16 chars for the number, 16 chars for the suffix
|
||||
char *s = str+32;
|
||||
*s = '\0';
|
||||
int idx = 0;
|
||||
int mode = MODE(flags);
|
||||
bool neg = false;
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
neg = true;
|
||||
}
|
||||
do {
|
||||
*--s = '0' + (val % 10);
|
||||
++idx;
|
||||
val /= 10;
|
||||
if (mode!=0 && idx==mode) {
|
||||
mode = 0;
|
||||
*--s = '.';
|
||||
if (val==0)
|
||||
*--s = '0';
|
||||
}
|
||||
} while (val!=0 || mode>0 || (mode==MODE(LEADING0) && idx<len));
|
||||
if (neg) *--s = '-';
|
||||
|
||||
// TODO needs check on all string lengths ...
|
||||
if (prefix) {
|
||||
int len = strlen(prefix);
|
||||
if (len <= 16) {
|
||||
s -= len;
|
||||
strncpy(s, prefix, len);
|
||||
}
|
||||
}
|
||||
if (suffix) {
|
||||
strncpy(&str[32], suffix, 16);
|
||||
}
|
||||
flags &= ~LEADING0;
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
|
||||
void lcdSetContrast()
|
||||
{
|
||||
lcdSetRefVolt(g_eeGeneral.contrast);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "bitmapbuffer.h"
|
||||
#include "opentx_types.h"
|
||||
#include "libopenui_globals.h"
|
||||
|
||||
#if LCD_W >= 480
|
||||
#define LCD_COLS 40
|
||||
@@ -48,8 +49,6 @@
|
||||
#define PREC2 0x30
|
||||
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
|
||||
|
||||
#define ZCHAR 0x10
|
||||
|
||||
/* rect, square flags */
|
||||
#define ROUND 0x04
|
||||
|
||||
@@ -67,7 +66,7 @@
|
||||
#define DISPLAY_BUFFER_SIZE (DISPLAY_PIXELS_COUNT)
|
||||
|
||||
#if defined(SIMU)
|
||||
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
extern pixel_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
#else
|
||||
#define displayBuf lcd->getData()
|
||||
#endif
|
||||
@@ -78,136 +77,23 @@ extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
extern coord_t lcdNextPos;
|
||||
void lcdNextLayer();
|
||||
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags=0);
|
||||
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags=0);
|
||||
|
||||
inline void lcdClear()
|
||||
{
|
||||
lcd->clear();
|
||||
}
|
||||
|
||||
inline void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags attr=0)
|
||||
{
|
||||
lcd->drawText(x, y, s, attr);
|
||||
}
|
||||
|
||||
inline void lcdDrawCenteredText(coord_t y, const char * s, LcdFlags attr=0)
|
||||
{
|
||||
lcd->drawText(LCD_W/2, y, s, attr | CENTERED);
|
||||
}
|
||||
|
||||
inline void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags attr=0)
|
||||
{
|
||||
lcd->drawSizedText(x, y, s, len, attr);
|
||||
}
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags=0, uint8_t len=0, const char * prefix=NULL, const char * suffix=NULL);
|
||||
|
||||
#define SOLID 0xff
|
||||
#define DOTTED 0x55
|
||||
#define STASHED 0x33
|
||||
|
||||
#if defined(PCBX10) && !defined(SIMU)
|
||||
#define PIXEL_PTR(x, y) &displayBuf[(LCD_H*LCD_W-1) - (y)*LCD_W - (x)]
|
||||
#else
|
||||
#define PIXEL_PTR(x, y) &displayBuf[(y)*LCD_W + (x)]
|
||||
#endif
|
||||
|
||||
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color);
|
||||
void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
|
||||
|
||||
inline void lcdDrawSolidHorizontalLine(coord_t x, coord_t y, coord_t w, LcdFlags att)
|
||||
{
|
||||
lcd->drawSolidHorizontalLine(x, y, w, att);
|
||||
}
|
||||
|
||||
inline void lcdDrawSolidVerticalLine(coord_t x, coord_t y, coord_t h, LcdFlags att)
|
||||
{
|
||||
lcd->drawSolidVerticalLine(x, y, h, att);
|
||||
}
|
||||
|
||||
inline void lcdDrawSolidFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, LcdFlags flags)
|
||||
{
|
||||
lcd->drawSolidFilledRect(x, y, w, h, flags);
|
||||
}
|
||||
|
||||
inline void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0)
|
||||
{
|
||||
lcd->drawHorizontalLine(x, y, w, pat, att);
|
||||
}
|
||||
|
||||
inline void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags att=0)
|
||||
{
|
||||
lcd->drawVerticalLine(x, y, h, pat, att);
|
||||
}
|
||||
|
||||
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
|
||||
inline void lcdDrawAlphaPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
|
||||
{
|
||||
display_t * p = PIXEL_PTR(x, y);
|
||||
lcdDrawAlphaPixel(p, opacity, color);
|
||||
}
|
||||
|
||||
inline void lcdSetColor(uint16_t color)
|
||||
{
|
||||
lcdColorTable[CUSTOM_COLOR_INDEX] = color;
|
||||
}
|
||||
|
||||
inline void lcdDrawSolidRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness=1, LcdFlags att=0)
|
||||
{
|
||||
lcd->drawSolidFilledRect(x, y, thickness, h, att);
|
||||
lcd->drawSolidFilledRect(x+w-thickness, y, thickness, h, att);
|
||||
lcd->drawSolidFilledRect(x, y, w, thickness, att);
|
||||
lcd->drawSolidFilledRect(x, y+h-thickness, w, thickness, att);
|
||||
}
|
||||
|
||||
inline void lcdDrawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att=0)
|
||||
{
|
||||
lcd->drawFilledRect(x, y, w, h, pat, att);
|
||||
}
|
||||
|
||||
void lcdDrawBlackOverlay();
|
||||
inline void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness=1, uint8_t pat=SOLID, LcdFlags att=0)
|
||||
{
|
||||
lcd->drawRect(x, y, w, h, thickness, pat, att);
|
||||
}
|
||||
|
||||
void lcdDrawCircle(int x0, int y0, int radius);
|
||||
void lcdDrawPie(int x0, int y0, int radius, int angle1=0, int angle2=360);
|
||||
void lcdDrawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int endAngle);
|
||||
|
||||
inline void lcdDrawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t * bmp, LcdFlags flags=0, int startAngle=0, int endAngle=360)
|
||||
{
|
||||
lcd->drawBitmapPatternPie(x0, y0, bmp, flags, startAngle, endAngle);
|
||||
}
|
||||
|
||||
inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0)
|
||||
{
|
||||
lcdDrawSolidRect(x, y, w, w, att);
|
||||
}
|
||||
|
||||
inline int getBitmapWidth(const uint8_t * bmp)
|
||||
{
|
||||
return *((const uint16_t *)bmp);
|
||||
}
|
||||
|
||||
inline int getBitmapHeight(const uint8_t * bmp)
|
||||
{
|
||||
return *(((const uint16_t *)bmp)+1);
|
||||
}
|
||||
|
||||
uint8_t getMappedChar(uint8_t c);
|
||||
int getCharWidth(uint8_t c, const uint16_t * spec);
|
||||
uint8_t getFontHeight(LcdFlags flags);
|
||||
int getTextWidth(const char * s, int len=0, LcdFlags flags=0);
|
||||
|
||||
inline void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0)
|
||||
{
|
||||
lcd->drawBitmapPattern(x, y, img, flags, offset, width);
|
||||
}
|
||||
|
||||
#if defined(BOOT)
|
||||
#define BLINK_ON_PHASE (0)
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#define _LIBOPENUI_H_
|
||||
|
||||
#include "libopenui_config.h"
|
||||
#include "libopenui_file.h"
|
||||
#include "font.h"
|
||||
#include "window.h"
|
||||
#include "mainwindow.h"
|
||||
#include "static.h"
|
||||
@@ -43,6 +45,10 @@
|
||||
#include "page.h"
|
||||
#include "menu.h"
|
||||
#include "dialog.h"
|
||||
#include "fullscreen_dialog.h"
|
||||
#include "message_dialog.h"
|
||||
#include "confirm_dialog.h"
|
||||
#include "dialog.h"
|
||||
#include "gridlayout.h"
|
||||
#include "getset_helpers.h"
|
||||
#include "curveedit.h"
|
||||
@@ -18,35 +18,27 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _PROGRESS_H_
|
||||
#define _PROGRESS_H_
|
||||
#include "opentx.h"
|
||||
#include "menu_screen.h"
|
||||
#include "screen_setup.h"
|
||||
|
||||
#include "window.h"
|
||||
ScreenMenu::ScreenMenu():
|
||||
TabsGroup(ICON_THEME)
|
||||
{
|
||||
updateTabs();
|
||||
}
|
||||
|
||||
class Progress : public Window {
|
||||
public:
|
||||
Progress(Window * parent, const rect_t & rect):
|
||||
Window(parent, rect)
|
||||
{
|
||||
void ScreenMenu::updateTabs()
|
||||
{
|
||||
removeAllTabs();
|
||||
|
||||
for (int index = 0; index < MAX_CUSTOM_SCREENS; index++) {
|
||||
if (customScreens[index]) {
|
||||
addTab(new ScreenSetupPage(this, index));
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() override
|
||||
{
|
||||
return "Progress";
|
||||
else {
|
||||
addTab(new ScreenAddPage(this, index));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
void setValue(int value)
|
||||
{
|
||||
this->value = value;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
protected:
|
||||
int value;
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,19 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "progress.h"
|
||||
#include "theme.h"
|
||||
#ifndef _MENU_SCREEN_H_
|
||||
#define _MENU_SCREEN_H_
|
||||
|
||||
void Progress::paint(BitmapBuffer * dc)
|
||||
{
|
||||
theme->drawProgressBar(dc, 0, 0, width(), height(), value);
|
||||
}
|
||||
#include "tabsgroup.h"
|
||||
|
||||
class ScreenMenu: public TabsGroup {
|
||||
friend class ScreenSetupPage;
|
||||
|
||||
public:
|
||||
ScreenMenu();
|
||||
|
||||
protected:
|
||||
void updateTabs();
|
||||
};
|
||||
|
||||
#endif // _MENU_SCREEN_H_
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 "message_dialog.h"
|
||||
#include "static.h"
|
||||
|
||||
MessageDialog::MessageDialog(const char * title, const char * message):
|
||||
Dialog(title, {50, 73, LCD_W - 100, LCD_H - 146})
|
||||
{
|
||||
new StaticText(this, {0, height() / 2, width(), PAGE_LINE_HEIGHT}, message, CENTERED);
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void MessageDialog::onKeyEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -18,25 +18,23 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _LIBOPEUI_HELPERS_H_
|
||||
#define _LIBOPEUI_HELPERS_H_
|
||||
#ifndef _MESSAGE_DIALOG_H_
|
||||
#define _MESSAGE_DIALOG_H_
|
||||
|
||||
template<class T>
|
||||
inline T min(T a, T b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
#include "dialog.h"
|
||||
|
||||
template<class T>
|
||||
inline T max(T a, T b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T limit(T vmin, T x, T vmax)
|
||||
{
|
||||
return min(max(vmin, x), vmax);
|
||||
}
|
||||
class MessageDialog: public Dialog {
|
||||
public:
|
||||
MessageDialog(const char * title, const char * message);
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline void POPUP_INFORMATION(const char * str)
|
||||
{
|
||||
new MessageDialog("Message", str);
|
||||
}
|
||||
|
||||
#endif // _MESSAGE_DIALOG_H_
|
||||
@@ -153,13 +153,13 @@ class CurveButton : public Button {
|
||||
void paint(BitmapBuffer * dc) override
|
||||
{
|
||||
// bounding rect
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
|
||||
// curve characteristics
|
||||
if (isCurveFilled(index)) {
|
||||
CurveInfo &curve = g_model.curves[index];
|
||||
drawNumber(dc, 130, 5, 5 + curve.points, LEFT, 0, nullptr, STR_PTS);
|
||||
drawTextAtIndex(dc, 130, 25, STR_CURVE_TYPES, curve.type);
|
||||
dc->drawNumber(130, 5, 5 + curve.points, LEFT, 0, nullptr, STR_PTS);
|
||||
dc->drawTextAtIndex(130, 25, STR_CURVE_TYPES, curve.type);
|
||||
if (curve.smooth)
|
||||
dc->drawText(130, 45, "Smooth");
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ void CommonInputOrMixButton::paint(BitmapBuffer * dc)
|
||||
if (active)
|
||||
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
|
||||
paintBody(dc);
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
}
|
||||
|
||||
class InputLineButton : public CommonInputOrMixButton {
|
||||
@@ -339,7 +339,7 @@ class InputLineButton : public CommonInputOrMixButton {
|
||||
|
||||
if (line.name[0]) {
|
||||
dc->drawBitmap(146, 2 + FIELD_PADDING_TOP, mixerSetupLabelBitmap);
|
||||
dc->drawSizedText(166, FIELD_PADDING_TOP, line.name, sizeof(line.name), ZCHAR);
|
||||
dc->drawSizedText(166, FIELD_PADDING_TOP, line.name, sizeof(line.name));
|
||||
}
|
||||
|
||||
// second line ...
|
||||
|
||||
@@ -24,19 +24,19 @@
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData * ls)
|
||||
{
|
||||
lcdDrawChar(x, y, '[');
|
||||
lcdDrawNumber(lcdNextPos+2, y, lswTimerValue(ls->v2), LEFT|PREC1);
|
||||
lcdDrawChar(lcdNextPos, y, ':');
|
||||
if (ls->v3 < 0)
|
||||
lcdDrawText(lcdNextPos+3, y, "<<");
|
||||
else if (ls->v3 == 0)
|
||||
lcdDrawText(lcdNextPos+3, y, "--");
|
||||
else
|
||||
lcdDrawNumber(lcdNextPos+3, y, lswTimerValue(ls->v2+ls->v3), LEFT|PREC1);
|
||||
lcdDrawChar(lcdNextPos, y, ']');
|
||||
}
|
||||
//void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData * ls)
|
||||
//{
|
||||
// lcdDrawChar(x, y, '[');
|
||||
// lcdDrawNumber(lcdNextPos+2, y, lswTimerValue(ls->v2), LEFT|PREC1);
|
||||
// lcdDrawChar(lcdNextPos, y, ':');
|
||||
// if (ls->v3 < 0)
|
||||
// lcdDrawText(lcdNextPos+3, y, "<<");
|
||||
// else if (ls->v3 == 0)
|
||||
// lcdDrawText(lcdNextPos+3, y, "--");
|
||||
// else
|
||||
// lcdDrawNumber(lcdNextPos+3, y, lswTimerValue(ls->v2+ls->v3), LEFT|PREC1);
|
||||
// lcdDrawChar(lcdNextPos, y, ']');
|
||||
//}
|
||||
|
||||
class LogicalSwitchEditWindow: public Page {
|
||||
public:
|
||||
@@ -102,7 +102,7 @@ class LogicalSwitchEditWindow: public Page {
|
||||
edit2->invalidate();
|
||||
});
|
||||
edit1->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, 2, 2, lswTimerValue(value), flags | PREC1);
|
||||
dc->drawNumber(2, 2, lswTimerValue(value), flags | PREC1);
|
||||
});
|
||||
edit2->setDisplayHandler([=](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
if (value < 0)
|
||||
@@ -110,7 +110,7 @@ class LogicalSwitchEditWindow: public Page {
|
||||
else if (value == 0)
|
||||
dc->drawText(2, 2, "--", flags);
|
||||
else
|
||||
drawNumber(dc, 2, 2, lswTimerValue(cs->v2 + value), flags | PREC1);
|
||||
dc->drawNumber(2, 2, lswTimerValue(cs->v2 + value), flags | PREC1);
|
||||
});
|
||||
grid.nextLine();
|
||||
}
|
||||
@@ -127,14 +127,14 @@ class LogicalSwitchEditWindow: public Page {
|
||||
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1);
|
||||
auto timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v1));
|
||||
timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, 2, 2, lswTimerValue(value), flags | PREC1);
|
||||
dc->drawNumber(2, 2, lswTimerValue(value), flags | PREC1);
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2);
|
||||
timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v2));
|
||||
timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, 2, 2, lswTimerValue(value), flags | PREC1);
|
||||
dc->drawNumber(2, 2, lswTimerValue(value), flags | PREC1);
|
||||
});
|
||||
grid.nextLine();
|
||||
}
|
||||
@@ -265,10 +265,10 @@ class LogicalSwitchButton : public Button {
|
||||
dc->drawSolidFilledRect(2, 2, rect.w-4, rect.h-4, WARNING_COLOR);
|
||||
|
||||
// The bounding rect
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
|
||||
// CSW func
|
||||
lcdDrawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func);
|
||||
dc->drawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func);
|
||||
|
||||
// CSW params
|
||||
if (lsFamily == LS_FAMILY_BOOL || lsFamily == LS_FAMILY_STICKY) {
|
||||
@@ -277,15 +277,15 @@ class LogicalSwitchButton : public Button {
|
||||
}
|
||||
else if (lsFamily == LS_FAMILY_EDGE) {
|
||||
drawSwitch(dc, col1, line2, ls->v1);
|
||||
putsEdgeDelayParam(col2, line2, ls);
|
||||
// TODO putsEdgeDelayParam(col2, line2, ls);
|
||||
}
|
||||
else if (lsFamily == LS_FAMILY_COMP) {
|
||||
drawSource(dc, col2, line1, ls->v1, 0);
|
||||
drawSource(dc, col3, line1, ls->v2, 0);
|
||||
}
|
||||
else if (lsFamily == LS_FAMILY_TIMER) {
|
||||
lcdDrawNumber(col2, line1, lswTimerValue(ls->v1), LEFT|PREC1);
|
||||
lcdDrawNumber(col3, line1, lswTimerValue(ls->v2), LEFT|PREC1);
|
||||
dc->drawNumber(col2, line1, lswTimerValue(ls->v1), LEFT|PREC1);
|
||||
dc->drawNumber(col3, line1, lswTimerValue(ls->v2), LEFT|PREC1);
|
||||
}
|
||||
else {
|
||||
drawSource(dc, col2, line1, ls->v1, 0);
|
||||
@@ -297,12 +297,12 @@ class LogicalSwitchButton : public Button {
|
||||
|
||||
// CSW duration
|
||||
if (ls->duration > 0) {
|
||||
drawNumber(dc, col2, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->duration, PREC1 | LEFT);
|
||||
dc->drawNumber(col2, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->duration, PREC1 | LEFT);
|
||||
}
|
||||
|
||||
// CSW delay
|
||||
if (lsFamily != LS_FAMILY_EDGE && ls->delay > 0) {
|
||||
drawNumber(dc, col3, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->delay, PREC1 | LEFT);
|
||||
dc->drawNumber(col3, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->delay, PREC1 | LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ class MixLineButton : public CommonInputOrMixButton {
|
||||
|
||||
if (line.name[0]) {
|
||||
dc->drawBitmap(146, FIELD_PADDING_TOP, mixerSetupLabelBitmap);
|
||||
dc->drawSizedText(166, FIELD_PADDING_TOP, line.name, sizeof(line.name), ZCHAR);
|
||||
dc->drawSizedText(166, FIELD_PADDING_TOP, line.name, sizeof(line.name));
|
||||
}
|
||||
|
||||
// second line ...
|
||||
|
||||
@@ -121,15 +121,15 @@ class OutputLineButton : public Button {
|
||||
void paint(BitmapBuffer * dc) override
|
||||
{
|
||||
// first line
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, output->min - 1000, PREC1);
|
||||
drawNumber(dc, 68, FIELD_PADDING_TOP, output->max + 1000, PREC1);
|
||||
drawNumber(dc, 132, FIELD_PADDING_TOP, output->offset, PREC1);
|
||||
drawNumber(dc, 226, FIELD_PADDING_TOP, PPM_CENTER + output->ppmCenter, RIGHT);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, output->min - 1000, PREC1);
|
||||
dc->drawNumber(68, FIELD_PADDING_TOP, output->max + 1000, PREC1);
|
||||
dc->drawNumber(132, FIELD_PADDING_TOP, output->offset, PREC1);
|
||||
dc->drawNumber(226, FIELD_PADDING_TOP, PPM_CENTER + output->ppmCenter, RIGHT);
|
||||
dc->drawText(228, FIELD_PADDING_TOP - 3, output->symetrical ? "=" : "\306");
|
||||
|
||||
// second line
|
||||
if (output->revert) {
|
||||
drawTextAtIndex(dc, 4, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, STR_MMMINV, output->revert);
|
||||
dc->drawTextAtIndex(4, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, STR_MMMINV, output->revert);
|
||||
}
|
||||
if (output->curve) {
|
||||
dc->drawBitmap(68, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, mixerSetupCurveBitmap);
|
||||
@@ -137,11 +137,11 @@ class OutputLineButton : public Button {
|
||||
}
|
||||
if (output->name[0]) {
|
||||
dc->drawBitmap(146, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, mixerSetupLabelBitmap);
|
||||
dc->drawSizedText(166, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, output->name, sizeof(output->name), ZCHAR);
|
||||
dc->drawSizedText(166, PAGE_LINE_HEIGHT + FIELD_PADDING_TOP, output->name, sizeof(output->name));
|
||||
}
|
||||
|
||||
// bounding rect
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -46,7 +46,7 @@ class ChannelFailsafeBargraph: public Window {
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
|
||||
coord_t x = 0;
|
||||
lcdDrawRect(x, 0, width(), height());
|
||||
dc->drawRect(x, 0, width(), height());
|
||||
const coord_t lenChannel = limit((uint8_t) 1, uint8_t((abs(channelValue) * width() / 2 + lim / 2) / lim),
|
||||
uint8_t(width() / 2));
|
||||
const coord_t lenFailsafe = limit((uint8_t) 1, uint8_t((abs(failsafeValue) * width() / 2 + lim / 2) / lim),
|
||||
@@ -54,8 +54,8 @@ class ChannelFailsafeBargraph: public Window {
|
||||
x += width() / 2;
|
||||
const coord_t xChannel = (channelValue > 0) ? x : x + 1 - lenChannel;
|
||||
const coord_t xFailsafe = (failsafeValue > 0) ? x : x + 1 - lenFailsafe;
|
||||
lcdDrawSolidFilledRect(xChannel, + 2, lenChannel, (height() / 2) - 3, TEXT_COLOR);
|
||||
lcdDrawSolidFilledRect(xFailsafe, (height() / 2) + 1, lenFailsafe, (height() / 2) - 3, ALARM_COLOR);
|
||||
dc->drawSolidFilledRect(xChannel, + 2, lenChannel, (height() / 2) - 3, TEXT_COLOR);
|
||||
dc->drawSolidFilledRect(xFailsafe, (height() / 2) + 1, lenFailsafe, (height() / 2) - 3, ALARM_COLOR);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -130,7 +130,7 @@ class FailSafeFooter : public Window {
|
||||
|
||||
class FailSafePage : public PageTab {
|
||||
public:
|
||||
FailSafePage(uint8_t moduleIdx) :
|
||||
explicit FailSafePage(uint8_t moduleIdx) :
|
||||
PageTab("FAILSAFE", ICON_STATS_ANALOGS),
|
||||
moduleIdx(moduleIdx)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ FailSafeMenu::FailSafeMenu(uint8_t moduleIdx) :
|
||||
|
||||
class RegisterDialog: public Dialog {
|
||||
public:
|
||||
RegisterDialog(uint8_t moduleIdx):
|
||||
explicit RegisterDialog(uint8_t moduleIdx):
|
||||
Dialog(STR_REGISTER, {50, 73, LCD_W - 100, LCD_H - 146}),
|
||||
moduleIdx(moduleIdx)
|
||||
{
|
||||
@@ -272,7 +272,7 @@ class BindRxChoiceMenu: public Menu {
|
||||
moduleIdx(moduleIdx),
|
||||
receiverIdx(receiverIdx)
|
||||
{
|
||||
uint8_t receiversCount = min<uint8_t>(reusableBuffer.moduleSetup.bindInformation.candidateReceiversCount, PXX2_MAX_RECEIVERS_PER_MODULE);
|
||||
auto receiversCount = min<uint8_t>(reusableBuffer.moduleSetup.bindInformation.candidateReceiversCount, PXX2_MAX_RECEIVERS_PER_MODULE);
|
||||
for (uint8_t i = 0; i < receiversCount; i++) {
|
||||
const char * receiverName = reusableBuffer.moduleSetup.bindInformation.candidateReceiversNames[i];
|
||||
addLine(receiverName, [=]() {
|
||||
@@ -437,7 +437,7 @@ class ModuleWindow : public Window {
|
||||
update();
|
||||
}
|
||||
|
||||
~ModuleWindow()
|
||||
~ModuleWindow() override
|
||||
{
|
||||
deleteChildren();
|
||||
}
|
||||
@@ -452,7 +452,7 @@ class ModuleWindow : public Window {
|
||||
TextButton * registerButton = nullptr;
|
||||
Choice * failSafeChoice = nullptr;
|
||||
|
||||
void addChannelRange(FormGridLayout &grid, uint8_t moduleIdx)
|
||||
void addChannelRange(FormGridLayout &grid)
|
||||
{
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_CHANNELRANGE);
|
||||
auto channelStart = new NumberEdit(this, grid.getFieldSlot(2, 0), 1,
|
||||
@@ -658,7 +658,7 @@ class ModuleWindow : public Window {
|
||||
|
||||
// Channel Range
|
||||
if (g_model.moduleData[moduleIdx].type != MODULE_TYPE_NONE) {
|
||||
addChannelRange(grid, moduleIdx); //TODO XJT2 should only set channel count of 8/16/24
|
||||
addChannelRange(grid); //TODO XJT2 should only set channel count of 8/16/24
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
@@ -787,13 +787,13 @@ class ModuleWindow : public Window {
|
||||
|
||||
// R9M Power
|
||||
if (isModuleR9M_FCC(moduleIdx)) {
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_RFPOWER);
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER);
|
||||
new Choice(this, grid.getFieldSlot(), STR_R9M_FCC_POWER_VALUES, 0, R9M_FCC_POWER_MAX,
|
||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power));
|
||||
}
|
||||
|
||||
if (isModuleR9M_LBT(moduleIdx)) {
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_RFPOWER);
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER);
|
||||
new Choice(this, grid.getFieldSlot(), STR_R9M_LBT_POWER_VALUES, 0, R9M_LBT_POWER_MAX,
|
||||
GET_DEFAULT(min<uint8_t>(g_model.moduleData[moduleIdx].pxx.power, R9M_LBT_POWER_MAX)),
|
||||
SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power));
|
||||
@@ -820,7 +820,7 @@ class ModuleWindow : public Window {
|
||||
};
|
||||
|
||||
ModelSetupPage::ModelSetupPage() :
|
||||
PageTab(STR_MENUSETUP, ICON_MODEL_SETUP)
|
||||
PageTab(STR_MENU_MODEL_SETUP, ICON_MODEL_SETUP)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -994,7 +994,7 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// Throttle warning
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_THROTTLEWARNING);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_THROTTLE_WARNING);
|
||||
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_model.disableThrottleWarning));
|
||||
grid.nextLine();
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ class SensorButton : public Button {
|
||||
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
|
||||
}
|
||||
|
||||
drawNumber(dc, 2, 1, number, LEFT, 0, NULL, ":");
|
||||
dc->drawNumber(2, 1, number, LEFT, 0, NULL, ":");
|
||||
|
||||
lcdDrawSizedText(SENSOR_COL1, line1, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
|
||||
dc->drawSizedText(SENSOR_COL1, line1, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN);
|
||||
|
||||
if (telemetryItem.isAvailable()) {
|
||||
LcdFlags color = telemetryItem.isOld() ? ALARM_COLOR : TEXT_COLOR;
|
||||
@@ -94,9 +94,9 @@ class SensorButton : public Button {
|
||||
drawHexNumber(dc, SENSOR_COL3, line1, sensor->id, LEFT);
|
||||
}
|
||||
else if (sensor->type == TELEM_TYPE_CUSTOM && !g_model.ignoreSensorIds) {
|
||||
drawNumber(dc, SENSOR_COL3, line1, sensor->instance, LEFT);
|
||||
dc->drawNumber(SENSOR_COL3, line1, sensor->instance, LEFT);
|
||||
}
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -409,7 +409,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_LOWALARM);
|
||||
auto edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.warning));
|
||||
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getWarningRssi(), flags);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getWarningRssi(), flags);
|
||||
});
|
||||
window->setFirstField(edit);
|
||||
grid.nextLine();
|
||||
@@ -417,7 +417,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_CRITICALALARM);
|
||||
edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.critical));
|
||||
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getCriticalRssi(), flags);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getCriticalRssi(), flags);
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
@@ -514,7 +514,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
// Delete all sensors button
|
||||
new TextButton(window, grid.getFieldSlot(), STR_DELETE_ALL_SENSORS,
|
||||
[]() -> uint8_t {
|
||||
new FullScreenDialog(WARNING_TYPE_CONFIRM, STR_CONFIRMDELETE, "", [=]() {
|
||||
new FullScreenDialog(WARNING_TYPE_CONFIRM, STR_CONFIRMDELETE, "", "", [=]() {
|
||||
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class MultiPosCalibrationWindow: public Window {
|
||||
|
||||
virtual void paint(BitmapBuffer * dc)
|
||||
{
|
||||
drawHorizontalSlider(5, 8, rect.w - 18, 1 + (potsPos[potIndex] & 0x0f), 1, XPOTS_MULTIPOS_COUNT+1, XPOTS_MULTIPOS_COUNT, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS | OPTION_SLIDER_NUMBER_BUTTON);
|
||||
drawHorizontalSlider(dc, 5, 8, rect.w - 18, 1 + (potsPos[potIndex] & 0x0f), 1, XPOTS_MULTIPOS_COUNT+1, XPOTS_MULTIPOS_COUNT, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS | OPTION_SLIDER_NUMBER_BUTTON);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -89,9 +89,9 @@ class PotCalibrationWindow: public Window {
|
||||
virtual void paint(BitmapBuffer * dc)
|
||||
{
|
||||
if(rect.h > rect.w)
|
||||
drawVerticalSlider(5, 8, rect.h - 18, calibratedAnalogs[potIndex], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS | OPTION_SLIDER_SQUARE_BUTTON);
|
||||
drawVerticalSlider(dc, 5, 8, rect.h - 18, calibratedAnalogs[potIndex], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS | OPTION_SLIDER_SQUARE_BUTTON);
|
||||
else
|
||||
drawHorizontalSlider(5, 8, rect.w - 18, calibratedAnalogs[potIndex], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS | OPTION_SLIDER_SQUARE_BUTTON);
|
||||
drawHorizontalSlider(dc, 5, 8, rect.w - 18, calibratedAnalogs[potIndex], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS | OPTION_SLIDER_SQUARE_BUTTON);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -152,7 +152,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB);
|
||||
auto batCal = new NumberEdit(window, grid.getFieldSlot(), -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration));
|
||||
batCal->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, 2, 0, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V");
|
||||
dc->drawNumber(2, 0, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V");
|
||||
});
|
||||
batCal->setWindowFlags(REFRESH_ALWAYS);
|
||||
grid.nextLine();
|
||||
@@ -160,7 +160,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
// Factory reset
|
||||
new TextButton(window, grid.getFieldSlot(), STR_FACTORYRESET,
|
||||
[=]() -> int8_t {
|
||||
new FullScreenDialog(WARNING_TYPE_CONFIRM, STR_CONFIRMRESET, STR_POPUPS_ENTER_EXIT, [=]() {
|
||||
new FullScreenDialog(WARNING_TYPE_CONFIRM, STR_CONFIRMRESET, STR_POPUPS_ENTER_EXIT, "", [=]() {
|
||||
storageEraseAll(false);
|
||||
NVIC_SystemReset();
|
||||
return 0;
|
||||
|
||||
@@ -88,7 +88,7 @@ class DateTimeWindow : public Window {
|
||||
SET_LOAD_DATETIME(&t);
|
||||
});
|
||||
month->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
});
|
||||
|
||||
/* TODO dynamic max instead of 31 ...
|
||||
@@ -110,7 +110,7 @@ class DateTimeWindow : public Window {
|
||||
SET_LOAD_DATETIME(&t);
|
||||
});
|
||||
day->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
@@ -130,7 +130,7 @@ class DateTimeWindow : public Window {
|
||||
SET_LOAD_DATETIME(&t);
|
||||
});
|
||||
hour->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
});
|
||||
|
||||
auto minutes = new NumberEdit(this, grid.getFieldSlot(3, 1), 0, 59,
|
||||
@@ -146,7 +146,7 @@ class DateTimeWindow : public Window {
|
||||
SET_LOAD_DATETIME(&t);
|
||||
});
|
||||
minutes->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
});
|
||||
|
||||
auto seconds = new NumberEdit(this, grid.getFieldSlot(3, 2), 0, 59,
|
||||
@@ -162,7 +162,7 @@ class DateTimeWindow : public Window {
|
||||
SET_LOAD_DATETIME(&t);
|
||||
});
|
||||
seconds->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags | LEADING0, 2);
|
||||
});
|
||||
grid.nextLine();
|
||||
getParent()->moveWindowsTop(top(), adjustHeight());
|
||||
@@ -170,7 +170,7 @@ class DateTimeWindow : public Window {
|
||||
};
|
||||
|
||||
RadioSetupPage::RadioSetupPage():
|
||||
PageTab(STR_MENURADIOSETUP, ICON_RADIO_SETUP)
|
||||
PageTab(STR_RADIO_SETUP, ICON_RADIO_SETUP)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// Main volume
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_SPEAKER_VOLUME);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_VOLUME);
|
||||
new Slider(window, grid.getFieldSlot(), -VOLUME_LEVEL_DEF, VOLUME_LEVEL_MAX-VOLUME_LEVEL_DEF, GET_SET_DEFAULT(g_eeGeneral.speakerVolume));
|
||||
grid.nextLine();
|
||||
|
||||
@@ -238,7 +238,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// Beeps pitch
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_SPKRPITCH);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_PITCH);
|
||||
auto edit = new NumberEdit(window, grid.getFieldSlot(), 0, 300,
|
||||
GET_DEFAULT(15 * g_eeGeneral.speakerPitch),
|
||||
[=](int32_t newValue) {
|
||||
@@ -255,7 +255,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// Vario volume
|
||||
new StaticText(window, grid.getLabelSlot(true), TR_SPEAKER_VOLUME);
|
||||
new StaticText(window, grid.getLabelSlot(true), TR_VOLUME);
|
||||
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
|
||||
grid.nextLine();
|
||||
|
||||
@@ -285,7 +285,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// Haptic strength
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_HAPTICSTRENGTH);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_STRENGTH);
|
||||
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticStrength));
|
||||
grid.nextLine();
|
||||
}
|
||||
@@ -308,7 +308,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// RSSI shutdown alarm
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_RSSISHUTDOWNALARM);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_RSSI_SHUTDOWN_ALARM);
|
||||
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm));
|
||||
grid.nextLine();
|
||||
|
||||
@@ -375,7 +375,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// GPS format
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_GPSCOORD);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_GPS_COORDS_FORMAT);
|
||||
new Choice(window, grid.getFieldSlot(), STR_GPSFORMAT, 0, 1, GET_SET_DEFAULT(g_eeGeneral.gpsFormat));
|
||||
grid.nextLine();
|
||||
}
|
||||
@@ -388,12 +388,12 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
#endif
|
||||
|
||||
// Country code
|
||||
new StaticText(window, grid.getLabelSlot(), STR_COUNTRYCODE);
|
||||
new Choice(window, grid.getFieldSlot(), STR_COUNTRYCODES, 0, 2, GET_SET_DEFAULT(g_eeGeneral.countryCode));
|
||||
new StaticText(window, grid.getLabelSlot(), STR_COUNTRY_CODE);
|
||||
new Choice(window, grid.getFieldSlot(), STR_COUNTRY_CODES, 0, 2, GET_SET_DEFAULT(g_eeGeneral.countryCode));
|
||||
grid.nextLine();
|
||||
|
||||
// Audio language
|
||||
new StaticText(window, grid.getLabelSlot(), STR_VOICELANG);
|
||||
new StaticText(window, grid.getLabelSlot(), STR_VOICE_LANGUAGE);
|
||||
auto choice = new Choice(window, grid.getFieldSlot(), nullptr, 0, DIM(languagePacks) - 2, GET_VALUE(currentLanguagePackIdx),
|
||||
[](uint8_t newValue) {
|
||||
currentLanguagePackIdx = newValue;
|
||||
@@ -406,7 +406,7 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// Imperial units
|
||||
new StaticText(window, grid.getLabelSlot(), STR_UNITSSYSTEM);
|
||||
new StaticText(window, grid.getLabelSlot(), STR_UNITS_SYSTEM);
|
||||
new Choice(window, grid.getFieldSlot(), STR_VUNITSSYSTEM, 0, 1, GET_SET_DEFAULT(g_eeGeneral.imperial));
|
||||
grid.nextLine();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class SpectrumWindow : public Window
|
||||
}
|
||||
|
||||
coord_t y = max<coord_t>(FH, SPECTRUM_HEIGHT - peak_y - FH);
|
||||
drawNumber(dc, min<coord_t>(100, peak_x), y, ((reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) + peak_x * (reusableBuffer.spectrumAnalyser.span / 128)) / 1000000, TINSIZE);
|
||||
dc->drawNumber(min<coord_t>(100, peak_x), y, ((reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) + peak_x * (reusableBuffer.spectrumAnalyser.span / 128)) / 1000000, TINSIZE);
|
||||
dc->drawText(lcdNextPos, y, "M", TINSIZE);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void RadioTrainerPage::build(FormWindow * window)
|
||||
new StaticText(window, grid.getLabelSlot(), STR_MULTIPLIER);
|
||||
auto multiplier = new NumberEdit(window, grid.getFieldSlot(3, 0), -10, 40, GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
|
||||
multiplier->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value+10, flags | PREC1, 0);
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value+10, flags | PREC1, 0);
|
||||
});
|
||||
grid.nextLine();
|
||||
grid.nextLine();
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#include "rle.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int rle_decode_8bit(unsigned char* dest, unsigned int dest_size, const unsigned char* src)
|
||||
{
|
||||
//unsigned char count = 0;
|
||||
unsigned char prev_byte = 0;
|
||||
bool prev_byte_valid = false;
|
||||
|
||||
const unsigned char* dest_end = dest + dest_size;
|
||||
unsigned char* d = dest;
|
||||
|
||||
while(d < dest_end) {
|
||||
|
||||
*d++ = *src;
|
||||
if (prev_byte_valid && (*src == prev_byte)) {
|
||||
|
||||
src++;
|
||||
|
||||
if (d + *src > dest + dest_size) {
|
||||
TRACE("rle_decode_8bit: destination overflow!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(d, prev_byte, *src);
|
||||
d += *src++;
|
||||
prev_byte_valid = false;
|
||||
}
|
||||
else {
|
||||
prev_byte = *src++;
|
||||
prev_byte_valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
return d - dest;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef _rle_h_
|
||||
#define _rle_h_
|
||||
|
||||
int rle_decode_8bit(unsigned char* dest, unsigned int dest_size, const unsigned char* src);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* 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 <algorithm>
|
||||
#include "screen_setup.h"
|
||||
#include "opentx.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
ScreenAddPage::ScreenAddPage(ScreenMenu * menu, uint8_t pageIndex):
|
||||
PageTab("", ICON_THEME_ADD_VIEW),
|
||||
menu(menu),
|
||||
pageIndex(pageIndex)
|
||||
{
|
||||
setTitle(STR_ADD_MAIN_VIEW);
|
||||
}
|
||||
|
||||
void ScreenAddPage::build(FormWindow * window)
|
||||
{
|
||||
auto button = new TextButton(window, {LCD_W / 2 - 100, (window->height() - 24) / 2, 200, 24}, STR_ADD_MAIN_VIEW);
|
||||
button->setPressHandler([=]() {
|
||||
const LayoutFactory * factory = getRegisteredLayouts().front();
|
||||
customScreens[pageIndex] = factory->create(&g_model.screenData[pageIndex].layoutData);
|
||||
strncpy(g_model.screenData[pageIndex].layoutName, factory->getId(), sizeof(g_model.screenData[pageIndex].layoutName));
|
||||
menu->removeTab(pageIndex);
|
||||
menu->addTab(new ScreenSetupPage(menu, pageIndex));
|
||||
menu->setCurrentTab(pageIndex);
|
||||
if (pageIndex < MAX_CUSTOM_SCREENS - 1) {
|
||||
menu->addTab(new ScreenAddPage(menu, pageIndex + 1));
|
||||
}
|
||||
storageDirty(EE_MODEL);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
class LayoutChoice: public FormField {
|
||||
public:
|
||||
LayoutChoice(Window * parent, const rect_t & rect, std::function<const LayoutFactory *()> getValue, std::function<void(const LayoutFactory *)> setValue):
|
||||
FormField(parent, {rect.x, rect.y, 59, 33}),
|
||||
getValue(std::move(getValue)),
|
||||
setValue(std::move(setValue))
|
||||
{
|
||||
}
|
||||
|
||||
void paint(BitmapBuffer * dc) override
|
||||
{
|
||||
FormField::paint(dc);
|
||||
auto layout = getValue();
|
||||
layout->drawThumb(dc, 4, 4, editMode ? TEXT_INVERTED_COLOR : LINE_COLOR);
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
editMode = true;
|
||||
invalidate();
|
||||
openMenu();
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void openMenu()
|
||||
{
|
||||
auto menu = new Menu();
|
||||
|
||||
for (auto layout: getRegisteredLayouts()) {
|
||||
menu->addLine([=](BitmapBuffer *dc, coord_t x, coord_t y, LcdFlags flags) {
|
||||
layout->drawThumb(dc, x + 2, y + 2, flags);
|
||||
dc->drawText(65, y + 5, layout->getName(), flags);
|
||||
}, [=]() {
|
||||
setValue(layout);
|
||||
});
|
||||
}
|
||||
|
||||
auto it = std::find(getRegisteredLayouts().begin(), getRegisteredLayouts().end(), getValue());
|
||||
menu->select(std::distance(getRegisteredLayouts().begin(), it));
|
||||
|
||||
menu->setCloseHandler([=]() {
|
||||
editMode = false;
|
||||
setFocus();
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
std::function<const LayoutFactory *()> getValue;
|
||||
std::function<void(const LayoutFactory *)> setValue;
|
||||
};
|
||||
|
||||
ScreenSetupPage::ScreenSetupPage(ScreenMenu * menu, uint8_t pageIndex):
|
||||
PageTab("", ICON_THEME_VIEW1 + pageIndex),
|
||||
menu(menu),
|
||||
pageIndex(pageIndex)
|
||||
{
|
||||
char title[] = "Main view X";
|
||||
title[sizeof(title) - 2] = '1' + pageIndex;
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
void ScreenSetupPage::build(FormWindow * window)
|
||||
{
|
||||
FormGridLayout grid;
|
||||
grid.spacer(PAGE_PADDING);
|
||||
|
||||
// Layout choice...
|
||||
new StaticText(window, grid.getLabelSlot(false), STR_LAYOUT);
|
||||
auto layoutSlot = grid.getFieldSlot();
|
||||
layoutSlot.h = 2 * PAGE_LINE_HEIGHT - 1;
|
||||
layoutChoice = new LayoutChoice(window, layoutSlot, GET_VALUE(customScreens[pageIndex]->getFactory()), [=](const LayoutFactory *factory) {
|
||||
delete customScreens[pageIndex];
|
||||
customScreens[pageIndex] = factory->create(&g_model.screenData[pageIndex].layoutData);
|
||||
strncpy(g_model.screenData[pageIndex].layoutName, factory->getId(), sizeof(g_model.screenData[pageIndex].layoutName));
|
||||
SET_DIRTY();
|
||||
updateLayoutOptions();
|
||||
});
|
||||
grid.nextLine(layoutChoice->height());
|
||||
|
||||
// Setup widgets button...
|
||||
setupWidgetsButton = new TextButton(window, grid.getFieldSlot(), STR_SETUP_WIDGETS);
|
||||
setupWidgetsButton->setPressHandler([=]() {
|
||||
// auto setupWidgetsPage = new SetupWidgetsPage();
|
||||
// setupWidgetsPage->setCloseHandler([=]() {
|
||||
// setupWidgetsButton->setFocus();
|
||||
// });
|
||||
return 0;
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
// Dynamic options window...
|
||||
optionsWindow = new Window(window, {0, grid.getWindowHeight(), LCD_W, 0}, FORWARD_SCROLL);
|
||||
grid.addWindow(optionsWindow);
|
||||
updateLayoutOptions();
|
||||
}
|
||||
|
||||
void ScreenSetupPage::updateLayoutOptions()
|
||||
{
|
||||
FormGridLayout grid;
|
||||
optionsWindow->clear();
|
||||
FormField::setCurrentField(setupWidgetsButton); // next field will be linked to this button
|
||||
|
||||
auto screen = customScreens[pageIndex];
|
||||
|
||||
// Layout options...
|
||||
int index = 0;
|
||||
for (auto * option = screen->getFactory()->getOptions(); option->name; option++, index++) {
|
||||
ZoneOptionValue * value = screen->getOptionValue(index);
|
||||
|
||||
// Option label
|
||||
new StaticText(optionsWindow, grid.getLabelSlot(false), option->name);
|
||||
|
||||
// Option value
|
||||
switch (option->type) {
|
||||
case ZoneOption::Bool:
|
||||
new CheckBox(optionsWindow, grid.getFieldSlot(), GET_SET_DEFAULT(value->boolValue));
|
||||
break;
|
||||
|
||||
case ZoneOption::Color:
|
||||
new ColorEdit(optionsWindow, grid.getFieldSlot(), GET_SET_DEFAULT(value->unsignedValue));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
if (pageIndex > 0 || customScreens[1]) {
|
||||
auto button = new TextButton(optionsWindow, grid.getFieldSlot(), STR_REMOVE_SCREEN);
|
||||
button->setPressHandler([=]() {
|
||||
if (pageIndex < MAX_CUSTOM_SCREENS - 1) {
|
||||
memmove(&g_model.screenData[pageIndex], &g_model.screenData[pageIndex + 1], sizeof(CustomScreenData) * (MAX_CUSTOM_SCREENS - pageIndex - 1));
|
||||
}
|
||||
memset(&g_model.screenData[MAX_CUSTOM_SCREENS - 1], 0, sizeof(CustomScreenData));
|
||||
loadCustomScreens();
|
||||
menu->updateTabs();
|
||||
storageDirty(EE_MODEL);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
optionsWindow->adjustHeight();
|
||||
optionsWindow->getParent()->adjustInnerHeight();
|
||||
|
||||
FormField::link(FormField::getCurrentField(), layoutChoice);
|
||||
}
|
||||
@@ -18,38 +18,31 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _KEYBOARD_NUMBER_H_
|
||||
#define _KEYBOARD_NUMBER_H_
|
||||
|
||||
#include "keyboard_base.h"
|
||||
#include "basenumberedit.h"
|
||||
|
||||
class NumberKeyboard : public Keyboard<BaseNumberEdit> {
|
||||
friend class BaseNumberEdit;
|
||||
#include "menu_screen.h"
|
||||
|
||||
class ScreenAddPage: public PageTab {
|
||||
public:
|
||||
NumberKeyboard();
|
||||
ScreenAddPage(ScreenMenu * menu, uint8_t pageIndex);
|
||||
|
||||
~NumberKeyboard() override;
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() override
|
||||
{
|
||||
return "NumberKeyboard";
|
||||
}
|
||||
#endif
|
||||
|
||||
static NumberKeyboard * instance()
|
||||
{
|
||||
if (!_instance)
|
||||
_instance = new NumberKeyboard();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
void build(FormWindow * window) override;
|
||||
|
||||
protected:
|
||||
static NumberKeyboard * _instance;
|
||||
ScreenMenu * menu;
|
||||
uint8_t pageIndex;
|
||||
};
|
||||
|
||||
#endif // _KEYBOARD_NUMBER_H_
|
||||
class ScreenSetupPage: public PageTab {
|
||||
public:
|
||||
ScreenSetupPage(ScreenMenu * menu, uint8_t pageIndex);
|
||||
|
||||
void build(FormWindow * window) override;
|
||||
|
||||
protected:
|
||||
ScreenMenu * menu;
|
||||
uint8_t pageIndex;
|
||||
Window * optionsWindow = nullptr;
|
||||
TextButton * setupWidgetsButton = nullptr;
|
||||
FormField * layoutChoice = nullptr;
|
||||
|
||||
void updateLayoutOptions();
|
||||
};
|
||||
@@ -684,6 +684,6 @@ bool menuScreenAdd(event_t event)
|
||||
return false;
|
||||
}
|
||||
|
||||
SIMPLE_MENU_WITH_OPTIONS(STR_ADDMAINVIEW, THEME_ICONS, menuTabScreensSetup, menuPageCount, menuPageCount-1, 0);
|
||||
SIMPLE_MENU_WITH_OPTIONS(STR_ADD_MAIN_VIEW, THEME_ICONS, menuTabScreensSetup, menuPageCount, menuPageCount-1, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class SpecialFunctionEditPage : public Page {
|
||||
break;
|
||||
|
||||
case FUNC_VOLUME:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_SPEAKER_VOLUME);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VOLUME);
|
||||
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
break;
|
||||
@@ -176,7 +176,7 @@ class SpecialFunctionEditPage : public Page {
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE);
|
||||
auto edit = new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0, 255, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
edit->setDisplayHandler([=](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
lcdDrawNumber(2, 2, CFN_PARAM(cfn), PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
dc->drawNumber(2, 2, CFN_PARAM(cfn), PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -192,11 +192,11 @@ class SpecialFunctionEditPage : public Page {
|
||||
auto repeat = new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(2, 1), -1, 60/CFN_PLAY_REPEAT_MUL, GET_SET_DEFAULT(CFN_PLAY_REPEAT(cfn)));
|
||||
repeat->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
if (value == 0)
|
||||
lcdDrawText(3, 0, "1x", flags);
|
||||
dc->drawText(3, 0, "1x", flags);
|
||||
else if (value == CFN_PLAY_REPEAT_NOSTART)
|
||||
lcdDrawText(3, 0, "!1x", flags);
|
||||
dc->drawText(3, 0, "!1x", flags);
|
||||
else
|
||||
drawNumber(dc, 3, 0, value * CFN_PLAY_REPEAT_MUL, flags, 0, nullptr, "s");
|
||||
dc->drawNumber(3, 0, value * CFN_PLAY_REPEAT_MUL, flags, 0, nullptr, "s");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ class SpecialFunctionButton : public Button {
|
||||
if (CFN_EMPTY(cfn))
|
||||
return;
|
||||
|
||||
lcdDrawTextAtIndex(col2, line1, STR_VFSWFUNC, func, 0);
|
||||
dc->drawTextAtIndex(col2, line1, STR_VFSWFUNC, func, 0);
|
||||
int16_t val_min = 0;
|
||||
int16_t val_max = 255;
|
||||
|
||||
@@ -305,7 +305,7 @@ class SpecialFunctionButton : public Button {
|
||||
case FUNC_OVERRIDE_CHANNEL:
|
||||
drawChn(dc, col1, line2, CFN_CH_INDEX(cfn) + 1, 0);
|
||||
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
|
||||
lcdDrawNumber(col2, line2, CFN_PARAM(cfn));
|
||||
dc->drawNumber(col2, line2, CFN_PARAM(cfn));
|
||||
break;
|
||||
|
||||
case FUNC_TRAINER:
|
||||
@@ -314,11 +314,11 @@ class SpecialFunctionButton : public Button {
|
||||
|
||||
case FUNC_RESET:
|
||||
if (CFN_PARAM(cfn) < FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
lcdDrawTextAtIndex(col1, line2, STR_VFSWRESET, CFN_PARAM(cfn));
|
||||
dc->drawTextAtIndex(col1, line2, STR_VFSWRESET, CFN_PARAM(cfn));
|
||||
}
|
||||
else {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[CFN_PARAM(cfn) - FUNC_RESET_PARAM_FIRST_TELEM];
|
||||
lcdDrawSizedText(col1, line2, sensor->label, TELEM_LABEL_LEN, ZCHAR);
|
||||
dc->drawSizedText(col1, line2, sensor->label, TELEM_LABEL_LEN);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -327,16 +327,16 @@ class SpecialFunctionButton : public Button {
|
||||
break;
|
||||
|
||||
case FUNC_PLAY_SOUND:
|
||||
lcdDrawTextAtIndex(col1, line2, STR_FUNCSOUNDS, CFN_PARAM(cfn));
|
||||
dc->drawTextAtIndex(col1, line2, STR_FUNCSOUNDS, CFN_PARAM(cfn));
|
||||
break;
|
||||
|
||||
case FUNC_PLAY_TRACK:
|
||||
case FUNC_BACKGND_MUSIC:
|
||||
case FUNC_PLAY_SCRIPT:
|
||||
if (ZEXIST(cfn->play.name))
|
||||
lcdDrawSizedText(col1, line2, cfn->play.name, sizeof(cfn->play.name), 0);
|
||||
dc->drawSizedText(col1, line2, cfn->play.name, sizeof(cfn->play.name), 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(col1, line2, STR_VCSWFUNC, 0, 0);
|
||||
dc->drawTextAtIndex(col1, line2, STR_VCSWFUNC, 0, 0);
|
||||
break;
|
||||
|
||||
case FUNC_SET_TIMER:
|
||||
@@ -344,7 +344,7 @@ class SpecialFunctionButton : public Button {
|
||||
break;
|
||||
|
||||
case FUNC_SET_FAILSAFE:
|
||||
lcdDrawTextAtIndex(col1, line2, "\004Int.Ext.", CFN_PARAM(cfn), 0);
|
||||
dc->drawTextAtIndex(col1, line2, "\004Int.Ext.", CFN_PARAM(cfn), 0);
|
||||
break;
|
||||
|
||||
case FUNC_PLAY_VALUE:
|
||||
@@ -352,35 +352,35 @@ class SpecialFunctionButton : public Button {
|
||||
break;
|
||||
|
||||
case FUNC_HAPTIC:
|
||||
lcdDrawNumber(col1, line2, CFN_PARAM(cfn), 0);
|
||||
dc->drawNumber(col1, line2, CFN_PARAM(cfn), 0);
|
||||
break;
|
||||
|
||||
case FUNC_LOGS:
|
||||
lcdDrawNumber(col3, line1, CFN_PARAM(cfn), PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
dc->drawNumber(col3, line1, CFN_PARAM(cfn), PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
break;
|
||||
}
|
||||
if (HAS_ENABLE_PARAM(func)) {
|
||||
drawCheckBox(col3, line2, CFN_ACTIVE(cfn), 0);
|
||||
drawCheckBox(dc, col3, line2, CFN_ACTIVE(cfn), 0);
|
||||
}
|
||||
else if (HAS_REPEAT_PARAM(func)) {
|
||||
if (CFN_PLAY_REPEAT(cfn) == 0) {
|
||||
lcdDrawText(col3, line2, "1x", 0);
|
||||
dc->drawText(col3, line2, "1x", 0);
|
||||
}
|
||||
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
|
||||
lcdDrawText(col3, line2, "!1x", 0);
|
||||
dc->drawText(col3, line2, "!1x", 0);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(col3 + 12, line2, CFN_PLAY_REPEAT(cfn) * CFN_PLAY_REPEAT_MUL, 0 | RIGHT, 0, nullptr, "s");
|
||||
dc->drawNumber(col3 + 12, line2, CFN_PLAY_REPEAT(cfn) * CFN_PLAY_REPEAT_MUL, 0 | RIGHT, 0, nullptr, "s");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void paint(BitmapBuffer * dc) override
|
||||
void paint(BitmapBuffer * dc) override
|
||||
{
|
||||
if (active)
|
||||
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
|
||||
paintSpecialFunctionLine(dc);
|
||||
drawSolidRect(dc, 0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? SCROLLBOX_COLOR : CURVE_AXIS_COLOR);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -20,25 +20,26 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const BitmapBuffer * Theme::asterisk = NULL;
|
||||
const BitmapBuffer * Theme::question = NULL;
|
||||
const BitmapBuffer * Theme::busy = NULL;
|
||||
extern ThemeBase * defaultTheme;
|
||||
const BitmapBuffer * ThemeBase::asterisk = NULL;
|
||||
const BitmapBuffer * ThemeBase::question = NULL;
|
||||
const BitmapBuffer * ThemeBase::busy = NULL;
|
||||
|
||||
std::list<Theme *> & getRegisteredThemes()
|
||||
std::list<ThemeBase *> & getRegisteredThemes()
|
||||
{
|
||||
static std::list<Theme *> themes;
|
||||
static std::list<ThemeBase *> themes;
|
||||
return themes;
|
||||
}
|
||||
|
||||
void registerTheme(Theme * theme)
|
||||
void registerTheme(ThemeBase * theme)
|
||||
{
|
||||
TRACE("register theme %s", theme->getName());
|
||||
getRegisteredThemes().push_back(theme);
|
||||
}
|
||||
|
||||
void Theme::init() const
|
||||
void ThemeBase::init() const
|
||||
{
|
||||
memset(&g_eeGeneral.themeData, 0, sizeof(Theme::PersistentData));
|
||||
memset(&g_eeGeneral.themeData, 0, sizeof(ThemeBase::PersistentData));
|
||||
if (options) {
|
||||
int i = 0;
|
||||
for (const ZoneOption * option = options; option->name; option++, i++) {
|
||||
@@ -48,19 +49,22 @@ void Theme::init() const
|
||||
}
|
||||
}
|
||||
|
||||
void Theme::load() const
|
||||
void ThemeBase::load() const
|
||||
{
|
||||
if (!asterisk) asterisk = BitmapBuffer::load(getThemePath("asterisk.bmp"));
|
||||
if (!question) question = BitmapBuffer::load(getThemePath("question.bmp"));
|
||||
if (!busy) busy = BitmapBuffer::load(getThemePath("busy.bmp"));
|
||||
if (!asterisk)
|
||||
asterisk = BitmapBuffer::load(getFilePath("asterisk.bmp"));
|
||||
if (!question)
|
||||
question = BitmapBuffer::load(getFilePath("question.bmp"));
|
||||
if (!busy)
|
||||
busy = BitmapBuffer::load(getFilePath("busy.bmp"));
|
||||
}
|
||||
|
||||
ZoneOptionValue * Theme::getOptionValue(unsigned int index) const
|
||||
ZoneOptionValue * ThemeBase::getOptionValue(unsigned int index) const
|
||||
{
|
||||
return &g_eeGeneral.themeData.options[index];
|
||||
}
|
||||
|
||||
const char * Theme::getFilePath(const char * filename) const
|
||||
const char * ThemeBase::getFilePath(const char * filename) const
|
||||
{
|
||||
static char path[_MAX_LFN+1] = THEMES_PATH "/";
|
||||
strcpy(path + sizeof(THEMES_PATH), getName());
|
||||
@@ -70,7 +74,7 @@ const char * Theme::getFilePath(const char * filename) const
|
||||
return path;
|
||||
}
|
||||
|
||||
void Theme::drawThumb(coord_t x, coord_t y, uint32_t flags)
|
||||
void ThemeBase::drawThumb(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t flags)
|
||||
{
|
||||
#define THUMB_WIDTH 51
|
||||
#define THUMB_HEIGHT 31
|
||||
@@ -79,16 +83,16 @@ void Theme::drawThumb(coord_t x, coord_t y, uint32_t flags)
|
||||
}
|
||||
lcd->drawBitmap(x, y, thumb);
|
||||
if (flags == LINE_COLOR) {
|
||||
lcdDrawFilledRect(x, y, THUMB_WIDTH, THUMB_HEIGHT, SOLID, OVERLAY_COLOR | OPACITY(10));
|
||||
dc->drawFilledRect(x, y, THUMB_WIDTH, THUMB_HEIGHT, SOLID, OVERLAY_COLOR | OPACITY(10));
|
||||
}
|
||||
}
|
||||
|
||||
void Theme::drawBackground(BitmapBuffer * dc) const
|
||||
void ThemeBase::drawBackground(BitmapBuffer * dc) const
|
||||
{
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
|
||||
}
|
||||
|
||||
void Theme::drawMessageBox(const char * title, const char * text, const char * action, uint32_t type) const
|
||||
void ThemeBase::drawMessageBox(const char * title, const char * text, const char * action, uint32_t type) const
|
||||
{
|
||||
|
||||
}
|
||||
@@ -127,9 +131,62 @@ void Theme::drawMessageBox(const char * title, const char * text, const char * a
|
||||
// }
|
||||
//}
|
||||
|
||||
Theme * getTheme(const char * name)
|
||||
void ThemeBase::drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const
|
||||
{
|
||||
std::list<Theme *>::const_iterator it = getRegisteredThemes().cbegin();
|
||||
if (focus) {
|
||||
dc->drawSolidFilledRect(0, 2, 16, 16, TEXT_INVERTED_BGCOLOR);
|
||||
if (value) {
|
||||
dc->drawSolidFilledRect(2, 4, 12, 12, TEXT_BGCOLOR);
|
||||
dc->drawSolidFilledRect(3, 5, 10, 10, SCROLLBOX_COLOR);
|
||||
}
|
||||
else {
|
||||
dc->drawSolidFilledRect(2, 4, 12, 12, TEXT_BGCOLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (value) {
|
||||
dc->drawSolidFilledRect(2, 4, 12, 12, SCROLLBOX_COLOR);
|
||||
dc->drawSolidRect(0, 2, 16, 16, 1, CURVE_AXIS_COLOR);
|
||||
}
|
||||
else {
|
||||
dc->drawSolidRect(0, 2, 16, 16, 1, CURVE_AXIS_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeBase::drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const
|
||||
{
|
||||
int val = limit(vmin, value, vmax);
|
||||
int w = divRoundClosest((rect.w - 16) * (val - vmin), vmax - vmin);
|
||||
|
||||
if (edit) {
|
||||
dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawSolidFilledRect(4, 11, rect.w - 8, 4, TEXT_INVERTED_BGCOLOR);
|
||||
dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
dc->drawBitmapPattern(0, 11, LBM_SLIDER_BAR_LEFT, LINE_COLOR);
|
||||
dc->drawSolidFilledRect(4, 11, rect.w - 8, 4, LINE_COLOR);
|
||||
dc->drawBitmapPattern(rect.w - 4, 11, LBM_SLIDER_BAR_RIGHT, LINE_COLOR);
|
||||
}
|
||||
|
||||
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_OUT, TEXT_COLOR);
|
||||
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR);
|
||||
// if ((options & INVERS) && (!(options & BLINK) || !BLINK_ON_PHASE))
|
||||
if (focus) {
|
||||
dc->drawBitmapPattern(w, 5, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeBase::drawPageHeader(BitmapBuffer * dc, const PageHeader * header) const
|
||||
{
|
||||
drawMenuBackground(dc, header->getIcon(), "");
|
||||
dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
}
|
||||
|
||||
ThemeBase * getTheme(const char * name)
|
||||
{
|
||||
std::list<ThemeBase *>::const_iterator it = getRegisteredThemes().cbegin();
|
||||
for (; it != getRegisteredThemes().cend(); ++it) {
|
||||
if (!strcmp(name, (*it)->getName())) {
|
||||
return (*it);
|
||||
@@ -138,11 +195,11 @@ Theme * getTheme(const char * name)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void loadTheme(Theme * newTheme)
|
||||
void loadTheme(ThemeBase * newTheme)
|
||||
{
|
||||
TRACE("load theme %s", newTheme->getName());
|
||||
theme = newTheme;
|
||||
theme->load();
|
||||
newTheme->load();
|
||||
}
|
||||
|
||||
void loadTheme()
|
||||
@@ -150,11 +207,12 @@ void loadTheme()
|
||||
char name[THEME_NAME_LEN + 1];
|
||||
memset(name, 0, sizeof(name));
|
||||
strncpy(name, g_eeGeneral.themeName, THEME_NAME_LEN);
|
||||
Theme * newTheme = getTheme(name);
|
||||
if (newTheme) {
|
||||
ThemeBase * newTheme = getTheme(name);
|
||||
if (newTheme)
|
||||
loadTheme(newTheme);
|
||||
}
|
||||
else {
|
||||
theme->load();
|
||||
}
|
||||
else
|
||||
loadTheme(defaultTheme);
|
||||
// else {
|
||||
// loadTheme(theme);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -18,29 +18,30 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _THEME_H_
|
||||
#define _THEME_H_
|
||||
#ifndef _COLORLCD_THEME_H_
|
||||
#define _COLORLCD_THEME_H_
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "zone.h"
|
||||
#include "thirdparty/libopenui/src/theme.h"
|
||||
|
||||
class BitmapBuffer;
|
||||
class PageTab;
|
||||
|
||||
#define MAX_THEME_OPTIONS 5
|
||||
|
||||
class Theme;
|
||||
void registerTheme(Theme * theme);
|
||||
class ThemeBase;
|
||||
void registerTheme(ThemeBase * theme);
|
||||
|
||||
class Theme
|
||||
class ThemeBase: public Theme
|
||||
{
|
||||
public:
|
||||
struct PersistentData {
|
||||
ZoneOptionValue options[MAX_THEME_OPTIONS];
|
||||
};
|
||||
|
||||
Theme(const char * name, const ZoneOption * options = nullptr):
|
||||
ThemeBase(const char * name, const ZoneOption * options = nullptr):
|
||||
name(name),
|
||||
options(options),
|
||||
thumb(nullptr)
|
||||
@@ -55,7 +56,7 @@ class Theme
|
||||
|
||||
const char * getFilePath(const char * filename) const;
|
||||
|
||||
void drawThumb(coord_t x, coord_t y, uint32_t flags);
|
||||
void drawThumb(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t flags);
|
||||
|
||||
inline const ZoneOption * getOptions() const
|
||||
{
|
||||
@@ -74,25 +75,18 @@ class Theme
|
||||
|
||||
virtual void drawBackground(BitmapBuffer * dc) const;
|
||||
|
||||
virtual const BitmapBuffer * getIconButtonBitmap(uint8_t index, bool selected) const
|
||||
{
|
||||
TRACE("No bitmap for icon %d in this theme", index);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual const BitmapBuffer * getIconMask(uint8_t index) const
|
||||
{
|
||||
TRACE("No mask for icon %d in this theme", index);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void drawMenuBackground(BitmapBuffer * dc, uint8_t icon, const char *title) const = 0;
|
||||
|
||||
virtual void drawMenuHeader(BitmapBuffer * dc, std::vector<PageTab *> & tabs, uint8_t currentIndex) const = 0;
|
||||
|
||||
virtual void drawMessageBox(const char * title, const char * text, const char * action, uint32_t flags) const;
|
||||
// virtual void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const = 0;
|
||||
|
||||
virtual void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const = 0;
|
||||
void drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const override;
|
||||
|
||||
void drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const override;
|
||||
|
||||
void drawPageHeader(BitmapBuffer * dc, const PageHeader * page) const override;
|
||||
|
||||
protected:
|
||||
const char * name;
|
||||
@@ -105,17 +99,10 @@ class Theme
|
||||
static const BitmapBuffer * busy;
|
||||
};
|
||||
|
||||
extern Theme * theme;
|
||||
|
||||
inline const char * getThemePath(const char * filename)
|
||||
{
|
||||
return theme->getFilePath(filename);
|
||||
}
|
||||
|
||||
Theme * getTheme(const char * name);
|
||||
void loadTheme(Theme * theme);
|
||||
ThemeBase * getTheme(const char * name);
|
||||
void loadTheme(ThemeBase * theme);
|
||||
void loadTheme();
|
||||
|
||||
std::list<Theme *> & getRegisteredThemes();
|
||||
std::list<ThemeBase *> & getRegisteredThemes();
|
||||
|
||||
#endif // _THEME_H_
|
||||
#endif // _COLORLCD_THEME_H_
|
||||
|
||||
@@ -27,11 +27,11 @@ const ZoneOption OPTIONS_THEME_DEFAULT[] = {
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
class FlyskyTheme: public Theme
|
||||
class FlyskyTheme: public ThemeBase
|
||||
{
|
||||
public:
|
||||
FlyskyTheme():
|
||||
Theme("FlySky", OPTIONS_THEME_DEFAULT)
|
||||
ThemeBase("FlySky", OPTIONS_THEME_DEFAULT)
|
||||
{
|
||||
loadColors();
|
||||
}
|
||||
@@ -78,9 +78,9 @@ class FlyskyTheme: public Theme
|
||||
|
||||
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_TITLE_COLOR) const
|
||||
{
|
||||
TRACE("loadMenuIcon %s", getThemePath(filename));
|
||||
TRACE("loadMenuIcon %s", getFilePath(filename));
|
||||
|
||||
BitmapBuffer * mask = BitmapBuffer::loadMask(getThemePath(filename));
|
||||
BitmapBuffer * mask = BitmapBuffer::loadMask(getFilePath(filename));
|
||||
if (mask) {
|
||||
delete iconMask[index];
|
||||
iconMask[index] = mask;
|
||||
@@ -177,9 +177,9 @@ class FlyskyTheme: public Theme
|
||||
loadMenuIcon(ICON_MONITOR_CHANNELS4, "mask_monitor_channels4.png");
|
||||
loadMenuIcon(ICON_MONITOR_LOGICAL_SWITCHES, "mask_monitor_logsw.png");
|
||||
|
||||
BitmapBuffer * background = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_bg.png"));
|
||||
BitmapBuffer * shadow = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_shadow.png"));
|
||||
BitmapBuffer * dot = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_dot.png"));
|
||||
BitmapBuffer * background = BitmapBuffer::loadMask(getFilePath("mask_currentmenu_bg.png"));
|
||||
BitmapBuffer * shadow = BitmapBuffer::loadMask(getFilePath("mask_currentmenu_shadow.png"));
|
||||
BitmapBuffer * dot = BitmapBuffer::loadMask(getFilePath("mask_currentmenu_dot.png"));
|
||||
|
||||
if (!currentMenuBackground) {
|
||||
currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53);
|
||||
@@ -205,22 +205,22 @@ class FlyskyTheme: public Theme
|
||||
{
|
||||
// Calibration screen
|
||||
delete calibStick;
|
||||
calibStick = BitmapBuffer::load(getThemePath("stick_pointer.png"));
|
||||
calibStick = BitmapBuffer::load(getFilePath("stick_pointer.png"));
|
||||
|
||||
delete calibStickBackground;
|
||||
calibStickBackground = BitmapBuffer::load(getThemePath("stick_background.png"));
|
||||
calibStickBackground = BitmapBuffer::load(getFilePath("stick_background.png"));
|
||||
|
||||
delete calibTrackpBackground;
|
||||
calibTrackpBackground = BitmapBuffer::load(getThemePath("trackp_background.png"));
|
||||
calibTrackpBackground = BitmapBuffer::load(getFilePath("trackp_background.png"));
|
||||
|
||||
delete calibRadioPict;
|
||||
calibRadioPict = BitmapBuffer::load(getThemePath("NV14.bmp"));
|
||||
calibRadioPict = BitmapBuffer::load(getFilePath("NV14.bmp"));
|
||||
|
||||
// Model Selection screen
|
||||
delete modelselIconBitmap;
|
||||
modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", TITLE_BGCOLOR, TEXT_BGCOLOR);
|
||||
if (modelselIconBitmap) {
|
||||
BitmapBuffer * bitmap = BitmapBuffer::load(getThemePath("modelsel/icon_default.png"));
|
||||
BitmapBuffer * bitmap = BitmapBuffer::load(getFilePath("modelsel/icon_default.png"));
|
||||
modelselIconBitmap->drawBitmap(20, 8, bitmap);
|
||||
delete bitmap;
|
||||
}
|
||||
@@ -235,13 +235,13 @@ class FlyskyTheme: public Theme
|
||||
modelselModelNameBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelname.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
|
||||
delete modelselModelMoveBackground;
|
||||
modelselModelMoveBackground = BitmapBuffer::loadMask(getThemePath("modelsel/mask_moveback.png"));
|
||||
modelselModelMoveBackground = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveback.png"));
|
||||
|
||||
delete modelselModelMoveIcon;
|
||||
modelselModelMoveIcon = BitmapBuffer::loadMask(getThemePath("modelsel/mask_moveico.png"));
|
||||
modelselModelMoveIcon = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveico.png"));
|
||||
|
||||
delete modelselWizardBackground;
|
||||
modelselWizardBackground = BitmapBuffer::load(getThemePath("wizard/background.png"));
|
||||
modelselWizardBackground = BitmapBuffer::load(getFilePath("wizard/background.png"));
|
||||
|
||||
// Channels monitor screen
|
||||
delete chanMonLockedBitmap;
|
||||
@@ -276,10 +276,10 @@ class FlyskyTheme: public Theme
|
||||
mixerSetupCurveBitmap = BitmapBuffer::loadMaskOnBackground("mask_textline_curve.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
|
||||
delete mixerSetupSwitchIcon;
|
||||
mixerSetupSwitchIcon = BitmapBuffer::loadMask(getThemePath("mask_textline_switch.png"));
|
||||
mixerSetupSwitchIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_switch.png"));
|
||||
|
||||
delete mixerSetupFlightmodeIcon;
|
||||
mixerSetupFlightmodeIcon = BitmapBuffer::loadMask(getThemePath("mask_textline_fm.png"));
|
||||
mixerSetupFlightmodeIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_fm.png"));
|
||||
|
||||
delete mixerSetupSlowBitmap;
|
||||
mixerSetupSlowBitmap = BitmapBuffer::loadMaskOnBackground("mask_textline_slow.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
@@ -291,12 +291,12 @@ class FlyskyTheme: public Theme
|
||||
mixerSetupDelaySlowBitmap = BitmapBuffer::loadMaskOnBackground("mask_textline_delayslow.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
}
|
||||
|
||||
virtual void load() const override
|
||||
void load() const override
|
||||
{
|
||||
loadColors();
|
||||
Theme::load();
|
||||
ThemeBase::load();
|
||||
if (!backgroundBitmap) {
|
||||
backgroundBitmap = BitmapBuffer::load(getThemePath("background.png"));
|
||||
backgroundBitmap = BitmapBuffer::load(getFilePath("background.png"));
|
||||
}
|
||||
update();
|
||||
}
|
||||
@@ -341,26 +341,25 @@ class FlyskyTheme: public Theme
|
||||
|
||||
void drawMenuBackground(BitmapBuffer * dc, uint8_t icon, const char * title) const override
|
||||
{
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
|
||||
if (topleftBitmap) {
|
||||
dc->drawBitmap(0, 0, topleftBitmap);
|
||||
uint16_t width = topleftBitmap->getWidth();
|
||||
dc->drawSolidFilledRect(width, 0, LCD_W-width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
// if (topleftBitmap) {
|
||||
// dc->drawBitmap(0, 0, topleftBitmap);
|
||||
// uint16_t width = topleftBitmap->getWidth();
|
||||
// dc->drawSolidFilledRect(width, 0, LCD_W-width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
// }
|
||||
// else {
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
}
|
||||
|
||||
if (icon == ICON_OPENTX)
|
||||
dc->drawBitmap(4, 10, menuIconSelected[ICON_OPENTX]);
|
||||
else
|
||||
dc->drawBitmap(5, 7, menuIconSelected[icon]);
|
||||
|
||||
// }
|
||||
//
|
||||
// if (icon == ICON_OPENTX)
|
||||
// dc->drawBitmap(4, 10, menuIconSelected[ICON_OPENTX]);
|
||||
// else
|
||||
// dc->drawBitmap(5, 7, menuIconSelected[icon]);
|
||||
//
|
||||
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP - MENU_HEADER_HEIGHT, TEXT_BGCOLOR); // the white separation line
|
||||
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); // the title line background
|
||||
//
|
||||
if (title) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP, title, MENU_TITLE_COLOR);
|
||||
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP, title, MENU_TITLE_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,20 +368,20 @@ class FlyskyTheme: public Theme
|
||||
return iconMask[index];
|
||||
}
|
||||
|
||||
const BitmapBuffer * getIconButtonBitmap(uint8_t index, bool selected) const override
|
||||
const BitmapBuffer * getIcon(uint8_t index, IconState state) const override
|
||||
{
|
||||
return selected ? menuIconSelected[index] : menuIconNormal[index];
|
||||
return state == STATE_DEFAULT ? menuIconNormal[index] : menuIconSelected[index];
|
||||
}
|
||||
|
||||
void drawMenuHeader(BitmapBuffer * dc, std::vector<PageTab *> & tabs, uint8_t currentIndex) const override
|
||||
{
|
||||
uint8_t padding_left = 0;
|
||||
uint8_t padding_left = 4;
|
||||
|
||||
dc->drawSolidFilledRect(0, 0, padding_left, MENU_HEADER_BUTTON_WIDTH, HEADER_BGCOLOR);
|
||||
for (unsigned i=0; i<tabs.size(); i++) {
|
||||
dc->drawBitmap(padding_left + i*MENU_HEADER_BUTTON_WIDTH, 0, theme->getIconButtonBitmap(tabs[i]->getIcon(), currentIndex == i));
|
||||
dc->drawSolidFilledRect(0, 0, 4, MENU_HEADER_BUTTON_WIDTH, HEADER_BGCOLOR);
|
||||
for (unsigned i = 0; i < tabs.size(); i++) {
|
||||
dc->drawBitmap(padding_left + i*MENU_HEADER_BUTTON_WIDTH, 0, theme->getIcon(tabs[i]->getIcon(), currentIndex == i ? STATE_PRESSED : STATE_DEFAULT));
|
||||
}
|
||||
coord_t x = padding_left + MENU_HEADER_BUTTON_WIDTH * tabs.size();
|
||||
// coord_t x = padding_left + MENU_HEADER_BUTTON_WIDTH * tabs.size();
|
||||
// coord_t w = width() - x;
|
||||
// if (w > 0) {
|
||||
// dc->drawSolidFilledRect(x, 0, w, MENU_HEADER_BUTTON_WIDTH, HEADER_BGCOLOR);
|
||||
@@ -396,17 +395,22 @@ class FlyskyTheme: public Theme
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
|
||||
#if defined(TRANSLATIONS_CN)
|
||||
sprintf(str, "%d" TR_MONTH "%d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
const char * const STR_MONTHS[] = TR_MONTHS;
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
lcdDrawText(DATETIME_MIDDLE, DATETIME_LINE1, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
#endif
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME));
|
||||
lcdDrawText(DATETIME_MIDDLE, DATETIME_LINE2, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
}
|
||||
|
||||
void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const override
|
||||
{
|
||||
drawSolidRect(dc, x, y, w, h, 1, TEXT_COLOR);
|
||||
dc->drawSolidRect(x, y, w, h, 1, TEXT_COLOR);
|
||||
if (value > 0) {
|
||||
int width = (w * value) / 100;
|
||||
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, SCROLLBOX_COLOR);
|
||||
@@ -432,5 +436,6 @@ BitmapBuffer * FlyskyTheme::currentMenuBackground = nullptr;
|
||||
FlyskyTheme flyskyTheme;
|
||||
|
||||
#if defined(PCBFLYSKY)
|
||||
ThemeBase * defaultTheme = &flyskyTheme;
|
||||
Theme * theme = &flyskyTheme;
|
||||
#endif
|
||||
@@ -27,11 +27,11 @@ const ZoneOption OPTIONS_THEME_DEFAULT[] = {
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
class FrskyTheme: public Theme
|
||||
class FrskyTheme: public ThemeBase
|
||||
{
|
||||
public:
|
||||
FrskyTheme():
|
||||
Theme("FrSky", OPTIONS_THEME_DEFAULT)
|
||||
ThemeBase("FrSky", OPTIONS_THEME_DEFAULT)
|
||||
{
|
||||
loadColors();
|
||||
}
|
||||
@@ -72,8 +72,8 @@ class FrskyTheme: public Theme
|
||||
|
||||
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_TITLE_COLOR) const
|
||||
{
|
||||
TRACE("loadMenuIcon %s", getThemePath(filename));
|
||||
BitmapBuffer * mask = BitmapBuffer::loadMask(getThemePath(filename));
|
||||
TRACE("loadMenuIcon %s", getFilePath(filename));
|
||||
BitmapBuffer * mask = BitmapBuffer::loadMask(getFilePath(filename));
|
||||
if (mask) {
|
||||
delete iconMask[index];
|
||||
iconMask[index] = mask;
|
||||
@@ -148,13 +148,14 @@ class FrskyTheme: public Theme
|
||||
loadMenuIcon(ICON_MONITOR_CHANNELS4, "mask_monitor_channels4.png");
|
||||
loadMenuIcon(ICON_MONITOR_LOGICAL_SWITCHES, "mask_monitor_logsw.png");
|
||||
|
||||
BitmapBuffer * background = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_bg.png"));
|
||||
BitmapBuffer * shadow = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_shadow.png"));
|
||||
BitmapBuffer * dot = BitmapBuffer::loadMask(getThemePath("mask_currentmenu_dot.png"));
|
||||
BitmapBuffer * background = BitmapBuffer::loadMask(getFilePath("mask_currentmenu_bg.png"));
|
||||
BitmapBuffer * shadow = BitmapBuffer::loadMask(getFilePath("mask_currentmenu_shadow.png"));
|
||||
BitmapBuffer * dot = BitmapBuffer::loadMask(getFilePath("mask_currentmenu_dot.png"));
|
||||
|
||||
if (!currentMenuBackground) {
|
||||
currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53);
|
||||
}
|
||||
|
||||
if (currentMenuBackground) {
|
||||
currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->getWidth(), MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->getWidth(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, TEXT_BGCOLOR);
|
||||
@@ -165,7 +166,7 @@ class FrskyTheme: public Theme
|
||||
}
|
||||
|
||||
delete topleftBitmap;
|
||||
topleftBitmap = BitmapBuffer::loadMaskOnBackground("topleft.png", TITLE_BGCOLOR, HEADER_BGCOLOR);
|
||||
topleftBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("topleft.png"), TITLE_BGCOLOR, HEADER_BGCOLOR);
|
||||
|
||||
delete background;
|
||||
delete shadow;
|
||||
@@ -176,31 +177,31 @@ class FrskyTheme: public Theme
|
||||
{
|
||||
// Calibration screen
|
||||
delete calibStick;
|
||||
calibStick = BitmapBuffer::load(getThemePath("stick_pointer.png"));
|
||||
calibStick = BitmapBuffer::load(getFilePath("stick_pointer.png"));
|
||||
|
||||
delete calibStickBackground;
|
||||
calibStickBackground = BitmapBuffer::load(getThemePath("stick_background.png"));
|
||||
calibStickBackground = BitmapBuffer::load(getFilePath("stick_background.png"));
|
||||
|
||||
delete calibTrackpBackground;
|
||||
calibTrackpBackground = BitmapBuffer::load(getThemePath("trackp_background.png"));
|
||||
calibTrackpBackground = BitmapBuffer::load(getFilePath("trackp_background.png"));
|
||||
|
||||
delete calibRadioPict;
|
||||
#if defined(PCBX10)
|
||||
if(STICKS_PWM_ENABLED()) {
|
||||
calibRadioPict = BitmapBuffer::load(getThemePath("X10S.bmp"));
|
||||
calibRadioPict = BitmapBuffer::load(getFilePath("X10S.bmp"));
|
||||
}
|
||||
else {
|
||||
calibRadioPict = BitmapBuffer::load(getThemePath("X10.bmp"));
|
||||
calibRadioPict = BitmapBuffer::load(getFilePath("X10.bmp"));
|
||||
}
|
||||
#else
|
||||
calibRadioPict = BitmapBuffer::load(getThemePath("horus.bmp"));
|
||||
calibRadioPict = BitmapBuffer::load(getFilePath("horus.bmp"));
|
||||
#endif
|
||||
|
||||
// Model Selection screen
|
||||
delete modelselIconBitmap;
|
||||
modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", TITLE_BGCOLOR, TEXT_BGCOLOR);
|
||||
if (modelselIconBitmap) {
|
||||
BitmapBuffer * bitmap = BitmapBuffer::load(getThemePath("modelsel/icon_default.png"));
|
||||
BitmapBuffer * bitmap = BitmapBuffer::load(getFilePath("modelsel/icon_default.png"));
|
||||
modelselIconBitmap->drawBitmap(20, 8, bitmap);
|
||||
delete bitmap;
|
||||
}
|
||||
@@ -215,13 +216,13 @@ class FrskyTheme: public Theme
|
||||
modelselModelNameBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelname.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
|
||||
delete modelselModelMoveBackground;
|
||||
modelselModelMoveBackground = BitmapBuffer::loadMask(getThemePath("modelsel/mask_moveback.png"));
|
||||
modelselModelMoveBackground = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveback.png"));
|
||||
|
||||
delete modelselModelMoveIcon;
|
||||
modelselModelMoveIcon = BitmapBuffer::loadMask(getThemePath("modelsel/mask_moveico.png"));
|
||||
modelselModelMoveIcon = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveico.png"));
|
||||
|
||||
delete modelselWizardBackground;
|
||||
modelselWizardBackground = BitmapBuffer::load(getThemePath("wizard/background.png"));
|
||||
modelselWizardBackground = BitmapBuffer::load(getFilePath("wizard/background.png"));
|
||||
|
||||
// Channels monitor screen
|
||||
delete chanMonLockedBitmap;
|
||||
@@ -256,10 +257,10 @@ class FrskyTheme: public Theme
|
||||
mixerSetupCurveBitmap = BitmapBuffer::loadMaskOnBackground("mask_textline_curve.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
|
||||
delete mixerSetupSwitchIcon;
|
||||
mixerSetupSwitchIcon = BitmapBuffer::loadMask(getThemePath("mask_textline_switch.png"));
|
||||
mixerSetupSwitchIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_switch.png"));
|
||||
|
||||
delete mixerSetupFlightmodeIcon;
|
||||
mixerSetupFlightmodeIcon = BitmapBuffer::loadMask(getThemePath("mask_textline_fm.png"));
|
||||
mixerSetupFlightmodeIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_fm.png"));
|
||||
|
||||
delete mixerSetupSlowBitmap;
|
||||
mixerSetupSlowBitmap = BitmapBuffer::loadMaskOnBackground("mask_textline_slow.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
@@ -271,17 +272,17 @@ class FrskyTheme: public Theme
|
||||
mixerSetupDelaySlowBitmap = BitmapBuffer::loadMaskOnBackground("mask_textline_delayslow.png", TEXT_COLOR, TEXT_BGCOLOR);
|
||||
}
|
||||
|
||||
virtual void load() const override
|
||||
void load() const override
|
||||
{
|
||||
loadColors();
|
||||
Theme::load();
|
||||
ThemeBase::load();
|
||||
if (!backgroundBitmap) {
|
||||
backgroundBitmap = BitmapBuffer::load(getThemePath("background.png"));
|
||||
backgroundBitmap = BitmapBuffer::load(getFilePath("background.png"));
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
virtual void update() const override
|
||||
void update() const override
|
||||
{
|
||||
TRACE("TODO THEME::UPDATE()");
|
||||
#if 0
|
||||
@@ -320,12 +321,10 @@ class FrskyTheme: public Theme
|
||||
|
||||
void drawMenuBackground(BitmapBuffer * dc, uint8_t icon, const char * title) const override
|
||||
{
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
|
||||
if (topleftBitmap) {
|
||||
dc->drawBitmap(0, 0, topleftBitmap);
|
||||
uint16_t width = topleftBitmap->getWidth();
|
||||
dc->drawSolidFilledRect(width, 0, LCD_W-width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
@@ -339,7 +338,7 @@ class FrskyTheme: public Theme
|
||||
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP - MENU_HEADER_HEIGHT, TEXT_BGCOLOR); // the white separation line
|
||||
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); // the title line background
|
||||
if (title) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 1, title, MENU_TITLE_COLOR);
|
||||
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 1, title, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
drawMenuDatetime(dc);
|
||||
@@ -350,9 +349,9 @@ class FrskyTheme: public Theme
|
||||
return iconMask[index];
|
||||
}
|
||||
|
||||
const BitmapBuffer * getIconButtonBitmap(uint8_t index, bool selected) const override
|
||||
const BitmapBuffer * getIcon(uint8_t index, IconState state) const override
|
||||
{
|
||||
return selected ? menuIconSelected[index] : menuIconNormal[index];
|
||||
return state == STATE_DEFAULT ? menuIconNormal[index] : menuIconSelected[index];
|
||||
}
|
||||
|
||||
void drawMenuHeader(BitmapBuffer * dc, std::vector<PageTab *> & tabs, uint8_t currentIndex) const override
|
||||
@@ -373,17 +372,20 @@ class FrskyTheme: public Theme
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
#if defined(TRANSLATIONS_CN)
|
||||
sprintf(str, "%d" TR_MONTH "%d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
const char * const STR_MONTHS[] = TR_MONTHS;
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
lcdDrawText(DATETIME_MIDDLE, DATETIME_LINE1, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
|
||||
#endif
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME));
|
||||
lcdDrawText(DATETIME_MIDDLE, DATETIME_LINE2, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, SMLSIZE|TEXT_INVERTED_COLOR|CENTERED);
|
||||
}
|
||||
|
||||
void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const override
|
||||
{
|
||||
drawSolidRect(dc, x, y, w, h, 1, TEXT_COLOR);
|
||||
dc->drawSolidRect(x, y, w, h, 1, TEXT_COLOR);
|
||||
if (value > 0) {
|
||||
int width = (w * value) / 100;
|
||||
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, SCROLLBOX_COLOR);
|
||||
@@ -409,5 +411,6 @@ BitmapBuffer * FrskyTheme::currentMenuBackground = nullptr;
|
||||
FrskyTheme frskyTheme;
|
||||
|
||||
#if defined(PCBFRSKY)
|
||||
ThemeBase * defaultTheme = &frskyTheme;
|
||||
Theme * theme = &frskyTheme;
|
||||
#endif
|
||||
|
||||
@@ -21,10 +21,7 @@
|
||||
#include "libopenui_config.h"
|
||||
#include "timeedit.h"
|
||||
#include "keyboard_number.h"
|
||||
#include "draw_functions.h"
|
||||
#include "strhelpers.h"
|
||||
#include <keys.h>
|
||||
#include <opentx.h>
|
||||
|
||||
TimeEdit::TimeEdit(Window * parent, const rect_t & rect, int32_t vmin, int32_t vmax, std::function<int32_t()> getValue, std::function<void(int32_t)> setValue, LcdFlags flags):
|
||||
BaseNumberEdit(parent, rect, vmin, vmax, getValue, setValue, flags)
|
||||
@@ -59,7 +56,7 @@ void TimeEdit::onKeyEvent(event_t event)
|
||||
if (value <= vmax)
|
||||
setValue(value);
|
||||
else
|
||||
AUDIO_KEY_ERROR();
|
||||
onKeyError();
|
||||
return;
|
||||
}
|
||||
else if (event == EVT_ROTARY_LEFT) {
|
||||
@@ -68,7 +65,7 @@ void TimeEdit::onKeyEvent(event_t event)
|
||||
if (value >= vmin)
|
||||
setValue(value);
|
||||
else
|
||||
AUDIO_KEY_ERROR();
|
||||
onKeyError();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "view_main.h"
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
// #include "menu_screens.h"
|
||||
// #include "model_select.h"
|
||||
// #include "view_channels.h"
|
||||
@@ -177,12 +178,18 @@ void ViewMain::onKeyEvent(event_t event)
|
||||
new RadioMenu();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_TELEM):
|
||||
killEvents(event);
|
||||
new ScreenMenu();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
Menu * menu = new Menu();
|
||||
menu->addLine(STR_MODEL_SELECT, [=]() {
|
||||
// new ModelselectMenu();
|
||||
});
|
||||
if (1/*modelHasNotes()*/) {
|
||||
if (modelHasNotes()) {
|
||||
menu->addLine(STR_VIEW_NOTES, [=]() {
|
||||
// TODO
|
||||
});
|
||||
@@ -221,14 +228,11 @@ void ViewMain::onKeyEvent(event_t event)
|
||||
void ViewMain::checkEvents()
|
||||
{
|
||||
Window::checkEvents();
|
||||
|
||||
// TODO temporary for refreshing the trims
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void ViewMain::paint(BitmapBuffer * dc)
|
||||
{
|
||||
theme->drawBackground(dc);
|
||||
static_cast<ThemeBase *>(theme)->drawBackground(dc);
|
||||
|
||||
// drawMainPots();
|
||||
|
||||
|
||||
@@ -109,10 +109,10 @@ class WidgetsContainer: public WidgetsContainerInterface
|
||||
char name[WIDGET_NAME_LEN + 1];
|
||||
memset(name, 0, sizeof(name));
|
||||
strncpy(name, persistentData->zones[i].widgetName, WIDGET_NAME_LEN);
|
||||
widgets[i] = loadWidget(name, getZone(i), &persistentData->zones[i].widgetData);
|
||||
// widgets[i] = loadWidget(name, getZone(i), &persistentData->zones[i].widgetData);
|
||||
}
|
||||
else {
|
||||
widgets[i] = NULL;
|
||||
widgets[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +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 __COLORLCD_DRAW_FUNCTIONS__
|
||||
#define __COLORLCD_DRAW_FUNCTIONS__
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix, const char * suffix);
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att);
|
||||
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable=nullptr);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags attr, event_t event);
|
||||
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
|
||||
void drawFatalErrorScreen(const char * message);
|
||||
void runFatalErrorScreen(const char * message);
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att);
|
||||
void lcdDrawMMM(coord_t x, coord_t y, LcdFlags flags);
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att);
|
||||
#endif
|
||||
|
||||
#endif // __COLORLCD_DRAW_FUNCTIONS__
|
||||
@@ -4,6 +4,7 @@ set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/menus.cpp
|
||||
../common/stdlcd/draw_functions.cpp
|
||||
../common/stdlcd/fonts.cpp
|
||||
../common/stdlcd/popups.cpp
|
||||
../common/stdlcd/model_inputs.cpp
|
||||
../common/stdlcd/model_mixes.cpp
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "fonts.h"
|
||||
|
||||
const unsigned char font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
@@ -43,13 +43,11 @@ const unsigned char font_5x7[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
#if !defined(BOOT)
|
||||
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)
|
||||
@@ -72,12 +70,11 @@ const unsigned char font_10x14[] = {
|
||||
#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)
|
||||
@@ -18,44 +18,21 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _LIBOPEUI_TYPES_H_
|
||||
#define _LIBOPEUI_TYPES_H_
|
||||
#ifndef _FONTS_H_
|
||||
#define _FONTS_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
extern const unsigned char font_5x7[];
|
||||
extern const unsigned char font_10x14[];
|
||||
|
||||
typedef int coord_t;
|
||||
#if !defined(BOOT)
|
||||
extern const unsigned char font_5x7_B[];
|
||||
extern const unsigned char font_3x5[];
|
||||
extern const unsigned char font_4x6[];
|
||||
extern const unsigned char font_8x10[];
|
||||
extern const unsigned char font_22x38_num[];
|
||||
extern const unsigned char font_5x7_extra[];
|
||||
extern const unsigned char font_10x14_extra[];
|
||||
extern const unsigned char font_4x6_extra[];
|
||||
#endif
|
||||
|
||||
struct point_t
|
||||
{
|
||||
coord_t x;
|
||||
coord_t y;
|
||||
};
|
||||
|
||||
struct rect_t
|
||||
{
|
||||
coord_t x, y, w, h;
|
||||
|
||||
constexpr coord_t left() const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
constexpr coord_t right() const
|
||||
{
|
||||
return x + w;
|
||||
}
|
||||
|
||||
constexpr coord_t top() const
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
constexpr coord_t bottom() const
|
||||
{
|
||||
return y + h;
|
||||
}
|
||||
};
|
||||
|
||||
typedef uint32_t LcdFlags;
|
||||
|
||||
#endif // _LIBOPEUI_TYPES_H_
|
||||
#endif // _FONTS_H_
|
||||