Startup / shutdown refactoring
This commit is contained in:
@@ -5,6 +5,7 @@ set(GUI_SRC
|
||||
fonts.cpp
|
||||
popups.cpp
|
||||
widgets.cpp
|
||||
startup_shutdown.cpp
|
||||
menu_model.cpp
|
||||
model_select.cpp
|
||||
model_setup.cpp
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "gui_common.h"
|
||||
#include "menus.h"
|
||||
#include "popups.h"
|
||||
#include "common/stdlcd/draw_functions.h"
|
||||
|
||||
#define MENUS_SCROLLBAR_WIDTH 0
|
||||
|
||||
@@ -192,7 +193,6 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e
|
||||
#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);
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
|
||||
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0);
|
||||
void editGVarValue(coord_t x, coord_t y, event_t event, uint8_t gvar, uint8_t flightMode, LcdFlags flags);
|
||||
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
|
||||
|
||||
@@ -122,9 +122,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 drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att);
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att = 0);
|
||||
#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);
|
||||
@@ -141,14 +139,6 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
|
||||
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att);
|
||||
|
||||
void drawRtcTime(coord_t x, coord_t y, LcdFlags att);
|
||||
void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att, LcdFlags att2);
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags=0);
|
||||
inline void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att)
|
||||
{
|
||||
drawTimer(x, y, tme, att, att);
|
||||
}
|
||||
|
||||
#define SOLID 0xff
|
||||
#define DOTTED 0x55
|
||||
|
||||
@@ -209,8 +199,6 @@ inline display_t getPixel(uint8_t x, uint8_t y)
|
||||
|
||||
const char * writeScreenshot();
|
||||
|
||||
void drawShutdownAnimation(uint32_t index, const char * message);
|
||||
|
||||
uint8_t getTextWidth(const char * s, uint8_t len=0, LcdFlags flags=0);
|
||||
|
||||
#endif // _LCD_H_
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#define PWR_PRESS_DURATION_MIN 100 // 1s
|
||||
#define PWR_PRESS_DURATION_MAX 500 // 5s
|
||||
|
||||
#define SLEEP_BITMAP_WIDTH 60
|
||||
#define SLEEP_BITMAP_HEIGHT 60
|
||||
|
||||
const unsigned char bmp_sleep[] = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
||||
void drawStartupAnimation(uint32_t duration)
|
||||
{
|
||||
uint8_t index = limit<uint8_t>(0, duration / (PWR_PRESS_DURATION_MIN / 4), 3);
|
||||
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
if (index >= i) {
|
||||
lcdDrawFilledRect(LCD_W / 2 - 18 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0);
|
||||
}
|
||||
}
|
||||
|
||||
lcdRefresh();
|
||||
lcdRefreshWait();
|
||||
}
|
||||
|
||||
void drawShutdownAnimation(uint32_t duration, const char * message)
|
||||
{
|
||||
uint8_t index = limit<uint8_t>(0, duration / (PWR_PRESS_SHUTDOWN_DELAY / 5), 4);
|
||||
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
if (3 - index >= i) {
|
||||
lcdDrawFilledRect(LCD_W / 2 - 18 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0);
|
||||
}
|
||||
}
|
||||
if (message) {
|
||||
lcdDrawText((LCD_W - getTextWidth(message)) / 2, LCD_H-2*FH, message);
|
||||
}
|
||||
|
||||
lcdRefresh();
|
||||
lcdRefreshWait();
|
||||
}
|
||||
|
||||
void drawSleepBitmap()
|
||||
{
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
|
||||
lcdDraw1bitBitmap((LCD_W - SLEEP_BITMAP_WIDTH) / 2, (LCD_H - SLEEP_BITMAP_HEIGHT) / 2, bmp_sleep, 0);
|
||||
|
||||
lcdRefresh();
|
||||
lcdRefreshWait();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,15 +65,15 @@ void menuStatisticsView(event_t event)
|
||||
|
||||
// Session and Total timers
|
||||
lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer);
|
||||
lcdDrawText(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0);
|
||||
|
||||
// Throttle special timers
|
||||
lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr);
|
||||
lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16);
|
||||
|
||||
// Timers
|
||||
for (int i=0; i<TIMERS; i++) {
|
||||
@@ -81,7 +81,7 @@ void menuStatisticsView(event_t event)
|
||||
if (timersStates[i].val > 3600)
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0);
|
||||
else
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0);
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val);
|
||||
}
|
||||
|
||||
#if defined(THRTRACE)
|
||||
|
||||
@@ -235,17 +235,3 @@ void drawStatusLine()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const unsigned char SLEEP_BITMAP[] = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
||||
#define SLEEP_BITMAP_WIDTH 60
|
||||
#define SLEEP_BITMAP_HEIGHT 60
|
||||
|
||||
void drawSleepBitmap()
|
||||
{
|
||||
lcdClear();
|
||||
lcdDraw1bitBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, SLEEP_BITMAP, 0);
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ set(GUI_SRC
|
||||
fonts.cpp
|
||||
popups.cpp
|
||||
widgets.cpp
|
||||
startup_shutdown.cpp
|
||||
menu_model.cpp
|
||||
model_select.cpp
|
||||
model_setup.cpp
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "lcd.h"
|
||||
#include "menus.h"
|
||||
#include "popups.h"
|
||||
#include "common/stdlcd/draw_functions.h"
|
||||
|
||||
#define HEADER_LINE 0
|
||||
#define HEADER_LINE_COLUMNS
|
||||
@@ -215,7 +216,6 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e
|
||||
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
|
||||
|
||||
#if defined(GVARS)
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
|
||||
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);
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) editGVarFieldValue(x, y, v, min, max, lcdattr, editflags, event)
|
||||
@@ -226,9 +226,6 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e
|
||||
#define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
|
||||
#endif
|
||||
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att = 0);
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags=0);
|
||||
|
||||
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event);
|
||||
|
||||
extern uint8_t s_curveChan;
|
||||
|
||||
@@ -117,7 +117,6 @@ 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 drawStringWithIndex(coord_t x, coord_t y, const char *str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(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);
|
||||
@@ -132,13 +131,6 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
|
||||
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att);
|
||||
|
||||
void drawRtcTime(coord_t x, coord_t y, LcdFlags att);
|
||||
void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att, LcdFlags att2);
|
||||
inline void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att)
|
||||
{
|
||||
drawTimer(x, y, tme, att, att);
|
||||
}
|
||||
|
||||
#define SOLID 0xff
|
||||
#define DOTTED 0x55
|
||||
|
||||
@@ -163,8 +155,6 @@ inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0)
|
||||
void lcdInvertLine(int8_t line);
|
||||
#define lcdInvertLastLine() lcdInvertLine(LCD_LINES-1)
|
||||
|
||||
void drawShutdownAnimation(uint32_t index, const char * message);
|
||||
void drawSleepBitmap();
|
||||
void drawTelemetryTopBar();
|
||||
|
||||
#define V_BAR(xx, yy, ll) \
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#define PWR_PRESS_DURATION_MIN 100 // 1s
|
||||
#define PWR_PRESS_DURATION_MAX 500 // 5s
|
||||
|
||||
#define ANIMATIONS_BITMAP_WIDTH 60
|
||||
#define ANIMATIONS_BITMAP_HEIGHT 60
|
||||
|
||||
const unsigned char bmp_startup[] = {
|
||||
#include "startup.lbm"
|
||||
};
|
||||
|
||||
const unsigned char bmp_lock[] = {
|
||||
#include "lock.lbm"
|
||||
};
|
||||
|
||||
const unsigned char bmp_shutdown[] = {
|
||||
#include "shutdown.lbm"
|
||||
};
|
||||
|
||||
const unsigned char bmp_sleep[] = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
||||
void drawStartupAnimation(uint32_t duration)
|
||||
{
|
||||
uint8_t index = limit<uint8_t>(0, duration / (PWR_PRESS_DURATION_MIN / 5), 4);
|
||||
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
|
||||
if (index == 0)
|
||||
lcdDrawBitmap((LCD_W - ANIMATIONS_BITMAP_WIDTH) / 2, (LCD_H - ANIMATIONS_BITMAP_HEIGHT) / 2, bmp_lock, 0, ANIMATIONS_BITMAP_WIDTH);
|
||||
else
|
||||
lcdDrawBitmap((LCD_W - ANIMATIONS_BITMAP_WIDTH) / 2, (LCD_H - ANIMATIONS_BITMAP_HEIGHT) / 2, bmp_startup, (index - 1) * ANIMATIONS_BITMAP_WIDTH, ANIMATIONS_BITMAP_WIDTH);
|
||||
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
void drawShutdownAnimation(uint32_t duration, const char * message)
|
||||
{
|
||||
uint8_t index = limit<uint8_t>(0, duration / (PWR_PRESS_SHUTDOWN_DELAY / 4), 3);
|
||||
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
|
||||
lcdDrawBitmap((LCD_W - ANIMATIONS_BITMAP_WIDTH) / 2, (LCD_H - ANIMATIONS_BITMAP_HEIGHT) / 2, bmp_shutdown, (3 - index) * ANIMATIONS_BITMAP_WIDTH, ANIMATIONS_BITMAP_WIDTH);
|
||||
if (message) {
|
||||
lcdDrawText((LCD_W - getTextWidth(message)) / 2, LCD_H - 2*FH, message);
|
||||
}
|
||||
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
void drawSleepBitmap()
|
||||
{
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
lcdDrawBitmap((LCD_W - ANIMATIONS_BITMAP_WIDTH) / 2, (LCD_H - ANIMATIONS_BITMAP_HEIGHT) / 2, bmp_sleep, 0);
|
||||
lcdRefresh();
|
||||
lcdRefreshWait();
|
||||
}
|
||||
@@ -59,15 +59,15 @@ void menuStatisticsView(event_t event)
|
||||
|
||||
// Session and Total timers
|
||||
lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer);
|
||||
lcdDrawText(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0);
|
||||
|
||||
// Throttle special timers
|
||||
lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr);
|
||||
lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0);
|
||||
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16);
|
||||
|
||||
// Timers
|
||||
for (int i=0; i<TIMERS; i++) {
|
||||
@@ -75,7 +75,7 @@ void menuStatisticsView(event_t event)
|
||||
if (timersStates[i].val > 3600)
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0);
|
||||
else
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0);
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val);
|
||||
}
|
||||
|
||||
#if defined(THRTRACE)
|
||||
|
||||
@@ -20,19 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const unsigned char SLEEP_BITMAP[] = {
|
||||
#include "../../bitmaps/212x64/sleep.lbm"
|
||||
};
|
||||
|
||||
#define SLEEP_BITMAP_WIDTH 60
|
||||
#define SLEEP_BITMAP_HEIGHT 60
|
||||
void drawSleepBitmap()
|
||||
{
|
||||
lcdClear();
|
||||
lcdDrawBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, SLEEP_BITMAP, 0, SLEEP_BITMAP_WIDTH);
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval)
|
||||
{
|
||||
#define BOX_CENTERY (LCD_H-BOX_WIDTH/2-10)
|
||||
|
||||
@@ -142,12 +142,8 @@ 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 flags=0, uint8_t len=0, const char * prefix=NULL, const char * suffix=NULL);
|
||||
|
||||
#if !defined(BOOT)
|
||||
|
||||
#define putstime_t int32_t
|
||||
|
||||
void drawRtcTime(coord_t x, coord_t y, LcdFlags att=0);
|
||||
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags=0);
|
||||
void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att=0);
|
||||
|
||||
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||
@@ -159,7 +155,6 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
|
||||
|
||||
#define putsChn(x, y, idx, att) drawSource(x, y, MIXSRC_CH1+idx-1, att)
|
||||
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
|
||||
|
||||
#endif // !BOOT
|
||||
|
||||
#define SOLID 0xff
|
||||
|
||||
@@ -391,20 +391,20 @@ void drawSleepBitmap()
|
||||
}
|
||||
|
||||
#define SHUTDOWN_CIRCLE_DIAMETER 150
|
||||
void drawShutdownAnimation(uint32_t index, const char * message)
|
||||
void drawShutdownAnimation(uint32_t duration, const char * message)
|
||||
{
|
||||
static uint32_t last_index = 0xffffffff;
|
||||
static uint32_t lastDuration = 0xffffffff;
|
||||
static const BitmapBuffer * shutdown = BitmapBuffer::load(getThemePath("shutdown.bmp"));
|
||||
|
||||
if (shutdown) {
|
||||
if (index < last_index) {
|
||||
if (duration < lastDuration) {
|
||||
theme->drawBackground();
|
||||
lcd->drawBitmap((LCD_W-shutdown->getWidth())/2, (LCD_H-shutdown->getHeight())/2, shutdown);
|
||||
lcdStoreBackupBuffer();
|
||||
}
|
||||
else {
|
||||
lcdRestoreBackupBuffer();
|
||||
int quarter = index / (PWR_PRESS_SHUTDOWN_DELAY / 5);
|
||||
int quarter = duration / (PWR_PRESS_SHUTDOWN_DELAY / 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);
|
||||
@@ -413,7 +413,7 @@ void drawShutdownAnimation(uint32_t index, const char * message)
|
||||
}
|
||||
else {
|
||||
lcd->clear();
|
||||
int quarter = index / (PWR_PRESS_SHUTDOWN_DELAY / 5);
|
||||
int quarter = duration / (PWR_PRESS_SHUTDOWN_DELAY / 5);
|
||||
for (int i=1; i<=4; i++) {
|
||||
if (quarter >= i) {
|
||||
lcd->drawSolidFilledRect(LCD_W / 2 - 70 + 24 * i, LCD_H / 2 - 10, 20, 20, TEXT_BGCOLOR);
|
||||
@@ -422,5 +422,5 @@ void drawShutdownAnimation(uint32_t index, const char * message)
|
||||
}
|
||||
|
||||
lcdRefresh();
|
||||
last_index = index;
|
||||
lastDuration = duration;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#define OPTION_MENU_TITLE_BAR 0x02
|
||||
#define OPTION_MENU_NO_SCROLLBAR 0x04
|
||||
|
||||
#define OPTION_SLIDER_INVERS INVERS
|
||||
#define OPTION_SLIDER_BLINK BLINK
|
||||
#define OPTION_SLIDER_VERTICAL 0x04
|
||||
#define OPTION_SLIDER_EMPTY_BAR 0x08
|
||||
#define OPTION_SLIDER_DBL_COLOR 0x10
|
||||
@@ -68,10 +66,10 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
|
||||
#endif
|
||||
|
||||
// Screen templates
|
||||
void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons=NULL, uint32_t options=0);
|
||||
void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons=nullptr, uint32_t options=0);
|
||||
void drawSplash();
|
||||
void drawSleepBitmap();
|
||||
void drawShutdownAnimation(uint32_t index, const char * message);
|
||||
void drawShutdownAnimation(uint32_t duration, const char * message);
|
||||
|
||||
// Main view standard widgets
|
||||
void drawTopBar();
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 _COMMON_DRAW_FUNCTIONS_H_
|
||||
#define _COMMON_DRAW_FUNCTIONS_H_
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags att=0);
|
||||
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att = 0);
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags=0);
|
||||
|
||||
void drawRtcTime(coord_t x, coord_t y, LcdFlags att);
|
||||
void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att, LcdFlags att2);
|
||||
inline void drawTimer(coord_t x, coord_t y, int32_t tme, LcdFlags att = 0)
|
||||
{
|
||||
drawTimer(x, y, tme, att, att);
|
||||
}
|
||||
|
||||
void drawStartupAnimation(uint32_t duration);
|
||||
void drawShutdownAnimation(uint32_t duration, const char * message);
|
||||
void drawSleepBitmap();
|
||||
|
||||
#endif // _COMMON_DRAW_FUNCTIONS_H_
|
||||
@@ -233,20 +233,3 @@ void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverI
|
||||
lcdDrawText(x, y, "External", flags);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
void drawShutdownAnimation(uint32_t index, const char * message)
|
||||
{
|
||||
lcdClear();
|
||||
int quarter = index / (PWR_PRESS_SHUTDOWN_DELAY / 5);
|
||||
for (int i=1; i<=4; i++) {
|
||||
if (4 - quarter >= i) {
|
||||
lcdDrawFilledRect(LCD_W / 2 - 28 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0);
|
||||
}
|
||||
}
|
||||
if (message) {
|
||||
lcdDrawText((LCD_W - getTextWidth(message)) / 2, LCD_H-2*FH, message);
|
||||
}
|
||||
lcdRefresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user