|
@@ -189,29 +189,32 @@ static void lcd_setFont(char font_nr) {
|
189
|
189
|
}
|
190
|
190
|
}
|
191
|
191
|
|
192
|
|
-char lcd_print(char c) {
|
|
192
|
+void lcd_print(char c) {
|
|
193
|
+ if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) {
|
|
194
|
+ u8g.setFont(FONT_SPECIAL_NAME);
|
|
195
|
+ u8g.print(c);
|
|
196
|
+ lcd_setFont(currentfont);
|
|
197
|
+ }
|
|
198
|
+ else charset_mapper(c);
|
|
199
|
+}
|
|
200
|
+
|
|
201
|
+char lcd_print_and_count(char c) {
|
193
|
202
|
if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) {
|
194
|
203
|
u8g.setFont(FONT_SPECIAL_NAME);
|
195
|
204
|
u8g.print(c);
|
196
|
205
|
lcd_setFont(currentfont);
|
197
|
206
|
return 1;
|
198
|
|
- } else {
|
199
|
|
- return charset_mapper(c);
|
200
|
207
|
}
|
|
208
|
+ else return charset_mapper(c);
|
201
|
209
|
}
|
202
|
210
|
|
203
|
|
-char lcd_print(const char* str) {
|
204
|
|
- int i = 0;
|
205
|
|
- char c, n = 0;
|
206
|
|
- while ((c = str[i++])) n += lcd_print(c);
|
207
|
|
- return n;
|
|
211
|
+void lcd_print(const char* str) {
|
|
212
|
+ for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c);
|
208
|
213
|
}
|
209
|
214
|
|
210
|
|
-// Needed for Arduino < 1.0.0
|
211
|
|
-char lcd_printPGM(const char* str) {
|
212
|
|
- char c, n = 0;
|
213
|
|
- while ((c = pgm_read_byte(str++))) n += lcd_print(c);
|
214
|
|
- return n;
|
|
215
|
+/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
|
|
216
|
+void lcd_printPGM(const char* str) {
|
|
217
|
+ for (; char c = pgm_read_byte(str); ++str) lcd_print(c);
|
215
|
218
|
}
|
216
|
219
|
|
217
|
220
|
// Initialize or re-initializw the LCD
|
|
@@ -337,11 +340,11 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink)
|
337
|
340
|
lcd_printPGM(pstr);
|
338
|
341
|
else {
|
339
|
342
|
if (!axis_homed[axis])
|
340
|
|
- lcd_printPGM(PSTR("?"));
|
|
343
|
+ u8g.print('?');
|
341
|
344
|
else {
|
342
|
345
|
#if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
343
|
346
|
if (!axis_known_position[axis])
|
344
|
|
- lcd_printPGM(PSTR(" "));
|
|
347
|
+ u8g.print(' ');
|
345
|
348
|
else
|
346
|
349
|
#endif
|
347
|
350
|
lcd_printPGM(pstr);
|
|
@@ -421,7 +424,7 @@ static void lcd_implementation_status_screen() {
|
421
|
424
|
int per = ((fanSpeeds[0] + 1) * 100) / 256;
|
422
|
425
|
if (per) {
|
423
|
426
|
lcd_print(itostr3(per));
|
424
|
|
- lcd_print('%');
|
|
427
|
+ u8g.print('%');
|
425
|
428
|
}
|
426
|
429
|
#endif
|
427
|
430
|
|
|
@@ -463,7 +466,7 @@ static void lcd_implementation_status_screen() {
|
463
|
466
|
lcd_setFont(FONT_STATUSMENU);
|
464
|
467
|
u8g.setPrintPos(12, 49);
|
465
|
468
|
lcd_print(itostr3(feedrate_percentage));
|
466
|
|
- lcd_print('%');
|
|
469
|
+ u8g.print('%');
|
467
|
470
|
|
468
|
471
|
// Status line
|
469
|
472
|
#if ENABLED(USE_SMALL_INFOFONT)
|
|
@@ -482,7 +485,7 @@ static void lcd_implementation_status_screen() {
|
482
|
485
|
lcd_print(ftostr12ns(filament_width_meas));
|
483
|
486
|
lcd_printPGM(PSTR(" factor:"));
|
484
|
487
|
lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
|
485
|
|
- lcd_print('%');
|
|
488
|
+ u8g.print('%');
|
486
|
489
|
}
|
487
|
490
|
#endif
|
488
|
491
|
}
|
|
@@ -514,17 +517,17 @@ static void lcd_implementation_status_screen() {
|
514
|
517
|
|
515
|
518
|
if (center && !valstr) {
|
516
|
519
|
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
|
517
|
|
- while (--pad >= 0) { lcd_print(' '); n--; }
|
|
520
|
+ while (--pad >= 0) { u8g.print(' '); n--; }
|
518
|
521
|
}
|
519
|
522
|
while (n > 0 && (c = pgm_read_byte(pstr))) {
|
520
|
|
- n -= lcd_print(c);
|
|
523
|
+ n -= lcd_print_and_count(c);
|
521
|
524
|
pstr++;
|
522
|
525
|
}
|
523
|
526
|
if (valstr) while (n > 0 && (c = *valstr)) {
|
524
|
|
- n -= lcd_print(c);
|
|
527
|
+ n -= lcd_print_and_count(c);
|
525
|
528
|
valstr++;
|
526
|
529
|
}
|
527
|
|
- while (n-- > 0) lcd_print(' ');
|
|
530
|
+ while (n-- > 0) u8g.print(' ');
|
528
|
531
|
}
|
529
|
532
|
|
530
|
533
|
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
|
|
@@ -539,13 +542,13 @@ static void lcd_implementation_status_screen() {
|
539
|
542
|
lcd_implementation_mark_as_selected(row, isSelected);
|
540
|
543
|
|
541
|
544
|
while (c = pgm_read_byte(pstr)) {
|
542
|
|
- n -= lcd_print(c);
|
|
545
|
+ n -= lcd_print_and_count(c);
|
543
|
546
|
pstr++;
|
544
|
547
|
}
|
545
|
|
- while (n--) lcd_print(' ');
|
|
548
|
+ while (n--) u8g.print(' ');
|
546
|
549
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
|
547
|
550
|
lcd_print(post_char);
|
548
|
|
- lcd_print(' ');
|
|
551
|
+ u8g.print(' ');
|
549
|
552
|
}
|
550
|
553
|
|
551
|
554
|
// Macros for specific types of menu items
|
|
@@ -563,11 +566,11 @@ static void lcd_implementation_status_screen() {
|
563
|
566
|
lcd_implementation_mark_as_selected(row, isSelected);
|
564
|
567
|
|
565
|
568
|
while (c = pgm_read_byte(pstr)) {
|
566
|
|
- n -= lcd_print(c);
|
|
569
|
+ n -= lcd_print_and_count(c);
|
567
|
570
|
pstr++;
|
568
|
571
|
}
|
569
|
|
- lcd_print(':');
|
570
|
|
- while (n--) lcd_print(' ');
|
|
572
|
+ u8g.print(':');
|
|
573
|
+ while (n--) u8g.print(' ');
|
571
|
574
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, (row + 1) * (DOG_CHAR_HEIGHT));
|
572
|
575
|
if (pgm) lcd_printPGM(data); else lcd_print((char*)data);
|
573
|
576
|
}
|
|
@@ -621,7 +624,7 @@ static void lcd_implementation_status_screen() {
|
621
|
624
|
u8g.setPrintPos(0, rowHeight + kHalfChar);
|
622
|
625
|
lcd_printPGM(pstr);
|
623
|
626
|
if (value != NULL) {
|
624
|
|
- lcd_print(':');
|
|
627
|
+ u8g.print(':');
|
625
|
628
|
u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar);
|
626
|
629
|
lcd_print(value);
|
627
|
630
|
}
|
|
@@ -643,10 +646,10 @@ static void lcd_implementation_status_screen() {
|
643
|
646
|
|
644
|
647
|
if (isDir) lcd_print(LCD_STR_FOLDER[0]);
|
645
|
648
|
while ((c = *filename)) {
|
646
|
|
- n -= lcd_print(c);
|
|
649
|
+ n -= lcd_print_and_count(c);
|
647
|
650
|
filename++;
|
648
|
651
|
}
|
649
|
|
- while (n--) lcd_print(' ');
|
|
652
|
+ while (n--) u8g.print(' ');
|
650
|
653
|
}
|
651
|
654
|
|
652
|
655
|
#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)
|