[Horus] UI continued
This commit is contained in:
@@ -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);
|
||||
|
||||
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)
|
||||
{
|
||||
if (h==0 || w==0) return;
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
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)
|
||||
{
|
||||
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);
|
||||
if (active) {
|
||||
lcdDrawBitmapPattern(x, y, LBM_CURVE_COORD_SHADOW, TEXT_COLOR);
|
||||
|
||||
@@ -27,20 +27,19 @@
|
||||
#define MENU_HEADER_HEIGHT 45
|
||||
#define MENU_TITLE_TOP 48
|
||||
#define MENU_TITLE_HEIGHT 21
|
||||
#define MENU_BODY_TOP 69 // MENU_TITLE_TOP + MENU_TITLE_HEIGHT
|
||||
#define MENU_CONTENT_TOP 72
|
||||
#define MENU_BODY_HEIGHT 182
|
||||
#define MENU_FOOTER_TOP 251 // MENU_BODY_TOP + MENU_BODY_HEIGHT
|
||||
#define MENU_BODY_TOP (MENU_TITLE_TOP+MENU_TITLE_HEIGHT)
|
||||
#define MENU_CONTENT_TOP (MENU_BODY_TOP+3)
|
||||
#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 DEFAULT_SCROLLBAR_X LCD_W-10
|
||||
#define DEFAULT_SCROLLBAR_Y MENU_CONTENT_TOP
|
||||
#define DEFAULT_SCROLLBAR_H (MENU_FOOTER_TOP - DEFAULT_SCROLLBAR_Y - 6)
|
||||
|
||||
#define NUM_BODY_LINES 9
|
||||
#define FH 20
|
||||
#define NUM_BODY_LINES (MENU_BODY_HEIGHT / FH)
|
||||
|
||||
#define INVERT_HORZ_MARGIN 3
|
||||
#define INVERT_VERT_MARGIN 1
|
||||
@@ -52,13 +51,17 @@
|
||||
#define CURVE_COORD_WIDTH 36
|
||||
#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_INIT_VPOS -1
|
||||
|
||||
#define MENU_ICONS_SPACING 31
|
||||
#define SUBMENU_LINE_WIDTH 230
|
||||
|
||||
#define BITMAP_BUFFER_SIZE(w, h) (4 + (w)*(h)*3)
|
||||
#define LOAD_MODEL_BITMAP()
|
||||
|
||||
#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)
|
||||
{
|
||||
putsTimer(x, y, getValue(MIXSRC_TX_TIME), att);
|
||||
|
||||
+29
-28
@@ -23,15 +23,20 @@
|
||||
|
||||
#include "bitmapbuffer.h"
|
||||
|
||||
#define LCD_W 480
|
||||
#define LCD_H 272
|
||||
#if defined(PCBHORUS)
|
||||
#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 lcdint_t int32_t
|
||||
|
||||
#define LCD_COLS 30
|
||||
|
||||
#define BSS 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 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);
|
||||
@@ -154,37 +175,17 @@ inline void lcdDrawAlphaPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t co
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
lcdDrawSolidFilledRect(x, y, thickness, h, att);
|
||||
lcdDrawSolidFilledRect(x+w-thickness, y, thickness, h, att);
|
||||
lcdDrawSolidFilledRect(x, y, w, thickness, att);
|
||||
lcdDrawSolidFilledRect(x, y+h-thickness, w, thickness, att);
|
||||
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)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../../opentx.h"
|
||||
#include "opentx.h"
|
||||
|
||||
uint8_t g_moduleIdx;
|
||||
bool menuModelFailsafe(evt_t event);
|
||||
@@ -699,7 +699,7 @@ bool menuModelSetup(evt_t event)
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void displayMessageBox()
|
||||
|
||||
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)
|
||||
@@ -78,10 +78,7 @@ void displayWarning(evt_t event)
|
||||
{
|
||||
warningResult = false;
|
||||
|
||||
if (warningType == WARNING_TYPE_INPUT)
|
||||
theme->drawMessageBox(warningText, "", "", MESSAGEBOX_TYPE_INFO);
|
||||
else
|
||||
theme->drawMessageBox(warningText, "", "", MESSAGEBOX_TYPE_WARNING);
|
||||
theme->drawMessageBox(warningText, "", "", warningType);
|
||||
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_INFOLINE_Y, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const BitmapBuffer * Theme::asterisk = NULL;
|
||||
const BitmapBuffer * Theme::question = NULL;
|
||||
const BitmapBuffer * Theme::busy = NULL;
|
||||
|
||||
void Theme::init() const
|
||||
{
|
||||
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
|
||||
{
|
||||
return &g_eeGeneral.themeData.options[index];
|
||||
@@ -70,40 +81,39 @@ void Theme::drawAboutBackground() const
|
||||
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) {
|
||||
drawBackground();
|
||||
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);
|
||||
}
|
||||
else {
|
||||
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, asterisk);
|
||||
}
|
||||
else if (type == WARNING_TYPE_INFO)
|
||||
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, busy);
|
||||
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 ((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+28, title, ALARM_COLOR|DBLSIZE);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, title, ALARM_COLOR|DBLSIZE);
|
||||
#else
|
||||
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, title, ALARM_COLOR|DBLSIZE);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+28, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (title) {
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, title, ALARM_COLOR|DBLSIZE);
|
||||
}
|
||||
|
||||
if (text) {
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y, text);
|
||||
}
|
||||
|
||||
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;
|
||||
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
|
||||
{
|
||||
public:
|
||||
@@ -66,7 +61,7 @@ class Theme
|
||||
|
||||
ZoneOptionValue * getOptionValue(unsigned int index) const;
|
||||
|
||||
virtual void load() const = 0;
|
||||
virtual void load() const;
|
||||
|
||||
virtual void drawBackground() const;
|
||||
|
||||
@@ -80,6 +75,9 @@ class Theme
|
||||
const char * name;
|
||||
const ZoneOption * options;
|
||||
BitmapBuffer * thumb;
|
||||
static const BitmapBuffer * asterisk;
|
||||
static const BitmapBuffer * question;
|
||||
static const BitmapBuffer * busy;
|
||||
};
|
||||
|
||||
extern Theme * theme;
|
||||
|
||||
@@ -64,11 +64,15 @@ class DefaultTheme: public Theme
|
||||
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
|
||||
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
|
||||
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
|
||||
{
|
||||
static BitmapBuffer * backgroundBitmap = BitmapBuffer::load(getThemePath("mainbg.bmp"));
|
||||
if (backgroundBitmap) {
|
||||
lcd->drawBitmap(0, 0, backgroundBitmap);
|
||||
}
|
||||
@@ -80,8 +84,7 @@ class DefaultTheme: public Theme
|
||||
|
||||
virtual void drawAboutBackground() const
|
||||
{
|
||||
static BitmapBuffer * backgroundBitmap = BitmapBuffer::load(getThemePath("aboutbg.bmp"));
|
||||
lcd->drawBitmap(0, 0, backgroundBitmap);
|
||||
lcd->drawBitmap(0, 0, aboutBackgroundBitmap);
|
||||
}
|
||||
|
||||
virtual void drawTopbarBackground(const uint8_t * icon) const
|
||||
@@ -98,7 +101,14 @@ class DefaultTheme: public Theme
|
||||
|
||||
drawTopbarDatetime();
|
||||
}
|
||||
|
||||
protected:
|
||||
static const BitmapBuffer * backgroundBitmap;
|
||||
static const BitmapBuffer * aboutBackgroundBitmap;
|
||||
};
|
||||
|
||||
const BitmapBuffer * DefaultTheme::backgroundBitmap = NULL;
|
||||
const BitmapBuffer * DefaultTheme::aboutBackgroundBitmap = NULL;
|
||||
|
||||
DefaultTheme defaultTheme;
|
||||
Theme * theme = &defaultTheme;
|
||||
|
||||
@@ -35,13 +35,29 @@ Zone Topbar::getZone(unsigned int index) const
|
||||
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()
|
||||
{
|
||||
theme->drawTopbarBackground(NULL);
|
||||
|
||||
// USB icon
|
||||
if (usbPlugged()) {
|
||||
lcdDrawBitmapPattern(378, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
|
||||
lcdDrawBitmapPattern(LCD_W-102, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
// RSSI
|
||||
@@ -49,7 +65,7 @@ void drawTopBar()
|
||||
const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31};
|
||||
for (unsigned int i = 0; i < DIM(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();
|
||||
|
||||
@@ -26,27 +26,6 @@ void drawColumnHeader(const char * const * headers, uint8_t 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_pointer.lbm"
|
||||
#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)
|
||||
{
|
||||
int width = getTextWidth(label, 0, attr);
|
||||
int width = getTextWidth(label, 0, 0);
|
||||
int padding = 0;
|
||||
if (attr & (BUTTON_OFF|BUTTON_ON)) {
|
||||
padding = 5;
|
||||
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user