|
|
@ -421,7 +421,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { |
|
|
|
void lcd_erase_line(const int16_t line) { |
|
|
|
lcd.setCursor(0, line); |
|
|
|
for (uint8_t i = LCD_WIDTH + 1; --i;) |
|
|
|
lcd.print(' '); |
|
|
|
lcd.write(' '); |
|
|
|
} |
|
|
|
|
|
|
|
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
|
|
|
@ -438,9 +438,9 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { |
|
|
|
|
|
|
|
static void logo_lines(const char* const extra) { |
|
|
|
int16_t indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2; |
|
|
|
lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" )); lcd.print('\x01'); |
|
|
|
lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" )); lcd.write('\x01'); |
|
|
|
lcd.setCursor(indent, 1); lcd_printPGM(PSTR("|Marlin|")); lcd_printPGM(extra); |
|
|
|
lcd.setCursor(indent, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" )); lcd.print('\x03'); |
|
|
|
lcd.setCursor(indent, 2); lcd.write('\x02'); lcd_printPGM(PSTR( "------" )); lcd.write('\x03'); |
|
|
|
} |
|
|
|
|
|
|
|
void bootscreen() { |
|
|
@ -581,11 +581,11 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, |
|
|
|
lcd_printPGM(pstr); |
|
|
|
else { |
|
|
|
if (!axis_homed[axis]) |
|
|
|
lcd.print('?'); |
|
|
|
lcd.write('?'); |
|
|
|
else { |
|
|
|
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) |
|
|
|
if (!axis_known_position[axis]) |
|
|
|
lcd.print(' '); |
|
|
|
lcd.write(' '); |
|
|
|
else |
|
|
|
#endif |
|
|
|
lcd_printPGM(pstr); |
|
|
@ -602,7 +602,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co |
|
|
|
if (prefix >= 0) lcd.print(prefix); |
|
|
|
|
|
|
|
lcd.print(itostr3(t1 + 0.5)); |
|
|
|
lcd.print('/'); |
|
|
|
lcd.write('/'); |
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER |
|
|
|
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : |
|
|
@ -614,9 +614,9 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co |
|
|
|
); |
|
|
|
|
|
|
|
if (!blink && is_idle) { |
|
|
|
lcd.print(' '); |
|
|
|
if (t2 >= 10) lcd.print(' '); |
|
|
|
if (t2 >= 100) lcd.print(' '); |
|
|
|
lcd.write(' '); |
|
|
|
if (t2 >= 10) lcd.write(' '); |
|
|
|
if (t2 >= 100) lcd.write(' '); |
|
|
|
} |
|
|
|
else |
|
|
|
#endif |
|
|
@ -624,8 +624,8 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co |
|
|
|
|
|
|
|
if (prefix >= 0) { |
|
|
|
lcd.print((char)LCD_DEGREE_CHAR); |
|
|
|
lcd.print(' '); |
|
|
|
if (t2 < 10) lcd.print(' '); |
|
|
|
lcd.write(' '); |
|
|
|
if (t2 < 10) lcd.write(' '); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -742,7 +742,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd.print(itostr3(card.percentDone())); |
|
|
|
else |
|
|
|
lcd_printPGM(PSTR("---")); |
|
|
|
lcd.print('%'); |
|
|
|
lcd.write('%'); |
|
|
|
#endif // SDSUPPORT
|
|
|
|
|
|
|
|
#else // LCD_WIDTH >= 20
|
|
|
@ -764,7 +764,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink); |
|
|
|
lcd.print(ftostr4sign(current_position[X_AXIS])); |
|
|
|
|
|
|
|
lcd.print(' '); |
|
|
|
lcd.write(' '); |
|
|
|
|
|
|
|
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); |
|
|
|
lcd.print(ftostr4sign(current_position[Y_AXIS])); |
|
|
@ -788,7 +788,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd.setCursor(0, 2); |
|
|
|
lcd.print((char)LCD_FEEDRATE_CHAR); |
|
|
|
lcd.print(itostr3(feedrate_percentage)); |
|
|
|
lcd.print('%'); |
|
|
|
lcd.write('%'); |
|
|
|
|
|
|
|
#if LCD_WIDTH >= 20 && ENABLED(SDSUPPORT) |
|
|
|
|
|
|
@ -798,7 +798,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd.print(itostr3(card.percentDone())); |
|
|
|
else |
|
|
|
lcd_printPGM(PSTR("---")); |
|
|
|
lcd.print('%'); |
|
|
|
lcd.write('%'); |
|
|
|
|
|
|
|
#endif // LCD_WIDTH >= 20 && SDSUPPORT
|
|
|
|
|
|
|
@ -837,7 +837,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd.print(ftostr12ns(filament_width_meas)); |
|
|
|
lcd_printPGM(PSTR(" V")); |
|
|
|
lcd.print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); |
|
|
|
lcd.print('%'); |
|
|
|
lcd.write('%'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -858,10 +858,10 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd_print_utf(stat); // The string leaves space
|
|
|
|
chars -= slen - status_scroll_pos; // Amount of space left
|
|
|
|
} |
|
|
|
lcd.print('.'); // Always at 1+ spaces left, draw a dot
|
|
|
|
lcd.write('.'); // Always at 1+ spaces left, draw a dot
|
|
|
|
if (--chars) { |
|
|
|
if (status_scroll_pos < slen + 1) // Draw a second dot if there's space
|
|
|
|
--chars, lcd.print('.'); |
|
|
|
--chars, lcd.write('.'); |
|
|
|
if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message
|
|
|
|
} |
|
|
|
} |
|
|
@ -897,7 +897,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd.setCursor(0, row); |
|
|
|
if (center && !valstr) { |
|
|
|
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; |
|
|
|
while (--pad >= 0) { lcd.print(' '); n--; } |
|
|
|
while (--pad >= 0) { lcd.write(' '); n--; } |
|
|
|
} |
|
|
|
while (n > 0 && (c = pgm_read_byte(pstr))) { |
|
|
|
n -= charset_mapper(c); |
|
|
@ -907,7 +907,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
n -= charset_mapper(c); |
|
|
|
valstr++; |
|
|
|
} |
|
|
|
while (n-- > 0) lcd.print(' '); |
|
|
|
while (n-- > 0) lcd.write(' '); |
|
|
|
} |
|
|
|
|
|
|
|
static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) { |
|
|
@ -919,7 +919,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
n -= charset_mapper(c); |
|
|
|
pstr++; |
|
|
|
} |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
while (n--) lcd.write(' '); |
|
|
|
lcd.print(post_char); |
|
|
|
} |
|
|
|
|
|
|
@ -932,8 +932,8 @@ static void lcd_implementation_status_screen() { |
|
|
|
n -= charset_mapper(c); |
|
|
|
pstr++; |
|
|
|
} |
|
|
|
lcd.print(':'); |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
lcd.write(':'); |
|
|
|
while (n--) lcd.write(' '); |
|
|
|
lcd_print(data); |
|
|
|
} |
|
|
|
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) { |
|
|
@ -945,8 +945,8 @@ static void lcd_implementation_status_screen() { |
|
|
|
n -= charset_mapper(c); |
|
|
|
pstr++; |
|
|
|
} |
|
|
|
lcd.print(':'); |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
lcd.write(':'); |
|
|
|
while (n--) lcd.write(' '); |
|
|
|
lcd_printPGM(data); |
|
|
|
} |
|
|
|
|
|
|
@ -981,10 +981,10 @@ static void lcd_implementation_status_screen() { |
|
|
|
lcd.setCursor(1, 1); |
|
|
|
lcd_printPGM(pstr); |
|
|
|
if (value != NULL) { |
|
|
|
lcd.print(':'); |
|
|
|
lcd.write(':'); |
|
|
|
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
|
|
|
|
lcd.setCursor((LCD_WIDTH - 1) - (lcd_strlen(value) + 1), valrow); // Right-justified, padded by spaces
|
|
|
|
lcd.print(' '); // overwrite char if value gets shorter
|
|
|
|
lcd.write(' '); // overwrite char if value gets shorter
|
|
|
|
lcd_print(value); |
|
|
|
} |
|
|
|
} |
|
|
@ -1005,7 +1005,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
n -= charset_mapper(c); |
|
|
|
filename++; |
|
|
|
} |
|
|
|
while (n--) lcd.print(' '); |
|
|
|
while (n--) lcd.write(' '); |
|
|
|
lcd.print(post_char); |
|
|
|
} |
|
|
|
|
|
|
@ -1083,7 +1083,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
|
|
|
|
#endif // LCD_HAS_STATUS_INDICATORS
|
|
|
|
|
|
|
|
#ifdef AUTO_BED_LEVELING_UBL |
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) |
|
|
|
|
|
|
|
/*
|
|
|
|
* These are just basic data for the 20x4 LCD work that |
|
|
@ -1111,75 +1111,10 @@ static void lcd_implementation_status_screen() { |
|
|
|
| +-------+ Z:00.000| |
|
|
|
*/ |
|
|
|
|
|
|
|
void _lcd_ubl_plot_HD44780(uint8_t x_plot, uint8_t y_plot) { |
|
|
|
|
|
|
|
uint8_t lcd_w_pos; |
|
|
|
|
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd_w_pos = 8; |
|
|
|
#else |
|
|
|
lcd_w_pos = 12; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if LCD_HEIGHT < 3 |
|
|
|
|
|
|
|
/*
|
|
|
|
*** 16x2 or 20x2 display ** |
|
|
|
* |
|
|
|
* Show X and Y positions |
|
|
|
*/ |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.setCursor(0, 0); |
|
|
|
lcd.print("X"); |
|
|
|
#else |
|
|
|
lcd.setCursor(1, 0); |
|
|
|
lcd.print("X:"); |
|
|
|
#endif |
|
|
|
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot])))); |
|
|
|
|
|
|
|
lcd.setCursor(lcd_w_pos, 0); |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.print("Y"); |
|
|
|
#else |
|
|
|
lcd.print("Y:"); |
|
|
|
#endif |
|
|
|
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot])))); |
|
|
|
|
|
|
|
/*
|
|
|
|
* Print plot position |
|
|
|
*/ |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.setCursor(0, 1); |
|
|
|
#else |
|
|
|
lcd.setCursor(1, 1); |
|
|
|
#endif |
|
|
|
lcd.print("("); |
|
|
|
lcd.print(x_plot); |
|
|
|
lcd.print(","); |
|
|
|
lcd.print(y_plot); |
|
|
|
lcd.print(")"); |
|
|
|
|
|
|
|
/*
|
|
|
|
* Print Z values |
|
|
|
*/ |
|
|
|
lcd.setCursor(lcd_w_pos, 1); |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.print("Z"); |
|
|
|
#else |
|
|
|
lcd.print("Z:"); |
|
|
|
#endif |
|
|
|
if (!isnan(ubl.z_values[x_plot][y_plot])) { |
|
|
|
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot])); |
|
|
|
} |
|
|
|
else { |
|
|
|
lcd.print(" -----"); |
|
|
|
} |
|
|
|
|
|
|
|
#elif LCD_HEIGHT > 3 |
|
|
|
|
|
|
|
void lcd_set_ubl_map_plot_chars() { |
|
|
|
#if LCD_HEIGHT > 3 |
|
|
|
//#include "_ubl_lcd_map_characters.h"
|
|
|
|
|
|
|
|
const static PROGMEM byte _lcd_box_top[8] = { |
|
|
|
const static byte _lcd_box_top[8] PROGMEM = { |
|
|
|
B11111, |
|
|
|
B00000, |
|
|
|
B00000, |
|
|
@ -1189,8 +1124,7 @@ static void lcd_implementation_status_screen() { |
|
|
|
B00000, |
|
|
|
B00000 |
|
|
|
}; |
|
|
|
|
|
|
|
const static PROGMEM byte _lcd_box_bottom[8] = { |
|
|
|
const static byte _lcd_box_bottom[8] PROGMEM = { |
|
|
|
B00000, |
|
|
|
B00000, |
|
|
|
B00000, |
|
|
@ -1200,75 +1134,99 @@ static void lcd_implementation_status_screen() { |
|
|
|
B00000, |
|
|
|
B11111 |
|
|
|
}; |
|
|
|
|
|
|
|
/*
|
|
|
|
* Draw the Mesh Map Box |
|
|
|
*/ |
|
|
|
// First create the box custom characters
|
|
|
|
createChar_P(1, _lcd_box_top); |
|
|
|
createChar_P(2, _lcd_box_bottom); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) { |
|
|
|
|
|
|
|
#if LCD_WIDTH >= 20 |
|
|
|
#define _LCD_W_POS 12 |
|
|
|
#define _PLOT_X 1 |
|
|
|
#define _MAP_X 3 |
|
|
|
#define _LABEL(C,X,Y) lcd.setCursor(X, Y); lcd.print(C) |
|
|
|
#define _XLABEL(X,Y) _LABEL("X:",X,Y) |
|
|
|
#define _YLABEL(X,Y) _LABEL("Y:",X,Y) |
|
|
|
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y) |
|
|
|
#else |
|
|
|
#define _LCD_W_POS 8 |
|
|
|
#define _PLOT_X 0 |
|
|
|
#define _MAP_X 1 |
|
|
|
#define _LABEL(X,Y,C) lcd.setCursor(X, Y); lcd.write(C) |
|
|
|
#define _XLABEL(X,Y) _LABEL('X',X,Y) |
|
|
|
#define _YLABEL(X,Y) _LABEL('Y',X,Y) |
|
|
|
#define _ZLABEL(X,Y) _LABEL('Z',X,Y) |
|
|
|
#endif |
|
|
|
|
|
|
|
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show X and Y positions |
|
|
|
*/ |
|
|
|
_XLABEL(_PLOT_X, 0); |
|
|
|
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot])))); |
|
|
|
|
|
|
|
_YLABEL(_LCD_W_POS, 0); |
|
|
|
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot])))); |
|
|
|
|
|
|
|
lcd.setCursor(_PLOT_X, 0); |
|
|
|
|
|
|
|
#else // 16x4 or 20x4 display
|
|
|
|
|
|
|
|
// Draw the mesh map box
|
|
|
|
/**
|
|
|
|
* Draw the Mesh Map Box |
|
|
|
*/ |
|
|
|
uint8_t m; |
|
|
|
|
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.setCursor(_MAP_X, 0); for (m = 0; m < 5; m++) lcd.write(1); // Top
|
|
|
|
lcd.setCursor(_MAP_X, 3); for (m = 0; m < 5; m++) lcd.write(2); // Bottom
|
|
|
|
for (m = 0; m <= 3; m++) { |
|
|
|
lcd.setCursor(2, m); lcd.write('|'); // Left
|
|
|
|
lcd.setCursor(8, m); lcd.write('|'); // Right
|
|
|
|
} |
|
|
|
|
|
|
|
for(m = 1; m <= 5; m++) { lcd.setCursor(m, 0); lcd.write(1); } // Top
|
|
|
|
for(m = 1; m <= 5; m++) { lcd.setCursor(m, 3); lcd.write(2); } // Bottom
|
|
|
|
for(m = 0; m <= 3; m++) { lcd.setCursor(2, m); lcd.write('|'); } // Left
|
|
|
|
for(m = 0; m <= 3; m++) { lcd.setCursor(8, m); lcd.write('|'); } // Right
|
|
|
|
lcd.setCursor(_LCD_W_POS, 0); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
for(m = 3; m <= 7; m++) { lcd.setCursor(m, 0); lcd.write(1); } // Top
|
|
|
|
for(m = 3; m <= 7; m++) { lcd.setCursor(m, 3); lcd.write(2); } // Bottom
|
|
|
|
for(m = 0; m <= 3; m++) { lcd.setCursor(2, m); lcd.write('|'); } // Left
|
|
|
|
for(m = 0; m <= 3; m++) { lcd.setCursor(8, m); lcd.write('|'); } // Right
|
|
|
|
#endif |
|
|
|
|
|
|
|
#endif |
|
|
|
/*
|
|
|
|
* Print plot position |
|
|
|
/**
|
|
|
|
* Print plot position |
|
|
|
*/ |
|
|
|
lcd.write('('); |
|
|
|
lcd.print(x_plot); |
|
|
|
lcd.write(','); |
|
|
|
lcd.print(y_plot); |
|
|
|
lcd.write(')'); |
|
|
|
|
|
|
|
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print Z values |
|
|
|
*/ |
|
|
|
lcd.setCursor(lcd_w_pos, 0); |
|
|
|
lcd.print("("); |
|
|
|
lcd.print(x_plot); |
|
|
|
lcd.print(","); |
|
|
|
lcd.print(y_plot); |
|
|
|
lcd.print(")"); |
|
|
|
|
|
|
|
/*
|
|
|
|
_ZLABEL(_LCD_W_POS, 1); |
|
|
|
if (!isnan(ubl.z_values[x_plot][y_plot])) |
|
|
|
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot])); |
|
|
|
else |
|
|
|
lcd_printPGM(PSTR(" -----")); |
|
|
|
|
|
|
|
#else // 16x4 or 20x4 display
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show all values at right of screen |
|
|
|
*/ |
|
|
|
lcd.setCursor(lcd_w_pos, 1); |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.print("X"); |
|
|
|
#else |
|
|
|
lcd.print("X:"); |
|
|
|
#endif |
|
|
|
_XLABEL(_LCD_W_POS, 1); |
|
|
|
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot])))); |
|
|
|
lcd.setCursor(lcd_w_pos, 2); |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.print("Y"); |
|
|
|
#else |
|
|
|
lcd.print("Y:"); |
|
|
|
#endif |
|
|
|
_YLABEL(_LCD_W_POS, 2); |
|
|
|
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot])))); |
|
|
|
|
|
|
|
/*
|
|
|
|
/**
|
|
|
|
* Show the location value |
|
|
|
*/ |
|
|
|
lcd.setCursor(lcd_w_pos, 3); |
|
|
|
#if LCD_WIDTH < 20 |
|
|
|
lcd.print("Z"); |
|
|
|
#else |
|
|
|
lcd.print("Z:"); |
|
|
|
#endif |
|
|
|
if (!isnan(ubl.z_values[x_plot][y_plot])) { |
|
|
|
_ZLABEL(_LCD_W_POS, 3); |
|
|
|
if (!isnan(ubl.z_values[x_plot][y_plot])) |
|
|
|
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot])); |
|
|
|
} |
|
|
|
else { |
|
|
|
lcd.print(" -----"); |
|
|
|
} |
|
|
|
else |
|
|
|
lcd_printPGM(PSTR(" -----")); |
|
|
|
|
|
|
|
#endif // LCD_HEIGHT > 3
|
|
|
|
} |
|
|
|