Cosmetics

This commit is contained in:
Bertrand Songis
2018-08-05 15:47:53 +02:00
parent f226cde6fe
commit 4f741dfad2
3 changed files with 27 additions and 36 deletions
+1 -1
View File
@@ -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)
{
}
+24 -30
View File
@@ -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
+2 -5
View File
@@ -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