|
@ -189,29 +189,32 @@ static void lcd_setFont(char font_nr) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
char lcd_print(char c) { |
|
|
void lcd_print(char c) { |
|
|
|
|
|
if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) { |
|
|
|
|
|
u8g.setFont(FONT_SPECIAL_NAME); |
|
|
|
|
|
u8g.print(c); |
|
|
|
|
|
lcd_setFont(currentfont); |
|
|
|
|
|
} |
|
|
|
|
|
else charset_mapper(c); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char lcd_print_and_count(char c) { |
|
|
if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) { |
|
|
if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) { |
|
|
u8g.setFont(FONT_SPECIAL_NAME); |
|
|
u8g.setFont(FONT_SPECIAL_NAME); |
|
|
u8g.print(c); |
|
|
u8g.print(c); |
|
|
lcd_setFont(currentfont); |
|
|
lcd_setFont(currentfont); |
|
|
return 1; |
|
|
return 1; |
|
|
} else { |
|
|
|
|
|
return charset_mapper(c); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
else return charset_mapper(c); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
char lcd_print(const char* str) { |
|
|
void lcd_print(const char* str) { |
|
|
int i = 0; |
|
|
for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c); |
|
|
char c, n = 0; |
|
|
|
|
|
while ((c = str[i++])) n += lcd_print(c); |
|
|
|
|
|
return n; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Needed for Arduino < 1.0.0
|
|
|
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ |
|
|
char lcd_printPGM(const char* str) { |
|
|
void lcd_printPGM(const char* str) { |
|
|
char c, n = 0; |
|
|
for (; char c = pgm_read_byte(str); ++str) lcd_print(c); |
|
|
while ((c = pgm_read_byte(str++))) n += lcd_print(c); |
|
|
|
|
|
return n; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Initialize or re-initializw the LCD
|
|
|
// Initialize or re-initializw the LCD
|
|
@ -337,11 +340,11 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) |
|
|
lcd_printPGM(pstr); |
|
|
lcd_printPGM(pstr); |
|
|
else { |
|
|
else { |
|
|
if (!axis_homed[axis]) |
|
|
if (!axis_homed[axis]) |
|
|
lcd_printPGM(PSTR("?")); |
|
|
u8g.print('?'); |
|
|
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_printPGM(PSTR(" ")); |
|
|
u8g.print(' '); |
|
|
else |
|
|
else |
|
|
#endif |
|
|
#endif |
|
|
lcd_printPGM(pstr); |
|
|
lcd_printPGM(pstr); |
|
@ -421,7 +424,7 @@ static void lcd_implementation_status_screen() { |
|
|
int per = ((fanSpeeds[0] + 1) * 100) / 256; |
|
|
int per = ((fanSpeeds[0] + 1) * 100) / 256; |
|
|
if (per) { |
|
|
if (per) { |
|
|
lcd_print(itostr3(per)); |
|
|
lcd_print(itostr3(per)); |
|
|
lcd_print('%'); |
|
|
u8g.print('%'); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -463,7 +466,7 @@ static void lcd_implementation_status_screen() { |
|
|
lcd_setFont(FONT_STATUSMENU); |
|
|
lcd_setFont(FONT_STATUSMENU); |
|
|
u8g.setPrintPos(12, 49); |
|
|
u8g.setPrintPos(12, 49); |
|
|
lcd_print(itostr3(feedrate_percentage)); |
|
|
lcd_print(itostr3(feedrate_percentage)); |
|
|
lcd_print('%'); |
|
|
u8g.print('%'); |
|
|
|
|
|
|
|
|
// Status line
|
|
|
// Status line
|
|
|
#if ENABLED(USE_SMALL_INFOFONT) |
|
|
#if ENABLED(USE_SMALL_INFOFONT) |
|
@ -482,7 +485,7 @@ static void lcd_implementation_status_screen() { |
|
|
lcd_print(ftostr12ns(filament_width_meas)); |
|
|
lcd_print(ftostr12ns(filament_width_meas)); |
|
|
lcd_printPGM(PSTR(" factor:")); |
|
|
lcd_printPGM(PSTR(" factor:")); |
|
|
lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); |
|
|
lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); |
|
|
lcd_print('%'); |
|
|
u8g.print('%'); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
@ -514,17 +517,17 @@ static void lcd_implementation_status_screen() { |
|
|
|
|
|
|
|
|
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) { u8g.print(' '); n--; } |
|
|
} |
|
|
} |
|
|
while (n > 0 && (c = pgm_read_byte(pstr))) { |
|
|
while (n > 0 && (c = pgm_read_byte(pstr))) { |
|
|
n -= lcd_print(c); |
|
|
n -= lcd_print_and_count(c); |
|
|
pstr++; |
|
|
pstr++; |
|
|
} |
|
|
} |
|
|
if (valstr) while (n > 0 && (c = *valstr)) { |
|
|
if (valstr) while (n > 0 && (c = *valstr)) { |
|
|
n -= lcd_print(c); |
|
|
n -= lcd_print_and_count(c); |
|
|
valstr++; |
|
|
valstr++; |
|
|
} |
|
|
} |
|
|
while (n-- > 0) lcd_print(' '); |
|
|
while (n-- > 0) u8g.print(' '); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
|
|
|
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
|
|
@ -539,13 +542,13 @@ static void lcd_implementation_status_screen() { |
|
|
lcd_implementation_mark_as_selected(row, isSelected); |
|
|
lcd_implementation_mark_as_selected(row, isSelected); |
|
|
|
|
|
|
|
|
while (c = pgm_read_byte(pstr)) { |
|
|
while (c = pgm_read_byte(pstr)) { |
|
|
n -= lcd_print(c); |
|
|
n -= lcd_print_and_count(c); |
|
|
pstr++; |
|
|
pstr++; |
|
|
} |
|
|
} |
|
|
while (n--) lcd_print(' '); |
|
|
while (n--) u8g.print(' '); |
|
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)); |
|
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)); |
|
|
lcd_print(post_char); |
|
|
lcd_print(post_char); |
|
|
lcd_print(' '); |
|
|
u8g.print(' '); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Macros for specific types of menu items
|
|
|
// Macros for specific types of menu items
|
|
@ -563,11 +566,11 @@ static void lcd_implementation_status_screen() { |
|
|
lcd_implementation_mark_as_selected(row, isSelected); |
|
|
lcd_implementation_mark_as_selected(row, isSelected); |
|
|
|
|
|
|
|
|
while (c = pgm_read_byte(pstr)) { |
|
|
while (c = pgm_read_byte(pstr)) { |
|
|
n -= lcd_print(c); |
|
|
n -= lcd_print_and_count(c); |
|
|
pstr++; |
|
|
pstr++; |
|
|
} |
|
|
} |
|
|
lcd_print(':'); |
|
|
u8g.print(':'); |
|
|
while (n--) lcd_print(' '); |
|
|
while (n--) u8g.print(' '); |
|
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, (row + 1) * (DOG_CHAR_HEIGHT)); |
|
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, (row + 1) * (DOG_CHAR_HEIGHT)); |
|
|
if (pgm) lcd_printPGM(data); else lcd_print((char*)data); |
|
|
if (pgm) lcd_printPGM(data); else lcd_print((char*)data); |
|
|
} |
|
|
} |
|
@ -621,7 +624,7 @@ static void lcd_implementation_status_screen() { |
|
|
u8g.setPrintPos(0, rowHeight + kHalfChar); |
|
|
u8g.setPrintPos(0, rowHeight + kHalfChar); |
|
|
lcd_printPGM(pstr); |
|
|
lcd_printPGM(pstr); |
|
|
if (value != NULL) { |
|
|
if (value != NULL) { |
|
|
lcd_print(':'); |
|
|
u8g.print(':'); |
|
|
u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar); |
|
|
u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar); |
|
|
lcd_print(value); |
|
|
lcd_print(value); |
|
|
} |
|
|
} |
|
@ -643,10 +646,10 @@ static void lcd_implementation_status_screen() { |
|
|
|
|
|
|
|
|
if (isDir) lcd_print(LCD_STR_FOLDER[0]); |
|
|
if (isDir) lcd_print(LCD_STR_FOLDER[0]); |
|
|
while ((c = *filename)) { |
|
|
while ((c = *filename)) { |
|
|
n -= lcd_print(c); |
|
|
n -= lcd_print_and_count(c); |
|
|
filename++; |
|
|
filename++; |
|
|
} |
|
|
} |
|
|
while (n--) lcd_print(' '); |
|
|
while (n--) u8g.print(' '); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false) |
|
|
#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false) |
|
|