diff --git a/radio/src/gui/horus/bitmapbuffer.cpp b/radio/src/gui/horus/bitmapbuffer.cpp index 66dda5fa7..c2fce4f47 100644 --- a/radio/src/gui/horus/bitmapbuffer.cpp +++ b/radio/src/gui/horus/bitmapbuffer.cpp @@ -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 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; diff --git a/radio/src/gui/horus/lcd.cpp b/radio/src/gui/horus/lcd.cpp index 851e0c5f9..26a3880eb 100644 --- a/radio/src/gui/horus/lcd.cpp +++ b/radio/src/gui/horus/lcd.cpp @@ -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; idrawRect(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); diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/horus/widgets.cpp index 8a3f85da0..2f6ba668a 100644 --- a/radio/src/gui/horus/widgets.cpp +++ b/radio/src/gui/horus/widgets.cpp @@ -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();