|
|
|
@ -256,38 +256,11 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
|
|
|
|
|
while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize or re-initialize the LCD
|
|
|
|
|
static void lcd_implementation_init() {
|
|
|
|
|
|
|
|
|
|
#if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
|
|
|
|
|
OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if PIN_EXISTS(LCD_RESET)
|
|
|
|
|
OUT_WRITE(LCD_RESET_PIN, LOW); // perform a clean hardware reset
|
|
|
|
|
_delay_ms(5);
|
|
|
|
|
OUT_WRITE(LCD_RESET_PIN, HIGH);
|
|
|
|
|
_delay_ms(5); // delay to allow the display to initalize
|
|
|
|
|
u8g.begin(); // re-initialize the display
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
|
|
|
|
|
u8g.setContrast(lcd_contrast);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LCD_SCREEN_ROT_90)
|
|
|
|
|
u8g.setRot90(); // Rotate screen by 90°
|
|
|
|
|
#elif ENABLED(LCD_SCREEN_ROT_180)
|
|
|
|
|
u8g.setRot180(); // Rotate screen by 180°
|
|
|
|
|
#elif ENABLED(LCD_SCREEN_ROT_270)
|
|
|
|
|
u8g.setRot270(); // Rotate screen by 270°
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SHOW_BOOTSCREEN)
|
|
|
|
|
static bool show_bootscreen = true;
|
|
|
|
|
#if ENABLED(SHOW_BOOTSCREEN)
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
|
|
|
|
if (show_bootscreen) {
|
|
|
|
|
|
|
|
|
|
void lcd_custom_bootscreen() {
|
|
|
|
|
u8g.firstPage();
|
|
|
|
|
do {
|
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
@ -295,11 +268,16 @@ static void lcd_implementation_init() {
|
|
|
|
|
( 64 - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) /2,
|
|
|
|
|
CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp);
|
|
|
|
|
} while (u8g.nextPage());
|
|
|
|
|
safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // SHOW_CUSTOM_BOOTSCREEN
|
|
|
|
|
|
|
|
|
|
const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
|
|
|
|
|
void lcd_bootscreen() {
|
|
|
|
|
|
|
|
|
|
static bool show_bootscreen = true;
|
|
|
|
|
|
|
|
|
|
if (show_bootscreen) {
|
|
|
|
|
show_bootscreen = false;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(START_BMPHIGH)
|
|
|
|
|
constexpr uint8_t offy = 0;
|
|
|
|
@ -307,9 +285,9 @@ static void lcd_implementation_init() {
|
|
|
|
|
constexpr uint8_t offy = DOG_CHAR_HEIGHT;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
const uint8_t txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
|
|
|
|
|
const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2,
|
|
|
|
|
txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
|
|
|
|
|
|
|
|
|
|
if (show_bootscreen) {
|
|
|
|
|
u8g.firstPage();
|
|
|
|
|
do {
|
|
|
|
|
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
|
|
|
|
@ -323,10 +301,44 @@ static void lcd_implementation_init() {
|
|
|
|
|
#endif
|
|
|
|
|
} while (u8g.nextPage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
show_bootscreen = false;
|
|
|
|
|
#endif // SHOW_BOOTSCREEN
|
|
|
|
|
|
|
|
|
|
// Initialize or re-initialize the LCD
|
|
|
|
|
static void lcd_implementation_init() {
|
|
|
|
|
|
|
|
|
|
#if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
|
|
|
|
|
OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if PIN_EXISTS(LCD_RESET)
|
|
|
|
|
OUT_WRITE(LCD_RESET_PIN, LOW); // perform a clean hardware reset
|
|
|
|
|
_delay_ms(5);
|
|
|
|
|
OUT_WRITE(LCD_RESET_PIN, HIGH);
|
|
|
|
|
_delay_ms(5); // delay to allow the display to initalize
|
|
|
|
|
u8g.begin(); // re-initialize the display
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
|
|
|
|
|
u8g.setContrast(lcd_contrast);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LCD_SCREEN_ROT_90)
|
|
|
|
|
u8g.setRot90(); // Rotate screen by 90°
|
|
|
|
|
#elif ENABLED(LCD_SCREEN_ROT_180)
|
|
|
|
|
u8g.setRot180(); // Rotate screen by 180°
|
|
|
|
|
#elif ENABLED(LCD_SCREEN_ROT_270)
|
|
|
|
|
u8g.setRot270(); // Rotate screen by 270°
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // SHOW_BOOTSCREEN
|
|
|
|
|
#if ENABLED(SHOW_BOOTSCREEN)
|
|
|
|
|
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
|
|
|
|
lcd_custom_bootscreen();
|
|
|
|
|
#else
|
|
|
|
|
lcd_bootscreen();
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The kill screen is displayed for unrecoverable conditions
|
|
|
|
|