✨ SHOW_CUSTOM_BOOTSCREEN for HD44780 (#26793)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -1584,7 +1584,7 @@
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash.
|
||||
#endif
|
||||
#if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE)
|
||||
#if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, HAS_MARLINUI_HD44780)
|
||||
//#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup.
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -388,8 +388,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
/**
|
||||
* Custom Boot and Status screens
|
||||
*/
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI)
|
||||
#error "SHOW_CUSTOM_BOOTSCREEN requires Graphical LCD or TOUCH_UI_FTDI_EVE."
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(HAS_MARLINUI_HD44780, HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI)
|
||||
#error "SHOW_CUSTOM_BOOTSCREEN requires Character LCD, Graphical LCD, or TOUCH_UI_FTDI_EVE."
|
||||
#elif ENABLED(SHOW_CUSTOM_BOOTSCREEN) && DISABLED(SHOW_BOOTSCREEN)
|
||||
#error "SHOW_CUSTOM_BOOTSCREEN requires SHOW_BOOTSCREEN."
|
||||
#elif ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) && !HAS_MARLINUI_U8GLIB
|
||||
|
@@ -331,15 +331,24 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
|
||||
switch (screen_charset) {
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
case CHARSET_BOOT: {
|
||||
// Set boot screen corner characters
|
||||
if (screen_charset == CHARSET_BOOT) {
|
||||
for (uint8_t i = 4; i--;)
|
||||
createChar_P(i, corner[i]);
|
||||
}
|
||||
else
|
||||
for (uint8_t i = 4; i--;) createChar_P(i, corner[i]);
|
||||
} break;
|
||||
#endif
|
||||
{ // Info Screen uses 5 special characters
|
||||
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
||||
case CHARSET_BOOT_CUSTOM: {
|
||||
for (uint8_t i = COUNT(customBootChars); i--;)
|
||||
createChar_P(i, customBootChars[i]);
|
||||
} break;
|
||||
#endif
|
||||
|
||||
default: {
|
||||
// Info Screen uses 5 special characters
|
||||
createChar_P(LCD_STR_BEDTEMP[0], bedTemp);
|
||||
createChar_P(LCD_STR_DEGREE[0], degree);
|
||||
createChar_P(LCD_STR_THERMOMETER[0], thermometer);
|
||||
@@ -361,6 +370,8 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
|
||||
createChar_P(LCD_STR_FOLDER[0], folder);
|
||||
#endif
|
||||
}
|
||||
} break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -400,6 +411,42 @@ bool MarlinUI::detected() {
|
||||
return TERN1(DETECT_I2C_LCD_DEVICE, lcd.LcdDetected() == 1);
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
||||
|
||||
#ifndef CUSTOM_BOOTSCREEN_X
|
||||
#define CUSTOM_BOOTSCREEN_X -1
|
||||
#endif
|
||||
#ifndef CUSTOM_BOOTSCREEN_Y
|
||||
#define CUSTOM_BOOTSCREEN_Y ((LCD_HEIGHT - COUNT(custom_boot_lines)) / 2)
|
||||
#endif
|
||||
#ifndef CUSTOM_BOOTSCREEN_TIMEOUT
|
||||
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
||||
#endif
|
||||
|
||||
void MarlinUI::draw_custom_bootscreen(const uint8_t/*=0*/) {
|
||||
set_custom_characters(CHARSET_BOOT_CUSTOM);
|
||||
lcd.clear();
|
||||
const int8_t sx = CUSTOM_BOOTSCREEN_X;
|
||||
const uint8_t sy = CUSTOM_BOOTSCREEN_Y;
|
||||
for (lcd_uint_t i = 0; i < COUNT(custom_boot_lines); ++i) {
|
||||
PGM_P const pstr = (PGM_P)pgm_read_ptr(&custom_boot_lines[i]);
|
||||
const uint8_t clen = utf8_strlen_P(pstr);
|
||||
const lcd_uint_t x = sx >= 0 ? sx : (LCD_WIDTH - clen) / 2;
|
||||
for (lcd_uint_t j = 0; j < clen; ++j) {
|
||||
const lchar_t c = pgm_read_byte(&pstr[j]);
|
||||
lcd_put_lchar(x + j, sy + i, c == '\x08' ? '\x00' : c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shows the custom bootscreen and delays
|
||||
void MarlinUI::show_custom_bootscreen() {
|
||||
draw_custom_bootscreen();
|
||||
safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
|
||||
}
|
||||
|
||||
#endif // SHOW_CUSTOM_BOOTSCREEN
|
||||
|
||||
#if HAS_SLOW_BUTTONS
|
||||
uint8_t MarlinUI::read_slow_buttons() {
|
||||
#if ENABLED(LCD_I2C_TYPE_MCP23017)
|
||||
@@ -466,6 +513,8 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
}
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
TERN_(SHOW_CUSTOM_BOOTSCREEN, show_custom_bootscreen());
|
||||
|
||||
set_custom_characters(CHARSET_BOOT);
|
||||
lcd.clear();
|
||||
|
||||
|
@@ -27,6 +27,20 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
||||
|
||||
#include "../../../_Bootscreen.h"
|
||||
|
||||
#ifdef CUSTOM_BOOTSCREEN_Y
|
||||
#define CUSTOM_BOOT_LAST COUNT(custom_boot_lines) + CUSTOM_BOOTSCREEN_Y
|
||||
#else
|
||||
#define CUSTOM_BOOT_LAST COUNT(custom_boot_lines)
|
||||
#endif
|
||||
|
||||
static_assert(CUSTOM_BOOT_LAST <= LCD_HEIGHT, "custom_boot_lines (plus CUSTOM_BOOTSCREEN_Y) doesn't fit on the selected LCD.");
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_I2C_TYPE_PCF8575)
|
||||
|
||||
// NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins.
|
||||
|
@@ -105,7 +105,8 @@ typedef bool (*statusResetFunc_t)();
|
||||
enum HD44780CharSet : uint8_t {
|
||||
CHARSET_MENU,
|
||||
CHARSET_INFO,
|
||||
CHARSET_BOOT
|
||||
CHARSET_BOOT,
|
||||
CHARSET_BOOT_CUSTOM
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user