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(uint8_t format, T * data):
BitmapBufferBase(format, *((uint16_t*)data), *(((uint16_t*)data)+1), data + 2) BitmapBufferBase(format, data[0], data[1], data + 2)
{ {
} }
+22 -28
View File
@@ -25,41 +25,35 @@
const uint8_t __bmp_splash[] { const uint8_t __bmp_splash[] {
#include "bmp_splash.lbm" #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() void drawSplash()
{ {
static bool loadImgFromSD = true; static bool loadImgFromSD = true;
static BitmapBuffer* splashImg = NULL; static BitmapBuffer * splashImg = nullptr;
if (loadImgFromSD && splashImg == NULL) { if (loadImgFromSD && splashImg == nullptr) {
bool sd_mounted = sdMounted(); bool sd_mounted = sdMounted();
if (!sd_mounted) sdInit(); if (!sd_mounted)
splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE); sdInit();
loadImgFromSD = false; splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE);
if (!sd_mounted) sdDone(); loadImgFromSD = false;
} if (!sd_mounted)
sdDone();
}
lcd->clear(); lcd->clear();
if (splashImg) { if (splashImg) {
lcd->drawBitmap((LCD_W - splashImg->getWidth())/2, lcd->drawBitmap((LCD_W - splashImg->getWidth())/2,
(LCD_H - splashImg->getHeight())/2, (LCD_H - splashImg->getHeight())/2,
splashImg); splashImg);
} }
else { else {
// TODO: verify / load / decompress bitmap lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2,
lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2, (LCD_H - BMP_SPLASH.getHeight())/2,
(LCD_H - BMP_SPLASH.getHeight())/2, &BMP_SPLASH);
&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);
} }
#endif
lcdRefresh(); lcdRefresh();
} }
+2 -5
View File
@@ -1506,10 +1506,7 @@ void doMixerCalculations()
s_mixer_first_run_done = true; s_mixer_first_run_done = true;
} }
#define OPENTX_START_ARGS uint8_t splash=true void opentxStart(uint8_t splash=true)
#define OPENTX_START_SPLASH_NEEDED() (splash)
void opentxStart(OPENTX_START_ARGS)
{ {
TRACE("opentxStart"); TRACE("opentxStart");
@@ -1522,7 +1519,7 @@ void opentxStart(OPENTX_START_ARGS)
uint8_t calibration_needed = (g_eeGeneral.chkSum != evalChkSum()); uint8_t calibration_needed = (g_eeGeneral.chkSum != evalChkSum());
#if defined(GUI) #if defined(GUI)
if (!calibration_needed && OPENTX_START_SPLASH_NEEDED()) { if (!calibration_needed && splash) {
doSplash(); doSplash();
} }
#endif #endif