Use theme colours on shutdown screen
Uses COLOR_THEME_PRIMARY2 and COLOR_THEME_SECONDARY1 (i.e. the topbar icon and background colours) unless default theme.
This commit is contained in:
committed by
Peter Feerick
parent
765750b34b
commit
d3f35e8334
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
#include "theme_manager.h"
|
||||||
|
|
||||||
coord_t drawStringWithIndex(BitmapBuffer * dc, coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix, const char * suffix)
|
coord_t drawStringWithIndex(BitmapBuffer * dc, coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix, const char * suffix)
|
||||||
{
|
{
|
||||||
@@ -79,13 +80,24 @@ void drawValueOrGVar(BitmapBuffer* dc, coord_t x, coord_t y, gvar_t value,
|
|||||||
|
|
||||||
void drawSleepBitmap()
|
void drawSleepBitmap()
|
||||||
{
|
{
|
||||||
|
LcdFlags fgColor;
|
||||||
|
LcdFlags bgColor;
|
||||||
|
|
||||||
|
if (ThemePersistance::instance()->isDefaultTheme()) {
|
||||||
|
fgColor = COLOR2FLAGS(WHITE);
|
||||||
|
bgColor = COLOR2FLAGS(BLACK);
|
||||||
|
} else {
|
||||||
|
fgColor = COLOR_THEME_PRIMARY2;
|
||||||
|
bgColor = COLOR_THEME_SECONDARY1;
|
||||||
|
}
|
||||||
|
|
||||||
lcd->reset();
|
lcd->reset();
|
||||||
lcd->clear();
|
lcd->clear(bgColor);
|
||||||
|
|
||||||
const BitmapBuffer* bitmap = OpenTxTheme::instance()->shutdown;
|
const BitmapBuffer* bitmap = OpenTxTheme::instance()->shutdown;
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
lcd->drawMask((LCD_W-bitmap->width())/2, (LCD_H-bitmap->height())/2,
|
lcd->drawMask((LCD_W - bitmap->width()) / 2, (LCD_H - bitmap->height()) / 2,
|
||||||
bitmap, COLOR2FLAGS(WHITE));
|
bitmap, fgColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
@@ -96,46 +108,53 @@ void drawSleepBitmap()
|
|||||||
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
||||||
const char* message)
|
const char* message)
|
||||||
{
|
{
|
||||||
if (totalDuration == 0)
|
if (totalDuration == 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
static const BitmapBuffer * shutdown = OpenTxTheme::instance()->shutdown;
|
LcdFlags fgColor;
|
||||||
|
LcdFlags bgColor;
|
||||||
|
|
||||||
|
if (ThemePersistance::instance()->isDefaultTheme()) {
|
||||||
|
fgColor = COLOR2FLAGS(WHITE);
|
||||||
|
bgColor = COLOR2FLAGS(BLACK);
|
||||||
|
} else {
|
||||||
|
fgColor = COLOR_THEME_PRIMARY2;
|
||||||
|
bgColor = COLOR_THEME_SECONDARY1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const BitmapBuffer* shutdown = OpenTxTheme::instance()->shutdown;
|
||||||
|
|
||||||
lcd->reset();
|
lcd->reset();
|
||||||
lcd->clear(COLOR2FLAGS(BLACK));
|
lcd->clear(bgColor);
|
||||||
|
|
||||||
if (shutdown) {
|
if (shutdown) {
|
||||||
lcd->drawMask((LCD_W - shutdown->width()) / 2,
|
lcd->drawMask((LCD_W - shutdown->width()) / 2,
|
||||||
(LCD_H - shutdown->height()) / 2, shutdown,
|
(LCD_H - shutdown->height()) / 2, shutdown, fgColor);
|
||||||
COLOR2FLAGS(WHITE));
|
|
||||||
|
|
||||||
int quarter = duration / (totalDuration / 5);
|
int quarter = duration / (totalDuration / 5);
|
||||||
if (quarter >= 1)
|
if (quarter >= 1)
|
||||||
lcd->drawBitmapPattern(LCD_W / 2, (LCD_H - SHUTDOWN_CIRCLE_DIAMETER) / 2,
|
lcd->drawBitmapPattern(LCD_W / 2, (LCD_H - SHUTDOWN_CIRCLE_DIAMETER) / 2,
|
||||||
LBM_SHUTDOWN_CIRCLE, COLOR2FLAGS(WHITE), 0,
|
LBM_SHUTDOWN_CIRCLE, fgColor, 0,
|
||||||
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
||||||
if (quarter >= 2)
|
if (quarter >= 2)
|
||||||
lcd->drawBitmapPattern(LCD_W / 2, LCD_H / 2, LBM_SHUTDOWN_CIRCLE,
|
lcd->drawBitmapPattern(LCD_W / 2, LCD_H / 2, LBM_SHUTDOWN_CIRCLE, fgColor,
|
||||||
COLOR2FLAGS(WHITE), SHUTDOWN_CIRCLE_DIAMETER / 2,
|
SHUTDOWN_CIRCLE_DIAMETER / 2,
|
||||||
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
||||||
if (quarter >= 3)
|
if (quarter >= 3)
|
||||||
lcd->drawBitmapPattern((LCD_W - SHUTDOWN_CIRCLE_DIAMETER) / 2, LCD_H / 2,
|
lcd->drawBitmapPattern((LCD_W - SHUTDOWN_CIRCLE_DIAMETER) / 2, LCD_H / 2,
|
||||||
LBM_SHUTDOWN_CIRCLE, COLOR2FLAGS(WHITE),
|
LBM_SHUTDOWN_CIRCLE, fgColor,
|
||||||
SHUTDOWN_CIRCLE_DIAMETER,
|
SHUTDOWN_CIRCLE_DIAMETER,
|
||||||
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
||||||
if (quarter >= 4)
|
if (quarter >= 4)
|
||||||
lcd->drawBitmapPattern((LCD_W - SHUTDOWN_CIRCLE_DIAMETER) / 2,
|
lcd->drawBitmapPattern(
|
||||||
(LCD_H - SHUTDOWN_CIRCLE_DIAMETER) / 2,
|
(LCD_W - SHUTDOWN_CIRCLE_DIAMETER) / 2,
|
||||||
LBM_SHUTDOWN_CIRCLE, COLOR2FLAGS(WHITE),
|
(LCD_H - SHUTDOWN_CIRCLE_DIAMETER) / 2, LBM_SHUTDOWN_CIRCLE, fgColor,
|
||||||
SHUTDOWN_CIRCLE_DIAMETER * 3 / 2,
|
SHUTDOWN_CIRCLE_DIAMETER * 3 / 2, SHUTDOWN_CIRCLE_DIAMETER / 2);
|
||||||
SHUTDOWN_CIRCLE_DIAMETER / 2);
|
|
||||||
} else {
|
} else {
|
||||||
//lcd->clear();
|
|
||||||
int quarter = duration / (totalDuration / 5);
|
int quarter = duration / (totalDuration / 5);
|
||||||
for (int i = 1; i <= 4; i++) {
|
for (int i = 1; i <= 4; i++) {
|
||||||
if (quarter >= i) {
|
if (quarter >= i) {
|
||||||
lcd->drawSolidFilledRect(LCD_W / 2 - 70 + 24 * i, LCD_H / 2 - 10, 20,
|
lcd->drawSolidFilledRect(LCD_W / 2 - 70 + 24 * i, LCD_H / 2 - 10, 20,
|
||||||
20, COLOR2FLAGS(WHITE));
|
20, fgColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user