From a964f098b33300b23ce133bc48438684dae91efe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 27 Oct 2018 22:06:25 -0500 Subject: [PATCH] Make dogm status screen a CPP --- Marlin/src/lcd/dogm/dogm_Bootscreen.h | 137 +++++++++++ .../{dogm_bitmaps.h => dogm_Statusscreen.h} | 213 +----------------- ...s_screen_DOGM.h => status_screen_DOGM.cpp} | 73 +++--- Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp | 149 +++++++----- Marlin/src/lcd/ultralcd.h | 37 +++ 5 files changed, 325 insertions(+), 284 deletions(-) create mode 100644 Marlin/src/lcd/dogm/dogm_Bootscreen.h rename Marlin/src/lcd/dogm/{dogm_bitmaps.h => dogm_Statusscreen.h} (91%) rename Marlin/src/lcd/dogm/{status_screen_DOGM.h => status_screen_DOGM.cpp} (92%) diff --git a/Marlin/src/lcd/dogm/dogm_Bootscreen.h b/Marlin/src/lcd/dogm/dogm_Bootscreen.h new file mode 100644 index 000000000..efb299b35 --- /dev/null +++ b/Marlin/src/lcd/dogm/dogm_Bootscreen.h @@ -0,0 +1,137 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * Standard Marlin Boot Screen bitmaps + * + * Use the Marlin Bitmap Converter to make your own: + * http://marlinfw.org/tools/u8glib/converter.html + */ + +#include + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SHOW_BOOTSCREEN) + + //#define START_BMPHIGH // Costs 399 bytes more flash + + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + #include "../../../_Bootscreen.h" + + #ifndef CUSTOM_BOOTSCREEN_TIMEOUT + #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 + #endif + + #endif + + #if ENABLED(START_BMPHIGH) + + #define START_BMPWIDTH 112 + + const unsigned char start_bmp[] PROGMEM = { + B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, + B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111, + B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111, + B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111, + B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00011000,B00000000,B00011111,B11111111, + B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00001111,B11111111, + B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000111,B11111111, + B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000011,B11111111, + B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111, + B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111, + B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00111100,B00000011,B11110000,B01111111, + B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00111100,B00000111,B11111100,B00111111, + B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00111100,B00001111,B11111110,B00011111, + B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00111100,B00011111,B11111110,B00001111, + B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00111100,B00111111,B00111111,B00000111, + B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00111100,B00111110,B00011111,B00000111, + B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B10111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B10111111,B11111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B10111111,B11111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B10111111,B11111100,B00001111,B00000011, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, + B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110, + B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100, + B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000, + B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000, + B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000 + }; + + #else + + #define START_BMPWIDTH 56 + + const unsigned char start_bmp[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111, + B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111, + B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111, + B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111, + B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111, + B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111, + B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111, + B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011, + B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001, + B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001, + B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001, + B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001, + B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001, + B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001, + B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001, + B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, + B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000 + }; + + #endif + + #ifndef START_BMP_BYTEWIDTH + #define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8) + #endif + #ifndef START_BMPHEIGHT + #define START_BMPHEIGHT (sizeof(start_bmp) / (START_BMP_BYTEWIDTH)) + #endif + + static_assert(sizeof(start_bmp) == (START_BMP_BYTEWIDTH) * (START_BMPHEIGHT), "Bootscreen (start_bmp) dimensions don't match data."); + +#endif + +#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH + #define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8) +#endif +#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT + #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) +#endif diff --git a/Marlin/src/lcd/dogm/dogm_bitmaps.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h similarity index 91% rename from Marlin/src/lcd/dogm/dogm_bitmaps.h rename to Marlin/src/lcd/dogm/dogm_Statusscreen.h index c610ce4a3..261896506 100644 --- a/Marlin/src/lcd/dogm/dogm_bitmaps.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -21,7 +21,7 @@ */ /** - * Standard Marlin Boot and Status Screen bitmaps + * Standard Marlin Status Screen bitmaps * * Use the Marlin Bitmap Converter to make your own: * http://marlinfw.org/tools/u8glib/converter.html @@ -31,109 +31,18 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(SHOW_BOOTSCREEN) - - //#define START_BMPHIGH // Costs 399 bytes more flash - - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - - #include "../../../_Bootscreen.h" - - #ifndef CUSTOM_BOOTSCREEN_TIMEOUT - #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 - #endif - - #endif - - #if ENABLED(START_BMPHIGH) - - #define START_BMPWIDTH 112 - - const unsigned char start_bmp[] PROGMEM = { - B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, - B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, - B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111, - B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111, - B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111, - B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00011000,B00000000,B00011111,B11111111, - B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00001111,B11111111, - B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000111,B11111111, - B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000011,B11111111, - B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111, - B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111, - B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00111100,B00000011,B11110000,B01111111, - B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00111100,B00000111,B11111100,B00111111, - B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00111100,B00001111,B11111110,B00011111, - B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00111100,B00011111,B11111110,B00001111, - B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00111100,B00111111,B00111111,B00000111, - B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00111100,B00111110,B00011111,B00000111, - B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B10111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B10111111,B11111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B10111111,B11111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B10111111,B11111100,B00001111,B00000011, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, - B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110, - B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100, - B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000, - B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000, - B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000 - }; - - #else - - #define START_BMPWIDTH 56 - - const unsigned char start_bmp[] PROGMEM = { - B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111, - B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111, - B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111, - B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111, - B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111, - B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111, - B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111, - B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011, - B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001, - B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001, - B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001, - B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001, - B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001, - B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001, - B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001, - B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, - B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000 - }; - - #endif - - #ifndef START_BMP_BYTEWIDTH - #define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8) - #endif - #ifndef START_BMPHEIGHT - #define START_BMPHEIGHT (sizeof(start_bmp) / (START_BMP_BYTEWIDTH)) - #endif - - static_assert(sizeof(start_bmp) == (START_BMP_BYTEWIDTH) * (START_BMPHEIGHT), "Bootscreen (start_bmp) dimensions don't match data."); - -#endif - #if ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) - // This file must define STATUS_SCREENWIDTH and status_screen[012]_bmp. - // It can also define STATUS_SCREEN_X, STATUS_SCREEN_{BED,FAN}_TEXT_X and - // STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations. + /** + * Custom _Statusscreen.h files must define STATUS_SCREENWIDTH and status_screen[012]_bmp. + * There's no need to define STATUS_SCREENHEIGHT since it's calculated automatically. + * You can also define these to modify drawing and animation: + * + * - STATUS_SCREEN_X + * - STATUS_SCREEN_{BED,FAN}_TEXT_X + * - STATUS_SCREEN_HOTEND_TEXT_X(i) + * - FAN_ANIM_FRAMES + */ #include "../../../_Statusscreen.h" #else // !CUSTOM_STATUS_SCREEN_IMAGE @@ -1161,106 +1070,6 @@ #endif // !CUSTOM_STATUS_SCREEN_IMAGE -#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) - - const unsigned char cw_bmp[] PROGMEM = { - B00000011,B11111000,B00000000, - B00001111,B11111110,B00000000, - B00011110,B00001111,B00000000, - B00111000,B00000111,B00000000, - B00111000,B00000011,B10000000, - B01110000,B00000011,B10000000, - B01110000,B00001111,B11100000, - B01110000,B00000111,B11000000, - B01110000,B00000011,B10000000, - B01110000,B00000001,B00000000, - B01110000,B00000000,B00000000, - B00111000,B00000000,B00000000, - B00111000,B00000111,B00000000, - B00011110,B00001111,B00000000, - B00001111,B11111110,B00000000, - B00000011,B11111000,B00000000 - }; - - const unsigned char ccw_bmp[] PROGMEM = { - B00000000,B11111110,B00000000, - B00000011,B11111111,B10000000, - B00000111,B10000011,B11000000, - B00001110,B00000001,B11000000, - B00001110,B00000000,B11100000, - B00011100,B00000000,B11100000, - B01111111,B00000000,B11100000, - B00111110,B00000000,B11100000, - B00011100,B00000000,B11100000, - B00001000,B00000000,B11100000, - B00000000,B00000000,B11100000, - B00000000,B00000001,B11000000, - B00001110,B00000001,B11000000, - B00001111,B00000111,B10000000, - B00000111,B11111111,B00000000, - B00000001,B11111100,B00000000 - }; - - const unsigned char up_arrow_bmp[] PROGMEM = { - B00000100,B00000000, - B00001110,B00000000, - B00011111,B00000000, - B00111111,B10000000, - B01111111,B11000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000 - }; - - const unsigned char down_arrow_bmp[] PROGMEM = { - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B01111111,B11000000, - B00111111,B10000000, - B00011111,B00000000, - B00001110,B00000000, - B00000100,B00000000 - }; - - const unsigned char offset_bedline_bmp[] PROGMEM = { - B11111111,B11111111,B11111111 - }; - - const unsigned char nozzle_bmp[] PROGMEM = { - B01111111,B10000000, - B11111111,B11000000, - B11111111,B11000000, - B11111111,B11000000, - B01111111,B10000000, - B01111111,B10000000, - B11111111,B11000000, - B11111111,B11000000, - B11111111,B11000000, - B00111111,B00000000, - B00011110,B00000000, - B00001100,B00000000 - }; - -#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY - -#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH - #define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8) -#endif -#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT - #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) -#endif - #ifndef FAN_ANIM_FRAMES #define FAN_ANIM_FRAMES 2 #elif FAN_ANIM_FRAMES > 3 diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.h b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp similarity index 92% rename from Marlin/src/lcd/dogm/status_screen_DOGM.h rename to Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 22f7ab9d7..65408c6ab 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.h +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -20,16 +20,28 @@ * */ -/** - * status_screen_DOGM.h - * - * Standard Status Screen for Graphical Display - */ +// +// status_screen_DOGM.cpp +// Standard Status Screen for Graphical Display +// + +#include "../../inc/MarlinConfigPre.h" -#ifndef _STATUS_SCREEN_DOGM_H_ -#define _STATUS_SCREEN_DOGM_H_ +#if HAS_GRAPHICAL_LCD && DISABLED(LIGHTWEIGHT_UI) +#include "dogm_Statusscreen.h" +#include "../ultralcd.h" +#include "../lcdprint.h" #include "../../module/motion.h" +#include "../../module/temperature.h" + +#if ENABLED(SDSUPPORT) + #include "../../sd/cardreader.h" +#endif + +#if HAS_PRINT_PROGRESS + #include "../../module/printcounter.h" +#endif FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { const char * const str = itostr3(temp); @@ -123,7 +135,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } } -inline void lcd_implementation_status_message(const bool blink) { +FORCE_INLINE void lcd_implementation_status_message(const bool blink) { #if ENABLED(STATUS_MESSAGE_SCROLLING) static bool last_blink = false; @@ -200,42 +212,43 @@ inline void lcd_implementation_status_message(const bool blink) { #endif } +// The current graphical page being rendered +u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p; + void lcd_impl_status_screen_0() { const bool blink = lcd_blink(); - #if FAN_ANIM_FRAMES > 2 - static bool old_blink; - static uint8_t fan_frame; - if (old_blink != blink) { - old_blink = blink; - if (!fan_speed[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; - } - #endif - // Status Menu Font lcd_setFont(FONT_STATUSMENU); // // Fan Animation // - // Draws the whole heading image as a B/W bitmap rather than - // drawing the elements separately. - // This was done as an optimization, as it was slower to draw - // multiple parts compared to a single bitmap. + // Draw the entire heading image bitmap rather than each element + // separately. This is an optimization because it's slower to draw + // multiple elements than a single bitmap. // // The bitmap: - // - May be offset in X - // - Includes all nozzle(s), bed(s), and the fan. + // - May be offset in X + // - Includes all nozzle(s), bed(s), and the fan. // // TODO: // - // - Only draw the whole header on the first - // entry to the status screen. Nozzle, bed, and - // fan outline bits don't change. + // - Only draw the whole header on the first + // entry to the status screen. Nozzle, bed, and + // fan outline bits don't change. // - if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { + #if FAN_ANIM_FRAMES > 2 + static bool old_blink; + static uint8_t fan_frame; + if (old_blink != blink) { + old_blink = blink; + if (!fan_speed[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; + } + #endif + if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) u8g.drawBitmapP( STATUS_SCREEN_X, STATUS_SCREEN_Y, (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, @@ -253,8 +266,6 @@ void lcd_impl_status_screen_0() { status_screen0_bmp ); - } - // // Temperature Graphics and Info // @@ -359,7 +370,7 @@ void lcd_impl_status_screen_0() { lcd_put_u8str(buffer); } - #endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY + #endif // HAS_PRINT_PROGRESS // // XYZ Coordinates @@ -494,4 +505,4 @@ void lcd_impl_status_screen_0() { } } -#endif // _STATUS_SCREEN_DOGM_H_ +#endif // HAS_GRAPHICAL_LCD && !LIGHTWEIGHT_UI diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp index 524b6b8ba..2e415c8e9 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp @@ -37,16 +37,16 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include "../ultralcd.h" #include #include "HAL_LCD_class_defines.h" - -#include "../fontutils.h" #include "u8g_fontutf8.h" -#include "dogm_bitmaps.h" +#include "../lcdprint.h" +#include "../fontutils.h" +#include "dogm_Bootscreen.h" #include "../../sd/cardreader.h" #include "../../module/temperature.h" @@ -60,55 +60,22 @@ #include "../../feature/bedlevel/ubl/ubl.h" #endif -// The Marlin special symbols is now in the fontdata_ISO10646_1.h #define FONT_SPECIAL_NAME ISO10646_1_5x7 - -// Only Western languages support big / small fonts -#if DISABLED(DISPLAY_CHARSET_ISO10646_1) - #undef USE_BIG_EDIT_FONT - #undef USE_SMALL_INFOFONT -#endif - +#define FONT_MENU_NAME ISO10646_1_5x7 +#include "fontdata/fontdata_ISO10646_1.h" #if ENABLED(USE_SMALL_INFOFONT) #include "fontdata/fontdata_6x9_marlin.h" #define FONT_STATUSMENU_NAME u8g_font_6x9 - #define INFO_FONT_HEIGHT 7 #else #define FONT_STATUSMENU_NAME FONT_MENU_NAME - #define INFO_FONT_HEIGHT 8 -#endif - -#include LANGUAGE_DATA_INCL(LCD_LANGUAGE) - -#include "fontdata/fontdata_ISO10646_1.h" -#define FONT_MENU_NAME ISO10646_1_5x7 - -// DOGM parameters (size in pixels) -#define DOG_CHAR_WIDTH 6 -#define DOG_CHAR_HEIGHT 12 -#if ENABLED(USE_BIG_EDIT_FONT) - #define FONT_MENU_EDIT_NAME u8g_font_9x18 - #define DOG_CHAR_WIDTH_EDIT 9 - #define DOG_CHAR_HEIGHT_EDIT 18 -#else - #define FONT_MENU_EDIT_NAME FONT_MENU_NAME - #define DOG_CHAR_WIDTH_EDIT DOG_CHAR_WIDTH - #define DOG_CHAR_HEIGHT_EDIT DOG_CHAR_HEIGHT #endif -#define START_COL 0 +#define START_COL 0 U8G_CLASS u8g(U8G_PARAM); U8GLIB *pu8g = &u8g; -#ifndef LCD_PIXEL_WIDTH - #define LCD_PIXEL_WIDTH 128 -#endif -#ifndef LCD_PIXEL_HEIGHT - #define LCD_PIXEL_HEIGHT 64 -#endif - -#include "../lcdprint.h" +#include LANGUAGE_DATA_INCL(LCD_LANGUAGE) #if HAS_LCD_CONTRAST @@ -121,13 +88,6 @@ U8GLIB *pu8g = &u8g; #endif -// The current graphical page being rendered -u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p; - -// For selective rendering within a Y range -#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb)) -#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya)) - void lcd_setFont(const MarlinFont font_nr) { static char currentfont = 0; if (font_nr != currentfont) { @@ -223,8 +183,6 @@ void lcd_setFont(const MarlinFont font_nr) { #if ENABLED(LIGHTWEIGHT_UI) #include "status_screen_lite_ST7920.h" -#else - #include "status_screen_DOGM.h" #endif // Initialize or re-initialize the LCD @@ -572,6 +530,95 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) + const unsigned char cw_bmp[] PROGMEM = { + B00000011,B11111000,B00000000, + B00001111,B11111110,B00000000, + B00011110,B00001111,B00000000, + B00111000,B00000111,B00000000, + B00111000,B00000011,B10000000, + B01110000,B00000011,B10000000, + B01110000,B00001111,B11100000, + B01110000,B00000111,B11000000, + B01110000,B00000011,B10000000, + B01110000,B00000001,B00000000, + B01110000,B00000000,B00000000, + B00111000,B00000000,B00000000, + B00111000,B00000111,B00000000, + B00011110,B00001111,B00000000, + B00001111,B11111110,B00000000, + B00000011,B11111000,B00000000 + }; + + const unsigned char ccw_bmp[] PROGMEM = { + B00000000,B11111110,B00000000, + B00000011,B11111111,B10000000, + B00000111,B10000011,B11000000, + B00001110,B00000001,B11000000, + B00001110,B00000000,B11100000, + B00011100,B00000000,B11100000, + B01111111,B00000000,B11100000, + B00111110,B00000000,B11100000, + B00011100,B00000000,B11100000, + B00001000,B00000000,B11100000, + B00000000,B00000000,B11100000, + B00000000,B00000001,B11000000, + B00001110,B00000001,B11000000, + B00001111,B00000111,B10000000, + B00000111,B11111111,B00000000, + B00000001,B11111100,B00000000 + }; + + const unsigned char up_arrow_bmp[] PROGMEM = { + B00000100,B00000000, + B00001110,B00000000, + B00011111,B00000000, + B00111111,B10000000, + B01111111,B11000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000 + }; + + const unsigned char down_arrow_bmp[] PROGMEM = { + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B01111111,B11000000, + B00111111,B10000000, + B00011111,B00000000, + B00001110,B00000000, + B00000100,B00000000 + }; + + const unsigned char offset_bedline_bmp[] PROGMEM = { + B11111111,B11111111,B11111111 + }; + + const unsigned char nozzle_bmp[] PROGMEM = { + B01111111,B10000000, + B11111111,B11000000, + B11111111,B11000000, + B11111111,B11000000, + B01111111,B10000000, + B01111111,B10000000, + B11111111,B11000000, + B11111111,B11000000, + B11111111,B11000000, + B00111111,B00000000, + B00011110,B00000000, + B00001100,B00000000 + }; + void _lcd_zoffset_overlay_gfx(const float zvalue) { // Determine whether the user is raising or lowering the nozzle. static int8_t dir; @@ -610,4 +657,4 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop #endif // ULTIPANEL -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 67f9e05b7..106510e0b 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -25,6 +25,13 @@ #if HAS_GRAPHICAL_LCD + #ifndef LCD_PIXEL_WIDTH + #define LCD_PIXEL_WIDTH 128 + #endif + #ifndef LCD_PIXEL_HEIGHT + #define LCD_PIXEL_HEIGHT 64 + #endif + // LCD selection #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) #define U8G_CLASS U8GLIB_ST7920_128X64_4X @@ -125,6 +132,19 @@ #include "dogm/HAL_LCD_class_defines.h" extern U8G_CLASS u8g; + // DOGM font sizes + #define DOG_CHAR_WIDTH 6 + #define DOG_CHAR_HEIGHT 12 + #if ENABLED(USE_BIG_EDIT_FONT) + #define FONT_MENU_EDIT_NAME u8g_font_9x18 + #define DOG_CHAR_WIDTH_EDIT 9 + #define DOG_CHAR_HEIGHT_EDIT 18 + #else + #define FONT_MENU_EDIT_NAME FONT_MENU_NAME + #define DOG_CHAR_WIDTH_EDIT DOG_CHAR_WIDTH + #define DOG_CHAR_HEIGHT_EDIT DOG_CHAR_HEIGHT + #endif + enum MarlinFont : uint8_t { FONT_STATUSMENU = 1, FONT_SPECIAL, @@ -132,6 +152,23 @@ FONT_MENU, }; + // Only Western languages support big / small fonts + #if DISABLED(DISPLAY_CHARSET_ISO10646_1) + #undef USE_BIG_EDIT_FONT + #undef USE_SMALL_INFOFONT + #endif + + #if ENABLED(USE_SMALL_INFOFONT) + extern const u8g_fntpgm_uint8_t u8g_font_6x9[]; + #define INFO_FONT_HEIGHT 7 + #else + #define INFO_FONT_HEIGHT 8 + #endif + + // For selective rendering within a Y range + #define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb)) + #define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya)) + void lcd_setFont(const MarlinFont font_nr); #if ENABLED(LIGHTWEIGHT_UI)