[Horus] Shutdown animation in EMERGENCY mode - not tested

This commit is contained in:
Bertrand Songis
2016-05-06 10:23:32 +02:00
parent cd9c17e1f4
commit e2247623a2
5 changed files with 38 additions and 34 deletions
+10
View File
@@ -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)
{
for (coord_t i=y; i<y+h; i++) {
+2
View File
@@ -153,6 +153,8 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
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)
{
if (h==0 || w==0) return;
+3 -24
View File
@@ -37,10 +37,10 @@ char getMappedChar(unsigned char c)
{
if (c == 0)
return 0;
else if (c < 0xC0)
return c - 0x20;
else if (c >= 0x80 && c <= 0x85)
return 115 + c - 0x80;
else
return c - 0xC0 + 96;
return c - 0x20;
}
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
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)
{
putsTimer(x, y, getValue(MIXSRC_TX_TIME), att);
+5 -1
View File
@@ -211,7 +211,11 @@ inline void lcdDrawFilledRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_
}
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 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);
+18 -9
View File
@@ -401,20 +401,29 @@ void drawShutdownBitmap(uint32_t index)
static uint32_t last_index = 0xffffffff;
static const BitmapBuffer * shutdown = BitmapBuffer::load(getThemePath("shutdown.bmp"));
if (index < last_index) {
theme->drawBackground();
if (shutdown) {
if (shutdown) {
if (index < last_index) {
theme->drawBackground();
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 {
lcdRestoreBackupBuffer();
lcd->clear();
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);
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);
}
}
}
lcdRefresh();