Skip to content

Commit

Permalink
Invariant Marlin bootscreen (#15057)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Aug 28, 2019
1 parent b2a4b6f commit 3ac76f0
Show file tree
Hide file tree
Showing 127 changed files with 785 additions and 1,065 deletions.
11 changes: 3 additions & 8 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@

// @section info

// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
#define SHOW_BOOTSCREEN

This comment has been minimized.

Copy link
@tpruvot

tpruvot Aug 29, 2019

Contributor

I think #define SHOW_BOOTSCREEN should stay here, no ?

#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 ***
Expand All @@ -89,10 +84,10 @@
* respectfully request that you retain the unmodified Marlin boot screen.
*/

// Enable to show the bitmap in Marlin/_Bootscreen.h on startup.
// Show the bitmap in Marlin/_Bootscreen.h on startup.
//#define SHOW_CUSTOM_BOOTSCREEN

// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen.
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE

// @section machine
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@
#error "MKS_ROBIN_TFT is now FSMC_GRAPHICAL_TFT. Please update your configuration."
#elif defined(SDPOWER)
#error "SDPOWER is now SDPOWER_PIN. Please update your configuration and/or pins."
#elif defined(STRING_SPLASH_LINE1) || defined(STRING_SPLASH_LINE2)
#error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
#endif

#define BOARD_MKS_13 -1109
Expand Down
77 changes: 24 additions & 53 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,59 +449,28 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
}

#ifdef STRING_SPLASH_LINE1
//
// Show the Marlin logo with splash line 1
//
if (LCD_EXTRA_SPACE >= utf8_strlen(STRING_SPLASH_LINE1) + 1) {
//
// Show the Marlin logo, splash line1, and splash line 2
//
logo_lines(PSTR(" " STRING_SPLASH_LINE1));
#ifdef STRING_SPLASH_LINE2
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
#else
safe_delay(2000);
#endif
}
else {
//
// Show the Marlin logo with splash line 1
// After a delay show splash line 2, if it exists
//
#ifdef STRING_SPLASH_LINE2
#define _SPLASH_WAIT_1 1500
#else
#define _SPLASH_WAIT_1 2000
#endif
logo_lines(PSTR(""));
CENTER_OR_SCROLL(STRING_SPLASH_LINE1, _SPLASH_WAIT_1);
#ifdef STRING_SPLASH_LINE2
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 1500);
#ifdef STRING_SPLASH_LINE3
CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500);
#endif
#endif
}
#elif defined(STRING_SPLASH_LINE2)
//
// Show the Marlin logo with splash line 1
//
if (LCD_EXTRA_SPACE >= utf8_strlen(SHORT_BUILD_VERSION) + 1) {
//
// Show splash line 2 only, alongside the logo if possible
// Show the Marlin logo, splash line1, and splash line 2
//
if (LCD_EXTRA_SPACE >= utf8_strlen(STRING_SPLASH_LINE2) + 1) {
logo_lines(PSTR(" " STRING_SPLASH_LINE2));
safe_delay(2000);
}
else {
logo_lines(PSTR(""));
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
}
#else
logo_lines(PSTR(" " SHORT_BUILD_VERSION));
CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 2000);
}
else {
//
// Show only the Marlin logo
// Show the Marlin logo and short build version
// After a delay show the website URL
//
logo_lines(PSTR(""));
safe_delay(2000);
#endif
CENTER_OR_SCROLL(SHORT_BUILD_VERSION, 1500);
CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 1500);
#ifdef STRING_SPLASH_LINE3
CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500);
#endif
}

lcd.clear();
safe_delay(100);
Expand Down Expand Up @@ -585,11 +554,13 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const char pref

FORCE_INLINE void _draw_bed_status(const bool blink) {
_draw_heater_status(H_BED, (
#if HAS_LEVELING
planner.leveling_active && blink ? '_' :
#endif
LCD_STR_BEDTEMP[0]
), blink);
#if HAS_LEVELING
planner.leveling_active && blink ? '_' :
#endif
LCD_STR_BEDTEMP[0]
),
blink
);
}

#if HAS_PRINT_PROGRESS
Expand Down
44 changes: 20 additions & 24 deletions Marlin/src/lcd/dogm/ultralcd_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,17 @@ bool MarlinUI::detected() { return true; }
}
#endif // SHOW_CUSTOM_BOOTSCREEN

// Draws a slice of the Marlin bootscreen, without the u8g loop
void MarlinUI::draw_marlin_bootscreen() {
// Screen dimensions.
//const u8g_uint_t width = u8g.getWidth(), height = u8g.getHeight();
constexpr u8g_uint_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;

// Draw the static Marlin bootscreen from a u8g loop
// or the animated boot screen within its own u8g loop
void MarlinUI::draw_marlin_bootscreen(const bool line2/*=false*/) {
// Determine text space needed
#ifndef STRING_SPLASH_LINE2
constexpr u8g_uint_t text_total_height = MENU_FONT_HEIGHT,
text_width_2 = 0;
#else
constexpr u8g_uint_t text_total_height = (MENU_FONT_HEIGHT) * 2,
text_width_2 = u8g_uint_t((sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH));
#endif
constexpr u8g_uint_t text_width_1 = u8g_uint_t((sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)),
constexpr u8g_uint_t text_width_1 = u8g_uint_t((sizeof(SHORT_BUILD_VERSION) - 1) * (MENU_FONT_WIDTH)),
text_width_2 = u8g_uint_t((sizeof(MARLIN_WEBSITE_URL) - 1) * (MENU_FONT_WIDTH)),
text_max_width = _MAX(text_width_1, text_width_2),
text_total_height = (MENU_FONT_HEIGHT) * 2,
width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT,
rspace = width - (START_BMPWIDTH);
constexpr bool two_part = (height - (START_BMPHEIGHT)) < ((MENU_FONT_ASCENT) * 2);

u8g_int_t offx, offy, txt_base, txt_offx_1, txt_offx_2;

Expand All @@ -189,8 +183,8 @@ bool MarlinUI::detected() { return true; }
}
else {
constexpr int8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space
offy = inter; // V-align boot logo proportionally
offx = rspace / 2; // Center the boot logo in the whole space
offy = inter; // V-align boot logo proportionally
txt_offx_1 = (width - text_width_1) / 2; // Text 1 centered
txt_offx_2 = (width - text_width_2) / 2; // Text 2 centered
txt_base = offy + START_BMPHEIGHT + offy + text_total_height - (MENU_FONT_DESCENT); // Even spacing looks best
Expand All @@ -201,12 +195,8 @@ bool MarlinUI::detected() { return true; }
auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
set_font(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
lcd_put_u8str_P(txt_offx_1, txt_base, PSTR(STRING_SPLASH_LINE1));
#else
lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(STRING_SPLASH_LINE1));
lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(STRING_SPLASH_LINE2));
#endif
if (!two_part || !line2) lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(SHORT_BUILD_VERSION));
if (!two_part || line2) lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(MARLIN_WEBSITE_URL));
};

#if DISABLED(BOOT_MARLIN_LOGO_ANIMATED)
Expand All @@ -229,9 +219,15 @@ bool MarlinUI::detected() { return true; }
#ifndef BOOTSCREEN_TIMEOUT
#define BOOTSCREEN_TIMEOUT 2500
#endif
u8g.firstPage();
do { draw_marlin_bootscreen(); } while (u8g.nextPage());
safe_delay(BOOTSCREEN_TIMEOUT);
for (uint8_t q = 2; q--;) {
#if DISABLED(BOOT_MARLIN_LOGO_ANIMATED)
u8g.firstPage();
do { draw_marlin_bootscreen(q == 0); } while (u8g.nextPage());
#else
draw_marlin_bootscreen(q == 0);
#endif
safe_delay((BOOTSCREEN_TIMEOUT) / 2);
}
}

void MarlinUI::show_bootscreen() {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/ultralcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class MarlinUI {
#endif

#if ENABLED(SHOW_BOOTSCREEN)
static void draw_marlin_bootscreen();
static void draw_marlin_bootscreen(const bool line2=false);
static void show_marlin_bootscreen();
static void show_bootscreen();
#endif
Expand Down
14 changes: 6 additions & 8 deletions config/default/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@

// @section info

// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
#define SHOW_BOOTSCREEN
#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 ***
Expand All @@ -89,10 +84,13 @@
* respectfully request that you retain the unmodified Marlin boot screen.
*/

// Enable to show the bitmap in Marlin/_Bootscreen.h on startup.
// Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
#define SHOW_BOOTSCREEN

// Show the bitmap in Marlin/_Bootscreen.h on startup.
//#define SHOW_CUSTOM_BOOTSCREEN

// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen.
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE

// @section machine
Expand Down
14 changes: 6 additions & 8 deletions config/examples/3DFabXYZ/Migbot/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@

// @section info

// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "AJMartel" // Who made the changes.
#define SHOW_BOOTSCREEN
#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 ***
Expand All @@ -89,10 +84,13 @@
* respectfully request that you retain the unmodified Marlin boot screen.
*/

// Enable to show the bitmap in Marlin/_Bootscreen.h on startup.
// Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
#define SHOW_BOOTSCREEN

// Show the bitmap in Marlin/_Bootscreen.h on startup.
//#define SHOW_CUSTOM_BOOTSCREEN

// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen.
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE

// @section machine
Expand Down
16 changes: 7 additions & 9 deletions config/examples/ADIMLab/Gantry v1/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@

// @section info

// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
#define STRING_CONFIG_H_AUTHOR "(ETE-Design, Gantry v1)" // Who made the changes.
#define SHOW_BOOTSCREEN
#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
// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(ETE-Design, Granty v1)" // Who made the changes.

/**
* *** VENDORS PLEASE READ ***
Expand All @@ -89,10 +84,13 @@
* respectfully request that you retain the unmodified Marlin boot screen.
*/

// Enable to show the bitmap in Marlin/_Bootscreen.h on startup.
// Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
#define SHOW_BOOTSCREEN

// Show the bitmap in Marlin/_Bootscreen.h on startup.
#define SHOW_CUSTOM_BOOTSCREEN

// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen.
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE

// @section machine
Expand Down
16 changes: 7 additions & 9 deletions config/examples/ADIMLab/Gantry v2/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@

// @section info

// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
#define STRING_CONFIG_H_AUTHOR "(ETE-Design, Gantry v2)" // Who made the changes.
#define SHOW_BOOTSCREEN
#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
// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(ETE-Design, Granty v2)" // Who made the changes.

/**
* *** VENDORS PLEASE READ ***
Expand All @@ -89,10 +84,13 @@
* respectfully request that you retain the unmodified Marlin boot screen.
*/

// Enable to show the bitmap in Marlin/_Bootscreen.h on startup.
// Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
#define SHOW_BOOTSCREEN

// Show the bitmap in Marlin/_Bootscreen.h on startup.
#define SHOW_CUSTOM_BOOTSCREEN

// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen.
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE

// @section machine
Expand Down
14 changes: 6 additions & 8 deletions config/examples/AlephObjects/TAZ4/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@

// @section info

// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(Aleph Objects Inc, TAZ)" // Who made the changes.
#define SHOW_BOOTSCREEN
#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 ***
Expand All @@ -89,10 +84,13 @@
* respectfully request that you retain the unmodified Marlin boot screen.
*/

// Enable to show the bitmap in Marlin/_Bootscreen.h on startup.
// Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION **
#define SHOW_BOOTSCREEN

// Show the bitmap in Marlin/_Bootscreen.h on startup.
//#define SHOW_CUSTOM_BOOTSCREEN

// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen.
// Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE

// @section machine
Expand Down
Loading

0 comments on commit 3ac76f0

Please sign in to comment.