feat(color): Remove splash screen and boot loader background, add version info (#4139)
This commit is contained in:
@@ -17,8 +17,6 @@ set(BITMAP_LZ4_ARGS ${BITMAP_ARGS} --lz4)
|
|||||||
set(MASK_LZ4_ARGS ${MASK_ARGS} --lz4)
|
set(MASK_LZ4_ARGS ${MASK_ARGS} --lz4)
|
||||||
|
|
||||||
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash_logo "${RADIO_SRC_DIR}/bitmaps/480x272/splash_logo.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
|
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash_logo "${RADIO_SRC_DIR}/bitmaps/480x272/splash_logo.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
|
||||||
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash_bg "${RADIO_SRC_DIR}/bitmaps/480x272/splash_bg.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
|
|
||||||
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_splash_bg2 "${RADIO_SRC_DIR}/bitmaps/480x272/splash_bg2.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
|
|
||||||
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
|
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_LZ4_ARGS}")
|
||||||
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_masks "${RADIO_SRC_DIR}/bitmaps/480x272/mask_*.png" 8bits "${MASK_LZ4_ARGS}")
|
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_masks "${RADIO_SRC_DIR}/bitmaps/480x272/mask_*.png" 8bits "${MASK_LZ4_ARGS}")
|
||||||
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_slider_masks "${RADIO_SRC_DIR}/bitmaps/480x272/slider/*.png" 8bits "${MASK_LZ4_ARGS}")
|
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_slider_masks "${RADIO_SRC_DIR}/bitmaps/480x272/slider/*.png" 8bits "${MASK_LZ4_ARGS}")
|
||||||
@@ -33,8 +31,6 @@ add_custom_target(${BITMAP_TARGET_PREFIX}_bitmaps)
|
|||||||
|
|
||||||
add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps
|
add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps
|
||||||
${BITMAP_TARGET_PREFIX}_splash_logo
|
${BITMAP_TARGET_PREFIX}_splash_logo
|
||||||
${BITMAP_TARGET_PREFIX}_splash_bg
|
|
||||||
${BITMAP_TARGET_PREFIX}_splash_bg2
|
|
||||||
${BITMAP_TARGET_PREFIX}_button_bitmaps
|
${BITMAP_TARGET_PREFIX}_button_bitmaps
|
||||||
${BITMAP_TARGET_PREFIX}_masks
|
${BITMAP_TARGET_PREFIX}_masks
|
||||||
${BITMAP_TARGET_PREFIX}_slider_masks
|
${BITMAP_TARGET_PREFIX}_slider_masks
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB |
@@ -19,19 +19,48 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opentx.h"
|
|
||||||
|
|
||||||
#if defined(SPLASH)
|
#if defined(SPLASH)
|
||||||
|
|
||||||
const uint8_t __bmp_splash_bg[] {
|
#include "opentx.h"
|
||||||
#include "splash_bg.lbm"
|
#include "stamp.h"
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t __bmp_splash_logo[] {
|
#if defined(VERSION_TAG)
|
||||||
|
const std::string ver_str = "" VERSION_TAG;
|
||||||
|
const std::string nam_str = "" CODENAME;
|
||||||
|
#if LCD_W > LCD_H
|
||||||
|
#define TXT_Y 204
|
||||||
|
#else
|
||||||
|
#define TXT_Y 404
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
const std::string ver_str = "" VERSION;
|
||||||
|
const std::string nam_str = "" VERSION_SUFFIX;
|
||||||
|
const std::string git_str = "(" GIT_STR ")";
|
||||||
|
#if LCD_W > LCD_H
|
||||||
|
#define TXT_Y 180
|
||||||
|
#else
|
||||||
|
#define TXT_Y 380
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LCD_W > LCD_H
|
||||||
|
#define TXT_X (LCD_W * 4 / 5)
|
||||||
|
#define IMG_X (LCD_W / 3)
|
||||||
|
#define IMG_Y (LCD_H / 2)
|
||||||
|
#else
|
||||||
|
#define TXT_X (LCD_W / 2)
|
||||||
|
#define IMG_X (LCD_W / 2)
|
||||||
|
#define IMG_Y (LCD_H * 2 / 5)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BK_COLOR COLOR2FLAGS(BLACK)
|
||||||
|
#define TXT_COLOR COLOR2FLAGS(RGB(128, 128, 128))
|
||||||
|
|
||||||
|
const uint8_t __bmp_splash_logo[]{
|
||||||
#include "splash_logo.lbm"
|
#include "splash_logo.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
void draw_splash_cb(lv_event_t * e)
|
void draw_splash_cb(lv_event_t* e)
|
||||||
{
|
{
|
||||||
auto draw_ctx = lv_event_get_draw_ctx(e);
|
auto draw_ctx = lv_event_get_draw_ctx(e);
|
||||||
auto splashImg = (BitmapBuffer*)lv_event_get_user_data(e);
|
auto splashImg = (BitmapBuffer*)lv_event_get_user_data(e);
|
||||||
@@ -43,13 +72,13 @@ void draw_splash_cb(lv_event_t * e)
|
|||||||
lv_draw_img_dsc_init(&img_dsc);
|
lv_draw_img_dsc_init(&img_dsc);
|
||||||
|
|
||||||
lv_area_t coords;
|
lv_area_t coords;
|
||||||
coords.x1 = (LCD_W/2) - (splashImg->width()/2);
|
coords.x1 = (LCD_W / 2) - (splashImg->width() / 2);
|
||||||
coords.y1 = (LCD_H/2) - (splashImg->height()/2);
|
coords.y1 = (LCD_H / 2) - (splashImg->height() / 2);
|
||||||
coords.x2 = coords.x1 + splashImg->width()-1;
|
coords.x2 = coords.x1 + splashImg->width() - 1;
|
||||||
coords.y2 = coords.y1 + splashImg->height()-1;
|
coords.y2 = coords.y1 + splashImg->height() - 1;
|
||||||
|
|
||||||
lv_draw_img_decoded(draw_ctx, &img_dsc, &coords,
|
lv_draw_img_decoded(draw_ctx, &img_dsc, &coords,
|
||||||
(const uint8_t *)splashImg->getData(),
|
(const uint8_t*)splashImg->getData(),
|
||||||
LV_IMG_CF_TRUE_COLOR);
|
LV_IMG_CF_TRUE_COLOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,26 +92,29 @@ void drawSplash()
|
|||||||
// try splash from SD card first
|
// try splash from SD card first
|
||||||
if (loadSplashImg && splashImg == nullptr) {
|
if (loadSplashImg && splashImg == nullptr) {
|
||||||
if (!sdMounted()) sdInit();
|
if (!sdMounted()) sdInit();
|
||||||
splashImg = BitmapBuffer::loadBitmap(BITMAPS_PATH "/" SPLASH_FILE, BMP_RGB565);
|
splashImg =
|
||||||
|
BitmapBuffer::loadBitmap(BITMAPS_PATH "/" SPLASH_FILE, BMP_RGB565);
|
||||||
loadSplashImg = false;
|
loadSplashImg = false;
|
||||||
|
|
||||||
if (splashImg == nullptr) {
|
if (splashImg == nullptr) {
|
||||||
splashImg = new BitmapBuffer(BMP_RGB565, LCD_W, LCD_H);
|
splashImg = new BitmapBuffer(BMP_RGB565, LCD_W, LCD_H);
|
||||||
BitmapBuffer* splashBg = new LZ4Bitmap(BMP_ARGB4444, __bmp_splash_bg);
|
splashImg->clear(BK_COLOR);
|
||||||
BitmapBuffer* splashLogo = new LZ4Bitmap(BMP_ARGB4444, __bmp_splash_logo);
|
BitmapBuffer* splashLogo = new LZ4Bitmap(BMP_ARGB4444, __bmp_splash_logo);
|
||||||
for (int i=0; i<LCD_W; i += splashBg->width()) {
|
splashImg->drawBitmap(IMG_X - (splashLogo->width() / 2),
|
||||||
for (int j=0; j<LCD_H; j += splashBg->height()) {
|
IMG_Y - (splashLogo->height() / 2), splashLogo);
|
||||||
splashImg->drawBitmap(i, j, splashBg);
|
splashImg->drawText(TXT_X, TXT_Y, ver_str.c_str(), TXT_COLOR | CENTERED);
|
||||||
}
|
splashImg->drawText(TXT_X, TXT_Y + 24, nam_str.c_str(),
|
||||||
}
|
TXT_COLOR | CENTERED);
|
||||||
splashImg->drawBitmap((LCD_W/2) - (splashLogo->width()/2),
|
#if !defined(VERSION_TAG)
|
||||||
(LCD_H/2) - (splashLogo->height()/2),
|
splashImg->drawText(TXT_X, TXT_Y + 48, git_str.c_str(),
|
||||||
splashLogo);
|
TXT_COLOR | CENTERED);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
splashScreen = window_create(nullptr);
|
splashScreen = window_create(nullptr);
|
||||||
if (splashScreen) {
|
if (splashScreen) {
|
||||||
lv_obj_add_event_cb(splashScreen, draw_splash_cb, LV_EVENT_DRAW_MAIN, splashImg);
|
lv_obj_add_event_cb(splashScreen, draw_splash_cb, LV_EVENT_DRAW_MAIN,
|
||||||
|
splashImg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ const uint8_t __bmp_usb_plugged[] {
|
|||||||
};
|
};
|
||||||
LZ4Bitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged);
|
LZ4Bitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged);
|
||||||
|
|
||||||
const uint8_t __bmp_background[] {
|
|
||||||
#include "bmp_background.lbm"
|
|
||||||
};
|
|
||||||
LZ4Bitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background);
|
|
||||||
|
|
||||||
#define BL_GREEN COLOR2FLAGS(RGB(73, 219, 62))
|
#define BL_GREEN COLOR2FLAGS(RGB(73, 219, 62))
|
||||||
#define BL_RED COLOR2FLAGS(RGB(229, 32, 30))
|
#define BL_RED COLOR2FLAGS(RGB(229, 32, 30))
|
||||||
#define BL_BACKGROUND COLOR2FLAGS(BLACK)
|
#define BL_BACKGROUND COLOR2FLAGS(BLACK)
|
||||||
@@ -71,28 +66,7 @@ static void bootloaderDrawFooter()
|
|||||||
|
|
||||||
static void bootloaderDrawBackground()
|
static void bootloaderDrawBackground()
|
||||||
{
|
{
|
||||||
// we have plenty of memory, let's cache that background
|
lcd->clear(BL_BACKGROUND);
|
||||||
static BitmapBuffer* _background = nullptr;
|
|
||||||
|
|
||||||
if (!_background) {
|
|
||||||
_background = new BitmapBuffer(BMP_RGB565, LCD_W, LCD_H);
|
|
||||||
|
|
||||||
for (int i=0; i<LCD_W; i += BMP_BACKGROUND.width()) {
|
|
||||||
for (int j=0; j<LCD_H; j += BMP_BACKGROUND.height()) {
|
|
||||||
BitmapBuffer* bg_bmp = &BMP_BACKGROUND;
|
|
||||||
_background->drawBitmap(i, j, bg_bmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_background) {
|
|
||||||
lcd->drawBitmap(0, 0, _background);
|
|
||||||
lcd->drawFilledRect(0, 0, LCD_W, LCD_H, SOLID,
|
|
||||||
COLOR2FLAGS(BLACK), OPACITY(4));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lcd->clear(BL_BACKGROUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
|
void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#define USB_SW_TO_INTERNAL_MODULE() GPIO_SetBits(USB_SW_GPOIO, USB_SW_PIN);
|
#define USB_SW_TO_INTERNAL_MODULE() GPIO_SetBits(USB_SW_GPOIO, USB_SW_PIN);
|
||||||
#define USB_SW_TO_MCU() GPIO_ResetBits(USB_SW_GPOIO, USB_SW_PIN);
|
#define USB_SW_TO_MCU() GPIO_ResetBits(USB_SW_GPOIO, USB_SW_PIN);
|
||||||
|
|
||||||
#define SELECTED_COLOR (INVERS | COLOR_THEME_SECONDARY1)
|
|
||||||
#define DEFAULT_PADDING 28
|
#define DEFAULT_PADDING 28
|
||||||
#define DOUBLE_PADDING 56
|
#define DOUBLE_PADDING 56
|
||||||
#define MESSAGE_TOP (LCD_H - (2*DOUBLE_PADDING))
|
#define MESSAGE_TOP (LCD_H - (2*DOUBLE_PADDING))
|
||||||
@@ -50,11 +49,6 @@ const uint8_t __bmp_usb_plugged[] {
|
|||||||
};
|
};
|
||||||
LZ4Bitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged);
|
LZ4Bitmap BMP_USB_PLUGGED(BMP_ARGB4444, __bmp_usb_plugged);
|
||||||
|
|
||||||
const uint8_t __bmp_background[] {
|
|
||||||
#include "bmp_background.lbm"
|
|
||||||
};
|
|
||||||
LZ4Bitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background);
|
|
||||||
|
|
||||||
#define BL_GREEN COLOR2FLAGS(RGB(73, 219, 62))
|
#define BL_GREEN COLOR2FLAGS(RGB(73, 219, 62))
|
||||||
#define BL_RED COLOR2FLAGS(RGB(229, 32, 30))
|
#define BL_RED COLOR2FLAGS(RGB(229, 32, 30))
|
||||||
#define BL_BACKGROUND COLOR2FLAGS(BLACK)
|
#define BL_BACKGROUND COLOR2FLAGS(BLACK)
|
||||||
@@ -86,28 +80,7 @@ static void bootloaderDrawFooter()
|
|||||||
|
|
||||||
static void bootloaderDrawBackground()
|
static void bootloaderDrawBackground()
|
||||||
{
|
{
|
||||||
// we have plenty of memory, let's cache that background
|
lcd->clear(BL_BACKGROUND);
|
||||||
static BitmapBuffer* _background = nullptr;
|
|
||||||
|
|
||||||
if (!_background) {
|
|
||||||
_background = new BitmapBuffer(BMP_RGB565, LCD_W, LCD_H);
|
|
||||||
|
|
||||||
for (int i=0; i<LCD_W; i += BMP_BACKGROUND.width()) {
|
|
||||||
for (int j=0; j<LCD_H; j += BMP_BACKGROUND.height()) {
|
|
||||||
BitmapBuffer* bg_bmp = &BMP_BACKGROUND;
|
|
||||||
_background->drawBitmap(i, j, bg_bmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_background) {
|
|
||||||
lcd->drawBitmap(0, 0, _background);
|
|
||||||
lcd->drawFilledRect(0, 0, LCD_W, LCD_H, SOLID,
|
|
||||||
COLOR2FLAGS(BLACK), OPACITY(4));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lcd->clear(BL_BACKGROUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
|
void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
|
||||||
|
|||||||
Reference in New Issue
Block a user