Skip to content

Commit

Permalink
Improves the custom bootscreen logo feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrazio committed Jul 17, 2016
1 parent 1f3283e commit fa4274c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 99 deletions.
16 changes: 16 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@
#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1
#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2

//
// *** VENDORS PLEASE READ *****************************************************
//
// Marlin now allow you to have a vendor boot image to be displayed on machine
// start. When SHOW_CUSTOM_BOOTSCREEN is defined Marlin will first show your
// custom boot image and them the default Marlin boot image is shown.
//
// We suggest for you to take advantage of this new feature and keep the Marlin
// boot image unmodified. For an example have a look at the bq Hephestos 2
// example configuration folder.
//
//#define SHOW_CUSTOM_BOOTSCREEN
#if ENABLED(SHOW_BOOTSCREEN) && ENABLED(SHOW_CUSTOM_BOOTSCREEN)
#include "_Bootscreen.h"
#endif

// @section machine

// SERIAL_PORT selects which serial port should be used for communication with the host.
Expand Down
77 changes: 0 additions & 77 deletions Marlin/dogm_custom_bitmaps.h

This file was deleted.

38 changes: 17 additions & 21 deletions Marlin/dogm_lcd_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@

#include <U8glib.h>
#include "dogm_bitmaps.h"
#include "dogm_custom_bitmaps.h"


#include "ultralcd.h"
#include "ultralcd_st7920_u8glib_rrd.h"
Expand Down Expand Up @@ -220,10 +218,6 @@ char lcd_printPGM(const char* str) {
return n;
}

#if ENABLED(SHOW_BOOTSCREEN)
static bool show_bootscreen = true;
#endif

/* Warning: This function is called from interrupt context */
static void lcd_implementation_init() {

Expand All @@ -241,11 +235,6 @@ static void lcd_implementation_init() {
u8g.setContrast(lcd_contrast);
#endif

// FIXME: remove this workaround
// Uncomment this if you have the first generation (V1.10) of STBs board
// pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH);

#if ENABLED(LCD_SCREEN_ROT_90)
u8g.setRot90(); // Rotate screen by 90°
#elif ENABLED(LCD_SCREEN_ROT_180)
Expand All @@ -255,16 +244,23 @@ static void lcd_implementation_init() {
#endif

#if ENABLED(SHOW_BOOTSCREEN)
#if ENABLED(CUSTOM_START_BMP)
static bool show_bootscreen = true;

#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
if (show_bootscreen) {
u8g.firstPage();
do {
u8g.drawBitmapP((128-(CUSTOM_START_BMPWIDTH))/2, (64 - (CUSTOM_START_BMPHEIGHT))/2, CUSTOM_START_BMPBYTEWIDTH, CUSTOM_START_BMPHEIGHT, custom_start_bmp);
u8g.drawBitmapP(
(128 - (CUSTOM_BOOTSCREEN_BMPWIDTH)) /2,
( 64 - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) /2,
CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp);
} while (u8g.nextPage());
delay(CUSTOM_START_BMP_DELAY);
safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
}
#endif
#endif // SHOW_CUSTOM_BOOTSCREEN

int offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;

#if ENABLED(START_BMPHIGH)
int offy = 0;
#else
Expand All @@ -273,9 +269,9 @@ static void lcd_implementation_init() {

int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;

u8g.firstPage();
do {
if (show_bootscreen) {
if (show_bootscreen) {
u8g.firstPage();
do {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
Expand All @@ -285,12 +281,12 @@ static void lcd_implementation_init() {
u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
#endif
}
} while (u8g.nextPage());
} while (u8g.nextPage());
}

show_bootscreen = false;

#endif
#endif // SHOW_BOOTSCREEN
}

void lcd_kill_screen() {
Expand Down
4 changes: 3 additions & 1 deletion Marlin/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))

#define NOOP do{}while(0)
#define NOOP do{} while(0)

#define CEILING(x,y) (((x) + (y) - 1) / (y))

#endif //__MACROS_H

0 comments on commit fa4274c

Please sign in to comment.