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