|
@@ -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);
|
|
@@ -349,6 +352,8 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink)
|
349
|
352
|
}
|
350
|
353
|
}
|
351
|
354
|
|
|
355
|
+//#define DOGM_SD_PERCENT
|
|
356
|
+
|
352
|
357
|
static void lcd_implementation_status_screen() {
|
353
|
358
|
u8g.setColorIndex(1); // black on white
|
354
|
359
|
|
|
@@ -380,6 +385,13 @@ static void lcd_implementation_status_screen() {
|
380
|
385
|
if (IS_SD_PRINTING) {
|
381
|
386
|
// Progress bar solid part
|
382
|
387
|
u8g.drawBox(55, 50, (unsigned int)(71 * card.percentDone() * 0.01), 2 - (TALL_FONT_CORRECTION));
|
|
388
|
+
|
|
389
|
+ #if ENABLED(DOGM_SD_PERCENT)
|
|
390
|
+ // Percent complete
|
|
391
|
+ u8g.setPrintPos(55, 48);
|
|
392
|
+ u8g.print(itostr3(card.percentDone()));
|
|
393
|
+ u8g.print('%');
|
|
394
|
+ #endif
|
383
|
395
|
}
|
384
|
396
|
|
385
|
397
|
char buffer[10];
|
|
@@ -387,7 +399,13 @@ static void lcd_implementation_status_screen() {
|
387
|
399
|
bool has_days = (elapsed.value > 60*60*24L);
|
388
|
400
|
elapsed.toDigital(buffer, has_days);
|
389
|
401
|
|
390
|
|
- u8g.setPrintPos(has_days ? 71 : 80, 48);
|
|
402
|
+ #if DISABLED(DOGM_SD_PERCENT)
|
|
403
|
+ #define SD_DURATION_X 71
|
|
404
|
+ #else
|
|
405
|
+ #define SD_DURATION_X 89
|
|
406
|
+ #endif
|
|
407
|
+
|
|
408
|
+ u8g.setPrintPos(SD_DURATION_X + (has_days ? 0 : 9), 48);
|
391
|
409
|
lcd_print(buffer);
|
392
|
410
|
|
393
|
411
|
#endif
|
|
@@ -406,7 +424,7 @@ static void lcd_implementation_status_screen() {
|
406
|
424
|
int per = ((fanSpeeds[0] + 1) * 100) / 256;
|
407
|
425
|
if (per) {
|
408
|
426
|
lcd_print(itostr3(per));
|
409
|
|
- lcd_print('%');
|
|
427
|
+ u8g.print('%');
|
410
|
428
|
}
|
411
|
429
|
#endif
|
412
|
430
|
|
|
@@ -448,7 +466,7 @@ static void lcd_implementation_status_screen() {
|
448
|
466
|
lcd_setFont(FONT_STATUSMENU);
|
449
|
467
|
u8g.setPrintPos(12, 49);
|
450
|
468
|
lcd_print(itostr3(feedrate_percentage));
|
451
|
|
- lcd_print('%');
|
|
469
|
+ u8g.print('%');
|
452
|
470
|
|
453
|
471
|
// Status line
|
454
|
472
|
#if ENABLED(USE_SMALL_INFOFONT)
|
|
@@ -467,7 +485,7 @@ static void lcd_implementation_status_screen() {
|
467
|
485
|
lcd_print(ftostr12ns(filament_width_meas));
|
468
|
486
|
lcd_printPGM(PSTR(" factor:"));
|
469
|
487
|
lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
|
470
|
|
- lcd_print('%');
|
|
488
|
+ u8g.print('%');
|
471
|
489
|
}
|
472
|
490
|
#endif
|
473
|
491
|
}
|
|
@@ -499,17 +517,17 @@ static void lcd_implementation_status_screen() {
|
499
|
517
|
|
500
|
518
|
if (center && !valstr) {
|
501
|
519
|
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
|
502
|
|
- while (--pad >= 0) { lcd_print(' '); n--; }
|
|
520
|
+ while (--pad >= 0) { u8g.print(' '); n--; }
|
503
|
521
|
}
|
504
|
522
|
while (n > 0 && (c = pgm_read_byte(pstr))) {
|
505
|
|
- n -= lcd_print(c);
|
|
523
|
+ n -= lcd_print_and_count(c);
|
506
|
524
|
pstr++;
|
507
|
525
|
}
|
508
|
526
|
if (valstr) while (n > 0 && (c = *valstr)) {
|
509
|
|
- n -= lcd_print(c);
|
|
527
|
+ n -= lcd_print_and_count(c);
|
510
|
528
|
valstr++;
|
511
|
529
|
}
|
512
|
|
- while (n-- > 0) lcd_print(' ');
|
|
530
|
+ while (n-- > 0) u8g.print(' ');
|
513
|
531
|
}
|
514
|
532
|
|
515
|
533
|
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
|
|
@@ -524,13 +542,13 @@ static void lcd_implementation_status_screen() {
|
524
|
542
|
lcd_implementation_mark_as_selected(row, isSelected);
|
525
|
543
|
|
526
|
544
|
while (c = pgm_read_byte(pstr)) {
|
527
|
|
- n -= lcd_print(c);
|
|
545
|
+ n -= lcd_print_and_count(c);
|
528
|
546
|
pstr++;
|
529
|
547
|
}
|
530
|
|
- while (n--) lcd_print(' ');
|
|
548
|
+ while (n--) u8g.print(' ');
|
531
|
549
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
|
532
|
550
|
lcd_print(post_char);
|
533
|
|
- lcd_print(' ');
|
|
551
|
+ u8g.print(' ');
|
534
|
552
|
}
|
535
|
553
|
|
536
|
554
|
// Macros for specific types of menu items
|
|
@@ -548,11 +566,11 @@ static void lcd_implementation_status_screen() {
|
548
|
566
|
lcd_implementation_mark_as_selected(row, isSelected);
|
549
|
567
|
|
550
|
568
|
while (c = pgm_read_byte(pstr)) {
|
551
|
|
- n -= lcd_print(c);
|
|
569
|
+ n -= lcd_print_and_count(c);
|
552
|
570
|
pstr++;
|
553
|
571
|
}
|
554
|
|
- lcd_print(':');
|
555
|
|
- while (n--) lcd_print(' ');
|
|
572
|
+ u8g.print(':');
|
|
573
|
+ while (n--) u8g.print(' ');
|
556
|
574
|
u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, (row + 1) * (DOG_CHAR_HEIGHT));
|
557
|
575
|
if (pgm) lcd_printPGM(data); else lcd_print((char*)data);
|
558
|
576
|
}
|
|
@@ -606,7 +624,7 @@ static void lcd_implementation_status_screen() {
|
606
|
624
|
u8g.setPrintPos(0, rowHeight + kHalfChar);
|
607
|
625
|
lcd_printPGM(pstr);
|
608
|
626
|
if (value != NULL) {
|
609
|
|
- lcd_print(':');
|
|
627
|
+ u8g.print(':');
|
610
|
628
|
u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar);
|
611
|
629
|
lcd_print(value);
|
612
|
630
|
}
|
|
@@ -628,10 +646,10 @@ static void lcd_implementation_status_screen() {
|
628
|
646
|
|
629
|
647
|
if (isDir) lcd_print(LCD_STR_FOLDER[0]);
|
630
|
648
|
while ((c = *filename)) {
|
631
|
|
- n -= lcd_print(c);
|
|
649
|
+ n -= lcd_print_and_count(c);
|
632
|
650
|
filename++;
|
633
|
651
|
}
|
634
|
|
- while (n--) lcd_print(' ');
|
|
652
|
+ while (n--) u8g.print(' ');
|
635
|
653
|
}
|
636
|
654
|
|
637
|
655
|
#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)
|