[Horus] Main view added
This commit is contained in:
+2
-2
@@ -1833,8 +1833,8 @@ translations/se.h: translations/se.h.txt
|
||||
|
||||
ifeq ($(PCB), $(filter $(PCB), HORUS))
|
||||
FONTNAME = DejaVu\ Sans
|
||||
TINSIZE = 5
|
||||
SMLSIZE = 7
|
||||
TINSIZE = 9
|
||||
SMLSIZE = 13
|
||||
STDSIZE = 16
|
||||
MIDSIZE = 16
|
||||
DBLSIZE = 20
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 526 B |
Binary file not shown.
|
Before Width: | Height: | Size: 158 B |
Binary file not shown.
|
Before Width: | Height: | Size: 440 B |
@@ -40,8 +40,8 @@
|
||||
* Header bitmaps
|
||||
*/
|
||||
|
||||
const uint8_t LBM_TOP_POLYGON[] = {
|
||||
#include "../../bitmaps/Horus/mask_top_polygon.lbm"
|
||||
const uint8_t LBM_TOPMENU_POLYGON[] = {
|
||||
#include "../../bitmaps/Horus/mask_topmenu_polygon.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_DOT[] = {
|
||||
@@ -60,11 +60,31 @@ const uint8_t LBM_CURRENT_DOT[] = {
|
||||
#include "../../bitmaps/Horus/mask_current_dot.lbm"
|
||||
};
|
||||
|
||||
/*
|
||||
* Main view bitmaps
|
||||
*/
|
||||
|
||||
const uint8_t LBM_TOPMENU_OPENTX[] = {
|
||||
#include "../../bitmaps/Horus/mask_topmenu_opentx.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_HTRIM_FRAME[] = {
|
||||
#include "../../bitmaps/Horus/mask_htrim_frame.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_VTRIM_FRAME[] = {
|
||||
#include "../../bitmaps/Horus/mask_vtrim_frame.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_TRIM_SHADOW[] = {
|
||||
#include "../../bitmaps/Horus/mask_trim_shadow.lbm"
|
||||
};
|
||||
|
||||
/*
|
||||
* Radio menu bitmaps
|
||||
*/
|
||||
|
||||
const uint8_t LBM_MENU_RADIO[] = {
|
||||
const uint8_t LBM_RADIO_ICON[] = {
|
||||
#include "../../bitmaps/Horus/mask_menu_radio.lbm"
|
||||
};
|
||||
|
||||
@@ -93,7 +113,7 @@ const uint8_t LBM_VERSION_ICON[] = {
|
||||
};
|
||||
|
||||
const uint8_t * const LBM_RADIO_ICONS[] = {
|
||||
LBM_MENU_RADIO,
|
||||
LBM_RADIO_ICON,
|
||||
LBM_RADIO_SETUP_ICON,
|
||||
LBM_SD_BROWSER_ICON,
|
||||
LBM_GLOBAL_FUNCTIONS_ICON,
|
||||
@@ -106,7 +126,7 @@ const uint8_t * const LBM_RADIO_ICONS[] = {
|
||||
* Model menu bitmaps
|
||||
*/
|
||||
|
||||
const uint8_t LBM_MENU_MODEL[] = {
|
||||
const uint8_t LBM_MODEL_ICON[] = {
|
||||
#include "../../bitmaps/Horus/mask_menu_model.lbm"
|
||||
};
|
||||
|
||||
@@ -159,7 +179,7 @@ const uint8_t LBM_TELEMETRY_ICON[] = {
|
||||
};
|
||||
|
||||
const uint8_t * const LBM_MODEL_ICONS[] = {
|
||||
LBM_MENU_MODEL,
|
||||
LBM_MODEL_ICON,
|
||||
LBM_MODEL_SETUP_ICON,
|
||||
CASE_HELI(LBM_HELI_ICON)
|
||||
CASE_FLIGHT_MODES(LBM_FLIGHT_MODES_ICON)
|
||||
|
||||
@@ -75,12 +75,20 @@ void displayProgressBar(const char *label);
|
||||
void updateProgressBar(int num, int den);
|
||||
|
||||
// Header bitmaps
|
||||
extern const uint8_t LBM_TOP_POLYGON[];
|
||||
extern const uint8_t LBM_TOPMENU_POLYGON[];
|
||||
extern const uint8_t LBM_DOT[];
|
||||
extern const uint8_t LBM_CURRENT_BG[];
|
||||
extern const uint8_t LBM_CURRENT_SHADOW[];
|
||||
extern const uint8_t LBM_CURRENT_DOT[];
|
||||
|
||||
// Main view icons
|
||||
extern const uint8_t LBM_TOPMENU_OPENTX[];
|
||||
extern const uint8_t LBM_HTRIM_FRAME[];
|
||||
extern const uint8_t LBM_VTRIM_FRAME[];
|
||||
extern const uint8_t LBM_TRIM_SHADOW[];
|
||||
extern const uint8_t LBM_RADIO_ICON[];
|
||||
extern const uint8_t LBM_MODEL_ICON[];
|
||||
|
||||
// Menu icons
|
||||
extern const uint8_t * const LBM_RADIO_ICONS[];
|
||||
extern const uint8_t * const LBM_MODEL_ICONS[];
|
||||
|
||||
+17
-16
@@ -428,38 +428,39 @@ void putsRtcTime(coord_t x, coord_t y, LcdFlags att)
|
||||
putsTimer(x, y, getValue(MIXSRC_TX_TIME), att);
|
||||
}
|
||||
|
||||
void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att)
|
||||
void getTimerString(char * str, putstime_t tme, LcdFlags att)
|
||||
{
|
||||
div_t qr;
|
||||
|
||||
char str[10]; // "-00:00:00"
|
||||
char *s = str;
|
||||
|
||||
att &= ~LEFT;
|
||||
|
||||
if (tme < 0) {
|
||||
// TODO lcd_putcAtt(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
|
||||
tme = -tme;
|
||||
*s++ = '-';
|
||||
*str++ = '-';
|
||||
}
|
||||
|
||||
qr = div(tme, 60);
|
||||
|
||||
if (att & TIMEHOUR) {
|
||||
div_t qr2 = div(qr.quot, 60);
|
||||
*s++ = '0' + (qr2.quot/10);
|
||||
*s++ = '0' + (qr2.quot%10);
|
||||
*s++ = ':';
|
||||
*str++ = '0' + (qr2.quot/10);
|
||||
*str++ = '0' + (qr2.quot%10);
|
||||
*str++ = ':';
|
||||
qr.quot = qr2.rem;
|
||||
}
|
||||
|
||||
*s++ = '0' + (qr.quot/10);
|
||||
*s++ = '0' + (qr.quot%10);
|
||||
*s++ = ':';
|
||||
*s++ = '0' + (qr.rem/10);
|
||||
*s++ = '0' + (qr.rem%10);
|
||||
*s = '\0';
|
||||
*str++ = '0' + (qr.quot/10);
|
||||
*str++ = '0' + (qr.quot%10);
|
||||
*str++ = ':';
|
||||
*str++ = '0' + (qr.rem/10);
|
||||
*str++ = '0' + (qr.rem%10);
|
||||
*str = '\0';
|
||||
}
|
||||
|
||||
void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att)
|
||||
{
|
||||
char str[10]; // "-00:00:00"
|
||||
getTimerString(str, tme, att);
|
||||
att &= ~LEFT;
|
||||
lcd_putsAtt(x, y, str, att);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
|
||||
|
||||
#define putstime_t int32_t
|
||||
|
||||
void getTimerString(char * str, putstime_t tme, LcdFlags att=0);
|
||||
void putsRtcTime(coord_t x, coord_t y, LcdFlags att=0);
|
||||
void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
|
||||
|
||||
|
||||
@@ -42,11 +42,14 @@
|
||||
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
||||
#define BITMAP_X ((LCD_W-64)/2)
|
||||
#define BITMAP_Y (LCD_H/2)
|
||||
#define TRIM_LH_X (32+9)
|
||||
#define TRIM_LV_X 10
|
||||
#define TRIM_RV_X (LCD_W-11)
|
||||
#define TRIM_RH_X (LCD_W-32-9)
|
||||
#define TRIM_LEN 27
|
||||
|
||||
#define TRIM_LH_X 90
|
||||
#define TRIM_LV_X 24
|
||||
#define TRIM_RV_X (LCD_W-35)
|
||||
#define TRIM_RH_X (LCD_W-95)
|
||||
#define TRIM_V_Y 135
|
||||
#define TRIM_H_Y 235
|
||||
#define TRIM_LEN 80
|
||||
|
||||
void drawPotsBars()
|
||||
{
|
||||
@@ -74,72 +77,117 @@ void doMainScreenGraphics()
|
||||
drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert);
|
||||
}
|
||||
|
||||
void displayTrims(uint8_t phase)
|
||||
void drawTrimSquare(coord_t x, coord_t y)
|
||||
{
|
||||
lcdDrawFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TEXT_COLOR);
|
||||
}
|
||||
|
||||
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawVerticalLine(xm, ym, 9, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawHorizontalLine(xm-1, ym, 3, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
void drawHorizontalStick(coord_t x, int val)
|
||||
{
|
||||
for (int i=0; i<=160; i+=4) {
|
||||
if (i==0 || i==80 || i==160)
|
||||
lcdDrawVerticalLine(x+i, 250, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawVerticalLine(x+i, 252, 9, TEXT_COLOR);
|
||||
}
|
||||
drawHorizontalTrimPosition(x+TRIM_LEN+val*TRIM_LEN/RESX-4, TRIM_H_Y+16, val);
|
||||
}
|
||||
|
||||
void drawVerticalStick(coord_t x, int val)
|
||||
{
|
||||
for (int i=0; i<=160; i+=4) {
|
||||
if (i==0 || i==80 || i==160)
|
||||
lcdDrawHorizontalLine(x, 56+i, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawHorizontalLine(x+2, 56+i, 9, TEXT_COLOR);
|
||||
}
|
||||
drawVerticalTrimPosition(x, TRIM_V_Y+val*TRIM_LEN/RESX-6, val);
|
||||
}
|
||||
|
||||
void drawSticks()
|
||||
{
|
||||
drawVerticalStick(6, calibratedStick[1]);
|
||||
drawHorizontalStick(TRIM_LH_X-TRIM_LEN+1, calibratedStick[0]);
|
||||
drawVerticalStick(LCD_W-18, calibratedStick[2]);
|
||||
drawHorizontalStick(TRIM_RH_X-TRIM_LEN+1, calibratedStick[3]);
|
||||
}
|
||||
|
||||
void displayTrims(uint8_t flightMode)
|
||||
{
|
||||
g_model.displayTrims = DISPLAY_TRIMS_ALWAYS;
|
||||
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
static coord_t x[4] = {TRIM_LH_X, TRIM_LV_X, TRIM_RV_X, TRIM_RH_X};
|
||||
static uint8_t vert[4] = {0,1,1,0};
|
||||
coord_t xm, ym;
|
||||
xm = x[CONVERT_MODE(i)];
|
||||
static uint8_t vert[4] = {0, 1, 1, 0};
|
||||
unsigned int stickIndex = CONVERT_MODE(i);
|
||||
coord_t xm = x[stickIndex];
|
||||
|
||||
uint8_t att = ROUND;
|
||||
int16_t val = getTrimValue(phase, i);
|
||||
|
||||
int16_t dir = val;
|
||||
int32_t trim = getTrimValue(flightMode, i);
|
||||
int32_t val = trim * TRIM_LEN / 125;
|
||||
bool exttrim = false;
|
||||
if (val < -125 || val > 125) {
|
||||
if (val < -(TRIM_LEN+1)) {
|
||||
val = -(TRIM_LEN+1);
|
||||
exttrim = true;
|
||||
}
|
||||
else if (val > (TRIM_LEN+1)) {
|
||||
val = TRIM_LEN+1;
|
||||
exttrim = true;
|
||||
}
|
||||
|
||||
if (val < -(TRIM_LEN+1)*4) {
|
||||
val = -(TRIM_LEN+1);
|
||||
}
|
||||
else if (val > (TRIM_LEN+1)*4) {
|
||||
val = TRIM_LEN+1;
|
||||
}
|
||||
else {
|
||||
val /= 4;
|
||||
}
|
||||
|
||||
if (vert[i]) {
|
||||
ym = 31;
|
||||
lcd_vline(xm, ym-TRIM_LEN, TRIM_LEN*2);
|
||||
coord_t ym = TRIM_V_Y;
|
||||
lcdDrawBitmapPattern(xm, ym-TRIM_LEN, LBM_VTRIM_FRAME, TEXT_COLOR);
|
||||
if (i!=2 || !g_model.thrTrim) {
|
||||
lcd_vline(xm-1, ym-1, 3);
|
||||
lcd_vline(xm+1, ym-1, 3);
|
||||
// TODO
|
||||
}
|
||||
ym -= val;
|
||||
|
||||
// TODO lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att);
|
||||
if (dir >= 0) {
|
||||
lcd_hline(xm-1, ym-1, 3);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcd_hline(xm-1, ym+1, 3);
|
||||
}
|
||||
if (exttrim) {
|
||||
lcd_hline(xm-1, ym, 3);
|
||||
drawVerticalTrimPosition(xm-1, ym-6, val);
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
// TODO lcd_outdezAtt(trim>0 ? 100 : 200, xm-2, trim, TINSIZE|VERTICAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ym = 60;
|
||||
lcd_hline(xm-TRIM_LEN, ym, TRIM_LEN*2);
|
||||
lcd_hline(xm-1, ym-1, 3);
|
||||
lcd_hline(xm-1, ym+1, 3);
|
||||
coord_t ym = TRIM_H_Y;
|
||||
lcdDrawBitmapPattern(xm-TRIM_LEN, ym, LBM_HTRIM_FRAME, TEXT_COLOR);
|
||||
xm += val;
|
||||
|
||||
// TODO lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att);
|
||||
if (dir >= 0) {
|
||||
lcd_vline(xm+1, ym-1, 3);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcd_vline(xm-1, ym-1, 3);
|
||||
}
|
||||
if (exttrim) {
|
||||
lcd_vline(xm, ym-1, 3);
|
||||
drawHorizontalTrimPosition(xm-3, ym-2, val);
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcd_outdezAtt((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+2, trim, TINSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
lcdDrawSquare(xm-3, ym-3, 7, att);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,6 +335,11 @@ const uint16_t LBM_MAINVIEW_FLAT[] = {
|
||||
#include "../../bitmaps/Horus/mainview_flat.lbm"
|
||||
};
|
||||
|
||||
const uint16_t LBM_CORSAIR[] = {
|
||||
#include "../../bitmaps/Horus/corsair.lbm"
|
||||
};
|
||||
|
||||
|
||||
void menuMainView(evt_t event)
|
||||
{
|
||||
// clear the screen
|
||||
@@ -340,7 +393,32 @@ void menuMainView(evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
lcdDrawBitmap(0, 0, LBM_MAINVIEW_FLAT);
|
||||
// lcdDrawBitmap(0, 0, LBM_MAINVIEW_FLAT);
|
||||
|
||||
// Header
|
||||
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
|
||||
lcdDrawTopmenuDatetime();
|
||||
|
||||
// Flight Mode Name
|
||||
int mode = mixerCurrentFlightMode;
|
||||
lcd_putsnAtt(212, 237, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|SMLSIZE);
|
||||
|
||||
// Sticks
|
||||
drawSticks();
|
||||
|
||||
// Trims
|
||||
displayTrims(mode);
|
||||
|
||||
// Model bitmap
|
||||
lcdDrawBitmap(256, 104, LBM_CORSAIR);
|
||||
|
||||
// Model name
|
||||
lcdDrawBitmapPattern(256, 62, LBM_MODEL_ICON, MENU_TITLE_COLOR);
|
||||
lcd_putsAtt(293, 68, "MyPlane Name", SMLSIZE);
|
||||
lcdDrawHorizontalLine(287, 85, 140, TITLE_BGCOLOR);
|
||||
|
||||
|
||||
#if 0
|
||||
displayMainViewIndex();
|
||||
|
||||
@@ -49,6 +49,27 @@ void displayColumnHeader(const char * const *headers, uint8_t index)
|
||||
// TODO ? displayHeader(headers[index]);
|
||||
}
|
||||
|
||||
const char * 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_LEFT(s) (LCD_W+DATETIME_SEPARATOR_X+8-getTextWidth(s, SMLSIZE))/2
|
||||
|
||||
void lcdDrawTopmenuDatetime()
|
||||
{
|
||||
lcdDrawVerticalLine(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]);
|
||||
lcd_putsAtt(DATETIME_LEFT(str), DATETIME_LINE1, str, SMLSIZE|TEXT_INVERTED_COLOR);
|
||||
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME));
|
||||
lcd_putsAtt(DATETIME_LEFT(str), DATETIME_LINE2, str, SMLSIZE|TEXT_INVERTED_COLOR);
|
||||
}
|
||||
|
||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval)
|
||||
{
|
||||
#define BOX_CENTERY (220 - FH - BOX_WIDTH/2)
|
||||
@@ -122,7 +143,7 @@ void drawMenuTemplate(const char * name, evt_t event)
|
||||
lcdDrawFilledRect(0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT, TEXT_BGCOLOR);
|
||||
lcdDrawFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOP_POLYGON, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
||||
|
||||
if (m_posVert < 0) {
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR);
|
||||
@@ -145,6 +166,8 @@ void drawMenuTemplate(const char * name, evt_t event)
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
lcdDrawTopmenuDatetime();
|
||||
|
||||
if (name) {
|
||||
// must be done at the end so that we can write something at the right of the menu title
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+2, name, MENU_TITLE_COLOR);
|
||||
|
||||
Reference in New Issue
Block a user