From 6172cd2528e056e7ebcb710ebeec3eeb0d9696e5 Mon Sep 17 00:00:00 2001 From: Ludy Date: Sat, 7 Sep 2019 11:52:57 +0200 Subject: [PATCH] CHAMBER integration to GLCD (#14981) --- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 353 ++++++++++++--------- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 83 ++--- 2 files changed, 257 insertions(+), 179 deletions(-) diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index ed2978a42..821018bc0 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -29,11 +29,14 @@ */ #include "../../inc/MarlinConfig.h" +#include "ultralcd_DOGM.h" #define BW(N) ((N + 7) / 8) -#if ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) +#if ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) && DISABLED(STATUS_COMBINE_HEATERS) + #undef STATUS_HEATERS_X + #undef STATUS_BED_X /** * Custom _Statusscreen.h files can define: * - A custom logo image @@ -50,54 +53,26 @@ #endif -#if ENABLED(STATUS_COMBINE_HEATERS) - #undef STATUS_HOTEND_ANIM - #undef STATUS_BED_ANIM -#endif - // // Default Status Screen Heater or Hotends bitmaps // - #if !STATUS_HEATERS_WIDTH && !STATUS_HOTEND1_WIDTH #if ENABLED(STATUS_COMBINE_HEATERS) + #undef STATUS_HOTEND_ANIM + #undef STATUS_BED_ANIM + #define STATUS_HEATERS_XSPACE 24 + // // Status Screen Combined Heater bitmaps // + #if HAS_HEATED_BED && HOTENDS <= 4 - #if HAS_HEATED_BED && HOTENDS == 0 - #define STATUS_HEATERS_X 80 - #endif - - #if HAS_HEATED_BED && HOTENDS <= 3 - - #define STATUS_BED_WIDTH 21 - - #if HOTENDS == 0 - - #define STATUS_HEATERS_WIDTH 21 - - const unsigned char status_heaters_bmp[] PROGMEM = { - B00000100,B00010000,B01000000, - B00000010,B00001000,B00100000, - B00000010,B00001000,B00100000, - B00000100,B00010000,B01000000, - B00001000,B00100000,B10000000, - B00010000,B01000001,B00000000, - B00010000,B01000001,B00000000, - B00001000,B00100000,B10000000, - B00000100,B00010000,B01000000, - B00000000,B00000000,B00000000, - B00011111,B11111111,B11111000, - B00011111,B11111111,B11111000 - }; - - #elif HOTENDS == 1 + #if HOTENDS == 1 - #define STATUS_HEATERS_WIDTH 90 - #define STATUS_BED_X 80 + #define STATUS_HEATERS_WIDTH 96 + #define STATUS_BED_TEXT_X (STATUS_HEATERS_WIDTH - 10) const unsigned char status_heaters_bmp[] PROGMEM = { B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, @@ -116,7 +91,8 @@ #elif HOTENDS == 2 - #define STATUS_HEATERS_WIDTH 90 + #define STATUS_HEATERS_WIDTH 96 + #define STATUS_BED_TEXT_X (STATUS_HEATERS_WIDTH - 10) const unsigned char status_heaters_bmp[] PROGMEM = { B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, @@ -133,9 +109,10 @@ B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11111000 }; - #else // HOTENDS > 2 + #elif HOTENDS == 3 - #define STATUS_HEATERS_WIDTH 90 + #define STATUS_HEATERS_WIDTH 96 + #define STATUS_BED_TEXT_X (STATUS_HEATERS_WIDTH - 10) const unsigned char status_heaters_bmp[] PROGMEM = { B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000100,B00010000,B01000000, @@ -152,13 +129,33 @@ B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00011111,B11111111,B11111000 }; + #else // HOTENDS > 3 + + #define STATUS_HEATERS_WIDTH 120 + #define STATUS_BED_TEXT_X (STATUS_HEATERS_WIDTH - 10) + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000100,B00010000,B01000000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00000010,B00001000,B00100000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000010,B00001000,B00100000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00111011,B01110000,B00000000,B00000100,B00010000,B01000000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00011011,B01100000,B00000000,B00001000,B00100000,B10000000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00011000,B00100000,B00000000,B00010000,B01000001,B00000000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00111111,B01110000,B00000000,B00010000,B01000001,B00000000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00111111,B01110000,B00000000,B00001000,B00100000,B10000000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000100,B00010000,B01000000, + B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000, + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00011111,B11111111,B11111000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00011111,B11111111,B11111000 + }; + #endif // HOTENDS #else // !HAS_HEATED_BED || HOTENDS > 3 #if HOTENDS == 1 - #define STATUS_HEATERS_WIDTH 11 + #define STATUS_HEATERS_WIDTH 12 const unsigned char status_heaters_bmp[] PROGMEM = { B00011111,B11100000, @@ -213,7 +210,7 @@ B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000 }; - #elif HOTENDS > 3 + #elif HOTENDS == 4 #define STATUS_HEATERS_WIDTH 84 @@ -232,6 +229,25 @@ B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000 }; + #elif HOTENDS > 4 + + #define STATUS_HEATERS_WIDTH 108 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111000,B01110000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00111011,B11110000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00111011,B01110000,B00000000,B00111000,B11110000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00011011,B01100000,B00000000,B00011111,B01100000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00011000,B00100000,B00000000,B00011111,B01100000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00111111,B01110000,B00000000,B00111011,B01110000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00111111,B01110000,B00000000,B00111100,B11110000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000, + B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000, + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000 + }; + #endif // HOTENDS #endif // !HAS_HEATED_BED || HOTENDS > 3 @@ -241,10 +257,16 @@ // // Status Screen Hotends bitmaps // - #if HOTENDS - #define STATUS_HOTEND1_WIDTH 12 + #define STATUS_HOTEND1_WIDTH 16 + + #define MAX_HOTEND_BITMAPS 5 + #if HOTENDS > MAX_HOTEND_BITMAPS + #define STATUS_HOTEND_BITMAPS MAX_HOTEND_BITMAPS + #else + #define STATUS_HOTEND_BITMAPS HOTENDS + #endif #if HOTENDS == 1 || ENABLED(STATUS_HOTEND_NUMBERLESS) @@ -286,17 +308,6 @@ #if HOTENDS >= 2 - #if HAS_HEATED_BED - #define MAX_HOTEND_BITMAPS 3 - #else - #define MAX_HOTEND_BITMAPS 4 - #endif - #if HOTENDS > MAX_HOTEND_BITMAPS - #define STATUS_HOTEND_BITMAPS MAX_HOTEND_BITMAPS - #else - #define STATUS_HOTEND_BITMAPS HOTENDS - #endif - #ifdef STATUS_HOTEND_ANIM const unsigned char status_hotend1_a_bmp[] PROGMEM = { @@ -450,7 +461,7 @@ #endif - #if STATUS_HOTEND_BITMAPS >= 4 && !HAS_HEATED_BED + #if STATUS_HOTEND_BITMAPS >= 4 #ifdef STATUS_HOTEND_ANIM @@ -505,7 +516,7 @@ #endif - #if STATUS_HOTEND_BITMAPS >= 5 && !HAS_HEATED_BED + #if STATUS_HOTEND_BITMAPS >= 5 #ifdef STATUS_HOTEND_ANIM @@ -571,17 +582,16 @@ // // Default Status Screen Bed bitmaps // - -#if !STATUS_BED_WIDTH && DISABLED(STATUS_COMBINE_HEATERS) && HAS_HEATED_BED && HOTENDS < 4 +#if !STATUS_BED_WIDTH && HAS_HEATED_BED && DISABLED(STATUS_COMBINE_HEATERS) #if ENABLED(STATUS_ALT_BED_BITMAP) #define STATUS_BED_ANIM #define STATUS_BED_WIDTH 24 #ifndef STATUS_BED_X - #define STATUS_BED_X 72 + #define STATUS_BED_X (LCD_PIXEL_WIDTH - (STATUS_BED_BYTEWIDTH + STATUS_CHAMBER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) #endif - #define STATUS_BED_TEXT_X (STATUS_BED_X + 13) + #define STATUS_BED_TEXT_X (STATUS_BED_X + 11) const unsigned char status_bed_bmp[] PROGMEM = { B11111111,B11111111,B11000000, @@ -612,7 +622,7 @@ #define STATUS_BED_WIDTH 21 #ifndef STATUS_BED_X - #define STATUS_BED_X 80 + #define STATUS_BED_X (LCD_PIXEL_WIDTH - (STATUS_BED_BYTEWIDTH + STATUS_CHAMBER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) #endif #ifdef STATUS_BED_ANIM @@ -657,81 +667,104 @@ #endif #endif +#else + #define STATUS_BED_WIDTH 0 +#endif -#endif // !STATUS_BED_WIDTH && !STATUS_COMBINE_HEATERS && HAS_HEATED_BED && HOTENDS < 4 +#if !STATUS_CHAMBER_WIDTH && HAS_HEATED_CHAMBER && ((HOTENDS <= 4 && !HAS_HEATED_BED) || (HOTENDS <= 3 && HAS_HEATED_BED)) -#if HAS_HEATED_CHAMBER + #define STATUS_CHAMBER_WIDTH 21 - #define STATUS_CHAMBER_WIDTH 16 + #if STATUS_HEATERS_WIDTH + #if ENABLED(STATUS_COMBINE_HEATERS) + #define STATUS_CHAMBER_X (LCD_PIXEL_WIDTH - 2 - (STATUS_CHAMBER_BYTEWIDTH) * 8) + #elif HAS_FAN0 && HAS_HEATED_BED && HOTENDS <= 2 + #define STATUS_CHAMBER_X (LCD_PIXEL_WIDTH - 2 - (STATUS_HEATERS_BYTEWIDTH - STATUS_CHAMBER_BYTEWIDTH) * 8) + #elif HAS_FAN0 && !HAS_HEATED_BED + #define STATUS_CHAMBER_X (LCD_PIXEL_WIDTH - (STATUS_CHAMBER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) + #else + #define STATUS_CHAMBER_X (LCD_PIXEL_WIDTH - (STATUS_CHAMBER_BYTEWIDTH) * 8) + #endif + #endif #ifdef STATUS_CHAMBER_ANIM const unsigned char status_chamber_bmp[] PROGMEM = { - B11111111,B11111111, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B10000000,B00000001, - B11111111,B11111111, - B11111111,B11111111 + B00011111,B11111111,B11111000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00010000,B00000000,B00001000, + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; const unsigned char status_chamber_on_bmp[] PROGMEM = { - B11111111,B11111111, - B10000000,B00000001, - B10000100,B00100001, - B10000010,B00010001, - B10000010,B00010001, - B10000100,B00100001, - B10001000,B01000001, - B10001000,B01000001, - B10000100,B00100001, - B10000000,B00000001, - B11111111,B11111111, - B11111111,B11111111 + B00011111,B11111111,B11111000, + B00010000,B00000000,B00001000, + B00010000,B10000100,B00001000, + B00010000,B01000010,B00001000, + B00010000,B01000010,B00001000, + B00010000,B10000100,B00001000, + B00010001,B00001000,B00001000, + B00010001,B00001000,B00001000, + B00010000,B10000100,B00001000, + B00010000,B00000000,B00001000, + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; #else const unsigned char status_chamber_bmp[] PROGMEM = { - B11111111,B11111111, - B10000000,B00000001, - B10000100,B00100001, - B10000010,B00010001, - B10000010,B00010001, - B10000100,B00100001, - B10001000,B01000001, - B10001000,B01000001, - B10000100,B00100001, - B10000000,B00000001, - B11111111,B11111111, - B11111111,B11111111 + B00011111,B11111111,B11111000, + B00010000,B00000000,B00001000, + B00010000,B10000100,B00001000, + B00010000,B01000010,B00001000, + B00010000,B01000010,B00001000, + B00010000,B10000100,B00001000, + B00010001,B00001000,B00001000, + B00010001,B00001000,B00001000, + B00010000,B10000100,B00001000, + B00010000,B00000000,B00001000, + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; #endif +#else // HAS_HEATED_CHAMBER + #define STATUS_CHAMBER_WIDTH 0 +#endif -#endif // HAS_HEATED_CHAMBER +#define BED_CHAM (HAS_HEATED_BED || HAS_HEATED_CHAMBER) +#define BED_CHAM_FAN (BED_CHAM || HAS_FAN0) -// Can also be overridden in Configuration.h +// Can also be overridden in Configuration_adv.h // If you can afford it, try the 3-frame fan animation! // Don't compile in the fan animation with no fan -#if !HAS_FAN0 +#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_CHAM) || (ENABLED(STATUS_COMBINE_HEATERS) && HAS_HEATED_CHAMBER)) #undef STATUS_FAN_FRAMES -#elif !defined(STATUS_FAN_FRAMES) +#elif !STATUS_FAN_FRAMES #define STATUS_FAN_FRAMES 2 #elif STATUS_FAN_FRAMES > 4 #error "A maximum of 4 fan animation frames is currently supported." #endif +#if HOTENDS > 4 + #undef STATUS_LOGO_WIDTH + #undef STATUS_HEATERS_XSPACE + #define STATUS_HEATERS_XSPACE 24 +#endif + // // Provide default Fan Bitmaps // -#if !defined(STATUS_FAN_WIDTH) && STATUS_FAN_FRAMES > 0 +#if !STATUS_FAN_WIDTH && STATUS_FAN_FRAMES > 0 // Provide a fan animation if none exists @@ -836,7 +869,7 @@ #elif STATUS_FAN_FRAMES == 3 - #define STATUS_FAN_WIDTH 21 + #define STATUS_FAN_WIDTH 20 #if ENABLED(STATUS_ALT_FAN_BITMAP) @@ -974,7 +1007,7 @@ #elif STATUS_FAN_FRAMES == 4 - #define STATUS_FAN_WIDTH 21 + #define STATUS_FAN_WIDTH 20 #if ENABLED(STATUS_ALT_FAN_BITMAP) @@ -1153,6 +1186,35 @@ #endif // !STATUS_ALT_FAN_BITMAP #endif +#else + #undef STATUS_FAN_FRAMES + #define STATUS_FAN_WIDTH 0 +#endif + +#if ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) + + #if STATUS_HOTEND1_WIDTH + #define HAS_SPACES ((LCD_PIXEL_WIDTH - (HOTENDS * STATUS_HOTEND1_WIDTH) - STATUS_BED_WIDTH - STATUS_CHAMBER_WIDTH - STATUS_FAN_WIDTH - 24) < STATUS_LOGO_WIDTH ? true : false) + #elif STATUS_HEATERS_WIDTH + #define HAS_SPACES (((LCD_PIXEL_WIDTH - STATUS_HEATERS_WIDTH - STATUS_BED_WIDTH - STATUS_CHAMBER_WIDTH - STATUS_FAN_WIDTH - 20) < STATUS_LOGO_WIDTH) ? true : false) + #endif + + #if HAS_SPACES + #undef STATUS_LOGO_WIDTH + #endif + + #if (HOTENDS > 1 && STATUS_LOGO_WIDTH && BED_CHAM_FAN) || ( HOTENDS >= 3 && !BED_CHAM_FAN) + #define _STATUS_HEATERS_X(H,S,N) (((LCD_PIXEL_WIDTH - (H * (S + N)) - STATUS_LOGO_WIDTH - STATUS_BED_WIDTH - STATUS_CHAMBER_WIDTH - STATUS_FAN_WIDTH) / 2) + STATUS_LOGO_WIDTH) + #if STATUS_HOTEND1_WIDTH + #if HOTENDS > 2 + #define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 6) + #else + #define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 4) + #endif + #else + #define STATUS_HEATERS_X _STATUS_HEATERS_X(1, STATUS_HEATERS_WIDTH, 4) + #endif + #endif #endif @@ -1187,14 +1249,25 @@ #if STATUS_HOTEND1_WIDTH || STATUS_HEATERS_WIDTH #ifndef STATUS_HEATERS_XSPACE - #define STATUS_HEATERS_XSPACE 24 // Like the included bitmaps + #if (HOTENDS == 3 || HOTENDS == 4) && ENABLED(STATUS_COMBINE_HEATERS) + #define STATUS_HEATERS_XSPACE 24 + #else + #define STATUS_HEATERS_XSPACE 26 // Like the included bitmaps + #endif #endif #ifndef STATUS_HEATERS_X #if STATUS_LOGO_BYTEWIDTH - #define STATUS_HEATERS_X ((STATUS_LOGO_BYTEWIDTH + 0) * 8) + #define STATUS_HEATERS_X (STATUS_LOGO_BYTEWIDTH * 8) + #elif ((STATUS_CHAMBER_WIDTH || STATUS_FAN_WIDTH) && (STATUS_BED_WIDTH && STATUS_HOTEND_BITMAPS == 3)) || \ + ((STATUS_CHAMBER_WIDTH || STATUS_FAN_WIDTH || STATUS_BED_WIDTH) && STATUS_HOTEND_BITMAPS == 4) + #define STATUS_HEATERS_X 5 #else - #define STATUS_HEATERS_X 8 // Like the included bitmaps + #if ENABLED(STATUS_COMBINE_HEATERS) && HAS_HEATED_BED && HOTENDS <= 4 + #define STATUS_HEATERS_X 5 + #else + #define STATUS_HEATERS_X 8 // Like the included bitmaps + #endif #endif #endif @@ -1205,7 +1278,6 @@ // // Hotend images. A base hotend image and optional "ON" state image. // - #ifndef STATUS_HOTEND_BITMAPS #define STATUS_HOTEND_BITMAPS 1 #endif @@ -1257,20 +1329,21 @@ #ifndef STATUS_HOTEND2_X #define STATUS_HOTEND2_X STATUS_HOTEND1_X + STATUS_HEATERS_XSPACE #endif - #ifndef STATUS_HOTEND3_X - #define STATUS_HOTEND3_X STATUS_HOTEND2_X + STATUS_HEATERS_XSPACE - #endif - #ifndef STATUS_HOTEND4_X - #define STATUS_HOTEND4_X STATUS_HOTEND3_X + STATUS_HEATERS_XSPACE - #endif - #ifndef STATUS_HOTEND5_X - #define STATUS_HOTEND5_X STATUS_HOTEND4_X + STATUS_HEATERS_XSPACE - #endif - #ifndef STATUS_HOTEND6_X - #define STATUS_HOTEND6_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE - #endif #if HOTENDS > 2 + #ifndef STATUS_HOTEND3_X + #define STATUS_HOTEND3_X STATUS_HOTEND2_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND4_X + #define STATUS_HOTEND4_X STATUS_HOTEND3_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND5_X + #define STATUS_HOTEND5_X STATUS_HOTEND4_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND6_X + #define STATUS_HOTEND6_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE + #endif + constexpr uint8_t status_hotend_x[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_X, STATUS_HOTEND2_X, STATUS_HOTEND3_X, STATUS_HOTEND4_X, STATUS_HOTEND5_X, STATUS_HOTEND6_X); #define STATUS_HOTEND_X(N) status_hotend_x[N] #elif HOTENDS > 1 @@ -1303,7 +1376,7 @@ #endif #endif - #if STATUS_HOTEND_BITMAPS > 1 + #if STATUS_HOTEND_BITMAPS > 1 && DISABLED(STATUS_HOTEND_NUMBERLESS) #define TEST_BITMAP_OFF status_hotend1_a_bmp #define TEST_BITMAP_ON status_hotend1_b_bmp #else @@ -1341,7 +1414,11 @@ #define STATUS_HOTEND_X(N) (STATUS_HEATERS_X + 2 + (N) * (STATUS_HEATERS_XSPACE)) #endif #ifndef STATUS_HOTEND_TEXT_X - #define STATUS_HOTEND_TEXT_X(N) (STATUS_HEATERS_X + 6 + (N) * (STATUS_HEATERS_XSPACE)) + #if HOTENDS == 4 && STATUS_LOGO_WIDTH + #define STATUS_HOTEND_TEXT_X(N) (STATUS_HEATERS_X + 6 + (N) * (STATUS_HEATERS_XSPACE)) + #else + #define STATUS_HOTEND_TEXT_X(N) (STATUS_HEATERS_X + 6 + (N) * (STATUS_HEATERS_XSPACE)) + #endif #endif #ifndef STATUS_HEATERS_BYTEWIDTH #define STATUS_HEATERS_BYTEWIDTH BW(STATUS_HEATERS_WIDTH) @@ -1363,16 +1440,13 @@ // // Chamber Bitmap Properties // -#ifndef STATUS_CHAMBER_WIDTH - #define STATUS_CHAMBER_WIDTH 0 -#endif #ifndef STATUS_CHAMBER_BYTEWIDTH #define STATUS_CHAMBER_BYTEWIDTH BW(STATUS_CHAMBER_WIDTH) #endif -#if STATUS_CHAMBER_WIDTH && !STATUS_HEATERS_WIDTH +#if STATUS_CHAMBER_WIDTH #ifndef STATUS_CHAMBER_X - #define STATUS_CHAMBER_X (128 - (STATUS_FAN_BYTEWIDTH + STATUS_CHAMBER_BYTEWIDTH) * 8) + #define STATUS_CHAMBER_X (LCD_PIXEL_WIDTH - (STATUS_CHAMBER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) #endif #ifndef STATUS_CHAMBER_HEIGHT @@ -1388,7 +1462,7 @@ #endif #ifndef STATUS_CHAMBER_TEXT_X - #define STATUS_CHAMBER_TEXT_X (STATUS_CHAMBER_X + 7) + #define STATUS_CHAMBER_TEXT_X (STATUS_CHAMBER_X + 11) #endif static_assert( @@ -1407,16 +1481,13 @@ // // Bed Bitmap Properties // -#ifndef STATUS_BED_WIDTH - #define STATUS_BED_WIDTH 0 -#endif #ifndef STATUS_BED_BYTEWIDTH #define STATUS_BED_BYTEWIDTH BW(STATUS_BED_WIDTH) #endif #if STATUS_BED_WIDTH && !STATUS_HEATERS_WIDTH #ifndef STATUS_BED_X - #define STATUS_BED_X (128 - (STATUS_CHAMBER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH + STATUS_BED_BYTEWIDTH) * 8) + #define STATUS_BED_X (LCD_PIXEL_WIDTH - (STATUS_CHAMBER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH + STATUS_BED_BYTEWIDTH) * 8) #endif #ifndef STATUS_BED_HEIGHT @@ -1432,7 +1503,7 @@ #endif #ifndef STATUS_BED_TEXT_X - #define STATUS_BED_TEXT_X (STATUS_BED_X + 11) + #define STATUS_BED_TEXT_X (STATUS_BED_X + 9) #endif static_assert( @@ -1445,27 +1516,23 @@ "Status bed bitmap (status_bed_on_bmp) dimensions don't match data." ); #endif - #endif // // Fan Bitmap Properties // -#ifndef STATUS_FAN_WIDTH - #define STATUS_FAN_WIDTH 0 -#endif #ifndef STATUS_FAN_BYTEWIDTH #define STATUS_FAN_BYTEWIDTH BW(STATUS_FAN_WIDTH) #endif #if STATUS_FAN_FRAMES #ifndef STATUS_FAN_X - #define STATUS_FAN_X (128 - (STATUS_FAN_BYTEWIDTH) * 8) + #define STATUS_FAN_X (LCD_PIXEL_WIDTH - (STATUS_FAN_BYTEWIDTH) * 8) #endif #ifndef STATUS_FAN_Y #define STATUS_FAN_Y 1 #endif #ifndef STATUS_FAN_TEXT_X - #define STATUS_FAN_TEXT_X 103 + #define STATUS_FAN_TEXT_X (STATUS_FAN_X - 1) #endif #ifndef STATUS_FAN_TEXT_Y #define STATUS_FAN_TEXT_Y 28 diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 4db6752b4..94c700012 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -63,13 +63,18 @@ #define EXTRAS_BASELINE (40 + INFO_FONT_ASCENT) #define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT) -#define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH && HOTENDS <= 3 && DISABLED(STATUS_COMBINE_HEATERS)) -#define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && STATUS_FAN_FRAMES) +#define DO_DRAW_LOGO (STATUS_LOGO_WIDTH && ENABLED(CUSTOM_STATUS_SCREEN_IMAGE)) +#define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH && HOTENDS <= 4) +#define DO_DRAW_CHAMBER (HAS_HEATED_CHAMBER && STATUS_CHAMBER_WIDTH && HOTENDS <= 4) +#define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && HOTENDS <= 4 && defined(STATUS_FAN_FRAMES)) + #define ANIM_HOTEND (HOTENDS && ENABLED(STATUS_HOTEND_ANIM)) #define ANIM_BED (DO_DRAW_BED && ENABLED(STATUS_BED_ANIM)) -#define ANIM_CHAMBER (HAS_HEATED_CHAMBER && ENABLED(STATUS_CHAMBER_ANIM)) +#define ANIM_CHAMBER (DO_DRAW_CHAMBER && ENABLED(STATUS_CHAMBER_ANIM)) + +#define ANIM_HBC (ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER) -#if ANIM_HOTEND || ANIM_BED +#if ANIM_HBC uint8_t heat_bits; #endif #if ANIM_HOTEND @@ -109,7 +114,7 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin UNUSED(blink); #endif - #if HAS_HEATED_BED + #if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS) || (HAS_HEATED_BED && ENABLED(STATUS_COMBINE_HEATERS) && HOTENDS <= 4) const bool isBed = heater < 0; #define IFBED(A,B) (isBed ? (A) : (B)) #else @@ -125,11 +130,11 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin const uint8_t tx = IFBED(STATUS_BED_TEXT_X, STATUS_HOTEND_TEXT_X(heater)); #if ENABLED(MARLIN_DEV_MODE) - const float temp = 20 + (millis() >> 8) % IFBED(100, 200); - const float target = IFBED(100, 200); + const float temp = 20 + (millis() >> 8) % IFBED(100, 200), + target = IFBED(100, 200); #else const float temp = IFBED(thermalManager.degBed(), thermalManager.degHotend(heater)), - target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater)); + target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater)); #endif #if DISABLED(STATUS_HOTEND_ANIM) @@ -140,7 +145,7 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin #define HOTEND_DOT false #endif - #if HAS_HEATED_BED && DISABLED(STATUS_BED_ANIM) + #if DO_DRAW_BED && DISABLED(STATUS_BED_ANIM) #define STATIC_BED true #define BED_DOT isHeat #else @@ -148,7 +153,13 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin #define BED_DOT false #endif - #if ANIM_HOTEND && ENABLED(STATUS_HOTEND_INVERTED) + #if ANIM_HOTEND && BOTH(STATUS_HOTEND_INVERTED, STATUS_HOTEND_NUMBERLESS) + #define OFF_BMP(N) status_hotend_b_bmp + #define ON_BMP(N) status_hotend_a_bmp + #elif ANIM_HOTEND && DISABLED(STATUS_HOTEND_INVERTED) && ENABLED(STATUS_HOTEND_NUMBERLESS) + #define OFF_BMP(N) status_hotend_a_bmp + #define ON_BMP(N) status_hotend_b_bmp + #elif ANIM_HOTEND && ENABLED(STATUS_HOTEND_INVERTED) #define OFF_BMP(N) status_hotend##N##_b_bmp #define ON_BMP(N) status_hotend##N##_a_bmp #else @@ -179,10 +190,11 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f); NOMORE(tall, BAR_TALL); - #ifdef STATUS_HOTEND_ANIM + #if ANIM_HOTEND // Draw hotend bitmap, either whole or split by the heating percent if (IFBED(0, 1)) { - const uint8_t hx = STATUS_HOTEND_X(heater), bw = STATUS_HOTEND_BYTEWIDTH(heater); + const uint8_t hx = STATUS_HOTEND_X(heater), + bw = STATUS_HOTEND_BYTEWIDTH(heater); #if ENABLED(STATUS_HEAT_PERCENT) if (isHeat && tall <= BAR_TALL) { const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall; @@ -196,10 +208,10 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin #endif // Draw a heating progress bar, if specified - #if ENABLED(STATUS_HEAT_PERCENT) + #if DO_DRAW_BED && ENABLED(STATUS_HEAT_PERCENT) if (IFBED(true, STATIC_HOTEND) && isHeat) { - const uint8_t bx = IFBED(STATUS_BED_X + STATUS_BED_WIDTH, STATUS_HOTEND_X(heater) + STATUS_HOTEND_WIDTH(heater)) + 1; + const uint8_t bx = IFBED(STATUS_BED_X + STATUS_BED_WIDTH - 1, STATUS_HOTEND_X(heater) + STATUS_HOTEND_WIDTH(heater)) + 1; u8g.drawFrame(bx, STATUS_HEATERS_Y, 3, STATUS_HEATERS_HEIGHT); if (tall) { const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall; @@ -233,11 +245,16 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin } -#if HAS_HEATED_CHAMBER +#if DO_DRAW_CHAMBER FORCE_INLINE void _draw_chamber_status(const bool blink) { - const float temp = thermalManager.degChamber(), + #if ENABLED(MARLIN_DEV_MODE) + const float temp = 10 + (millis() >> 8) % CHAMBER_MAXTEMP, + target = CHAMBER_MAXTEMP; + #else + const float temp = thermalManager.degChamber(), target = thermalManager.degTargetChamber(); + #endif #if !HEATER_IDLE_HANDLER UNUSED(blink); #endif @@ -299,7 +316,7 @@ void MarlinUI::draw_status_screen() { // At the first page, generate new display values if (first_page) { - #if ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER + #if ANIM_HBC uint8_t new_bits = 0; #if ANIM_HOTEND HOTEND_LOOP() if (thermalManager.isHeatingHotend(e) ^ SHOW_ON_STATE) SBI(new_bits, e); @@ -307,14 +324,14 @@ void MarlinUI::draw_status_screen() { #if ANIM_BED if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(new_bits, 7); #endif - #if ANIM_CHAMBER + #if DO_DRAW_CHAMBER if (thermalManager.isHeatingChamber() ^ SHOW_ON_STATE) SBI(new_bits, 6); #endif heat_bits = new_bits; #endif strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); - strcpy(zstring, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS]))); + strcpy(zstring, ftostr52sp( LOGICAL_Z_POSITION(current_position[Z_AXIS]))); #if ENABLED(FILAMENT_LCD_DISPLAY) strcpy(wstring, ftostr12ns(filament_width_meas)); strcpy(mstring, i16tostr3(100.0 * ( @@ -335,7 +352,7 @@ void MarlinUI::draw_status_screen() { TCNT5 = 0; #endif - #if STATUS_LOGO_WIDTH + #if DO_DRAW_LOGO if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1)) u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp); #endif @@ -346,13 +363,14 @@ void MarlinUI::draw_status_screen() { u8g.drawBitmapP(STATUS_HEATERS_X, STATUS_HEATERS_Y, STATUS_HEATERS_BYTEWIDTH, STATUS_HEATERS_HEIGHT, status_heaters_bmp); #endif - #if DO_DRAW_BED + #if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS) #if ANIM_BED #define BED_BITMAP(S) ((S) ? status_bed_on_bmp : status_bed_bmp) #else #define BED_BITMAP(S) status_bed_bmp #endif - const uint8_t bedy = STATUS_BED_Y(BED_ALT()), bedh = STATUS_BED_HEIGHT(BED_ALT()); + const uint8_t bedy = STATUS_BED_Y(BED_ALT()), + bedh = STATUS_BED_HEIGHT(BED_ALT()); if (PAGE_CONTAINS(bedy, bedy + bedh - 1)) u8g.drawBitmapP(STATUS_BED_X, bedy, STATUS_BED_BYTEWIDTH, bedh, BED_BITMAP(BED_ALT())); #endif @@ -363,12 +381,10 @@ void MarlinUI::draw_status_screen() { #else #define CHAMBER_BITMAP(S) status_chamber_bmp #endif - if (PAGE_CONTAINS(STATUS_CHAMBER_Y, STATUS_CHAMBER_Y + STATUS_CHAMBER_HEIGHT - 1)) - u8g.drawBitmapP( - STATUS_CHAMBER_X, STATUS_CHAMBER_Y, - STATUS_CHAMBER_BYTEWIDTH, STATUS_CHAMBER_HEIGHT, - CHAMBER_BITMAP(CHAMBER_ALT()) - ); + const uint8_t chambery = STATUS_CHAMBER_Y(CHAMBER_ALT()), + chamberh = STATUS_CHAMBER_HEIGHT(CHAMBER_ALT()); + if (PAGE_CONTAINS(chambery, chambery + chamberh - 1)) + u8g.drawBitmapP(STATUS_CHAMBER_X, chambery, STATUS_CHAMBER_BYTEWIDTH, chamberh, CHAMBER_BITMAP(CHAMBER_ALT())); #endif #if DO_DRAW_FAN @@ -381,9 +397,7 @@ void MarlinUI::draw_status_screen() { } #endif if (PAGE_CONTAINS(STATUS_FAN_Y, STATUS_FAN_Y + STATUS_FAN_HEIGHT - 1)) - u8g.drawBitmapP( - STATUS_FAN_X, STATUS_FAN_Y, - STATUS_FAN_BYTEWIDTH, STATUS_FAN_HEIGHT, + u8g.drawBitmapP(STATUS_FAN_X, STATUS_FAN_Y, STATUS_FAN_BYTEWIDTH, STATUS_FAN_HEIGHT, #if STATUS_FAN_FRAMES > 2 fan_frame == 1 ? status_fan1_bmp : fan_frame == 2 ? status_fan2_bmp : @@ -400,18 +414,17 @@ void MarlinUI::draw_status_screen() { // // Temperature Graphics and Info // - if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) { // Extruders for (uint8_t e = 0; e < MAX_HOTEND_DRAW; ++e) _draw_heater_status((heater_ind_t)e, blink); // Heated bed - #if HAS_HEATED_BED && HOTENDS < 4 + #if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS) || (HAS_HEATED_BED && ENABLED(STATUS_COMBINE_HEATERS) && HOTENDS <= 4) _draw_heater_status(H_BED, blink); #endif - #if HAS_HEATED_CHAMBER + #if DO_DRAW_CHAMBER _draw_chamber_status(blink); #endif @@ -575,7 +588,6 @@ void MarlinUI::draw_status_screen() { // // Feedrate // - #define EXTRAS_2_BASELINE (EXTRAS_BASELINE + 3) if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) { @@ -602,7 +614,6 @@ void MarlinUI::draw_status_screen() { // // Status line // - if (PAGE_CONTAINS(STATUS_BASELINE - INFO_FONT_ASCENT, STATUS_BASELINE + INFO_FONT_DESCENT)) { lcd_moveto(0, STATUS_BASELINE);