[Horus] Shutdown animation now OK
This commit is contained in:
@@ -49,7 +49,7 @@ const uint8_t LBM_CURRENT_DOT[] = {
|
||||
*/
|
||||
|
||||
const uint8_t LBM_MAINVIEW_BACKGROUND[] = {
|
||||
#include "background.lbm"
|
||||
#include "bmp_background.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_TOPMENU_OPENTX[] = {
|
||||
@@ -233,7 +233,7 @@ const uint8_t LBM_STAR1[] __DMA = {
|
||||
*/
|
||||
|
||||
const uint8_t LBM_ASTERISK[] __DMA = {
|
||||
#include "asterisk.lbm"
|
||||
#include "bmp_asterisk.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_POINT[] __DMA = {
|
||||
@@ -253,13 +253,13 @@ const uint8_t LBM_CURVE_COORD_SHADOW[] __DMA = {
|
||||
};
|
||||
|
||||
const uint8_t LBM_SHUTDOWN[] __DMA = {
|
||||
#include "shutdown.lbm"
|
||||
#include "alpha_shutdown.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SLEEP[] __DMA = {
|
||||
#include "sleep.lbm"
|
||||
#include "bmp_sleep.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_BIGRSCALE[] __DMA = {
|
||||
#include "mask_bigrscale.lbm"
|
||||
const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = {
|
||||
#include "mask_shutdown_circle.lbm"
|
||||
};
|
||||
|
||||
@@ -134,4 +134,4 @@ extern const uint8_t LBM_CURVE_POINT_CENTER[];
|
||||
extern const uint8_t LBM_CURVE_COORD_SHADOW[];
|
||||
extern const uint8_t LBM_SHUTDOWN[];
|
||||
extern const uint8_t LBM_SLEEP[];
|
||||
extern const uint8_t LBM_BIGRSCALE[];
|
||||
extern const uint8_t LBM_SHUTDOWN_CIRCLE[];
|
||||
|
||||
+29
-10
@@ -93,7 +93,7 @@ void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags fl
|
||||
display_t * p = PIXEL_PTR(x, y+row);
|
||||
const uint8_t * q = img + 4 + row*w + offset;
|
||||
for (coord_t col=0; col<width; col++) {
|
||||
lcdDrawTransparentPixel(p, *q, color);
|
||||
lcdDrawAlphaPixel(p, *q, color);
|
||||
p++; q++;
|
||||
}
|
||||
}
|
||||
@@ -798,7 +798,7 @@ void lcdSetContrast()
|
||||
lcdSetRefVolt(g_eeGeneral.contrast);
|
||||
}
|
||||
|
||||
void lcdDrawTransparentPixel(display_t * p, uint8_t opacity, uint16_t color)
|
||||
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color)
|
||||
{
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
|
||||
@@ -836,14 +836,14 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
|
||||
|
||||
if (pat == SOLID) {
|
||||
while (w--) {
|
||||
lcdDrawTransparentPixel(p, opacity, color);
|
||||
lcdDrawAlphaPixel(p, opacity, color);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (w--) {
|
||||
if (pat & 1) {
|
||||
lcdDrawTransparentPixel(p, opacity, color);
|
||||
lcdDrawAlphaPixel(p, opacity, color);
|
||||
pat = (pat >> 1) | 0x80;
|
||||
}
|
||||
else {
|
||||
@@ -867,7 +867,7 @@ void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags
|
||||
|
||||
if (pat == SOLID) {
|
||||
while (h--) {
|
||||
lcdDrawTransparentPixel(x, y, opacity, color);
|
||||
lcdDrawAlphaPixel(x, y, opacity, color);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
@@ -877,7 +877,7 @@ void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags
|
||||
}
|
||||
while (h--) {
|
||||
if (pat & 1) {
|
||||
lcdDrawTransparentPixel(x, y, opacity, color);
|
||||
lcdDrawAlphaPixel(x, y, opacity, color);
|
||||
pat = (pat >> 1) | 0x80;
|
||||
}
|
||||
else {
|
||||
@@ -896,6 +896,25 @@ inline void lcdDrawBitmapDMA(coord_t x, coord_t y, coord_t width, coord_t height
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDrawAlphaBitmap(coord_t x, coord_t y, const uint8_t * bmp)
|
||||
{
|
||||
int width = getBitmapWidth(bmp);
|
||||
int height = getBitmapHeight(bmp);
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (coord_t line=0; line<height; line++) {
|
||||
display_t * p = &displayBuf[(y+line)*LCD_W + x];
|
||||
const uint8_t * q = bmp + 4 + line*width*3;
|
||||
for (coord_t col=0; col<width; col++) {
|
||||
lcdDrawAlphaPixel(p, q[2]>>4, *((uint16_t *)q));
|
||||
p++; q+=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t height, int scale)
|
||||
{
|
||||
int width = getBitmapWidth(bmp);
|
||||
@@ -1095,16 +1114,16 @@ void lcdDrawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t * img, LcdFla
|
||||
for (int x=w2-1; x>=0; x--) {
|
||||
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
|
||||
if (slope >= slopes[0] && slope < slopes[1]) {
|
||||
lcdDrawTransparentPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
|
||||
lcdDrawAlphaPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
|
||||
}
|
||||
if (-slope >= slopes[0] && -slope < slopes[1]) {
|
||||
lcdDrawTransparentPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
|
||||
lcdDrawAlphaPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
|
||||
}
|
||||
if (slope >= slopes[2] && slope < slopes[3]) {
|
||||
lcdDrawTransparentPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
|
||||
lcdDrawAlphaPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
|
||||
}
|
||||
if (-slope >= slopes[2] && -slope < slopes[3]) {
|
||||
lcdDrawTransparentPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
|
||||
lcdDrawAlphaPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,16 +223,16 @@ inline void lcdDrawPixel(coord_t x, coord_t y, display_t value)
|
||||
lcdDrawPixel(p, value);
|
||||
}
|
||||
|
||||
void lcdDrawTransparentPixel(display_t * p, uint8_t opacity, uint16_t color);
|
||||
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color);
|
||||
void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
|
||||
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
|
||||
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
|
||||
inline void lcdDrawTransparentPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
|
||||
inline void lcdDrawAlphaPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
|
||||
{
|
||||
display_t * p = PIXEL_PTR(x, y);
|
||||
lcdDrawTransparentPixel(p, opacity, color);
|
||||
lcdDrawAlphaPixel(p, opacity, color);
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
@@ -305,6 +305,7 @@ int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight);
|
||||
int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0);
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t height=0, int scale=0);
|
||||
void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0);
|
||||
void lcdDrawAlphaBitmap(coord_t x, coord_t y, const uint8_t * bmp);
|
||||
|
||||
#define lcdSetRefVolt(...)
|
||||
void lcdSetContrast();
|
||||
@@ -314,7 +315,7 @@ const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint
|
||||
const char * imgLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||
|
||||
void drawSleepBitmap();
|
||||
void drawShutdownBitmap(uint8_t index);
|
||||
void drawShutdownBitmap(uint32_t index);
|
||||
|
||||
#if defined(BOOT)
|
||||
#define BLINK_ON_PHASE (0)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "../../opentx.h"
|
||||
|
||||
const uint8_t LBM_SPLASH[] __DMA = {
|
||||
#include "splash.lbm"
|
||||
#include "bmp_splash.lbm"
|
||||
};
|
||||
|
||||
#if defined(SPLASH)
|
||||
|
||||
@@ -324,8 +324,8 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SLEEP_BITMAP_WIDTH 110
|
||||
#define SLEEP_BITMAP_HEIGHT 110
|
||||
#define SLEEP_BITMAP_WIDTH 150
|
||||
#define SLEEP_BITMAP_HEIGHT 150
|
||||
void drawSleepBitmap()
|
||||
{
|
||||
lcdClear();
|
||||
@@ -335,10 +335,25 @@ void drawSleepBitmap()
|
||||
|
||||
#define SHUTDOWN_BITMAP_WIDTH 110
|
||||
#define SHUTDOWN_BITMAP_HEIGHT 110
|
||||
void drawShutdownBitmap(uint8_t index)
|
||||
#define SHUTDOWN_CIRCLE_DIAMETER 150
|
||||
void drawShutdownBitmap(uint32_t index)
|
||||
{
|
||||
// lcdClear();
|
||||
lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, LBM_SHUTDOWN, index*SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH);
|
||||
lcdDrawBitmapPatternPie((LCD_W-150)/2, (LCD_H-150)/2, LBM_BIGRSCALE, TEXT_COLOR, 0, 360/4*index);
|
||||
static uint32_t last_index = UINT32_MAX;
|
||||
|
||||
if (index < last_index) {
|
||||
lcdDrawBlackOverlay();
|
||||
lcdDrawAlphaBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, LBM_SHUTDOWN);
|
||||
lcdStoreBackupBuffer();
|
||||
}
|
||||
else {
|
||||
lcdRestoreBackupBuffer();
|
||||
index /= (PWR_PRESS_SHUTDOWN / 5);
|
||||
if (index >= 1) lcdDrawBitmapPattern(LCD_W/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, 0, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (index >= 2) lcdDrawBitmapPattern(LCD_W/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER/2, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (index >= 3) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER, SHUTDOWN_CIRCLE_DIAMETER/2);
|
||||
if (index >= 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();
|
||||
last_index = index;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ 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 drawShutdownBitmap(uint8_t index);
|
||||
void drawShutdownBitmap(uint32_t index);
|
||||
void drawSleepBitmap();
|
||||
void lcdDrawTelemetryTopBar();
|
||||
|
||||
|
||||
@@ -39,8 +39,10 @@ const pm_uchar bmp_shutdown[] PROGMEM = {
|
||||
|
||||
#define SHUTDOWN_BITMAP_WIDTH 60
|
||||
#define SHUTDOWN_BITMAP_HEIGHT 60
|
||||
void drawShutdownBitmap(uint8_t index)
|
||||
void drawShutdownBitmap(uint32_t index)
|
||||
{
|
||||
index /= (PWR_PRESS_SHUTDOWN / 4);
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, bmp_shutdown, index * SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH);
|
||||
lcdRefresh();
|
||||
|
||||
Reference in New Issue
Block a user