Replaced some literal constants with defines

Replaced calculation to centre bitmap with fixed values.
Saved 20 bytes.
This commit is contained in:
AnHardt 2015-02-03 09:52:29 +01:00
parent 3602474c25
commit c20606b8d7
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,8 @@
// BitMap for splashscreen // BitMap for splashscreen
// Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php // Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php
// Please note that using the high-res version takes about 0.5KB of // Please note that using the high-res version takes 402Bytes of PROGMEM.
//#define START_BMPHIGH
#ifdef START_BMPHIGH #ifdef START_BMPHIGH
#define START_BMPWIDTH 112 #define START_BMPWIDTH 112
#define START_BMPHEIGHT 38 #define START_BMPHEIGHT 38

View File

@ -109,9 +109,13 @@ static void lcd_implementation_init()
// Show splashscreen // Show splashscreen
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
int offy = (u8g.getHeight() - 18 - START_BMPHEIGHT) / 2; #ifdef START_BMPHIGH
int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*6) / 2; // 6 is fontwidth in pixel int offy = 0;
int txtY = u8g.getHeight() - 10; #else
int offy = DOG_CHAR_HEIGHT;
#endif
int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*DOG_CHAR_WIDTH) / 2;
int txtY = u8g.getHeight() - DOG_CHAR_HEIGHT;
u8g.firstPage(); u8g.firstPage();
do { do {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);