diff --git a/radio/src/gui/480x272/bitmapbuffer.h b/radio/src/gui/480x272/bitmapbuffer.h index 84dc6654c..760215198 100644 --- a/radio/src/gui/480x272/bitmapbuffer.h +++ b/radio/src/gui/480x272/bitmapbuffer.h @@ -61,7 +61,7 @@ class BitmapBufferBase } BitmapBufferBase(uint8_t format, T * data): - BitmapBufferBase(format, *((uint16_t*)data), *(((uint16_t*)data)+1), data + 2) + BitmapBufferBase(format, data[0], data[1], data + 2) { } diff --git a/radio/src/gui/480x272/splash.cpp b/radio/src/gui/480x272/splash.cpp index 64c45efb1..3ed3bf3d1 100644 --- a/radio/src/gui/480x272/splash.cpp +++ b/radio/src/gui/480x272/splash.cpp @@ -25,42 +25,36 @@ const uint8_t __bmp_splash[] { #include "bmp_splash.lbm" }; -Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t*)__bmp_splash); +Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t *)__bmp_splash); void drawSplash() { - static bool loadImgFromSD = true; - static BitmapBuffer* splashImg = NULL; + static bool loadImgFromSD = true; + static BitmapBuffer * splashImg = nullptr; - if (loadImgFromSD && splashImg == NULL) { - bool sd_mounted = sdMounted(); - if (!sd_mounted) sdInit(); - splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE); - loadImgFromSD = false; - if (!sd_mounted) sdDone(); - } - - lcd->clear(); - - if (splashImg) { - lcd->drawBitmap((LCD_W - splashImg->getWidth())/2, - (LCD_H - splashImg->getHeight())/2, - splashImg); - } - else { - // TODO: verify / load / decompress bitmap - lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2, - (LCD_H - BMP_SPLASH.getHeight())/2, - &BMP_SPLASH); - } - -#if MENUS_LOCK == 1 - if (readonly == false) { - lcdDrawSolidFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID|ROUND); - lcdDrawText((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 , 53, STR_UNLOCKED); + if (loadImgFromSD && splashImg == nullptr) { + bool sd_mounted = sdMounted(); + if (!sd_mounted) + sdInit(); + splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE); + loadImgFromSD = false; + if (!sd_mounted) + sdDone(); } -#endif + lcd->clear(); + + if (splashImg) { + lcd->drawBitmap((LCD_W - splashImg->getWidth())/2, + (LCD_H - splashImg->getHeight())/2, + splashImg); + } + else { + lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2, + (LCD_H - BMP_SPLASH.getHeight())/2, + &BMP_SPLASH); + } + lcdRefresh(); } #endif diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 7edc96c9e..e46ad96fe 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1506,10 +1506,7 @@ void doMixerCalculations() s_mixer_first_run_done = true; } -#define OPENTX_START_ARGS uint8_t splash=true -#define OPENTX_START_SPLASH_NEEDED() (splash) - -void opentxStart(OPENTX_START_ARGS) +void opentxStart(uint8_t splash=true) { TRACE("opentxStart"); @@ -1522,7 +1519,7 @@ void opentxStart(OPENTX_START_ARGS) uint8_t calibration_needed = (g_eeGeneral.chkSum != evalChkSum()); #if defined(GUI) - if (!calibration_needed && OPENTX_START_SPLASH_NEEDED()) { + if (!calibration_needed && splash) { doSplash(); } #endif