Przeglądaj źródła

🩹 Remove poison wchar_t macro

Scott Lahteine 1 rok temu
rodzic
commit
cb4a79173b

+ 3
- 3
Marlin/src/feature/power_monitor.cpp Wyświetl plik

@@ -53,7 +53,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
53 53
     void PowerMonitor::draw_current() {
54 54
       const float amps = getAmps();
55 55
       lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps));
56
-      lcd_put_wchar('A');
56
+      lcd_put_lchar('A');
57 57
     }
58 58
   #endif
59 59
 
@@ -61,7 +61,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
61 61
     void PowerMonitor::draw_voltage() {
62 62
       const float volts = getVolts();
63 63
       lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts));
64
-      lcd_put_wchar('V');
64
+      lcd_put_lchar('V');
65 65
     }
66 66
   #endif
67 67
 
@@ -69,7 +69,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
69 69
     void PowerMonitor::draw_power() {
70 70
       const float power = getPower();
71 71
       lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power));
72
-      lcd_put_wchar('W');
72
+      lcd_put_lchar('W');
73 73
     }
74 74
   #endif
75 75
 

+ 5
- 5
Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp Wyświetl plik

@@ -50,7 +50,7 @@ extern LCD_CLASS lcd;
50 50
 int lcd_glyph_height() { return 1; }
51 51
 
52 52
 typedef struct _hd44780_charmap_t {
53
-  wchar_t uchar; // the unicode char
53
+  lchar_t uchar; // the unicode char
54 54
   uint8_t idx;   // the glyph of the char in the ROM
55 55
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
56 56
 } hd44780_charmap_t;
@@ -992,7 +992,7 @@ void lcd_put_int(const int i) { lcd.print(i); }
992 992
 
993 993
 // return < 0 on error
994 994
 // return the advanced cols
995
-int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) {
995
+int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
996 996
 
997 997
   // find the HD44780 internal ROM first
998 998
   int ret;
@@ -1051,10 +1051,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
1051 1051
   pixel_len_t ret = 0;
1052 1052
   const uint8_t *p = (uint8_t *)utf8_str;
1053 1053
   while (ret < max_length) {
1054
-    wchar_t ch = 0;
1055
-    p = get_utf8_value_cb(p, cb_read_byte, &ch);
1054
+    lchar_t ch;
1055
+    p = get_utf8_value_cb(p, cb_read_byte, ch);
1056 1056
     if (!ch) break;
1057
-    ret += lcd_put_wchar_max(ch, max_length - ret);
1057
+    ret += lcd_put_lchar_max(ch, max_length - ret);
1058 1058
   }
1059 1059
   return (int)ret;
1060 1060
 }

+ 69
- 69
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp Wyświetl plik

@@ -405,7 +405,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
405 405
   void lcd_erase_line(const lcd_uint_t line) {
406 406
     lcd_moveto(0, line);
407 407
     for (uint8_t i = LCD_WIDTH + 1; --i;)
408
-      lcd_put_wchar(' ');
408
+      lcd_put_lchar(' ');
409 409
   }
410 410
 
411 411
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
@@ -413,7 +413,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
413 413
     uint8_t slen = utf8_strlen(ftxt);
414 414
     if (slen < len) {
415 415
       lcd_put_u8str_max(col, line, ftxt, len);
416
-      for (; slen < len; ++slen) lcd_put_wchar(' ');
416
+      for (; slen < len; ++slen) lcd_put_lchar(' ');
417 417
       safe_delay(time);
418 418
     }
419 419
     else {
@@ -425,7 +425,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
425 425
         lcd_put_u8str_max_P(col, line, p, len);
426 426
 
427 427
         // Fill with spaces
428
-        for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' ');
428
+        for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_lchar(' ');
429 429
 
430 430
         // Delay
431 431
         safe_delay(dly);
@@ -439,9 +439,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
439 439
 
440 440
   static void logo_lines(FSTR_P const extra) {
441 441
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2;
442
-    lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" ));  lcd_put_wchar('\x01');
442
+    lcd_put_lchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" ));  lcd_put_lchar('\x01');
443 443
     lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra);
444
-    lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" ));  lcd_put_wchar('\x03');
444
+    lcd_put_lchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" ));  lcd_put_lchar('\x03');
445 445
   }
446 446
 
447 447
   void MarlinUI::show_bootscreen() {
@@ -510,11 +510,11 @@ void MarlinUI::draw_kill_screen() {
510 510
 // Homed and known, display constantly.
511 511
 //
512 512
 FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
513
-  lcd_put_wchar('X' + uint8_t(axis));
513
+  lcd_put_lchar('X' + uint8_t(axis));
514 514
   if (blink)
515 515
     lcd_put_u8str(value);
516 516
   else if (axis_should_home(axis))
517
-    while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
517
+    while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
518 518
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
519 519
     lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
520 520
   else
@@ -531,27 +531,27 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
531 531
     const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
532 532
   #endif
533 533
 
534
-  if (prefix >= 0) lcd_put_wchar(prefix);
534
+  if (prefix >= 0) lcd_put_lchar(prefix);
535 535
 
536 536
   lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
537
-  lcd_put_wchar('/');
537
+  lcd_put_lchar('/');
538 538
 
539 539
   #if !HEATER_IDLE_HANDLER
540 540
     UNUSED(blink);
541 541
   #else
542 542
     if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
543
-      lcd_put_wchar(' ');
544
-      if (t2 >= 10) lcd_put_wchar(' ');
545
-      if (t2 >= 100) lcd_put_wchar(' ');
543
+      lcd_put_lchar(' ');
544
+      if (t2 >= 10) lcd_put_lchar(' ');
545
+      if (t2 >= 100) lcd_put_lchar(' ');
546 546
     }
547 547
     else
548 548
   #endif
549 549
       lcd_put_u8str(i16tostr3left(t2));
550 550
 
551 551
   if (prefix >= 0) {
552
-    lcd_put_wchar(LCD_STR_DEGREE[0]);
553
-    lcd_put_wchar(' ');
554
-    if (t2 < 10) lcd_put_wchar(' ');
552
+    lcd_put_lchar(LCD_STR_DEGREE[0]);
553
+    lcd_put_lchar(' ');
554
+    if (t2 < 10) lcd_put_lchar(' ');
555 555
   }
556 556
 }
557 557
 
@@ -559,27 +559,27 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
559 559
 FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
560 560
   const celsius_t t2 = thermalManager.degTargetCooler();
561 561
 
562
-  if (prefix >= 0) lcd_put_wchar(prefix);
562
+  if (prefix >= 0) lcd_put_lchar(prefix);
563 563
 
564 564
   lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
565
-  lcd_put_wchar('/');
565
+  lcd_put_lchar('/');
566 566
 
567 567
   #if !HEATER_IDLE_HANDLER
568 568
     UNUSED(blink);
569 569
   #else
570 570
     if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
571
-      lcd_put_wchar(' ');
572
-      if (t2 >= 10) lcd_put_wchar(' ');
573
-      if (t2 >= 100) lcd_put_wchar(' ');
571
+      lcd_put_lchar(' ');
572
+      if (t2 >= 10) lcd_put_lchar(' ');
573
+      if (t2 >= 100) lcd_put_lchar(' ');
574 574
     }
575 575
     else
576 576
   #endif
577 577
       lcd_put_u8str(i16tostr3left(t2));
578 578
 
579 579
   if (prefix >= 0) {
580
-    lcd_put_wchar(LCD_STR_DEGREE[0]);
581
-    lcd_put_wchar(' ');
582
-    if (t2 < 10) lcd_put_wchar(' ');
580
+    lcd_put_lchar(LCD_STR_DEGREE[0]);
581
+    lcd_put_lchar(' ');
582
+    if (t2 < 10) lcd_put_lchar(' ');
583 583
   }
584 584
 }
585 585
 #endif
@@ -588,7 +588,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
588 588
   FORCE_INLINE void _draw_flowmeter_status() {
589 589
     lcd_put_u8str("~");
590 590
     lcd_put_u8str(ftostr11ns(cooler.flowrate));
591
-    lcd_put_wchar('L');
591
+    lcd_put_lchar('L');
592 592
   }
593 593
 #endif
594 594
 
@@ -602,7 +602,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
602 602
     }
603 603
     else {
604 604
       lcd_put_u8str(ftostr12ns(ammeter.current));
605
-      lcd_put_wchar('A');
605
+      lcd_put_lchar('A');
606 606
     }
607 607
   }
608 608
 #endif
@@ -620,7 +620,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
620 620
       lcd_put_u8str(ui8tostr3rj(progress));
621 621
     else
622 622
       lcd_put_u8str(F("---"));
623
-    lcd_put_wchar('%');
623
+    lcd_put_lchar('%');
624 624
   }
625 625
 
626 626
 #endif
@@ -667,7 +667,7 @@ void MarlinUI::draw_status_message(const bool blink) {
667 667
       lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
668 668
       lcd_put_u8str(F(" V"));
669 669
       lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
670
-      lcd_put_wchar('%');
670
+      lcd_put_lchar('%');
671 671
       return;
672 672
     }
673 673
 
@@ -686,7 +686,7 @@ void MarlinUI::draw_status_message(const bool blink) {
686 686
       lcd_put_u8str(status_message);
687 687
 
688 688
       // Fill the rest with spaces
689
-      while (slen < LCD_WIDTH) { lcd_put_wchar(' '); ++slen; }
689
+      while (slen < LCD_WIDTH) { lcd_put_lchar(' '); ++slen; }
690 690
     }
691 691
     else {
692 692
       // String is larger than the available space in screen.
@@ -700,11 +700,11 @@ void MarlinUI::draw_status_message(const bool blink) {
700 700
       // If the remaining string doesn't completely fill the screen
701 701
       if (rlen < LCD_WIDTH) {
702 702
         uint8_t chars = LCD_WIDTH - rlen;     // Amount of space left in characters
703
-        lcd_put_wchar(' ');                   // Always at 1+ spaces left, draw a space
703
+        lcd_put_lchar(' ');                   // Always at 1+ spaces left, draw a space
704 704
         if (--chars) {                        // Draw a second space if there's room
705
-          lcd_put_wchar(' ');
705
+          lcd_put_lchar(' ');
706 706
           if (--chars) {                      // Draw a third space if there's room
707
-            lcd_put_wchar(' ');
707
+            lcd_put_lchar(' ');
708 708
             if (--chars)
709 709
               lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
710 710
           }
@@ -726,7 +726,7 @@ void MarlinUI::draw_status_message(const bool blink) {
726 726
 
727 727
     // Fill the rest with spaces if there are missing spaces
728 728
     while (slen < LCD_WIDTH) {
729
-      lcd_put_wchar(' ');
729
+      lcd_put_lchar(' ');
730 730
       ++slen;
731 731
     }
732 732
   #endif
@@ -778,7 +778,7 @@ inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink)
778 778
         duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
779 779
       #endif
780 780
       timepos -= remaining.toDigital(buffer);
781
-      lcd_put_wchar(timepos, 2, 'R');
781
+      lcd_put_lchar(timepos, 2, 'R');
782 782
     }
783 783
   #else
784 784
     constexpr bool show_remain = false;
@@ -787,7 +787,7 @@ inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink)
787 787
   if (!show_remain) {
788 788
     duration_t elapsed = print_job_timer.duration();
789 789
     timepos -= elapsed.toDigital(buffer);
790
-    lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
790
+    lcd_put_lchar(timepos, 2, LCD_STR_CLOCK[0]);
791 791
   }
792 792
   lcd_put_u8str(buffer);
793 793
   return timepos;
@@ -912,7 +912,7 @@ void MarlinUI::draw_status_screen() {
912 912
             else {
913 913
               const xy_pos_t lpos = current_position.asLogical();
914 914
               _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
915
-              lcd_put_wchar(' ');
915
+              lcd_put_lchar(' ');
916 916
               _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
917 917
             }
918 918
 
@@ -926,7 +926,7 @@ void MarlinUI::draw_status_screen() {
926 926
       _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
927 927
 
928 928
       #if HAS_LEVELING && !HAS_HEATED_BED
929
-        lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
929
+        lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
930 930
       #endif
931 931
 
932 932
     #endif // LCD_HEIGHT > 2
@@ -935,9 +935,9 @@ void MarlinUI::draw_status_screen() {
935 935
 
936 936
     #if LCD_HEIGHT > 3
937 937
 
938
-      lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]);
938
+      lcd_put_lchar(0, 2, LCD_STR_FEEDRATE[0]);
939 939
       lcd_put_u8str(i16tostr3rj(feedrate_percentage));
940
-      lcd_put_wchar('%');
940
+      lcd_put_lchar('%');
941 941
 
942 942
       const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink);
943 943
 
@@ -969,9 +969,9 @@ void MarlinUI::draw_status_screen() {
969 969
                 per = planner.flow_percentage[0];
970 970
               #endif
971 971
             }
972
-          lcd_put_wchar(c);
972
+          lcd_put_lchar(c);
973 973
           lcd_put_u8str(i16tostr3rj(per));
974
-          lcd_put_wchar('%');
974
+          lcd_put_lchar('%');
975 975
         #endif
976 976
       #endif
977 977
 
@@ -993,7 +993,7 @@ void MarlinUI::draw_status_screen() {
993 993
     _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
994 994
 
995 995
     #if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
996
-      lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
996
+      lcd_put_lchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
997 997
     #endif
998 998
 
999 999
     // ========== Line 2 ==========
@@ -1008,9 +1008,9 @@ void MarlinUI::draw_status_screen() {
1008 1008
       _draw_bed_status(blink);
1009 1009
     #endif
1010 1010
 
1011
-    lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
1011
+    lcd_put_lchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
1012 1012
     lcd_put_u8str(i16tostr3rj(feedrate_percentage));
1013
-    lcd_put_wchar('%');
1013
+    lcd_put_lchar('%');
1014 1014
 
1015 1015
     // ========== Line 3 ==========
1016 1016
 
@@ -1075,29 +1075,29 @@ void MarlinUI::draw_status_screen() {
1075 1075
                  vlen = vstr ? utf8_strlen(vstr) : 0;
1076 1076
     if (style & SS_CENTER) {
1077 1077
       int8_t pad = (LCD_WIDTH - plen - vlen) / 2;
1078
-      while (--pad >= 0) { lcd_put_wchar(' '); n--; }
1078
+      while (--pad >= 0) { lcd_put_lchar(' '); n--; }
1079 1079
     }
1080 1080
     if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
1081 1081
     if (vlen) n -= lcd_put_u8str_max(vstr, n);
1082
-    for (; n > 0; --n) lcd_put_wchar(' ');
1082
+    for (; n > 0; --n) lcd_put_lchar(' ');
1083 1083
   }
1084 1084
 
1085 1085
   // Draw a generic menu item with pre_char (if selected) and post_char
1086 1086
   void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) {
1087
-    lcd_put_wchar(0, row, sel ? pre_char : ' ');
1087
+    lcd_put_lchar(0, row, sel ? pre_char : ' ');
1088 1088
     uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2);
1089
-    for (; n; --n) lcd_put_wchar(' ');
1090
-    lcd_put_wchar(post_char);
1089
+    for (; n; --n) lcd_put_lchar(' ');
1090
+    lcd_put_lchar(post_char);
1091 1091
   }
1092 1092
 
1093 1093
   // Draw a menu item with a (potentially) editable value
1094 1094
   void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
1095 1095
     const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
1096
-    lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
1096
+    lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
1097 1097
     uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
1098 1098
     if (vlen) {
1099
-      lcd_put_wchar(':');
1100
-      for (; n; --n) lcd_put_wchar(' ');
1099
+      lcd_put_lchar(':');
1100
+      for (; n; --n) lcd_put_lchar(' ');
1101 1101
       if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
1102 1102
     }
1103 1103
   }
@@ -1107,10 +1107,10 @@ void MarlinUI::draw_status_screen() {
1107 1107
     ui.encoder_direction_normal();
1108 1108
     uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1);
1109 1109
     if (value) {
1110
-      lcd_put_wchar(':'); n--;
1110
+      lcd_put_lchar(':'); n--;
1111 1111
       const uint8_t len = utf8_strlen(value) + 1;   // Plus one for a leading space
1112 1112
       const lcd_uint_t valrow = n < len ? 2 : 1;    // Value on the next row if it won't fit
1113
-      lcd_put_wchar(LCD_WIDTH - len, valrow, ' ');  // Right-justified, padded, leading space
1113
+      lcd_put_lchar(LCD_WIDTH - len, valrow, ' ');  // Right-justified, padded, leading space
1114 1114
       lcd_put_u8str(value);
1115 1115
     }
1116 1116
   }
@@ -1120,22 +1120,22 @@ void MarlinUI::draw_status_screen() {
1120 1120
     ui.draw_select_screen_prompt(pref, string, suff);
1121 1121
     if (no) {
1122 1122
       SETCURSOR(0, LCD_HEIGHT - 1);
1123
-      lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_wchar(yesno ? ' ' : ']');
1123
+      lcd_put_lchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_lchar(yesno ? ' ' : ']');
1124 1124
     }
1125 1125
     if (yes) {
1126 1126
       SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1);
1127
-      lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_wchar(yesno ? ']' : ' ');
1127
+      lcd_put_lchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_lchar(yesno ? ']' : ' ');
1128 1128
     }
1129 1129
   }
1130 1130
 
1131 1131
   #if ENABLED(SDSUPPORT)
1132 1132
 
1133 1133
     void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
1134
-      lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
1134
+      lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
1135 1135
       constexpr uint8_t maxlen = LCD_WIDTH - 2;
1136 1136
       uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
1137
-      for (; n; --n) lcd_put_wchar(' ');
1138
-      lcd_put_wchar(isDir ? LCD_STR_FOLDER[0] : ' ');
1137
+      for (; n; --n) lcd_put_lchar(' ');
1138
+      lcd_put_lchar(isDir ? LCD_STR_FOLDER[0] : ' ');
1139 1139
     }
1140 1140
 
1141 1141
   #endif
@@ -1253,7 +1253,7 @@ void MarlinUI::draw_status_screen() {
1253 1253
     void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
1254 1254
       add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
1255 1255
       lcd.createChar(c, (uint8_t*)&chrdata);
1256
-      lcd_put_wchar(x, y, c);
1256
+      lcd_put_lchar(x, y, c);
1257 1257
     }
1258 1258
 
1259 1259
     void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
@@ -1270,7 +1270,7 @@ void MarlinUI::draw_status_screen() {
1270 1270
         #define _LCD_W_POS 8
1271 1271
         #define _PLOT_X 0
1272 1272
         #define _MAP_X 1
1273
-        #define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C)
1273
+        #define _LABEL(X,Y,C) lcd_put_lchar(X, Y, C)
1274 1274
         #define _XLABEL(X,Y) _LABEL('X',X,Y)
1275 1275
         #define _YLABEL(X,Y) _LABEL('Y',X,Y)
1276 1276
         #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
@@ -1333,13 +1333,13 @@ void MarlinUI::draw_status_screen() {
1333 1333
         n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
1334 1334
 
1335 1335
         for (i = 0; i < n_cols; i++) {
1336
-          lcd_put_wchar(i, 0, CHAR_LINE_TOP);                               // Box Top line
1337
-          lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT);                      // Box Bottom line
1336
+          lcd_put_lchar(i, 0, CHAR_LINE_TOP);                               // Box Top line
1337
+          lcd_put_lchar(i, n_rows - 1, CHAR_LINE_BOT);                      // Box Bottom line
1338 1338
         }
1339 1339
 
1340 1340
         for (j = 0; j < n_rows; j++) {
1341
-          lcd_put_wchar(0, j, CHAR_EDGE_L);                                 // Box Left edge
1342
-          lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R);                        // Box Right edge
1341
+          lcd_put_lchar(0, j, CHAR_EDGE_L);                                 // Box Left edge
1342
+          lcd_put_lchar(n_cols - 1, j, CHAR_EDGE_R);                        // Box Right edge
1343 1343
         }
1344 1344
 
1345 1345
         /**
@@ -1349,8 +1349,8 @@ void MarlinUI::draw_status_screen() {
1349 1349
         k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
1350 1350
         l = (HD44780_CHAR_HEIGHT) * n_rows;
1351 1351
         if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
1352
-          lcd_put_wchar(0, n_rows - 1, ' ');                                // Box Left edge
1353
-          lcd_put_wchar(n_cols - 1, n_rows - 1, ' ');                       // Box Right edge
1352
+          lcd_put_lchar(0, n_rows - 1, ' ');                                // Box Left edge
1353
+          lcd_put_lchar(n_cols - 1, n_rows - 1, ' ');                       // Box Right edge
1354 1354
         }
1355 1355
 
1356 1356
         clear_custom_char(&new_char);
@@ -1464,11 +1464,11 @@ void MarlinUI::draw_status_screen() {
1464 1464
       /**
1465 1465
        * Print plot position
1466 1466
        */
1467
-      lcd_put_wchar(_LCD_W_POS, 0, '(');
1467
+      lcd_put_lchar(_LCD_W_POS, 0, '(');
1468 1468
       lcd_put_u8str(ui8tostr3rj(x_plot));
1469
-      lcd_put_wchar(',');
1469
+      lcd_put_lchar(',');
1470 1470
       lcd_put_u8str(ui8tostr3rj(y_plot));
1471
-      lcd_put_wchar(')');
1471
+      lcd_put_lchar(')');
1472 1472
 
1473 1473
       #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1474 1474
 

+ 5
- 5
Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp Wyświetl plik

@@ -48,7 +48,7 @@
48 48
 int lcd_glyph_height() { return 1; }
49 49
 
50 50
 typedef struct _TFTGLCD_charmap_t {
51
-  wchar_t uchar; // the unicode char
51
+  lchar_t uchar; // the unicode char
52 52
   uint8_t idx;   // the glyph of the char in the ROM
53 53
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
54 54
 } TFTGLCD_charmap_t;
@@ -991,7 +991,7 @@ void lcd_put_int(const int i) {
991 991
 
992 992
 // return < 0 on error
993 993
 // return the advanced cols
994
-int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) {
994
+int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
995 995
 
996 996
   // find the HD44780 internal ROM first
997 997
   int ret;
@@ -1049,10 +1049,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
1049 1049
   pixel_len_t ret = 0;
1050 1050
   const uint8_t *p = (uint8_t *)utf8_str;
1051 1051
   while (ret < max_length) {
1052
-    wchar_t ch = 0;
1053
-    p = get_utf8_value_cb(p, cb_read_byte, &ch);
1052
+    lchar_t ch;
1053
+    p = get_utf8_value_cb(p, cb_read_byte, ch);
1054 1054
     if (!ch) break;
1055
-    ret += lcd_put_wchar_max(ch, max_length - ret);
1055
+    ret += lcd_put_lchar_max(ch, max_length - ret);
1056 1056
   }
1057 1057
   return (int)ret;
1058 1058
 }

+ 9
- 9
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp Wyświetl plik

@@ -524,16 +524,16 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
524 524
       UNUSED(blink);
525 525
     #else
526 526
       if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
527
-        lcd_put_wchar(' ');
528
-        if (t2 >= 10) lcd_put_wchar(' ');
529
-        if (t2 >= 100) lcd_put_wchar(' ');
527
+        lcd_put_lchar(' ');
528
+        if (t2 >= 10) lcd_put_lchar(' ');
529
+        if (t2 >= 100) lcd_put_lchar(' ');
530 530
       }
531 531
       else
532 532
     #endif
533 533
         lcd_put_u8str(i16tostr3left(t2));
534 534
 
535
-    lcd_put_wchar(' ');
536
-    if (t2 < 10) lcd_put_wchar(' ');
535
+    lcd_put_lchar(' ');
536
+    if (t2 < 10) lcd_put_lchar(' ');
537 537
 
538 538
     if (t2) picBits |= ICON_TEMP1;
539 539
     else    picBits &= ~ICON_TEMP1;
@@ -545,7 +545,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
545 545
 
546 546
   FORCE_INLINE void _draw_flowmeter_status() {
547 547
     lcd_moveto(5, 5); lcd_put_u8str(F("FLOW"));
548
-    lcd_moveto(7, 6); lcd_put_wchar('L');
548
+    lcd_moveto(7, 6); lcd_put_lchar('L');
549 549
     lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
550 550
 
551 551
     if (cooler.flowrate)  picBits |= ICON_FAN;
@@ -564,7 +564,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
564 564
     {
565 565
       lcd_put_u8str("mA");
566 566
       lcd_moveto(10, 7);
567
-      lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
567
+      lcd_put_lchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f)));
568 568
     }
569 569
     else {
570 570
       lcd_put_u8str(" A");
@@ -585,9 +585,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
585 585
     #if CUTTER_UNIT_IS(RPM)
586 586
       lcd_moveto(16, 6);  lcd_put_u8str(F("RPM"));
587 587
       lcd_moveto(15, 7);  lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
588
-      lcd_put_wchar('K');
588
+      lcd_put_lchar('K');
589 589
     #elif CUTTER_UNIT_IS(PERCENT)
590
-      lcd_moveto(17, 6);  lcd_put_wchar('%');
590
+      lcd_moveto(17, 6);  lcd_put_lchar('%');
591 591
       lcd_moveto(18, 7);  lcd_put_u8str(cutter_power2str(cutter.unitPower));
592 592
     #else
593 593
       lcd_moveto(17, 7);  lcd_put_u8str(cutter_power2str(cutter.unitPower));

+ 1
- 1
Marlin/src/lcd/dogm/lcdprint_u8g.cpp Wyświetl plik

@@ -28,7 +28,7 @@ void lcd_put_int(const int i) { u8g.print(i); }
28 28
 
29 29
 // return < 0 on error
30 30
 // return the advanced pixels
31
-int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) {
31
+int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
32 32
   if (c < 256) {
33 33
     u8g.print((char)c);
34 34
     return u8g_GetFontBBXWidth(u8g.getU8g());

+ 18
- 18
Marlin/src/lcd/dogm/marlinui_DOGM.cpp Wyświetl plik

@@ -371,11 +371,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
371 371
 
372 372
       if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
373 373
 
374
-      lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
375
-      lcd_put_wchar((char)('1' + extruder));
376
-      lcd_put_wchar(' ');
374
+      lcd_put_lchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
375
+      lcd_put_lchar((char)('1' + extruder));
376
+      lcd_put_lchar(' ');
377 377
       lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
378
-      lcd_put_wchar('/');
378
+      lcd_put_lchar('/');
379 379
 
380 380
       if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
381 381
         lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
@@ -421,12 +421,12 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
421 421
                 vlen = vstr ? utf8_strlen(vstr) : 0;
422 422
       if (style & SS_CENTER) {
423 423
         int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2;
424
-        while (--pad >= 0) n -= lcd_put_wchar(' ');
424
+        while (--pad >= 0) n -= lcd_put_lchar(' ');
425 425
       }
426 426
 
427 427
       if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
428 428
       if (vlen) n -= lcd_put_u8str_max(vstr, n);
429
-      while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
429
+      while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
430 430
     }
431 431
   }
432 432
 
@@ -434,9 +434,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
434 434
   void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
435 435
     if (mark_as_selected(row, sel)) {
436 436
       pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
437
-      while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
438
-      lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
439
-      lcd_put_wchar(' ');
437
+      while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
438
+      lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
439
+      lcd_put_lchar(' ');
440 440
     }
441 441
   }
442 442
 
@@ -449,8 +449,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
449 449
 
450 450
       pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
451 451
       if (vallen) {
452
-        lcd_put_wchar(':');
453
-        while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
452
+        lcd_put_lchar(':');
453
+        while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
454 454
         lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
455 455
         if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
456 456
       }
@@ -494,14 +494,14 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
494 494
 
495 495
     // If a value is included, print a colon, then print the value right-justified
496 496
     if (value) {
497
-      lcd_put_wchar(':');
497
+      lcd_put_lchar(':');
498 498
       if (extra_row) {
499 499
         // Assume that value is numeric (with no descender)
500 500
         baseline += EDIT_FONT_ASCENT + 2;
501 501
         onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
502 502
       }
503 503
       if (onpage) {
504
-        lcd_put_wchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
504
+        lcd_put_lchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
505 505
         lcd_put_u8str(value);
506 506
       }
507 507
     }
@@ -533,10 +533,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
533 533
     void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
534 534
       if (mark_as_selected(row, sel)) {
535 535
         const uint8_t maxlen = LCD_WIDTH - isDir;
536
-        if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
536
+        if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]);
537 537
         const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
538 538
         pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
539
-        while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
539
+        while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
540 540
       }
541 541
     }
542 542
 
@@ -611,11 +611,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
611 611
 
612 612
       // Print plot position
613 613
       if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
614
-        lcd_put_wchar(5, LCD_PIXEL_HEIGHT, '(');
614
+        lcd_put_lchar(5, LCD_PIXEL_HEIGHT, '(');
615 615
         u8g.print(x_plot);
616
-        lcd_put_wchar(',');
616
+        lcd_put_lchar(',');
617 617
         u8g.print(y_plot);
618
-        lcd_put_wchar(')');
618
+        lcd_put_lchar(')');
619 619
 
620 620
         // Show the location value
621 621
         lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);

+ 22
- 22
Marlin/src/lcd/dogm/status_screen_DOGM.cpp Wyświetl plik

@@ -200,7 +200,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
200 200
     const char *str = i16tostr3rj(temp);
201 201
     const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
202 202
     lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
203
-    lcd_put_wchar(LCD_STR_DEGREE[0]);
203
+    lcd_put_lchar(LCD_STR_DEGREE[0]);
204 204
   }
205 205
 }
206 206
 
@@ -432,13 +432,13 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
432 432
   const bool is_inch = parser.using_inch_units();
433 433
   const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
434 434
   const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
435
-  lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis));
435
+  lcd_put_lchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis));
436 436
   lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
437 437
 
438 438
   if (blink)
439 439
     lcd_put_u8str(value);
440 440
   else if (axis_should_home(axis))
441
-    while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
441
+    while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
442 442
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
443 443
     lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
444 444
   else
@@ -675,7 +675,7 @@ void MarlinUI::draw_status_screen() {
675 675
           lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
676 676
         #elif CUTTER_UNIT_IS(RPM)
677 677
           lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
678
-          lcd_put_wchar('K');
678
+          lcd_put_lchar('K');
679 679
         #else
680 680
           lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
681 681
         #endif
@@ -734,7 +734,7 @@ void MarlinUI::draw_status_screen() {
734 734
             }
735 735
           #endif
736 736
           lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
737
-          lcd_put_wchar(c);
737
+          lcd_put_lchar(c);
738 738
         }
739 739
       }
740 740
     #endif
@@ -783,7 +783,7 @@ void MarlinUI::draw_status_screen() {
783 783
         if (progress_state == 0) {
784 784
           if (progress_string[0]) {
785 785
             lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
786
-            lcd_put_wchar('%');
786
+            lcd_put_lchar('%');
787 787
           }
788 788
         }
789 789
         else if (progress_state == 2 && estimation_string[0]) {
@@ -804,7 +804,7 @@ void MarlinUI::draw_status_screen() {
804 804
         #if ENABLED(SHOW_SD_PERCENT)
805 805
           if (progress_string[0]) {
806 806
             lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
807
-            lcd_put_wchar('%');
807
+            lcd_put_lchar('%');
808 808
           }
809 809
         #endif
810 810
 
@@ -814,7 +814,7 @@ void MarlinUI::draw_status_screen() {
814 814
 
815 815
         #if ENABLED(SHOW_REMAINING_TIME)
816 816
           if (blink && estimation_string[0]) {
817
-            lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
817
+            lcd_put_lchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
818 818
             lcd_put_u8str(estimation_string);
819 819
           }
820 820
           else
@@ -912,11 +912,11 @@ void MarlinUI::draw_status_screen() {
912 912
 
913 913
   if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
914 914
     set_font(FONT_MENU);
915
-    lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
915
+    lcd_put_lchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
916 916
 
917 917
     set_font(FONT_STATUSMENU);
918 918
     lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
919
-    lcd_put_wchar('%');
919
+    lcd_put_lchar('%');
920 920
 
921 921
     //
922 922
     // Filament sensor display if SD is disabled
@@ -924,10 +924,10 @@ void MarlinUI::draw_status_screen() {
924 924
     #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
925 925
       lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
926 926
       lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
927
-      lcd_put_wchar('%');
927
+      lcd_put_lchar('%');
928 928
       set_font(FONT_MENU);
929
-      lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
930
-      lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
929
+      lcd_put_lchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
930
+      lcd_put_lchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
931 931
     #endif
932 932
   }
933 933
 
@@ -941,12 +941,12 @@ void MarlinUI::draw_status_screen() {
941 941
       // Alternate Status message and Filament display
942 942
       if (ELAPSED(millis(), next_filament_display)) {
943 943
         lcd_put_u8str(F(LCD_STR_FILAM_DIA));
944
-        lcd_put_wchar(':');
944
+        lcd_put_lchar(':');
945 945
         lcd_put_u8str(wstring);
946 946
         lcd_put_u8str(F("  " LCD_STR_FILAM_MUL));
947
-        lcd_put_wchar(':');
947
+        lcd_put_lchar(':');
948 948
         lcd_put_u8str(mstring);
949
-        lcd_put_wchar('%');
949
+        lcd_put_lchar('%');
950 950
         return;
951 951
       }
952 952
     #endif
@@ -979,7 +979,7 @@ void MarlinUI::draw_status_message(const bool blink) {
979 979
     if (slen <= lcd_width) {
980 980
       // The string fits within the line. Print with no scrolling
981 981
       lcd_put_u8str(status_message);
982
-      while (slen < lcd_width) { lcd_put_wchar(' '); ++slen; }
982
+      while (slen < lcd_width) { lcd_put_lchar(' '); ++slen; }
983 983
     }
984 984
     else {
985 985
       // String is longer than the available space
@@ -997,14 +997,14 @@ void MarlinUI::draw_status_message(const bool blink) {
997 997
       // If the remaining string doesn't completely fill the screen
998 998
       if (rlen < lcd_width) {
999 999
         uint8_t chars = lcd_width - rlen;       // Amount of space left in characters
1000
-        lcd_put_wchar(' ');                     // Always at 1+ spaces left, draw a space
1000
+        lcd_put_lchar(' ');                     // Always at 1+ spaces left, draw a space
1001 1001
         if (--chars) {                          // Draw a second space if there's room
1002
-          lcd_put_wchar(' ');
1002
+          lcd_put_lchar(' ');
1003 1003
           if (--chars) {                        // Draw a third space if there's room
1004
-            lcd_put_wchar(' ');
1004
+            lcd_put_lchar(' ');
1005 1005
             if (--chars) {                      // Print a second copy of the message
1006 1006
               lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
1007
-              lcd_put_wchar(' ');
1007
+              lcd_put_lchar(' ');
1008 1008
             }
1009 1009
           }
1010 1010
         }
@@ -1019,7 +1019,7 @@ void MarlinUI::draw_status_message(const bool blink) {
1019 1019
     lcd_put_u8str_max(status_message, pixel_width);
1020 1020
 
1021 1021
     // Fill the rest with spaces
1022
-    for (; slen < lcd_width; ++slen) lcd_put_wchar(' ');
1022
+    for (; slen < lcd_width; ++slen) lcd_put_lchar(' ');
1023 1023
 
1024 1024
   #endif // !STATUS_MESSAGE_SCROLLING
1025 1025
 

+ 12
- 12
Marlin/src/lcd/dogm/u8g_fontutf8.cpp Wyświetl plik

@@ -60,11 +60,11 @@ static int fontgroup_init(font_group_t * root, const uxg_fontinfo_t * fntinfo, i
60 60
   return 0;
61 61
 }
62 62
 
63
-static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
64
-  uxg_fontinfo_t vcmp = {(uint16_t)(val / 128), (uint8_t)(val % 128 + 128), (uint8_t)(val % 128 + 128), 0, 0};
65
-  size_t idx = 0;
63
+static const font_t* fontgroup_find(font_group_t * root, const lchar_t &val) {
64
+  if (val <= 0xFF) return nullptr;
66 65
 
67
-  if (val < 256) return nullptr;
66
+  uxg_fontinfo_t vcmp = { uint16_t(val >> 7), uint8_t((val & 0x7F) + 0x80), uint8_t((val & 0x7F) + 0x80), 0, 0 };
67
+  size_t idx = 0;
68 68
 
69 69
   if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0)
70 70
     return nullptr;
@@ -73,7 +73,7 @@ static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
73 73
   return vcmp.fntdata;
74 74
 }
75 75
 
76
-static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, wchar_t val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
76
+static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, const lchar_t &val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
77 77
   uint8_t buf[2] = {0, 0};
78 78
   const font_t * fntpqm = (font_t*)fontgroup_find(group, val);
79 79
   if (!fntpqm) {
@@ -106,10 +106,10 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default,
106 106
 static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
107 107
   const uint8_t *p = (uint8_t*)utf8_msg;
108 108
   for (;;) {
109
-    wchar_t val = 0;
110
-    p = get_utf8_value_cb(p, cb_read_byte, &val);
111
-    if (!val) break;
112
-    fontgroup_drawwchar(group, fnt_default, val, userdata, cb_draw_ram);
109
+    lchar_t ch;
110
+    p = get_utf8_value_cb(p, cb_read_byte, ch);
111
+    if (!ch) break;
112
+    fontgroup_drawwchar(group, fnt_default, ch, userdata, cb_draw_ram);
113 113
   }
114 114
 }
115 115
 
@@ -149,19 +149,19 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons
149 149
 }
150 150
 
151 151
 /**
152
- * @brief Draw a wchar_t at the specified position
152
+ * @brief Draw a lchar_t at the specified position
153 153
  *
154 154
  * @param pu8g : U8G pointer
155 155
  * @param x : position x axis
156 156
  * @param y : position y axis
157
- * @param ch : the wchar_t
157
+ * @param ch : the lchar_t
158 158
  * @param max_width : the pixel width of the string allowed
159 159
  *
160 160
  * @return number of pixels advanced
161 161
  *
162 162
  * Draw a UTF-8 string at the specified position
163 163
  */
164
-unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_width) {
164
+unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, pixel_len_t max_width) {
165 165
   struct _uxg_drawu8_data_t data;
166 166
   font_group_t *group = &g_fontgroup_root;
167 167
   const font_t *fnt_default = uxg_GetFont(pu8g);

+ 1
- 1
Marlin/src/lcd/dogm/u8g_fontutf8.h Wyświetl plik

@@ -26,7 +26,7 @@ typedef struct _uxg_fontinfo_t {
26 26
 
27 27
 int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
28 28
 
29
-unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, const pixel_len_t max_length);
29
+unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length);
30 30
 
31 31
 unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length);
32 32
 unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length);

+ 14
- 14
Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp Wyświetl plik

@@ -50,12 +50,12 @@ uint8_t read_byte(const uint8_t *byte) { return *byte; }
50 50
  *   @ displays an axis name such as XYZUVW, or E for an extruder
51 51
  */
52 52
 void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) {
53
-  wchar_t wchar;
53
+  lchar_t ch;
54 54
 
55 55
   while (*tpl) {
56
-    tpl = get_utf8_value_cb(tpl, read_byte, &wchar);
57
-    if (wchar > 255) wchar |= 0x0080;
58
-    const uint8_t ch = uint8_t(wchar & 0x00FF);
56
+    tpl = get_utf8_value_cb(tpl, read_byte, ch);
57
+    if (ch > 255) ch |= 0x0080;
58
+    const uint8_t ch = uint8_t(ch & 0x00FF);
59 59
 
60 60
     if (ch == '=' || ch == '~' || ch == '*') {
61 61
       if (index >= 0) {
@@ -80,32 +80,32 @@ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nu
80 80
 }
81 81
 
82 82
 void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
83
-  wchar_t wchar;
83
+  lchar_t ch;
84 84
   while (*cstr && max_len) {
85
-    cstr = get_utf8_value_cb(cstr, read_byte, &wchar);
85
+    cstr = get_utf8_value_cb(cstr, read_byte, ch);
86 86
     /*
87
-    if (wchar > 255) wchar |= 0x0080;
88
-    uint8_t ch = uint8_t(wchar & 0x00FF);
87
+    if (ch > 255) ch |= 0x0080;
88
+    uint8_t ch = uint8_t(ch & 0x00FF);
89 89
     add_character(ch);
90 90
     */
91
-    add(wchar);
91
+    add(ch);
92 92
     max_len--;
93 93
   }
94 94
   eol();
95 95
 }
96 96
 
97
-void DWIN_String::add(const wchar_t character) {
97
+void DWIN_String::add(const lchar_t &ch) {
98 98
   int ret;
99 99
   size_t idx = 0;
100 100
   dwin_charmap_t pinval;
101 101
   dwin_charmap_t *copy_address = nullptr;
102
-  pinval.uchar = character;
102
+  pinval.uchar = ch;
103 103
   pinval.idx = -1;
104 104
 
105
-  // For 8-bit ASCII just print the single character
105
+  // For 8-bit ASCII just print the single ch
106 106
   char str[] = { '?', 0 };
107
-  if (character < 255) {
108
-    str[0] = (char)character;
107
+  if (ch < 255) {
108
+    str[0] = (char)ch;
109 109
   }
110 110
   else {
111 111
     copy_address = nullptr;

+ 4
- 4
Marlin/src/lcd/e3v2/marlinui/dwin_string.h Wyświetl plik

@@ -29,7 +29,7 @@
29 29
 #include <stdint.h>
30 30
 
31 31
 typedef struct _dwin_charmap_t {
32
-  wchar_t uchar; // the unicode char
32
+  lchar_t uchar; // the unicode char
33 33
   uint8_t idx;   // the glyph of the char in the ROM
34 34
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
35 35
 } dwin_charmap_t;
@@ -69,10 +69,10 @@ class DWIN_String {
69 69
     /**
70 70
      * @brief Append a UTF-8 character
71 71
      *
72
-     * @param character The UTF-8 character
72
+     * @param ch The UTF-8 character
73 73
      */
74
-    static void add(wchar_t character);
75
-    static void set(wchar_t character) { set(); add(character); }
74
+    static void add(const lchar_t &ch);
75
+    static void set(const lchar_t &ch) { set(); add(ch); }
76 76
 
77 77
     /**
78 78
      * @brief Append / Set C-string

+ 3
- 3
Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp Wyświetl plik

@@ -63,7 +63,7 @@ int lcd_put_dwin_string() {
63 63
 
64 64
 // return < 0 on error
65 65
 // return the advanced cols
66
-int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) {
66
+int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
67 67
   dwin_string.set(c);
68 68
   dwin_string.truncate(max_length);
69 69
   // Draw the char(s) at the cursor and advance the cursor
@@ -87,8 +87,8 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
87 87
   const uint8_t *p = (uint8_t *)utf8_str;
88 88
   dwin_string.set();
89 89
   while (dwin_string.length < max_length) {
90
-    wchar_t ch = 0;
91
-    p = get_utf8_value_cb(p, cb_read_byte, &ch);
90
+    lchar_t ch;
91
+    p = get_utf8_value_cb(p, cb_read_byte, ch);
92 92
     if (!ch) break;
93 93
     dwin_string.add(ch);
94 94
   }

+ 4
- 4
Marlin/src/lcd/e3v2/marlinui/ui_common.cpp Wyświetl plik

@@ -213,7 +213,7 @@ void MarlinUI::draw_status_message(const bool blink) {
213 213
         lcd_put_u8str(status_message);
214 214
 
215 215
         // Fill the rest with spaces
216
-        while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; }
216
+        while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; }
217 217
       }
218 218
     }
219 219
     else {
@@ -227,10 +227,10 @@ void MarlinUI::draw_status_message(const bool blink) {
227 227
 
228 228
       // If the string doesn't completely fill the line...
229 229
       if (rlen < max_status_chars) {
230
-        lcd_put_wchar('.');                   // Always at 1+ spaces left, draw a dot
230
+        lcd_put_lchar('.');                   // Always at 1+ spaces left, draw a dot
231 231
         uint8_t chars = max_status_chars - rlen;  // Amount of space left in characters
232 232
         if (--chars) {                        // Draw a second dot if there's space
233
-          lcd_put_wchar('.');
233
+          lcd_put_lchar('.');
234 234
           if (--chars)
235 235
             lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
236 236
         }
@@ -254,7 +254,7 @@ void MarlinUI::draw_status_message(const bool blink) {
254 254
       lcd_put_u8str_max(status_message, max_status_chars);
255 255
 
256 256
       // Fill the rest with spaces if there are missing spaces
257
-      while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; }
257
+      while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; }
258 258
     }
259 259
 
260 260
   #endif

+ 7
- 10
Marlin/src/lcd/fontutils.h Wyświetl plik

@@ -31,36 +31,33 @@
31 31
 #pragma once
32 32
 
33 33
 #include <stdlib.h>
34
-#include <stddef.h> // wchar_t
35 34
 #include <stdint.h> // uint32_t
36 35
 
37 36
 #include "../HAL/shared/Marduino.h"
38 37
 #include "../core/macros.h"
39 38
 
39
+#define MAX_UTF8_CHAR_SIZE 4
40
+
40 41
 // read a byte from ROM or RAM
41 42
 typedef uint8_t (*read_byte_cb_t)(const uint8_t * str);
42 43
 
43 44
 uint8_t read_byte_ram(const uint8_t *str);
44 45
 uint8_t read_byte_rom(const uint8_t *str);
45 46
 
46
-// there's overflow of the wchar_t due to the 2-byte size in Arduino
47
-// sizeof(wchar_t)=2; sizeof(size_t)=2; sizeof(uint32_t)=4;
48
-// sizeof(int)=2; sizeof(long)=4; sizeof(unsigned)=2;
49
-//#undef wchar_t
50
-#define wchar_t uint32_t
51
-//typedef uint32_t wchar_t;
47
+// An extra long character type because wchar_t is only 2 bytes
48
+typedef uint32_t lchar_t;
52 49
 
53 50
 typedef uint16_t pixel_len_t;
54 51
 #define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1))
55 52
 
56 53
 /* Perform binary search */
57
-typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin); /*"data_list[idx] - *data_pin"*/
54
+typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin);
58 55
 int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx);
59 56
 
60 57
 /* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */
61
-const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval);
58
+const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval);
62 59
 
63
-inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) {
60
+inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval) {
64 61
   return (const char *)get_utf8_value_cb((const uint8_t *)pstart, cb_read_byte, pval);
65 62
 }
66 63
 

+ 9
- 9
Marlin/src/lcd/lcdprint.cpp Wyświetl plik

@@ -47,19 +47,19 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/
47 47
   const uint8_t *p = (uint8_t*)ptpl;
48 48
   int8_t n = maxlen;
49 49
   while (n > 0) {
50
-    wchar_t ch;
51
-    p = get_utf8_value_cb(p, read_byte_rom, &ch);
50
+    lchar_t ch;
51
+    p = get_utf8_value_cb(p, read_byte_rom, ch);
52 52
     if (!ch) break;
53 53
     if (ch == '=' || ch == '~' || ch == '*') {
54 54
       if (ind >= 0) {
55
-        if (ch == '*') { lcd_put_wchar('E'); n--; }
55
+        if (ch == '*') { lcd_put_lchar('E'); n--; }
56 56
         if (n) {
57 57
           int8_t inum = ind + ((ch == '=') ? 0 : LCD_FIRST_TOOL);
58 58
           if (inum >= 10) {
59
-            lcd_put_wchar('0' + (inum / 10)); n--;
59
+            lcd_put_lchar('0' + (inum / 10)); n--;
60 60
             inum %= 10;
61 61
           }
62
-          if (n) { lcd_put_wchar('0' + inum); n--; }
62
+          if (n) { lcd_put_lchar('0' + inum); n--; }
63 63
         }
64 64
       }
65 65
       else {
@@ -78,11 +78,11 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/
78 78
       n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
79 79
     }
80 80
     else if (ch == '@') {
81
-      lcd_put_wchar(AXIS_CHAR(ind));
81
+      lcd_put_lchar(AXIS_CHAR(ind));
82 82
       n--;
83 83
     }
84 84
     else {
85
-      lcd_put_wchar(ch);
85
+      lcd_put_lchar(ch);
86 86
       n -= ch > 255 ? prop : 1;
87 87
     }
88 88
   }
@@ -97,8 +97,8 @@ int calculateWidth(PGM_P const pstr) {
97 97
   int n = 0;
98 98
 
99 99
   do {
100
-    wchar_t ch;
101
-    p = get_utf8_value_cb(p, read_byte_rom, &ch);
100
+    lchar_t ch;
101
+    p = get_utf8_value_cb(p, read_byte_rom, ch);
102 102
     if (!ch) break;
103 103
     n += (ch > 255) ? prop : 1;
104 104
   } while (1);

+ 5
- 5
Marlin/src/lcd/lcdprint.h Wyświetl plik

@@ -138,7 +138,7 @@ int lcd_glyph_height();
138 138
  *
139 139
  * @return the output width (in pixels on GLCD)
140 140
  */
141
-int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length);
141
+int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length);
142 142
 
143 143
 /**
144 144
  * @brief Draw a SRAM UTF-8 string
@@ -267,17 +267,17 @@ inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, const char
267 267
 /**
268 268
  * @brief Draw a UTF-8 character with no width limit
269 269
  *
270
- * @param c The wchar to draw
270
+ * @param c The lchar to draw
271 271
  * @return the output width (in pixels on GLCD)
272 272
  */
273
-inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
273
+inline int lcd_put_lchar(const lchar_t &c) { return lcd_put_lchar_max(c, PIXEL_LEN_NOLIMIT); }
274 274
 /**
275 275
  * @param col
276 276
  * @param row
277 277
  */
278
-inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) {
278
+inline int lcd_put_lchar(const lcd_uint_t col, const lcd_uint_t row, const lchar_t &c) {
279 279
   lcd_moveto(col, row);
280
-  return lcd_put_wchar(c);
280
+  return lcd_put_lchar(c);
281 281
 }
282 282
 
283 283
 /**

+ 6
- 6
Marlin/src/lcd/marlinui.cpp Wyświetl plik

@@ -417,14 +417,14 @@ void MarlinUI::init() {
417 417
         };
418 418
 
419 419
         const uint8_t *p = (uint8_t*)string;
420
-        wchar_t ch;
420
+        lchar_t ch;
421 421
         if (wordwrap) {
422 422
           const uint8_t *wrd = nullptr;
423 423
           uint8_t c = 0;
424 424
           // find the end of the part
425 425
           for (;;) {
426 426
             if (!wrd) wrd = p;            // Get word start /before/ advancing
427
-            p = get_utf8_value_cb(p, cb_read_byte, &ch);
427
+            p = get_utf8_value_cb(p, cb_read_byte, ch);
428 428
             const bool eol = !ch;         // zero ends the string
429 429
             // End or a break between phrases?
430 430
             if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') {
@@ -435,8 +435,8 @@ void MarlinUI::init() {
435 435
               col += c;                   // advance col to new position
436 436
               while (c) {                 // character countdown
437 437
                 --c;                      // count down to zero
438
-                wrd = get_utf8_value_cb(wrd, cb_read_byte, &ch); // get characters again
439
-                lcd_put_wchar(ch);        // character to the LCD
438
+                wrd = get_utf8_value_cb(wrd, cb_read_byte, ch); // get characters again
439
+                lcd_put_lchar(ch);        // character to the LCD
440 440
               }
441 441
               if (eol) break;             // all done!
442 442
               wrd = nullptr;              // set up for next word
@@ -446,9 +446,9 @@ void MarlinUI::init() {
446 446
         }
447 447
         else {
448 448
           for (;;) {
449
-            p = get_utf8_value_cb(p, cb_read_byte, &ch);
449
+            p = get_utf8_value_cb(p, cb_read_byte, ch);
450 450
             if (!ch) break;
451
-            lcd_put_wchar(ch);
451
+            lcd_put_lchar(ch);
452 452
             col++;
453 453
             if (col >= LCD_WIDTH) _newline();
454 454
           }

+ 1
- 1
Marlin/src/lcd/menu/menu_bed_corners.cpp Wyświetl plik

@@ -178,7 +178,7 @@ static void _lcd_level_bed_corners_get_next_position() {
178 178
       lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS));
179 179
       IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy));
180 180
       lcd_put_u8str(GOOD_POINTS_TO_STR(good_points));
181
-      lcd_put_wchar('/');
181
+      lcd_put_lchar('/');
182 182
       lcd_put_u8str(GOOD_POINTS_TO_STR(nr_edge_points));
183 183
     }
184 184
 

+ 1
- 1
Marlin/src/lcd/menu/menu_configuration.cpp Wyświetl plik

@@ -79,7 +79,7 @@ void menu_advanced_settings();
79 79
     LIMIT(bar_percent, 0, 100);
80 80
     ui.encoderPosition = 0;
81 81
     MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT);
82
-    lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_wchar('%');
82
+    lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_lchar('%');
83 83
     lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
84 84
   }
85 85
 

+ 3
- 3
Marlin/src/lcd/menu/menu_password.cpp Wyświetl plik

@@ -61,10 +61,10 @@ void Password::menu_password_entry() {
61 61
   FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT);
62 62
   EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered);
63 63
   MENU_ITEM_ADDON_START(utf8_strlen(label) + 1);
64
-    lcd_put_wchar(' ');
65
-    lcd_put_wchar('1' + digit_no);
64
+    lcd_put_lchar(' ');
65
+    lcd_put_lchar('1' + digit_no);
66 66
     SETCURSOR_X(LCD_WIDTH - 2);
67
-    lcd_put_wchar('>');
67
+    lcd_put_lchar('>');
68 68
   MENU_ITEM_ADDON_END();
69 69
 
70 70
   ACTION_ITEM(MSG_START_OVER, start_over);

+ 2
- 2
Marlin/src/lcd/menu/menu_tune.cpp Wyświetl plik

@@ -76,12 +76,12 @@
76 76
           #if ENABLED(TFT_COLOR_UI)
77 77
             lcd_moveto(4, 3);
78 78
             lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
79
-            lcd_put_wchar(':');
79
+            lcd_put_lchar(':');
80 80
             lcd_moveto(10, 3);
81 81
           #else
82 82
             lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
83 83
             lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
84
-            lcd_put_wchar(':');
84
+            lcd_put_lchar(':');
85 85
           #endif
86 86
           lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));
87 87
         }

+ 8
- 8
Marlin/src/lcd/tft/tft_string.cpp Wyświetl plik

@@ -94,12 +94,12 @@ void TFT_String::set() {
94 94
  *   @ displays an axis name such as XYZUVW, or E for an extruder
95 95
  */
96 96
 void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) {
97
-  wchar_t wchar;
97
+  lchar_t ch;
98 98
 
99 99
   while (*tpl) {
100
-    tpl = get_utf8_value_cb(tpl, read_byte_ram, &wchar);
101
-    if (wchar > 255) wchar |= 0x0080;
102
-    const uint8_t ch = uint8_t(wchar & 0x00FF);
100
+    tpl = get_utf8_value_cb(tpl, read_byte_ram, ch);
101
+    if (ch > 255) ch |= 0x0080;
102
+    const uint8_t ch = uint8_t(ch & 0x00FF);
103 103
 
104 104
     if (ch == '=' || ch == '~' || ch == '*') {
105 105
       if (index >= 0) {
@@ -124,11 +124,11 @@ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nul
124 124
 }
125 125
 
126 126
 void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
127
-  wchar_t wchar;
127
+  lchar_t ch;
128 128
   while (*cstr && max_len) {
129
-    cstr = get_utf8_value_cb(cstr, read_byte_ram, &wchar);
130
-    if (wchar > 255) wchar |= 0x0080;
131
-    const uint8_t ch = uint8_t(wchar & 0x00FF);
129
+    cstr = get_utf8_value_cb(cstr, read_byte_ram, ch);
130
+    if (ch > 255) ch |= 0x0080;
131
+    const uint8_t ch = uint8_t(ch & 0x00FF);
132 132
     add_character(ch);
133 133
     max_len--;
134 134
   }

+ 1
- 1
Marlin/src/lcd/tft/tft_string.h Wyświetl plik

@@ -97,7 +97,7 @@ class TFT_String {
97 97
      * @param character The ASCII character
98 98
      */
99 99
     static void add(const char character) { add_character(character); eol(); }
100
-    static void set(wchar_t character) { set(); add(character); }
100
+    static void set(const lchar_t &character) { set(); add(character); }
101 101
 
102 102
     /**
103 103
      * @brief Append / Set C-string

+ 1
- 1
Marlin/src/lcd/tft/ui_common.cpp Wyświetl plik

@@ -96,7 +96,7 @@ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
96 96
   lcd_gotopixel(int(col) * (TFT_COL_WIDTH), int(row) * MENU_LINE_HEIGHT);
97 97
 }
98 98
 
99
-int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) {
99
+int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
100 100
   if (max_length < 1) return 0;
101 101
   tft_string.set(c);
102 102
   tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);

Ładowanie…
Anuluj
Zapisz