feat(color): Show custom image during shutdown if present
If `IMAGES\shutdown.png` is present, a custom shutdown image will be displayed while powering off the radio
This commit is contained in:
@@ -129,6 +129,7 @@ const int8_t bmp_shutdown_yo[] = {
|
|||||||
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
||||||
const char* message)
|
const char* message)
|
||||||
{
|
{
|
||||||
|
static BitmapBuffer* shutdownSplashImg = nullptr;
|
||||||
if (totalDuration == 0) return;
|
if (totalDuration == 0) return;
|
||||||
|
|
||||||
LcdFlags fgColor;
|
LcdFlags fgColor;
|
||||||
@@ -150,12 +151,22 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
|||||||
int quarter = duration / (totalDuration / 5);
|
int quarter = duration / (totalDuration / 5);
|
||||||
|
|
||||||
if (shutdown) {
|
if (shutdown) {
|
||||||
lcd->drawMask((LCD_W - shutdown->width()) / 2,
|
if (!sdMounted()) sdInit();
|
||||||
(LCD_H - shutdown->height()) / 2, shutdown, fgColor);
|
shutdownSplashImg = BitmapBuffer::loadBitmap(
|
||||||
|
BITMAPS_PATH "/" SHUTDOWN_SPLASH_FILE, BMP_RGB565);
|
||||||
|
|
||||||
for (int i = 0; i <= 3 - quarter; i += 1) {
|
if (shutdownSplashImg) {
|
||||||
lcd->drawBitmapPattern(LCD_W / 2 + bmp_shutdown_xo[i], LCD_H / 2 + bmp_shutdown_yo[i],
|
lcd->drawBitmap(0, 0, shutdownSplashImg);
|
||||||
LBM_SHUTDOWN_CIRCLE, fgColor, i * SHUTDOWN_CIRCLE_RADIUS, SHUTDOWN_CIRCLE_RADIUS);
|
} else {
|
||||||
|
lcd->drawMask((LCD_W - shutdown->width()) / 2,
|
||||||
|
(LCD_H - shutdown->height()) / 2, shutdown, fgColor);
|
||||||
|
|
||||||
|
for (int i = 0; i <= 3 - quarter; i += 1) {
|
||||||
|
lcd->drawBitmapPattern(
|
||||||
|
LCD_W / 2 + bmp_shutdown_xo[i], LCD_H / 2 + bmp_shutdown_yo[i],
|
||||||
|
LBM_SHUTDOWN_CIRCLE, fgColor, i * SHUTDOWN_CIRCLE_RADIUS,
|
||||||
|
SHUTDOWN_CIRCLE_RADIUS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 1; i <= 4; i++) {
|
for (int i = 1; i <= 4; i++) {
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ const char RADIO_SETTINGS_ERRORFILE_YAML_PATH[] = RADIO_PATH PATH_SEPARATOR "rad
|
|||||||
const char YAMLFILE_CHECKSUM_TAG_NAME[] = "checksum";
|
const char YAMLFILE_CHECKSUM_TAG_NAME[] = "checksum";
|
||||||
#endif
|
#endif
|
||||||
#define SPLASH_FILE "splash.png"
|
#define SPLASH_FILE "splash.png"
|
||||||
|
#define SHUTDOWN_SPLASH_FILE "shutdown.png"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MODELS_EXT ".bin"
|
#define MODELS_EXT ".bin"
|
||||||
|
|||||||
Reference in New Issue
Block a user