[Horus] Shutdown animation in EMERGENCY mode - not tested
This commit is contained in:
@@ -100,6 +100,16 @@ void BitmapBuffer::drawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BitmapBuffer::drawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness, uint8_t pat, LcdFlags att)
|
||||||
|
{
|
||||||
|
for (int i=0; i<thickness; i++) {
|
||||||
|
drawVerticalLine(x+i, y, h, pat, att);
|
||||||
|
drawVerticalLine(x+w-1-i, y, h, pat, att);
|
||||||
|
drawHorizontalLine(x, y+h-1-i, w, pat, att);
|
||||||
|
drawHorizontalLine(x, y+i, w, pat, att);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BitmapBuffer::drawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
void BitmapBuffer::drawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||||
{
|
{
|
||||||
for (coord_t i=y; i<y+h; i++) {
|
for (coord_t i=y; i<y+h; i++) {
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
|
|||||||
drawSolidFilledRect(x, y, 1, h, att);
|
drawSolidFilledRect(x, y, 1, h, att);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness, uint8_t pat, LcdFlags 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 || w==0) return;
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ char getMappedChar(unsigned char c)
|
|||||||
{
|
{
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return 0;
|
return 0;
|
||||||
else if (c < 0xC0)
|
else if (c >= 0x80 && c <= 0x85)
|
||||||
return c - 0x20;
|
return 115 + c - 0x80;
|
||||||
else
|
else
|
||||||
return c - 0xC0 + 96;
|
return c - 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getFontPatternWidth(const uint16_t * spec, int index)
|
int getFontPatternWidth(const uint16_t * spec, int index)
|
||||||
@@ -208,27 +208,6 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness, uint8_t pat, LcdFlags att)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (att & ROUND) {
|
|
||||||
lcdDrawVerticalLine(x, y+1, h-2, pat, att);
|
|
||||||
lcdDrawVerticalLine(x+w-1, y+1, h-2, pat, att);
|
|
||||||
lcdDrawHorizontalLine(x+1, y+h-1, w-2, pat, att);
|
|
||||||
lcdDrawHorizontalLine(x+1, y, w-2, pat, att);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
for (int i=0; i<thickness; i++) {
|
|
||||||
lcdDrawVerticalLine(x+i, y, h, pat, att);
|
|
||||||
lcdDrawVerticalLine(x+w-1-i, y, h, pat, att);
|
|
||||||
lcdDrawHorizontalLine(x, y+h-1-i, w, pat, att);
|
|
||||||
lcdDrawHorizontalLine(x, y+i, w, pat, att);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -211,7 +211,11 @@ inline void lcdDrawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lcdDrawBlackOverlay();
|
void lcdDrawBlackOverlay();
|
||||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness=1, uint8_t pat=SOLID, LcdFlags att=0);
|
inline void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t thickness=1, uint8_t pat=SOLID, LcdFlags att=0)
|
||||||
|
{
|
||||||
|
lcd->drawRect(x, y, w, h, thickness, pat, att);
|
||||||
|
}
|
||||||
|
|
||||||
void lcdDrawCircle(int x0, int y0, int radius);
|
void lcdDrawCircle(int x0, int y0, int radius);
|
||||||
void lcdDrawPie(int x0, int y0, int radius, int angle1=0, int angle2=360);
|
void lcdDrawPie(int x0, int y0, int radius, int angle1=0, int angle2=360);
|
||||||
void lcdDrawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int endAngle);
|
void lcdDrawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int endAngle);
|
||||||
|
|||||||
@@ -401,20 +401,29 @@ void drawShutdownBitmap(uint32_t index)
|
|||||||
static uint32_t last_index = 0xffffffff;
|
static uint32_t last_index = 0xffffffff;
|
||||||
static const BitmapBuffer * shutdown = BitmapBuffer::load(getThemePath("shutdown.bmp"));
|
static const BitmapBuffer * shutdown = BitmapBuffer::load(getThemePath("shutdown.bmp"));
|
||||||
|
|
||||||
if (index < last_index) {
|
if (shutdown) {
|
||||||
theme->drawBackground();
|
if (index < last_index) {
|
||||||
if (shutdown) {
|
theme->drawBackground();
|
||||||
lcd->drawBitmap((LCD_W-shutdown->getWidth())/2, (LCD_H-shutdown->getHeight())/2, shutdown);
|
lcd->drawBitmap((LCD_W-shutdown->getWidth())/2, (LCD_H-shutdown->getHeight())/2, shutdown);
|
||||||
|
lcdStoreBackupBuffer();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lcdRestoreBackupBuffer();
|
||||||
|
int quarter = index / (PWR_PRESS_SHUTDOWN / 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);
|
||||||
|
if (quarter >= 4) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER*3/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||||
}
|
}
|
||||||
lcdStoreBackupBuffer();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lcdRestoreBackupBuffer();
|
lcd->clear();
|
||||||
int quarter = index / (PWR_PRESS_SHUTDOWN / 5);
|
int quarter = index / (PWR_PRESS_SHUTDOWN / 5);
|
||||||
if (quarter >= 1) lcdDrawBitmapPattern(LCD_W/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, 0, SHUTDOWN_CIRCLE_DIAMETER/2);
|
for (int i=1; i<=4; i++) {
|
||||||
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 >= i) {
|
||||||
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);
|
lcd->drawSolidFilledRect(LCD_W / 2 - 70 + 24 * i, LCD_H / 2 - 10, 20, 20, TEXT_BGCOLOR);
|
||||||
if (quarter >= 4) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER*3/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
|
|||||||
Reference in New Issue
Block a user