mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 06:45:10 +03:00
[Horus] UI continued
This commit is contained in:
parent
23e597fffe
commit
b5f6618238
18 changed files with 241 additions and 138 deletions
BIN
radio/sdcard/horus/THEMES/TBS/thumb.bmp
Normal file
BIN
radio/sdcard/horus/THEMES/TBS/thumb.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
|
@ -48,6 +48,12 @@ set(9X_GUI_SRC
|
||||||
menu_general_diaganas.cpp
|
menu_general_diaganas.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(FATFS_SRC
|
||||||
|
${FATFS_DIR}/ff.c
|
||||||
|
${FATFS_DIR}/fattime.c
|
||||||
|
${FATFS_DIR}/option/ccsbcs.c
|
||||||
|
)
|
||||||
|
|
||||||
if(PCB STREQUAL HORUS)
|
if(PCB STREQUAL HORUS)
|
||||||
set(CPU_TYPE STM32F4)
|
set(CPU_TYPE STM32F4)
|
||||||
set(HSE_VALUE 12000000)
|
set(HSE_VALUE 12000000)
|
||||||
|
@ -240,7 +246,6 @@ elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X)
|
||||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} loadboot.cpp)
|
set(FIRMWARE_SRC ${FIRMWARE_SRC} loadboot.cpp)
|
||||||
elseif(PCB STREQUAL 9X OR PCB STREQUAL 9XR OR PCB STREQUAL 9X128 OR PCB STREQUAL 9XR128)
|
elseif(PCB STREQUAL 9X OR PCB STREQUAL 9XR OR PCB STREQUAL 9X128 OR PCB STREQUAL 9XR128)
|
||||||
option(SP22 "SmartieParts 2.2 Backlight support" OFF)
|
option(SP22 "SmartieParts 2.2 Backlight support" OFF)
|
||||||
option(HAPTIC "Haptic support" OFF)
|
|
||||||
option(PWM_BACKLIGHT "PWM Backlight" OFF)
|
option(PWM_BACKLIGHT "PWM Backlight" OFF)
|
||||||
set(ARCH AVR)
|
set(ARCH AVR)
|
||||||
set(MCU atmega64)
|
set(MCU atmega64)
|
||||||
|
@ -253,16 +258,13 @@ elseif(PCB STREQUAL 9X OR PCB STREQUAL 9XR OR PCB STREQUAL 9X128 OR PCB STREQUAL
|
||||||
add_definitions(-DPCBSTD -DPCB${PCB} -DCPUM64)
|
add_definitions(-DPCBSTD -DPCB${PCB} -DCPUM64)
|
||||||
set(TARGET_SRC ${TARGET_SRC} board_stock.cpp)
|
set(TARGET_SRC ${TARGET_SRC} board_stock.cpp)
|
||||||
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
||||||
if(HAPTIC)
|
|
||||||
add_definitions(-DHAPTIC)
|
|
||||||
set(SRC ${SRC} haptic.cpp)
|
|
||||||
endif()
|
|
||||||
if(SP22)
|
if(SP22)
|
||||||
add_definitions(-DSP22)
|
add_definitions(-DSP22)
|
||||||
endif()
|
endif()
|
||||||
if(PWM_BACKLIGHT)
|
if(PWM_BACKLIGHT)
|
||||||
add_definitions(-DPWM_BACKLIGHT)
|
add_definitions(-DPWM_BACKLIGHT)
|
||||||
endif()
|
endif()
|
||||||
|
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} lcd_driver.cpp)
|
||||||
elseif(PCB STREQUAL 9X2561)
|
elseif(PCB STREQUAL 9X2561)
|
||||||
set(ARCH AVR)
|
set(ARCH AVR)
|
||||||
set(MCU atmega2561)
|
set(MCU atmega2561)
|
||||||
|
@ -275,29 +277,44 @@ elseif(PCB STREQUAL 9X2561)
|
||||||
add_definitions(-DPCBSTD -DPCB${PCB} -DCPUM2561)
|
add_definitions(-DPCBSTD -DPCB${PCB} -DCPUM2561)
|
||||||
set(TARGET_SRC ${TARGET_SRC} board_stock.cpp)
|
set(TARGET_SRC ${TARGET_SRC} board_stock.cpp)
|
||||||
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
||||||
if(HAPTIC)
|
|
||||||
add_definitions(-DHAPTIC)
|
|
||||||
set(SRC ${SRC} haptic.cpp)
|
|
||||||
endif()
|
|
||||||
if(SP22)
|
if(SP22)
|
||||||
add_definitions(-DSP22)
|
add_definitions(-DSP22)
|
||||||
endif()
|
endif()
|
||||||
if(PWM_BACKLIGHT)
|
if(PWM_BACKLIGHT)
|
||||||
add_definitions(-DPWM_BACKLIGHT)
|
add_definitions(-DPWM_BACKLIGHT)
|
||||||
endif()
|
endif()
|
||||||
|
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} lcd_driver.cpp)
|
||||||
elseif(PCB STREQUAL GRUVIN9X)
|
elseif(PCB STREQUAL GRUVIN9X)
|
||||||
set(ARCH AVR)
|
set(ARCH AVR)
|
||||||
set(MCU atmega2560)
|
set(MCU atmega2560)
|
||||||
string(TOLOWER ${PCB} FLAVOUR)
|
string(TOLOWER ${PCB} FLAVOUR)
|
||||||
set(EEPROM EEPROM_RLC)
|
set(EEPROM EEPROM_RLC)
|
||||||
add_definitions(-DEEPROM_VARIANT=0)
|
add_definitions(-DEEPROM_VARIANT=0)
|
||||||
set(GUI_DIR 9x)
|
set(GUI_DIR 9x)
|
||||||
set(TARGET_DIR gruvin9x)
|
set(TARGET_DIR gruvin9x)
|
||||||
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps)
|
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps)
|
||||||
add_definitions(-DPCB${PCB} -DCPUM2560)
|
add_definitions(-DPCB${PCB} -DCPUM2560 -DROTARY_ENCODERS=2)
|
||||||
set(TARGET_SRC ${TARGET_SRC} board_gruvin9x.cpp)
|
set(TARGET_SRC ${TARGET_SRC} board_gruvin9x.cpp)
|
||||||
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
||||||
|
set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/9x/lcd_driver.cpp)
|
||||||
elseif(PCB STREQUAL MEGA2560)
|
elseif(PCB STREQUAL MEGA2560)
|
||||||
|
option(PWRMANAGE "Pwr Manage" OFF)
|
||||||
|
option(SDCARD "SD card support" ON)
|
||||||
|
set(ARCH AVR)
|
||||||
|
set(MCU atmega2560)
|
||||||
|
string(TOLOWER ${PCB} FLAVOUR)
|
||||||
|
set(EEPROM EEPROM_RLC)
|
||||||
|
add_definitions(-DEEPROM_VARIANT=0)
|
||||||
|
set(GUI_DIR 9x)
|
||||||
|
set(TARGET_DIR mega2560)
|
||||||
|
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps)
|
||||||
|
add_definitions(-DPCB${PCB} -DCPUM2560 -DROTARY_ENCODERS=2)
|
||||||
|
set(TARGET_SRC ${TARGET_SRC} board_mega2560.cpp)
|
||||||
|
set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC})
|
||||||
|
set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/9x/lcd_driver.cpp)
|
||||||
|
if(PWRMANAGE)
|
||||||
|
add_definitions(-DPWRMANAGE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unknown PCB '${PCB}'")
|
message(FATAL_ERROR "Unknown PCB '${PCB}'")
|
||||||
endif()
|
endif()
|
||||||
|
@ -501,9 +518,6 @@ if(ARCH STREQUAL ARM)
|
||||||
)
|
)
|
||||||
set(FIRMWARE_SRC
|
set(FIRMWARE_SRC
|
||||||
${FIRMWARE_SRC}
|
${FIRMWARE_SRC}
|
||||||
${FATFS_DIR}/ff.c
|
|
||||||
${FATFS_DIR}/fattime.c
|
|
||||||
${FATFS_DIR}/option/ccsbcs.c
|
|
||||||
${COOS_DIR}/kernel/core.c
|
${COOS_DIR}/kernel/core.c
|
||||||
${COOS_DIR}/kernel/hook.c
|
${COOS_DIR}/kernel/hook.c
|
||||||
${COOS_DIR}/kernel/task.c
|
${COOS_DIR}/kernel/task.c
|
||||||
|
@ -530,10 +544,15 @@ else()
|
||||||
option(GRAPHICS "Additional graphics" ON)
|
option(GRAPHICS "Additional graphics" ON)
|
||||||
option(BOLD "Bold font" ON)
|
option(BOLD "Bold font" ON)
|
||||||
option(BATTGRAPH "Battery graph" OFF)
|
option(BATTGRAPH "Battery graph" OFF)
|
||||||
|
option(HAPTIC "Haptic support" OFF)
|
||||||
|
set(LCD "DEFAULT" CACHE STRING "LCD type (DEFAULT/ST7565P/ST7565R/ERC12864FSF/ST7920)")
|
||||||
set(PULSES_SRC pulses_avr.cpp)
|
set(PULSES_SRC pulses_avr.cpp)
|
||||||
set(SRC ${SRC} main_avr.cpp)
|
set(SRC ${SRC} main_avr.cpp)
|
||||||
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} lcd_driver.cpp)
|
|
||||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common_avr/adc_driver.cpp)
|
set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common_avr/adc_driver.cpp)
|
||||||
|
add_definitions(-DLCD_${LCD})
|
||||||
|
if(SDCARD)
|
||||||
|
set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/gruvin9x/diskio.cpp)
|
||||||
|
endif()
|
||||||
if(AUDIO)
|
if(AUDIO)
|
||||||
add_definitions(-DAUDIO)
|
add_definitions(-DAUDIO)
|
||||||
set(SRC ${SRC} audio_avr.cpp)
|
set(SRC ${SRC} audio_avr.cpp)
|
||||||
|
@ -558,6 +577,10 @@ else()
|
||||||
if(BATTGRAPH)
|
if(BATTGRAPH)
|
||||||
add_definitions(-DBATTGRAPH)
|
add_definitions(-DBATTGRAPH)
|
||||||
endif()
|
endif()
|
||||||
|
if(HAPTIC)
|
||||||
|
add_definitions(-DHAPTIC)
|
||||||
|
set(SRC ${SRC} haptic.cpp)
|
||||||
|
endif()
|
||||||
if(${EXT} STREQUAL OFF)
|
if(${EXT} STREQUAL OFF)
|
||||||
add_definitions(-DEXTSTD)
|
add_definitions(-DEXTSTD)
|
||||||
elseif(EXT STREQUAL ARDUPILOT)
|
elseif(EXT STREQUAL ARDUPILOT)
|
||||||
|
@ -670,6 +693,7 @@ set(GUI_SRC
|
||||||
|
|
||||||
if(VIRTUAL_INPUTS)
|
if(VIRTUAL_INPUTS)
|
||||||
add_definitions(-DVIRTUALINPUTS)
|
add_definitions(-DVIRTUALINPUTS)
|
||||||
|
set(TEMPLATES OFF)
|
||||||
else()
|
else()
|
||||||
option(TEMPLATES "Model Templates Menu" ON)
|
option(TEMPLATES "Model Templates Menu" ON)
|
||||||
endif()
|
endif()
|
||||||
|
@ -718,6 +742,10 @@ if(GVARS)
|
||||||
math(EXPR EEPROM_VARIANT ${EEPROM_VARIANT}+${GVARS_VARIANT})
|
math(EXPR EEPROM_VARIANT ${EEPROM_VARIANT}+${GVARS_VARIANT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SDCARD)
|
||||||
|
set(FIRMWARE_SRC ${FIRMWARE_SRC} ${FATFS_SRC})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(FAI STREQUAL YES)
|
if(FAI STREQUAL YES)
|
||||||
add_definitions(-DFAI)
|
add_definitions(-DFAI)
|
||||||
elseif(FAI STREQUAL CHOICE)
|
elseif(FAI STREQUAL CHOICE)
|
||||||
|
|
|
@ -271,7 +271,9 @@ int cliMemoryInfo(const char ** argv)
|
||||||
|
|
||||||
int cliReboot(const char ** argv)
|
int cliReboot(const char ** argv)
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +455,7 @@ int cliDisplay(const char ** argv)
|
||||||
|
|
||||||
int cliDebugVars(const char ** argv)
|
int cliDebugVars(const char ** argv)
|
||||||
{
|
{
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS) && !defined(SIMU)
|
||||||
extern uint32_t ioMutexReq, ioMutexRel;
|
extern uint32_t ioMutexReq, ioMutexRel;
|
||||||
extern uint32_t sdReadRetries;
|
extern uint32_t sdReadRetries;
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,20 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
|
||||||
|
|
||||||
void drawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags att);
|
void drawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags att);
|
||||||
|
|
||||||
|
inline void drawSolidHorizontalLine(coord_t x, coord_t y, coord_t w, LcdFlags att)
|
||||||
|
{
|
||||||
|
drawSolidFilledRect(x, y, w, 1, att);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void drawSolidVerticalLine(coord_t x, coord_t y, coord_t h, LcdFlags att)
|
||||||
|
{
|
||||||
|
drawSolidFilledRect(x, y, 1, h, att);
|
||||||
|
}
|
||||||
|
|
||||||
inline void drawSolidFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, LcdFlags flags)
|
inline void drawSolidFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, LcdFlags flags)
|
||||||
{
|
{
|
||||||
|
if (h==0 || w==0) return;
|
||||||
|
if (h<0) { y+=h; h=-h; }
|
||||||
DMAFillRect(data, width, x, y, w, h, lcdColorTable[COLOR_IDX(flags)]);
|
DMAFillRect(data, width, x, y, w, h, lcdColorTable[COLOR_IDX(flags)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void drawCurveHorizontalScale()
|
||||||
|
|
||||||
void drawCurveCoord(int x, int y, const char * text, bool active)
|
void drawCurveCoord(int x, int y, const char * text, bool active)
|
||||||
{
|
{
|
||||||
lcdDrawSolidFilledRect(x, y, CURVE_COORD_WIDTH, CURVE_COORD_HEIGHT, CURVE_CURSOR_COLOR);
|
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);
|
lcdDrawText(x+3+(CURVE_COORD_WIDTH-1-getTextWidth(text, SMLSIZE))/2, y+1, text, LEFT|SMLSIZE|TEXT_BGCOLOR);
|
||||||
if (active) {
|
if (active) {
|
||||||
lcdDrawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, TEXT_COLOR);
|
lcdDrawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, TEXT_COLOR);
|
||||||
|
|
|
@ -27,20 +27,19 @@
|
||||||
#define MENU_HEADER_HEIGHT 45
|
#define MENU_HEADER_HEIGHT 45
|
||||||
#define MENU_TITLE_TOP 48
|
#define MENU_TITLE_TOP 48
|
||||||
#define MENU_TITLE_HEIGHT 21
|
#define MENU_TITLE_HEIGHT 21
|
||||||
#define MENU_BODY_TOP 69 // MENU_TITLE_TOP + MENU_TITLE_HEIGHT
|
#define MENU_BODY_TOP (MENU_TITLE_TOP+MENU_TITLE_HEIGHT)
|
||||||
#define MENU_CONTENT_TOP 72
|
#define MENU_CONTENT_TOP (MENU_BODY_TOP+3)
|
||||||
#define MENU_BODY_HEIGHT 182
|
|
||||||
#define MENU_FOOTER_TOP 251 // MENU_BODY_TOP + MENU_BODY_HEIGHT
|
|
||||||
#define MENU_FOOTER_HEIGHT 21
|
#define MENU_FOOTER_HEIGHT 21
|
||||||
|
#define MENU_FOOTER_TOP (LCD_H-MENU_FOOTER_HEIGHT)
|
||||||
|
#define MENU_BODY_HEIGHT (MENU_FOOTER_TOP-MENU_BODY_TOP)
|
||||||
#define MENUS_MARGIN_LEFT 6
|
#define MENUS_MARGIN_LEFT 6
|
||||||
|
|
||||||
#define DEFAULT_SCROLLBAR_X LCD_W-10
|
#define DEFAULT_SCROLLBAR_X LCD_W-10
|
||||||
#define DEFAULT_SCROLLBAR_Y MENU_CONTENT_TOP
|
#define DEFAULT_SCROLLBAR_Y MENU_CONTENT_TOP
|
||||||
#define DEFAULT_SCROLLBAR_H (MENU_FOOTER_TOP - DEFAULT_SCROLLBAR_Y - 6)
|
#define DEFAULT_SCROLLBAR_H (MENU_FOOTER_TOP - DEFAULT_SCROLLBAR_Y - 6)
|
||||||
|
|
||||||
#define NUM_BODY_LINES 9
|
|
||||||
#define FH 20
|
#define FH 20
|
||||||
|
#define NUM_BODY_LINES (MENU_BODY_HEIGHT / FH)
|
||||||
|
|
||||||
#define INVERT_HORZ_MARGIN 3
|
#define INVERT_HORZ_MARGIN 3
|
||||||
#define INVERT_VERT_MARGIN 1
|
#define INVERT_VERT_MARGIN 1
|
||||||
|
@ -52,13 +51,17 @@
|
||||||
#define CURVE_COORD_WIDTH 36
|
#define CURVE_COORD_WIDTH 36
|
||||||
#define CURVE_COORD_HEIGHT 17
|
#define CURVE_COORD_HEIGHT 17
|
||||||
|
|
||||||
|
#define DATETIME_SEPARATOR_X (LCD_W-55)
|
||||||
|
#define DATETIME_LINE1 9
|
||||||
|
#define DATETIME_LINE2 23
|
||||||
|
#define DATETIME_MIDDLE (LCD_W+DATETIME_SEPARATOR_X+8)/2
|
||||||
|
|
||||||
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
||||||
#define MENU_INIT_VPOS -1
|
#define MENU_INIT_VPOS -1
|
||||||
|
|
||||||
#define MENU_ICONS_SPACING 31
|
#define MENU_ICONS_SPACING 31
|
||||||
#define SUBMENU_LINE_WIDTH 230
|
#define SUBMENU_LINE_WIDTH 230
|
||||||
|
|
||||||
#define BITMAP_BUFFER_SIZE(w, h) (4 + (w)*(h)*3)
|
|
||||||
#define LOAD_MODEL_BITMAP()
|
#define LOAD_MODEL_BITMAP()
|
||||||
|
|
||||||
#if defined(FLIGHT_MODES)
|
#if defined(FLIGHT_MODES)
|
||||||
|
|
|
@ -234,15 +234,6 @@ void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SIMU)
|
|
||||||
void lcdDrawSolidFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, LcdFlags att)
|
|
||||||
{
|
|
||||||
for (coord_t i=y; i<y+h; i++) {
|
|
||||||
lcdDrawHorizontalLine(x, i, w, SOLID, att);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void putsRtcTime(coord_t x, coord_t y, LcdFlags att)
|
void putsRtcTime(coord_t x, coord_t y, LcdFlags att)
|
||||||
{
|
{
|
||||||
putsTimer(x, y, getValue(MIXSRC_TX_TIME), att);
|
putsTimer(x, y, getValue(MIXSRC_TX_TIME), att);
|
||||||
|
|
|
@ -23,15 +23,20 @@
|
||||||
|
|
||||||
#include "bitmapbuffer.h"
|
#include "bitmapbuffer.h"
|
||||||
|
|
||||||
#define LCD_W 480
|
#if defined(PCBHORUS)
|
||||||
#define LCD_H 272
|
#define LCD_W 480
|
||||||
|
#define LCD_H 272
|
||||||
|
#define LCD_COLS 30
|
||||||
|
#else
|
||||||
|
#define LCD_W 800
|
||||||
|
#define LCD_H 480
|
||||||
|
#define LCD_COLS 40
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CENTER
|
#define CENTER
|
||||||
|
|
||||||
#define lcdint_t int32_t
|
#define lcdint_t int32_t
|
||||||
|
|
||||||
#define LCD_COLS 30
|
|
||||||
|
|
||||||
#define BSS 0x00
|
#define BSS 0x00
|
||||||
#define BOLD 0x00
|
#define BOLD 0x00
|
||||||
|
|
||||||
|
@ -136,6 +141,22 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
|
||||||
|
|
||||||
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color);
|
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color);
|
||||||
void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
|
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)
|
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);
|
lcd->drawHorizontalLine(x, y, w, pat, att);
|
||||||
|
@ -154,37 +175,17 @@ inline void lcdDrawAlphaPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t co
|
||||||
lcdDrawAlphaPixel(p, opacity, color);
|
lcdDrawAlphaPixel(p, opacity, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(SIMU)
|
|
||||||
inline void lcdDrawSolidFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, LcdFlags flags)
|
|
||||||
{
|
|
||||||
DMAFillRect(lcd->getData(), LCD_W, x, y, w, h, lcdColorTable[COLOR_IDX(flags)]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void lcdDrawSolidFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, LcdFlags flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline void lcdSetColor(uint16_t color)
|
inline void lcdSetColor(uint16_t color)
|
||||||
{
|
{
|
||||||
lcdColorTable[CUSTOM_COLOR_INDEX] = color;
|
lcdColorTable[CUSTOM_COLOR_INDEX] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void lcdDrawSolidHorizontalLine(coord_t x, coord_t y, coord_t w, LcdFlags att)
|
|
||||||
{
|
|
||||||
lcdDrawSolidFilledRect(x, y, w, 1, att);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void lcdDrawSolidVerticalLine(coord_t x, coord_t y, coord_t h, LcdFlags att)
|
|
||||||
{
|
|
||||||
if (h<0) { y+=h; h=-h; }
|
|
||||||
lcdDrawSolidFilledRect(x, y, 1, h, att);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void lcdDrawSolidRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness=1, LcdFlags att=0)
|
inline void lcdDrawSolidRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness=1, LcdFlags att=0)
|
||||||
{
|
{
|
||||||
lcdDrawSolidFilledRect(x, y, thickness, h, att);
|
lcd->drawSolidFilledRect(x, y, thickness, h, att);
|
||||||
lcdDrawSolidFilledRect(x+w-thickness, y, thickness, h, att);
|
lcd->drawSolidFilledRect(x+w-thickness, y, thickness, h, att);
|
||||||
lcdDrawSolidFilledRect(x, y, w, thickness, att);
|
lcd->drawSolidFilledRect(x, y, w, thickness, att);
|
||||||
lcdDrawSolidFilledRect(x, y+h-thickness, 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)
|
inline void lcdDrawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att=0)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
uint8_t g_moduleIdx;
|
uint8_t g_moduleIdx;
|
||||||
bool menuModelFailsafe(evt_t event);
|
bool menuModelFailsafe(evt_t event);
|
||||||
|
@ -699,7 +699,7 @@ bool menuModelSetup(evt_t event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RANGECHECK_ENABLE()) {
|
if (IS_RANGECHECK_ENABLE()) {
|
||||||
theme->drawMessageBox("RSSI :", NULL, NULL, 0);
|
theme->drawMessageBox("RSSI :", NULL, NULL, WARNING_TYPE_INFO);
|
||||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y, TELEMETRY_RSSI(), DBLSIZE|LEFT);
|
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y, TELEMETRY_RSSI(), DBLSIZE|LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ void displayMessageBox()
|
||||||
|
|
||||||
void drawAlertBox(const char * title, const char * text, const char * action)
|
void drawAlertBox(const char * title, const char * text, const char * action)
|
||||||
{
|
{
|
||||||
theme->drawMessageBox(title, text, action, MESSAGEBOX_TYPE_ALERT);
|
theme->drawMessageBox(title, text, action, WARNING_TYPE_ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void message(const pm_char * title, const pm_char * text, const char * action, uint8_t sound)
|
void message(const pm_char * title, const pm_char * text, const char * action, uint8_t sound)
|
||||||
|
@ -78,10 +78,7 @@ void displayWarning(evt_t event)
|
||||||
{
|
{
|
||||||
warningResult = false;
|
warningResult = false;
|
||||||
|
|
||||||
if (warningType == WARNING_TYPE_INPUT)
|
theme->drawMessageBox(warningText, "", "", warningType);
|
||||||
theme->drawMessageBox(warningText, "", "", MESSAGEBOX_TYPE_INFO);
|
|
||||||
else
|
|
||||||
theme->drawMessageBox(warningText, "", "", MESSAGEBOX_TYPE_WARNING);
|
|
||||||
|
|
||||||
if (warningInfoText) {
|
if (warningInfoText) {
|
||||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_INFOLINE_Y, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
lcdDrawSizedText(WARNING_LINE_X, WARNING_INFOLINE_Y, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
|
const BitmapBuffer * Theme::asterisk = NULL;
|
||||||
|
const BitmapBuffer * Theme::question = NULL;
|
||||||
|
const BitmapBuffer * Theme::busy = NULL;
|
||||||
|
|
||||||
void Theme::init() const
|
void Theme::init() const
|
||||||
{
|
{
|
||||||
memset(&g_eeGeneral.themeData, 0, sizeof(Theme::PersistentData));
|
memset(&g_eeGeneral.themeData, 0, sizeof(Theme::PersistentData));
|
||||||
|
@ -32,6 +36,13 @@ void Theme::init() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Theme::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"));
|
||||||
|
}
|
||||||
|
|
||||||
ZoneOptionValue * Theme::getOptionValue(unsigned int index) const
|
ZoneOptionValue * Theme::getOptionValue(unsigned int index) const
|
||||||
{
|
{
|
||||||
return &g_eeGeneral.themeData.options[index];
|
return &g_eeGeneral.themeData.options[index];
|
||||||
|
@ -70,40 +81,39 @@ void Theme::drawAboutBackground() const
|
||||||
drawBackground();
|
drawBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::drawMessageBox(const char * title, const char * text, const char * action, uint32_t flags) const
|
void Theme::drawMessageBox(const char * title, const char * text, const char * action, uint32_t type) const
|
||||||
{
|
{
|
||||||
static const BitmapBuffer * asterisk = BitmapBuffer::load(getThemePath("asterisk.bmp"));
|
|
||||||
|
|
||||||
//if (flags & MESSAGEBOX_TYPE_ALERT) {
|
//if (flags & MESSAGEBOX_TYPE_ALERT) {
|
||||||
drawBackground();
|
drawBackground();
|
||||||
lcdDrawFilledRect(0, POPUP_Y, LCD_W, POPUP_H, SOLID, TEXT_INVERTED_COLOR | OPACITY(8));
|
lcdDrawFilledRect(0, POPUP_Y, LCD_W, POPUP_H, SOLID, TEXT_INVERTED_COLOR | OPACITY(8));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if ((flags & MESSAGEBOX_TYPE_ALERT) || (flags & MESSAGEBOX_TYPE_WARNING)) {
|
if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK)
|
||||||
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, asterisk);
|
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, asterisk);
|
||||||
}
|
else if (type == WARNING_TYPE_INFO)
|
||||||
else {
|
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, busy);
|
||||||
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, asterisk);
|
else
|
||||||
}
|
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, question);
|
||||||
|
|
||||||
|
if (type == WARNING_TYPE_ALERT) {
|
||||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
|
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
|
||||||
if ((flags & MESSAGEBOX_TYPE_ALERT) || (flags & MESSAGEBOX_TYPE_WARNING)) {
|
|
||||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
||||||
}
|
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, title, ALARM_COLOR|DBLSIZE);
|
||||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, title, ALARM_COLOR|DBLSIZE);
|
|
||||||
#else
|
#else
|
||||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|DBLSIZE);
|
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|DBLSIZE);
|
||||||
if ((flags & MESSAGEBOX_TYPE_ALERT) || (flags & MESSAGEBOX_TYPE_WARNING)) {
|
|
||||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else if (title) {
|
||||||
|
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|DBLSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y, text);
|
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action) {
|
if (action) {
|
||||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+16, action);
|
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+20, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,6 @@
|
||||||
class Theme;
|
class Theme;
|
||||||
void registerTheme(Theme * theme);
|
void registerTheme(Theme * theme);
|
||||||
|
|
||||||
#define MESSAGEBOX_TYPE_INFO 0
|
|
||||||
#define MESSAGEBOX_TYPE_QUESTION 1
|
|
||||||
#define MESSAGEBOX_TYPE_WARNING 2
|
|
||||||
#define MESSAGEBOX_TYPE_ALERT 4
|
|
||||||
|
|
||||||
class Theme
|
class Theme
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -66,7 +61,7 @@ class Theme
|
||||||
|
|
||||||
ZoneOptionValue * getOptionValue(unsigned int index) const;
|
ZoneOptionValue * getOptionValue(unsigned int index) const;
|
||||||
|
|
||||||
virtual void load() const = 0;
|
virtual void load() const;
|
||||||
|
|
||||||
virtual void drawBackground() const;
|
virtual void drawBackground() const;
|
||||||
|
|
||||||
|
@ -80,6 +75,9 @@ class Theme
|
||||||
const char * name;
|
const char * name;
|
||||||
const ZoneOption * options;
|
const ZoneOption * options;
|
||||||
BitmapBuffer * thumb;
|
BitmapBuffer * thumb;
|
||||||
|
static const BitmapBuffer * asterisk;
|
||||||
|
static const BitmapBuffer * question;
|
||||||
|
static const BitmapBuffer * busy;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Theme * theme;
|
extern Theme * theme;
|
||||||
|
|
|
@ -64,11 +64,15 @@ class DefaultTheme: public Theme
|
||||||
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
|
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
|
||||||
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
|
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
|
||||||
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
|
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
|
||||||
|
|
||||||
|
Theme::load();
|
||||||
|
|
||||||
|
if (!backgroundBitmap) backgroundBitmap = BitmapBuffer::load(getThemePath("mainbg.bmp"));
|
||||||
|
if (!aboutBackgroundBitmap) aboutBackgroundBitmap = BitmapBuffer::load(getThemePath("aboutbg.bmp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void drawBackground() const
|
virtual void drawBackground() const
|
||||||
{
|
{
|
||||||
static BitmapBuffer * backgroundBitmap = BitmapBuffer::load(getThemePath("mainbg.bmp"));
|
|
||||||
if (backgroundBitmap) {
|
if (backgroundBitmap) {
|
||||||
lcd->drawBitmap(0, 0, backgroundBitmap);
|
lcd->drawBitmap(0, 0, backgroundBitmap);
|
||||||
}
|
}
|
||||||
|
@ -80,8 +84,7 @@ class DefaultTheme: public Theme
|
||||||
|
|
||||||
virtual void drawAboutBackground() const
|
virtual void drawAboutBackground() const
|
||||||
{
|
{
|
||||||
static BitmapBuffer * backgroundBitmap = BitmapBuffer::load(getThemePath("aboutbg.bmp"));
|
lcd->drawBitmap(0, 0, aboutBackgroundBitmap);
|
||||||
lcd->drawBitmap(0, 0, backgroundBitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void drawTopbarBackground(const uint8_t * icon) const
|
virtual void drawTopbarBackground(const uint8_t * icon) const
|
||||||
|
@ -98,7 +101,14 @@ class DefaultTheme: public Theme
|
||||||
|
|
||||||
drawTopbarDatetime();
|
drawTopbarDatetime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static const BitmapBuffer * backgroundBitmap;
|
||||||
|
static const BitmapBuffer * aboutBackgroundBitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const BitmapBuffer * DefaultTheme::backgroundBitmap = NULL;
|
||||||
|
const BitmapBuffer * DefaultTheme::aboutBackgroundBitmap = NULL;
|
||||||
|
|
||||||
DefaultTheme defaultTheme;
|
DefaultTheme defaultTheme;
|
||||||
Theme * theme = &defaultTheme;
|
Theme * theme = &defaultTheme;
|
||||||
|
|
|
@ -35,13 +35,29 @@ Zone Topbar::getZone(unsigned int index) const
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * const STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||||
|
|
||||||
|
void drawTopbarDatetime()
|
||||||
|
{
|
||||||
|
lcd->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, TEXT_INVERTED_COLOR);
|
||||||
|
|
||||||
|
struct gtm t;
|
||||||
|
gettime(&t);
|
||||||
|
char str[10];
|
||||||
|
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||||
|
lcdDrawText(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);
|
||||||
|
}
|
||||||
|
|
||||||
void drawTopBar()
|
void drawTopBar()
|
||||||
{
|
{
|
||||||
theme->drawTopbarBackground(NULL);
|
theme->drawTopbarBackground(NULL);
|
||||||
|
|
||||||
// USB icon
|
// USB icon
|
||||||
if (usbPlugged()) {
|
if (usbPlugged()) {
|
||||||
lcdDrawBitmapPattern(378, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
|
lcdDrawBitmapPattern(LCD_W-102, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RSSI
|
// RSSI
|
||||||
|
@ -49,7 +65,7 @@ void drawTopBar()
|
||||||
const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31};
|
const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31};
|
||||||
for (unsigned int i = 0; i < DIM(rssiBarsHeight); i++) {
|
for (unsigned int i = 0; i < DIM(rssiBarsHeight); i++) {
|
||||||
uint8_t height = rssiBarsHeight[i];
|
uint8_t height = rssiBarsHeight[i];
|
||||||
lcdDrawSolidFilledRect(390 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
|
lcdDrawSolidFilledRect(LCD_W-90 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
topbar->refresh();
|
topbar->refresh();
|
||||||
|
|
|
@ -26,27 +26,6 @@ void drawColumnHeader(const char * const * headers, uint8_t index)
|
||||||
// TODO ? displayHeader(headers[index]);
|
// TODO ? displayHeader(headers[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
|
||||||
|
|
||||||
#define DATETIME_SEPARATOR_X 425
|
|
||||||
#define DATETIME_LINE1 9
|
|
||||||
#define DATETIME_LINE2 23
|
|
||||||
#define DATETIME_MIDDLE (LCD_W+DATETIME_SEPARATOR_X+8)/2
|
|
||||||
|
|
||||||
void drawTopbarDatetime()
|
|
||||||
{
|
|
||||||
lcdDrawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, TEXT_INVERTED_COLOR);
|
|
||||||
|
|
||||||
struct gtm t;
|
|
||||||
gettime(&t);
|
|
||||||
char str[10];
|
|
||||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
|
||||||
lcdDrawText(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "alpha_stick_background.lbm"
|
#include "alpha_stick_background.lbm"
|
||||||
#include "alpha_stick_pointer.lbm"
|
#include "alpha_stick_pointer.lbm"
|
||||||
#define STICK_PANEL_WIDTH 68
|
#define STICK_PANEL_WIDTH 68
|
||||||
|
@ -61,7 +40,7 @@ void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval)
|
||||||
|
|
||||||
void drawButton(coord_t x, coord_t y, const char * label, LcdFlags attr)
|
void drawButton(coord_t x, coord_t y, const char * label, LcdFlags attr)
|
||||||
{
|
{
|
||||||
int width = getTextWidth(label, 0, attr);
|
int width = getTextWidth(label, 0, 0);
|
||||||
int padding = 0;
|
int padding = 0;
|
||||||
if (attr & (BUTTON_OFF|BUTTON_ON)) {
|
if (attr & (BUTTON_OFF|BUTTON_ON)) {
|
||||||
padding = 5;
|
padding = 5;
|
||||||
|
|
61
radio/src/gui/horus/widgets/outputs.cpp
Normal file
61
radio/src/gui/horus/widgets/outputs.cpp
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
|
||||||
|
class OutputsWidget: public Widget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OutputsWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
|
||||||
|
Widget(factory, zone, persistentData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void refresh();
|
||||||
|
|
||||||
|
static const ZoneOption options[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const ZoneOption OutputsWidget::options[] = {
|
||||||
|
{ "Min", ZoneOption::Integer, OPTION_DEFAULT_VALUE({ .unsignedValue = 0 }) },
|
||||||
|
{ "Max", ZoneOption::Integer, OPTION_DEFAULT_VALUE({ .unsignedValue = 7 }) },
|
||||||
|
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE({ .unsignedValue = RED }) },
|
||||||
|
{ NULL, ZoneOption::Bool }
|
||||||
|
};
|
||||||
|
|
||||||
|
void OutputsWidget::refresh()
|
||||||
|
{
|
||||||
|
int firstChannel = MIXSRC_CH1 + persistentData->options[0].unsignedValue;
|
||||||
|
int lastChannel = MIXSRC_CH1 + persistentData->options[1].unsignedValue;
|
||||||
|
uint16_t color = persistentData->options[2].unsignedValue;
|
||||||
|
|
||||||
|
lcdSetColor(color);
|
||||||
|
lcd->drawSolidHorizontalLine(zone.x, zone.y+zone.h/2, zone.w, CUSTOM_COLOR);
|
||||||
|
|
||||||
|
int count = lastChannel - firstChannel + 1;
|
||||||
|
|
||||||
|
for (int ch=firstChannel, i=0; ch<=lastChannel; ch++, i++) {
|
||||||
|
int32_t value = limit<int32_t>(-RESX, getValue(ch), RESX);
|
||||||
|
int h = divRoundClosest((zone.h-1)/2 * value, RESX);
|
||||||
|
lcdDrawSolidFilledRect(zone.x+(zone.w*i)/count, zone.y + zone.h/2, zone.w/count-1, -h, CUSTOM_COLOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseWidgetFactory<OutputsWidget> outputsWidget("Outputs", OutputsWidget::options);
|
|
@ -1045,7 +1045,9 @@ void doSplash()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SPLASH_NEEDED()) {
|
if (SPLASH_NEEDED()) {
|
||||||
|
#if !defined(PCBTARANIS) && !defined(PCBHORUS)
|
||||||
drawSplash();
|
drawSplash();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
AUDIO_TADA();
|
AUDIO_TADA();
|
||||||
|
|
|
@ -873,17 +873,10 @@
|
||||||
#define TR_DELAY "Delay"
|
#define TR_DELAY "Delay"
|
||||||
#define TR_SD_CARD "SD CARD"
|
#define TR_SD_CARD "SD CARD"
|
||||||
#define TR_SDHC_CARD "SD-HC CARD"
|
#define TR_SDHC_CARD "SD-HC CARD"
|
||||||
#if defined(COLORLCD)
|
|
||||||
#define TR_NO_SOUNDS_ON_SD "No Sounds"
|
|
||||||
#define TR_NO_MODELS_ON_SD "No Models"
|
|
||||||
#define TR_NO_BITMAPS_ON_SD "No Bitmaps"
|
|
||||||
#define TR_NO_SCRIPTS_ON_SD "No Scripts"
|
|
||||||
#else
|
|
||||||
#define TR_NO_SOUNDS_ON_SD "No Sounds" BREAKSPACE "on SD"
|
#define TR_NO_SOUNDS_ON_SD "No Sounds" BREAKSPACE "on SD"
|
||||||
#define TR_NO_MODELS_ON_SD "No Models" BREAKSPACE "on SD"
|
#define TR_NO_MODELS_ON_SD "No Models" BREAKSPACE "on SD"
|
||||||
#define TR_NO_BITMAPS_ON_SD "No Bitmaps" BREAKSPACE "on SD"
|
#define TR_NO_BITMAPS_ON_SD "No Bitmaps" BREAKSPACE "on SD"
|
||||||
#define TR_NO_SCRIPTS_ON_SD "No Scripts" BREAKSPACE "on SD"
|
#define TR_NO_SCRIPTS_ON_SD "No Scripts" BREAKSPACE "on SD"
|
||||||
#endif
|
|
||||||
#define TR_SCRIPT_SYNTAX_ERROR "Script syntax error"
|
#define TR_SCRIPT_SYNTAX_ERROR "Script syntax error"
|
||||||
#define TR_SCRIPT_PANIC "Script panic"
|
#define TR_SCRIPT_PANIC "Script panic"
|
||||||
#define TR_SCRIPT_KILLED "Script killed"
|
#define TR_SCRIPT_KILLED "Script killed"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue