103103
104104#elif ENABLED(YHCB2004)
105105
106- LCD_CLASS lcd (YHCB2004_CLK , 20 , 4 , YHCB2004_MOSI, YHCB2004_MISO ); // CLK, cols, rows, MOSI, MISO
106+ LCD_CLASS lcd (YHCB2004_SCK_PIN , 20 , 4 , YHCB2004_MOSI_PIN, YHCB2004_MISO_PIN ); // CLK, cols, rows, MOSI, MISO
107107
108108#else
109109
@@ -521,7 +521,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
521521 else if (axis_should_home (axis))
522522 while (const char c = *value++) lcd_put_lchar (c <= ' .' ? c : ' ?' );
523523 else if (NONE (HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted (axis))
524- lcd_put_u8str (axis == Z_AXIS ? F (" " ) : F (" " ));
524+ lcd_put_u8str (TERN0 (HAS_Z_AXIS, axis == Z_AXIS) ? F (" " ) : F (" " ));
525525 else
526526 lcd_put_u8str (value);
527527}
@@ -537,7 +537,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
537537 */
538538FORCE_INLINE void _draw_heater_status (const heater_id_t heater_id, const char prefix, const bool blink) {
539539 #if HAS_HEATED_BED
540- const bool isBed = TERN (HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0 ) ;
540+ const bool isBed = heater_id == H_BED;
541541 const celsius_t t1 = (isBed ? thermalManager.wholeDegBed () : thermalManager.wholeDegHotend (heater_id)),
542542 t2 = (isBed ? thermalManager.degTargetBed () : thermalManager.degTargetHotend (heater_id));
543543 #else
@@ -546,7 +546,17 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
546546
547547 if (prefix >= 0 ) lcd_put_lchar (prefix);
548548
549- lcd_put_u8str (t1 < 0 ? " err" : i16tostr3rj (t1));
549+ if (t1 >= 0 )
550+ lcd_put_u8str (ui16tostr3rj (t1));
551+ else {
552+ #if ENABLED(SHOW_TEMPERATURE_BELOW_ZERO)
553+ char * const str = i16tostr3rj (t1);
554+ lcd_put_u8str (&str[1 ]);
555+ #else
556+ lcd_put_u8str (F (" err" ));
557+ #endif
558+ }
559+
550560 lcd_put_u8str (F (" /" ));
551561
552562 #if !HEATER_IDLE_HANDLER
@@ -762,9 +772,10 @@ void MarlinUI::draw_status_message(const bool blink) {
762772 #define TPOFFSET (LCD_WIDTH - 1 )
763773 static uint8_t timepos = TPOFFSET - 6 ;
764774 static char buffer[8 ];
765- static lcd_uint_t pc, pr;
766775
767776 #if ENABLED(SHOW_PROGRESS_PERCENT)
777+ static lcd_uint_t pc = 0 , pr = 2 ;
778+ inline void setPercentPos (const lcd_uint_t c, const lcd_uint_t r) { pc = c; pr = r; }
768779 void MarlinUI::drawPercent () {
769780 const uint8_t progress = ui.get_progress_percent ();
770781 if (progress) {
@@ -926,7 +937,7 @@ void MarlinUI::draw_status_screen() {
926937 #if LCD_WIDTH < 20
927938
928939 #if HAS_PRINT_PROGRESS
929- pc = 0 ; pr = 2 ;
940+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( 0 , 2 )) ;
930941 rotate_progress ();
931942 #endif
932943
@@ -952,25 +963,25 @@ void MarlinUI::draw_status_screen() {
952963
953964 // Two-component mix / gradient instead of XY
954965
955- char mixer_messages[12 ];
956- const char * mix_label;
966+ char mixer_messages[15 ];
967+ PGM_P mix_label;
957968 #if ENABLED(GRADIENT_MIX)
958969 if (mixer.gradient .enabled ) {
959970 mixer.update_mix_from_gradient ();
960- mix_label = " Gr" ;
971+ mix_label = PSTR ( " Gr" ) ;
961972 }
962973 else
963974 #endif
964975 {
965976 mixer.update_mix_from_vtool ();
966- mix_label = " Mx" ;
977+ mix_label = PSTR ( " Mx" ) ;
967978 }
968- sprintf_P (mixer_messages, PSTR (" %s %d;%d%% " ), mix_label, int (mixer.mix [0 ]), int (mixer.mix [1 ]));
979+ sprintf_P (mixer_messages, PSTR (S_FMT " %d;%d%% " ), mix_label, int (mixer.mix [0 ]), int (mixer.mix [1 ]));
969980 lcd_put_u8str (mixer_messages);
970981
971982 #else // !HAS_DUAL_MIXING
972983
973- const bool show_e_total = TERN0 (LCD_SHOW_E_TOTAL, printingIsActive ());
984+ const bool show_e_total = TERN1 (HAS_X_AXIS, TERN0 (LCD_SHOW_E_TOTAL, printingIsActive () ));
974985
975986 if (show_e_total) {
976987 #if ENABLED(LCD_SHOW_E_TOTAL)
@@ -981,10 +992,14 @@ void MarlinUI::draw_status_screen() {
981992 #endif
982993 }
983994 else {
984- const xy_pos_t lpos = current_position.asLogical ();
985- _draw_axis_value (X_AXIS, ftostr4sign (lpos.x ), blink);
986- lcd_put_u8str (F (" " ));
987- _draw_axis_value (Y_AXIS, ftostr4sign (lpos.y ), blink);
995+ #if HAS_X_AXIS
996+ const xy_pos_t lpos = current_position.asLogical ();
997+ _draw_axis_value (X_AXIS, ftostr4sign (lpos.x ), blink);
998+ #endif
999+ #if HAS_Y_AXIS
1000+ TERN_ (HAS_X_AXIS, lcd_put_u8str (F (" " )));
1001+ _draw_axis_value (Y_AXIS, ftostr4sign (lpos.y ), blink);
1002+ #endif
9881003 }
9891004
9901005 #endif // !HAS_DUAL_MIXING
@@ -993,11 +1008,12 @@ void MarlinUI::draw_status_screen() {
9931008
9941009 #endif // LCD_WIDTH >= 20
9951010
996- lcd_moveto (LCD_WIDTH - 8 , 1 );
997- _draw_axis_value (Z_AXIS, ftostr52sp (LOGICAL_Z_POSITION (current_position.z )), blink);
998-
999- #if HAS_LEVELING && !HAS_HEATED_BED
1000- lcd_put_lchar (planner.leveling_active || blink ? ' _' : ' ' );
1011+ #if HAS_Z_AXIS
1012+ lcd_moveto (LCD_WIDTH - 8 , 1 );
1013+ _draw_axis_value (Z_AXIS, ftostr52sp (LOGICAL_Z_POSITION (current_position.z )), blink);
1014+ #if HAS_LEVELING && !HAS_HEATED_BED
1015+ lcd_put_lchar (planner.leveling_active || blink ? ' _' : ' ' );
1016+ #endif
10011017 #endif
10021018
10031019 #endif // LCD_HEIGHT > 2
@@ -1013,7 +1029,7 @@ void MarlinUI::draw_status_screen() {
10131029 #if LCD_WIDTH >= 20
10141030
10151031 #if HAS_PRINT_PROGRESS
1016- pc = 6 ; pr = 2 ;
1032+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( 6 , 2 )) ;
10171033 rotate_progress ();
10181034 #else
10191035 char c;
@@ -1059,8 +1075,10 @@ void MarlinUI::draw_status_screen() {
10591075 //
10601076 // Z Coordinate
10611077 //
1062- lcd_moveto (LCD_WIDTH - 9 , 0 );
1063- _draw_axis_value (Z_AXIS, ftostr52sp (LOGICAL_Z_POSITION (current_position.z )), blink);
1078+ #if HAS_Z_AXIS
1079+ lcd_moveto (LCD_WIDTH - 9 , 0 );
1080+ _draw_axis_value (Z_AXIS, ftostr52sp (LOGICAL_Z_POSITION (current_position.z )), blink);
1081+ #endif
10641082
10651083 #if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
10661084 lcd_put_lchar (LCD_WIDTH - 1 , 0 , planner.leveling_active || blink ? ' _' : ' ' );
@@ -1094,15 +1112,15 @@ void MarlinUI::draw_status_screen() {
10941112 _draw_bed_status (blink);
10951113 #elif HAS_PRINT_PROGRESS
10961114 #define DREW_PRINT_PROGRESS 1
1097- pc = 0 ; pr = 2 ;
1115+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( 0 , 2 )) ;
10981116 rotate_progress ();
10991117 #endif
11001118
11011119 //
11021120 // All progress strings
11031121 //
11041122 #if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
1105- pc = LCD_WIDTH - 9 ; pr = 2 ;
1123+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( LCD_WIDTH - 9 , 2 )) ;
11061124 rotate_progress ();
11071125 #endif
11081126 #endif // LCD_INFO_SCREEN_STYLE 1
0 commit comments