103
103
104
104
#elif ENABLED(YHCB2004)
105
105
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
107
107
108
108
#else
109
109
@@ -521,7 +521,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
521
521
else if (axis_should_home (axis))
522
522
while (const char c = *value++) lcd_put_lchar (c <= ' .' ? c : ' ?' );
523
523
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 (" " ));
525
525
else
526
526
lcd_put_u8str (value);
527
527
}
@@ -537,7 +537,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
537
537
*/
538
538
FORCE_INLINE void _draw_heater_status (const heater_id_t heater_id, const char prefix, const bool blink) {
539
539
#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;
541
541
const celsius_t t1 = (isBed ? thermalManager.wholeDegBed () : thermalManager.wholeDegHotend (heater_id)),
542
542
t2 = (isBed ? thermalManager.degTargetBed () : thermalManager.degTargetHotend (heater_id));
543
543
#else
@@ -546,7 +546,17 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
546
546
547
547
if (prefix >= 0 ) lcd_put_lchar (prefix);
548
548
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
+
550
560
lcd_put_u8str (F (" /" ));
551
561
552
562
#if !HEATER_IDLE_HANDLER
@@ -762,9 +772,10 @@ void MarlinUI::draw_status_message(const bool blink) {
762
772
#define TPOFFSET (LCD_WIDTH - 1 )
763
773
static uint8_t timepos = TPOFFSET - 6 ;
764
774
static char buffer[8 ];
765
- static lcd_uint_t pc, pr;
766
775
767
776
#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; }
768
779
void MarlinUI::drawPercent () {
769
780
const uint8_t progress = ui.get_progress_percent ();
770
781
if (progress) {
@@ -926,7 +937,7 @@ void MarlinUI::draw_status_screen() {
926
937
#if LCD_WIDTH < 20
927
938
928
939
#if HAS_PRINT_PROGRESS
929
- pc = 0 ; pr = 2 ;
940
+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( 0 , 2 )) ;
930
941
rotate_progress ();
931
942
#endif
932
943
@@ -952,25 +963,25 @@ void MarlinUI::draw_status_screen() {
952
963
953
964
// Two-component mix / gradient instead of XY
954
965
955
- char mixer_messages[12 ];
956
- const char * mix_label;
966
+ char mixer_messages[15 ];
967
+ PGM_P mix_label;
957
968
#if ENABLED(GRADIENT_MIX)
958
969
if (mixer.gradient .enabled ) {
959
970
mixer.update_mix_from_gradient ();
960
- mix_label = " Gr" ;
971
+ mix_label = PSTR ( " Gr" ) ;
961
972
}
962
973
else
963
974
#endif
964
975
{
965
976
mixer.update_mix_from_vtool ();
966
- mix_label = " Mx" ;
977
+ mix_label = PSTR ( " Mx" ) ;
967
978
}
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 ]));
969
980
lcd_put_u8str (mixer_messages);
970
981
971
982
#else // !HAS_DUAL_MIXING
972
983
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 () ));
974
985
975
986
if (show_e_total) {
976
987
#if ENABLED(LCD_SHOW_E_TOTAL)
@@ -981,10 +992,14 @@ void MarlinUI::draw_status_screen() {
981
992
#endif
982
993
}
983
994
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
988
1003
}
989
1004
990
1005
#endif // !HAS_DUAL_MIXING
@@ -993,11 +1008,12 @@ void MarlinUI::draw_status_screen() {
993
1008
994
1009
#endif // LCD_WIDTH >= 20
995
1010
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
1001
1017
#endif
1002
1018
1003
1019
#endif // LCD_HEIGHT > 2
@@ -1013,7 +1029,7 @@ void MarlinUI::draw_status_screen() {
1013
1029
#if LCD_WIDTH >= 20
1014
1030
1015
1031
#if HAS_PRINT_PROGRESS
1016
- pc = 6 ; pr = 2 ;
1032
+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( 6 , 2 )) ;
1017
1033
rotate_progress ();
1018
1034
#else
1019
1035
char c;
@@ -1059,8 +1075,10 @@ void MarlinUI::draw_status_screen() {
1059
1075
//
1060
1076
// Z Coordinate
1061
1077
//
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
1064
1082
1065
1083
#if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
1066
1084
lcd_put_lchar (LCD_WIDTH - 1 , 0 , planner.leveling_active || blink ? ' _' : ' ' );
@@ -1094,15 +1112,15 @@ void MarlinUI::draw_status_screen() {
1094
1112
_draw_bed_status (blink);
1095
1113
#elif HAS_PRINT_PROGRESS
1096
1114
#define DREW_PRINT_PROGRESS 1
1097
- pc = 0 ; pr = 2 ;
1115
+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( 0 , 2 )) ;
1098
1116
rotate_progress ();
1099
1117
#endif
1100
1118
1101
1119
//
1102
1120
// All progress strings
1103
1121
//
1104
1122
#if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
1105
- pc = LCD_WIDTH - 9 ; pr = 2 ;
1123
+ TERN_ (SHOW_PROGRESS_PERCENT, setPercentPos ( LCD_WIDTH - 9 , 2 )) ;
1106
1124
rotate_progress ();
1107
1125
#endif
1108
1126
#endif // LCD_INFO_SCREEN_STYLE 1
0 commit comments