|
@@ -31,6 +31,10 @@
|
31
|
31
|
#include "utility.h"
|
32
|
32
|
#include "duration_t.h"
|
33
|
33
|
|
|
34
|
+#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
35
|
+ #include "ubl.h"
|
|
36
|
+#endif
|
|
37
|
+
|
34
|
38
|
extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array.
|
35
|
39
|
|
36
|
40
|
////////////////////////////////////
|
|
@@ -417,7 +421,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
|
417
|
421
|
void lcd_erase_line(const int16_t line) {
|
418
|
422
|
lcd.setCursor(0, line);
|
419
|
423
|
for (uint8_t i = LCD_WIDTH + 1; --i;)
|
420
|
|
- lcd.print(' ');
|
|
424
|
+ lcd.write(' ');
|
421
|
425
|
}
|
422
|
426
|
|
423
|
427
|
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
|
|
@@ -434,9 +438,9 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) {
|
434
|
438
|
|
435
|
439
|
static void logo_lines(const char* const extra) {
|
436
|
440
|
int16_t indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
|
437
|
|
- lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" )); lcd.print('\x01');
|
|
441
|
+ lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" )); lcd.write('\x01');
|
438
|
442
|
lcd.setCursor(indent, 1); lcd_printPGM(PSTR("|Marlin|")); lcd_printPGM(extra);
|
439
|
|
- lcd.setCursor(indent, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" )); lcd.print('\x03');
|
|
443
|
+ lcd.setCursor(indent, 2); lcd.write('\x02'); lcd_printPGM(PSTR( "------" )); lcd.write('\x03');
|
440
|
444
|
}
|
441
|
445
|
|
442
|
446
|
void bootscreen() {
|
|
@@ -577,11 +581,11 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
|
577
|
581
|
lcd_printPGM(pstr);
|
578
|
582
|
else {
|
579
|
583
|
if (!axis_homed[axis])
|
580
|
|
- lcd.print('?');
|
|
584
|
+ lcd.write('?');
|
581
|
585
|
else {
|
582
|
586
|
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
583
|
587
|
if (!axis_known_position[axis])
|
584
|
|
- lcd.print(' ');
|
|
588
|
+ lcd.write(' ');
|
585
|
589
|
else
|
586
|
590
|
#endif
|
587
|
591
|
lcd_printPGM(pstr);
|
|
@@ -598,7 +602,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
|
598
|
602
|
if (prefix >= 0) lcd.print(prefix);
|
599
|
603
|
|
600
|
604
|
lcd.print(itostr3(t1 + 0.5));
|
601
|
|
- lcd.print('/');
|
|
605
|
+ lcd.write('/');
|
602
|
606
|
|
603
|
607
|
#if HEATER_IDLE_HANDLER
|
604
|
608
|
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
|
|
@@ -610,9 +614,9 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
|
610
|
614
|
);
|
611
|
615
|
|
612
|
616
|
if (!blink && is_idle) {
|
613
|
|
- lcd.print(' ');
|
614
|
|
- if (t2 >= 10) lcd.print(' ');
|
615
|
|
- if (t2 >= 100) lcd.print(' ');
|
|
617
|
+ lcd.write(' ');
|
|
618
|
+ if (t2 >= 10) lcd.write(' ');
|
|
619
|
+ if (t2 >= 100) lcd.write(' ');
|
616
|
620
|
}
|
617
|
621
|
else
|
618
|
622
|
#endif
|
|
@@ -620,8 +624,8 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
|
620
|
624
|
|
621
|
625
|
if (prefix >= 0) {
|
622
|
626
|
lcd.print((char)LCD_DEGREE_CHAR);
|
623
|
|
- lcd.print(' ');
|
624
|
|
- if (t2 < 10) lcd.print(' ');
|
|
627
|
+ lcd.write(' ');
|
|
628
|
+ if (t2 < 10) lcd.write(' ');
|
625
|
629
|
}
|
626
|
630
|
}
|
627
|
631
|
|
|
@@ -738,7 +742,7 @@ static void lcd_implementation_status_screen() {
|
738
|
742
|
lcd.print(itostr3(card.percentDone()));
|
739
|
743
|
else
|
740
|
744
|
lcd_printPGM(PSTR("---"));
|
741
|
|
- lcd.print('%');
|
|
745
|
+ lcd.write('%');
|
742
|
746
|
#endif // SDSUPPORT
|
743
|
747
|
|
744
|
748
|
#else // LCD_WIDTH >= 20
|
|
@@ -760,7 +764,7 @@ static void lcd_implementation_status_screen() {
|
760
|
764
|
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
|
761
|
765
|
lcd.print(ftostr4sign(current_position[X_AXIS]));
|
762
|
766
|
|
763
|
|
- lcd.print(' ');
|
|
767
|
+ lcd.write(' ');
|
764
|
768
|
|
765
|
769
|
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
|
766
|
770
|
lcd.print(ftostr4sign(current_position[Y_AXIS]));
|
|
@@ -784,7 +788,7 @@ static void lcd_implementation_status_screen() {
|
784
|
788
|
lcd.setCursor(0, 2);
|
785
|
789
|
lcd.print((char)LCD_FEEDRATE_CHAR);
|
786
|
790
|
lcd.print(itostr3(feedrate_percentage));
|
787
|
|
- lcd.print('%');
|
|
791
|
+ lcd.write('%');
|
788
|
792
|
|
789
|
793
|
#if LCD_WIDTH >= 20 && ENABLED(SDSUPPORT)
|
790
|
794
|
|
|
@@ -794,7 +798,7 @@ static void lcd_implementation_status_screen() {
|
794
|
798
|
lcd.print(itostr3(card.percentDone()));
|
795
|
799
|
else
|
796
|
800
|
lcd_printPGM(PSTR("---"));
|
797
|
|
- lcd.print('%');
|
|
801
|
+ lcd.write('%');
|
798
|
802
|
|
799
|
803
|
#endif // LCD_WIDTH >= 20 && SDSUPPORT
|
800
|
804
|
|
|
@@ -833,7 +837,7 @@ static void lcd_implementation_status_screen() {
|
833
|
837
|
lcd.print(ftostr12ns(filament_width_meas));
|
834
|
838
|
lcd_printPGM(PSTR(" V"));
|
835
|
839
|
lcd.print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
|
836
|
|
- lcd.print('%');
|
|
840
|
+ lcd.write('%');
|
837
|
841
|
return;
|
838
|
842
|
}
|
839
|
843
|
|
|
@@ -854,10 +858,10 @@ static void lcd_implementation_status_screen() {
|
854
|
858
|
lcd_print_utf(stat); // The string leaves space
|
855
|
859
|
chars -= slen - status_scroll_pos; // Amount of space left
|
856
|
860
|
}
|
857
|
|
- lcd.print('.'); // Always at 1+ spaces left, draw a dot
|
|
861
|
+ lcd.write('.'); // Always at 1+ spaces left, draw a dot
|
858
|
862
|
if (--chars) {
|
859
|
863
|
if (status_scroll_pos < slen + 1) // Draw a second dot if there's space
|
860
|
|
- --chars, lcd.print('.');
|
|
864
|
+ --chars, lcd.write('.');
|
861
|
865
|
if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message
|
862
|
866
|
}
|
863
|
867
|
}
|
|
@@ -893,7 +897,7 @@ static void lcd_implementation_status_screen() {
|
893
|
897
|
lcd.setCursor(0, row);
|
894
|
898
|
if (center && !valstr) {
|
895
|
899
|
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
|
896
|
|
- while (--pad >= 0) { lcd.print(' '); n--; }
|
|
900
|
+ while (--pad >= 0) { lcd.write(' '); n--; }
|
897
|
901
|
}
|
898
|
902
|
while (n > 0 && (c = pgm_read_byte(pstr))) {
|
899
|
903
|
n -= charset_mapper(c);
|
|
@@ -903,7 +907,7 @@ static void lcd_implementation_status_screen() {
|
903
|
907
|
n -= charset_mapper(c);
|
904
|
908
|
valstr++;
|
905
|
909
|
}
|
906
|
|
- while (n-- > 0) lcd.print(' ');
|
|
910
|
+ while (n-- > 0) lcd.write(' ');
|
907
|
911
|
}
|
908
|
912
|
|
909
|
913
|
static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
|
|
@@ -915,7 +919,7 @@ static void lcd_implementation_status_screen() {
|
915
|
919
|
n -= charset_mapper(c);
|
916
|
920
|
pstr++;
|
917
|
921
|
}
|
918
|
|
- while (n--) lcd.print(' ');
|
|
922
|
+ while (n--) lcd.write(' ');
|
919
|
923
|
lcd.print(post_char);
|
920
|
924
|
}
|
921
|
925
|
|
|
@@ -928,8 +932,8 @@ static void lcd_implementation_status_screen() {
|
928
|
932
|
n -= charset_mapper(c);
|
929
|
933
|
pstr++;
|
930
|
934
|
}
|
931
|
|
- lcd.print(':');
|
932
|
|
- while (n--) lcd.print(' ');
|
|
935
|
+ lcd.write(':');
|
|
936
|
+ while (n--) lcd.write(' ');
|
933
|
937
|
lcd_print(data);
|
934
|
938
|
}
|
935
|
939
|
static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
|
|
@@ -941,8 +945,8 @@ static void lcd_implementation_status_screen() {
|
941
|
945
|
n -= charset_mapper(c);
|
942
|
946
|
pstr++;
|
943
|
947
|
}
|
944
|
|
- lcd.print(':');
|
945
|
|
- while (n--) lcd.print(' ');
|
|
948
|
+ lcd.write(':');
|
|
949
|
+ while (n--) lcd.write(' ');
|
946
|
950
|
lcd_printPGM(data);
|
947
|
951
|
}
|
948
|
952
|
|
|
@@ -977,10 +981,10 @@ static void lcd_implementation_status_screen() {
|
977
|
981
|
lcd.setCursor(1, 1);
|
978
|
982
|
lcd_printPGM(pstr);
|
979
|
983
|
if (value != NULL) {
|
980
|
|
- lcd.print(':');
|
|
984
|
+ lcd.write(':');
|
981
|
985
|
const uint8_t valrow = (lcd_strlen_P(pstr) + 1 + lcd_strlen(value) + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
982
|
986
|
lcd.setCursor((LCD_WIDTH - 1) - (lcd_strlen(value) + 1), valrow); // Right-justified, padded by spaces
|
983
|
|
- lcd.print(' '); // overwrite char if value gets shorter
|
|
987
|
+ lcd.write(' '); // overwrite char if value gets shorter
|
984
|
988
|
lcd_print(value);
|
985
|
989
|
}
|
986
|
990
|
}
|
|
@@ -1001,7 +1005,7 @@ static void lcd_implementation_status_screen() {
|
1001
|
1005
|
n -= charset_mapper(c);
|
1002
|
1006
|
filename++;
|
1003
|
1007
|
}
|
1004
|
|
- while (n--) lcd.print(' ');
|
|
1008
|
+ while (n--) lcd.write(' ');
|
1005
|
1009
|
lcd.print(post_char);
|
1006
|
1010
|
}
|
1007
|
1011
|
|
|
@@ -1079,10 +1083,152 @@ static void lcd_implementation_status_screen() {
|
1079
|
1083
|
|
1080
|
1084
|
#endif // LCD_HAS_STATUS_INDICATORS
|
1081
|
1085
|
|
1082
|
|
-#ifdef AUTO_BED_LEVELING_UBL
|
1083
|
|
- void lcd_return_to_status(); // These are just place holders for the 20x4 LCD work that
|
1084
|
|
- void _lcd_ubl_output_char_lcd() { // is coming up very soon. Soon this will morph into the
|
1085
|
|
- lcd_return_to_status(); // real code.
|
|
1086
|
+#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
1087
|
+
|
|
1088
|
+ /*
|
|
1089
|
+ * These are just basic data for the 20x4 LCD work that
|
|
1090
|
+ * is coming up very soon.
|
|
1091
|
+ * Soon this will morph into a map code.
|
|
1092
|
+ */
|
|
1093
|
+
|
|
1094
|
+ /**
|
|
1095
|
+ Possible map screens:
|
|
1096
|
+
|
|
1097
|
+ 16x2 |X000.00 Y000.00|
|
|
1098
|
+ |(00,00) Z00.000|
|
|
1099
|
+
|
|
1100
|
+ 20x2 | X:000.00 Y:000.00 |
|
|
1101
|
+ | (00,00) Z:00.000 |
|
|
1102
|
+
|
|
1103
|
+ 16x4 |+-------+(00,00)|
|
|
1104
|
+ || |X000.00|
|
|
1105
|
+ || |Y000.00|
|
|
1106
|
+ |+-------+Z00.000|
|
|
1107
|
+
|
|
1108
|
+ 20x4 | +-------+ (00,00) |
|
|
1109
|
+ | | | X:000.00|
|
|
1110
|
+ | | | Y:000.00|
|
|
1111
|
+ | +-------+ Z:00.000|
|
|
1112
|
+ */
|
|
1113
|
+
|
|
1114
|
+ void lcd_set_ubl_map_plot_chars() {
|
|
1115
|
+ #if LCD_HEIGHT > 3
|
|
1116
|
+ //#include "_ubl_lcd_map_characters.h"
|
|
1117
|
+ const static byte _lcd_box_top[8] PROGMEM = {
|
|
1118
|
+ B11111,
|
|
1119
|
+ B00000,
|
|
1120
|
+ B00000,
|
|
1121
|
+ B00000,
|
|
1122
|
+ B00000,
|
|
1123
|
+ B00000,
|
|
1124
|
+ B00000,
|
|
1125
|
+ B00000
|
|
1126
|
+ };
|
|
1127
|
+ const static byte _lcd_box_bottom[8] PROGMEM = {
|
|
1128
|
+ B00000,
|
|
1129
|
+ B00000,
|
|
1130
|
+ B00000,
|
|
1131
|
+ B00000,
|
|
1132
|
+ B00000,
|
|
1133
|
+ B00000,
|
|
1134
|
+ B00000,
|
|
1135
|
+ B11111
|
|
1136
|
+ };
|
|
1137
|
+ createChar_P(1, _lcd_box_top);
|
|
1138
|
+ createChar_P(2, _lcd_box_bottom);
|
|
1139
|
+ #endif
|
|
1140
|
+ }
|
|
1141
|
+
|
|
1142
|
+ void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
|
1143
|
+
|
|
1144
|
+ #if LCD_WIDTH >= 20
|
|
1145
|
+ #define _LCD_W_POS 12
|
|
1146
|
+ #define _PLOT_X 1
|
|
1147
|
+ #define _MAP_X 3
|
|
1148
|
+ #define _LABEL(C,X,Y) lcd.setCursor(X, Y); lcd.print(C)
|
|
1149
|
+ #define _XLABEL(X,Y) _LABEL("X:",X,Y)
|
|
1150
|
+ #define _YLABEL(X,Y) _LABEL("Y:",X,Y)
|
|
1151
|
+ #define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
|
|
1152
|
+ #else
|
|
1153
|
+ #define _LCD_W_POS 8
|
|
1154
|
+ #define _PLOT_X 0
|
|
1155
|
+ #define _MAP_X 1
|
|
1156
|
+ #define _LABEL(X,Y,C) lcd.setCursor(X, Y); lcd.write(C)
|
|
1157
|
+ #define _XLABEL(X,Y) _LABEL('X',X,Y)
|
|
1158
|
+ #define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
|
1159
|
+ #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
|
1160
|
+ #endif
|
|
1161
|
+
|
|
1162
|
+ #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
|
1163
|
+
|
|
1164
|
+ /**
|
|
1165
|
+ * Show X and Y positions
|
|
1166
|
+ */
|
|
1167
|
+ _XLABEL(_PLOT_X, 0);
|
|
1168
|
+ lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
|
1169
|
+
|
|
1170
|
+ _YLABEL(_LCD_W_POS, 0);
|
|
1171
|
+ lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
|
1172
|
+
|
|
1173
|
+ lcd.setCursor(_PLOT_X, 0);
|
|
1174
|
+
|
|
1175
|
+ #else // 16x4 or 20x4 display
|
|
1176
|
+
|
|
1177
|
+ /**
|
|
1178
|
+ * Draw the Mesh Map Box
|
|
1179
|
+ */
|
|
1180
|
+ uint8_t m;
|
|
1181
|
+ lcd.setCursor(_MAP_X, 0); for (m = 0; m < 5; m++) lcd.write(1); // Top
|
|
1182
|
+ lcd.setCursor(_MAP_X, 3); for (m = 0; m < 5; m++) lcd.write(2); // Bottom
|
|
1183
|
+ for (m = 0; m <= 3; m++) {
|
|
1184
|
+ lcd.setCursor(2, m); lcd.write('|'); // Left
|
|
1185
|
+ lcd.setCursor(8, m); lcd.write('|'); // Right
|
|
1186
|
+ }
|
|
1187
|
+
|
|
1188
|
+ lcd.setCursor(_LCD_W_POS, 0);
|
|
1189
|
+
|
|
1190
|
+ #endif
|
|
1191
|
+
|
|
1192
|
+ /**
|
|
1193
|
+ * Print plot position
|
|
1194
|
+ */
|
|
1195
|
+ lcd.write('(');
|
|
1196
|
+ lcd.print(x_plot);
|
|
1197
|
+ lcd.write(',');
|
|
1198
|
+ lcd.print(y_plot);
|
|
1199
|
+ lcd.write(')');
|
|
1200
|
+
|
|
1201
|
+ #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
|
1202
|
+
|
|
1203
|
+ /**
|
|
1204
|
+ * Print Z values
|
|
1205
|
+ */
|
|
1206
|
+ _ZLABEL(_LCD_W_POS, 1);
|
|
1207
|
+ if (!isnan(ubl.z_values[x_plot][y_plot]))
|
|
1208
|
+ lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
|
1209
|
+ else
|
|
1210
|
+ lcd_printPGM(PSTR(" -----"));
|
|
1211
|
+
|
|
1212
|
+ #else // 16x4 or 20x4 display
|
|
1213
|
+
|
|
1214
|
+ /**
|
|
1215
|
+ * Show all values at right of screen
|
|
1216
|
+ */
|
|
1217
|
+ _XLABEL(_LCD_W_POS, 1);
|
|
1218
|
+ lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
|
1219
|
+ _YLABEL(_LCD_W_POS, 2);
|
|
1220
|
+ lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
|
1221
|
+
|
|
1222
|
+ /**
|
|
1223
|
+ * Show the location value
|
|
1224
|
+ */
|
|
1225
|
+ _ZLABEL(_LCD_W_POS, 3);
|
|
1226
|
+ if (!isnan(ubl.z_values[x_plot][y_plot]))
|
|
1227
|
+ lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
|
1228
|
+ else
|
|
1229
|
+ lcd_printPGM(PSTR(" -----"));
|
|
1230
|
+
|
|
1231
|
+ #endif // LCD_HEIGHT > 3
|
1086
|
1232
|
}
|
1087
|
1233
|
|
1088
|
1234
|
#endif // AUTO_BED_LEVELING_UBL
|