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:
Risto
2023-09-23 18:46:50 +10:00
committed by GitHub
parent bf9d811c02
commit 870fe7eca3
2 changed files with 17 additions and 5 deletions
+16 -5
View File
@@ -129,6 +129,7 @@ const int8_t bmp_shutdown_yo[] = {
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
const char* message)
{
static BitmapBuffer* shutdownSplashImg = nullptr;
if (totalDuration == 0) return;
LcdFlags fgColor;
@@ -150,12 +151,22 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
int quarter = duration / (totalDuration / 5);
if (shutdown) {
lcd->drawMask((LCD_W - shutdown->width()) / 2,
(LCD_H - shutdown->height()) / 2, shutdown, fgColor);
if (!sdMounted()) sdInit();
shutdownSplashImg = BitmapBuffer::loadBitmap(
BITMAPS_PATH "/" SHUTDOWN_SPLASH_FILE, BMP_RGB565);
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);
if (shutdownSplashImg) {
lcd->drawBitmap(0, 0, shutdownSplashImg);
} 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 {
for (int i = 1; i <= 4; i++) {
+1
View File
@@ -78,6 +78,7 @@ const char RADIO_SETTINGS_ERRORFILE_YAML_PATH[] = RADIO_PATH PATH_SEPARATOR "rad
const char YAMLFILE_CHECKSUM_TAG_NAME[] = "checksum";
#endif
#define SPLASH_FILE "splash.png"
#define SHUTDOWN_SPLASH_FILE "shutdown.png"
#endif
#define MODELS_EXT ".bin"