Browse Source

🩹 Remove poison wchar_t macro

Scott Lahteine 2 years ago
parent
commit
cb4a79173b

+ 3
- 3
Marlin/src/feature/power_monitor.cpp View File

53
     void PowerMonitor::draw_current() {
53
     void PowerMonitor::draw_current() {
54
       const float amps = getAmps();
54
       const float amps = getAmps();
55
       lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps));
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
   #endif
58
   #endif
59
 
59
 
61
     void PowerMonitor::draw_voltage() {
61
     void PowerMonitor::draw_voltage() {
62
       const float volts = getVolts();
62
       const float volts = getVolts();
63
       lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts));
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
   #endif
66
   #endif
67
 
67
 
69
     void PowerMonitor::draw_power() {
69
     void PowerMonitor::draw_power() {
70
       const float power = getPower();
70
       const float power = getPower();
71
       lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power));
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
   #endif
74
   #endif
75
 
75
 

+ 5
- 5
Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp View File

50
 int lcd_glyph_height() { return 1; }
50
 int lcd_glyph_height() { return 1; }
51
 
51
 
52
 typedef struct _hd44780_charmap_t {
52
 typedef struct _hd44780_charmap_t {
53
-  wchar_t uchar; // the unicode char
53
+  lchar_t uchar; // the unicode char
54
   uint8_t idx;   // the glyph of the char in the ROM
54
   uint8_t idx;   // the glyph of the char in the ROM
55
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
55
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
56
 } hd44780_charmap_t;
56
 } hd44780_charmap_t;
992
 
992
 
993
 // return < 0 on error
993
 // return < 0 on error
994
 // return the advanced cols
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
   // find the HD44780 internal ROM first
997
   // find the HD44780 internal ROM first
998
   int ret;
998
   int ret;
1051
   pixel_len_t ret = 0;
1051
   pixel_len_t ret = 0;
1052
   const uint8_t *p = (uint8_t *)utf8_str;
1052
   const uint8_t *p = (uint8_t *)utf8_str;
1053
   while (ret < max_length) {
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
     if (!ch) break;
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
   return (int)ret;
1059
   return (int)ret;
1060
 }
1060
 }

+ 69
- 69
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp View File

405
   void lcd_erase_line(const lcd_uint_t line) {
405
   void lcd_erase_line(const lcd_uint_t line) {
406
     lcd_moveto(0, line);
406
     lcd_moveto(0, line);
407
     for (uint8_t i = LCD_WIDTH + 1; --i;)
407
     for (uint8_t i = LCD_WIDTH + 1; --i;)
408
-      lcd_put_wchar(' ');
408
+      lcd_put_lchar(' ');
409
   }
409
   }
410
 
410
 
411
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
411
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
413
     uint8_t slen = utf8_strlen(ftxt);
413
     uint8_t slen = utf8_strlen(ftxt);
414
     if (slen < len) {
414
     if (slen < len) {
415
       lcd_put_u8str_max(col, line, ftxt, len);
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
       safe_delay(time);
417
       safe_delay(time);
418
     }
418
     }
419
     else {
419
     else {
425
         lcd_put_u8str_max_P(col, line, p, len);
425
         lcd_put_u8str_max_P(col, line, p, len);
426
 
426
 
427
         // Fill with spaces
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
         // Delay
430
         // Delay
431
         safe_delay(dly);
431
         safe_delay(dly);
439
 
439
 
440
   static void logo_lines(FSTR_P const extra) {
440
   static void logo_lines(FSTR_P const extra) {
441
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2;
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
     lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra);
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
   void MarlinUI::show_bootscreen() {
447
   void MarlinUI::show_bootscreen() {
510
 // Homed and known, display constantly.
510
 // Homed and known, display constantly.
511
 //
511
 //
512
 FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
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
   if (blink)
514
   if (blink)
515
     lcd_put_u8str(value);
515
     lcd_put_u8str(value);
516
   else if (axis_should_home(axis))
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
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
518
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
519
     lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
519
     lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
520
   else
520
   else
531
     const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
531
     const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
532
   #endif
532
   #endif
533
 
533
 
534
-  if (prefix >= 0) lcd_put_wchar(prefix);
534
+  if (prefix >= 0) lcd_put_lchar(prefix);
535
 
535
 
536
   lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
536
   lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
537
-  lcd_put_wchar('/');
537
+  lcd_put_lchar('/');
538
 
538
 
539
   #if !HEATER_IDLE_HANDLER
539
   #if !HEATER_IDLE_HANDLER
540
     UNUSED(blink);
540
     UNUSED(blink);
541
   #else
541
   #else
542
     if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
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
     else
547
     else
548
   #endif
548
   #endif
549
       lcd_put_u8str(i16tostr3left(t2));
549
       lcd_put_u8str(i16tostr3left(t2));
550
 
550
 
551
   if (prefix >= 0) {
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
 FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
559
 FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
560
   const celsius_t t2 = thermalManager.degTargetCooler();
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
   lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
564
   lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
565
-  lcd_put_wchar('/');
565
+  lcd_put_lchar('/');
566
 
566
 
567
   #if !HEATER_IDLE_HANDLER
567
   #if !HEATER_IDLE_HANDLER
568
     UNUSED(blink);
568
     UNUSED(blink);
569
   #else
569
   #else
570
     if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
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
     else
575
     else
576
   #endif
576
   #endif
577
       lcd_put_u8str(i16tostr3left(t2));
577
       lcd_put_u8str(i16tostr3left(t2));
578
 
578
 
579
   if (prefix >= 0) {
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
 #endif
585
 #endif
588
   FORCE_INLINE void _draw_flowmeter_status() {
588
   FORCE_INLINE void _draw_flowmeter_status() {
589
     lcd_put_u8str("~");
589
     lcd_put_u8str("~");
590
     lcd_put_u8str(ftostr11ns(cooler.flowrate));
590
     lcd_put_u8str(ftostr11ns(cooler.flowrate));
591
-    lcd_put_wchar('L');
591
+    lcd_put_lchar('L');
592
   }
592
   }
593
 #endif
593
 #endif
594
 
594
 
602
     }
602
     }
603
     else {
603
     else {
604
       lcd_put_u8str(ftostr12ns(ammeter.current));
604
       lcd_put_u8str(ftostr12ns(ammeter.current));
605
-      lcd_put_wchar('A');
605
+      lcd_put_lchar('A');
606
     }
606
     }
607
   }
607
   }
608
 #endif
608
 #endif
620
       lcd_put_u8str(ui8tostr3rj(progress));
620
       lcd_put_u8str(ui8tostr3rj(progress));
621
     else
621
     else
622
       lcd_put_u8str(F("---"));
622
       lcd_put_u8str(F("---"));
623
-    lcd_put_wchar('%');
623
+    lcd_put_lchar('%');
624
   }
624
   }
625
 
625
 
626
 #endif
626
 #endif
667
       lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
667
       lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
668
       lcd_put_u8str(F(" V"));
668
       lcd_put_u8str(F(" V"));
669
       lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
669
       lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
670
-      lcd_put_wchar('%');
670
+      lcd_put_lchar('%');
671
       return;
671
       return;
672
     }
672
     }
673
 
673
 
686
       lcd_put_u8str(status_message);
686
       lcd_put_u8str(status_message);
687
 
687
 
688
       // Fill the rest with spaces
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
     else {
691
     else {
692
       // String is larger than the available space in screen.
692
       // String is larger than the available space in screen.
700
       // If the remaining string doesn't completely fill the screen
700
       // If the remaining string doesn't completely fill the screen
701
       if (rlen < LCD_WIDTH) {
701
       if (rlen < LCD_WIDTH) {
702
         uint8_t chars = LCD_WIDTH - rlen;     // Amount of space left in characters
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
         if (--chars) {                        // Draw a second space if there's room
704
         if (--chars) {                        // Draw a second space if there's room
705
-          lcd_put_wchar(' ');
705
+          lcd_put_lchar(' ');
706
           if (--chars) {                      // Draw a third space if there's room
706
           if (--chars) {                      // Draw a third space if there's room
707
-            lcd_put_wchar(' ');
707
+            lcd_put_lchar(' ');
708
             if (--chars)
708
             if (--chars)
709
               lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
709
               lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
710
           }
710
           }
726
 
726
 
727
     // Fill the rest with spaces if there are missing spaces
727
     // Fill the rest with spaces if there are missing spaces
728
     while (slen < LCD_WIDTH) {
728
     while (slen < LCD_WIDTH) {
729
-      lcd_put_wchar(' ');
729
+      lcd_put_lchar(' ');
730
       ++slen;
730
       ++slen;
731
     }
731
     }
732
   #endif
732
   #endif
778
         duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
778
         duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
779
       #endif
779
       #endif
780
       timepos -= remaining.toDigital(buffer);
780
       timepos -= remaining.toDigital(buffer);
781
-      lcd_put_wchar(timepos, 2, 'R');
781
+      lcd_put_lchar(timepos, 2, 'R');
782
     }
782
     }
783
   #else
783
   #else
784
     constexpr bool show_remain = false;
784
     constexpr bool show_remain = false;
787
   if (!show_remain) {
787
   if (!show_remain) {
788
     duration_t elapsed = print_job_timer.duration();
788
     duration_t elapsed = print_job_timer.duration();
789
     timepos -= elapsed.toDigital(buffer);
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
   lcd_put_u8str(buffer);
792
   lcd_put_u8str(buffer);
793
   return timepos;
793
   return timepos;
912
             else {
912
             else {
913
               const xy_pos_t lpos = current_position.asLogical();
913
               const xy_pos_t lpos = current_position.asLogical();
914
               _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
914
               _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
915
-              lcd_put_wchar(' ');
915
+              lcd_put_lchar(' ');
916
               _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
916
               _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
917
             }
917
             }
918
 
918
 
926
       _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
926
       _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
927
 
927
 
928
       #if HAS_LEVELING && !HAS_HEATED_BED
928
       #if HAS_LEVELING && !HAS_HEATED_BED
929
-        lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
929
+        lcd_put_lchar(planner.leveling_active || blink ? '_' : ' ');
930
       #endif
930
       #endif
931
 
931
 
932
     #endif // LCD_HEIGHT > 2
932
     #endif // LCD_HEIGHT > 2
935
 
935
 
936
     #if LCD_HEIGHT > 3
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
       lcd_put_u8str(i16tostr3rj(feedrate_percentage));
939
       lcd_put_u8str(i16tostr3rj(feedrate_percentage));
940
-      lcd_put_wchar('%');
940
+      lcd_put_lchar('%');
941
 
941
 
942
       const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink);
942
       const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink);
943
 
943
 
969
                 per = planner.flow_percentage[0];
969
                 per = planner.flow_percentage[0];
970
               #endif
970
               #endif
971
             }
971
             }
972
-          lcd_put_wchar(c);
972
+          lcd_put_lchar(c);
973
           lcd_put_u8str(i16tostr3rj(per));
973
           lcd_put_u8str(i16tostr3rj(per));
974
-          lcd_put_wchar('%');
974
+          lcd_put_lchar('%');
975
         #endif
975
         #endif
976
       #endif
976
       #endif
977
 
977
 
993
     _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
993
     _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
994
 
994
 
995
     #if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
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
     #endif
997
     #endif
998
 
998
 
999
     // ========== Line 2 ==========
999
     // ========== Line 2 ==========
1008
       _draw_bed_status(blink);
1008
       _draw_bed_status(blink);
1009
     #endif
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
     lcd_put_u8str(i16tostr3rj(feedrate_percentage));
1012
     lcd_put_u8str(i16tostr3rj(feedrate_percentage));
1013
-    lcd_put_wchar('%');
1013
+    lcd_put_lchar('%');
1014
 
1014
 
1015
     // ========== Line 3 ==========
1015
     // ========== Line 3 ==========
1016
 
1016
 
1075
                  vlen = vstr ? utf8_strlen(vstr) : 0;
1075
                  vlen = vstr ? utf8_strlen(vstr) : 0;
1076
     if (style & SS_CENTER) {
1076
     if (style & SS_CENTER) {
1077
       int8_t pad = (LCD_WIDTH - plen - vlen) / 2;
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
     if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
1080
     if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
1081
     if (vlen) n -= lcd_put_u8str_max(vstr, n);
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
   // Draw a generic menu item with pre_char (if selected) and post_char
1085
   // Draw a generic menu item with pre_char (if selected) and post_char
1086
   void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) {
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
     uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2);
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
   // Draw a menu item with a (potentially) editable value
1093
   // Draw a menu item with a (potentially) editable value
1094
   void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
1094
   void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
1095
     const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
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
     uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
1097
     uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen);
1098
     if (vlen) {
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
       if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
1101
       if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
1102
     }
1102
     }
1103
   }
1103
   }
1107
     ui.encoder_direction_normal();
1107
     ui.encoder_direction_normal();
1108
     uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1);
1108
     uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1);
1109
     if (value) {
1109
     if (value) {
1110
-      lcd_put_wchar(':'); n--;
1110
+      lcd_put_lchar(':'); n--;
1111
       const uint8_t len = utf8_strlen(value) + 1;   // Plus one for a leading space
1111
       const uint8_t len = utf8_strlen(value) + 1;   // Plus one for a leading space
1112
       const lcd_uint_t valrow = n < len ? 2 : 1;    // Value on the next row if it won't fit
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
       lcd_put_u8str(value);
1114
       lcd_put_u8str(value);
1115
     }
1115
     }
1116
   }
1116
   }
1120
     ui.draw_select_screen_prompt(pref, string, suff);
1120
     ui.draw_select_screen_prompt(pref, string, suff);
1121
     if (no) {
1121
     if (no) {
1122
       SETCURSOR(0, LCD_HEIGHT - 1);
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
     if (yes) {
1125
     if (yes) {
1126
       SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1);
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
   #if ENABLED(SDSUPPORT)
1131
   #if ENABLED(SDSUPPORT)
1132
 
1132
 
1133
     void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
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
       constexpr uint8_t maxlen = LCD_WIDTH - 2;
1135
       constexpr uint8_t maxlen = LCD_WIDTH - 2;
1136
       uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
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
   #endif
1141
   #endif
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) {
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
       add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
1254
       add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
1255
       lcd.createChar(c, (uint8_t*)&chrdata);
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
     void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
1259
     void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
1270
         #define _LCD_W_POS 8
1270
         #define _LCD_W_POS 8
1271
         #define _PLOT_X 0
1271
         #define _PLOT_X 0
1272
         #define _MAP_X 1
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
         #define _XLABEL(X,Y) _LABEL('X',X,Y)
1274
         #define _XLABEL(X,Y) _LABEL('X',X,Y)
1275
         #define _YLABEL(X,Y) _LABEL('Y',X,Y)
1275
         #define _YLABEL(X,Y) _LABEL('Y',X,Y)
1276
         #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
1276
         #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
1333
         n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
1333
         n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
1334
 
1334
 
1335
         for (i = 0; i < n_cols; i++) {
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
         for (j = 0; j < n_rows; j++) {
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
         k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
1349
         k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
1350
         l = (HD44780_CHAR_HEIGHT) * n_rows;
1350
         l = (HD44780_CHAR_HEIGHT) * n_rows;
1351
         if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
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
         clear_custom_char(&new_char);
1356
         clear_custom_char(&new_char);
1464
       /**
1464
       /**
1465
        * Print plot position
1465
        * Print plot position
1466
        */
1466
        */
1467
-      lcd_put_wchar(_LCD_W_POS, 0, '(');
1467
+      lcd_put_lchar(_LCD_W_POS, 0, '(');
1468
       lcd_put_u8str(ui8tostr3rj(x_plot));
1468
       lcd_put_u8str(ui8tostr3rj(x_plot));
1469
-      lcd_put_wchar(',');
1469
+      lcd_put_lchar(',');
1470
       lcd_put_u8str(ui8tostr3rj(y_plot));
1470
       lcd_put_u8str(ui8tostr3rj(y_plot));
1471
-      lcd_put_wchar(')');
1471
+      lcd_put_lchar(')');
1472
 
1472
 
1473
       #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1473
       #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1474
 
1474
 

+ 5
- 5
Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp View File

48
 int lcd_glyph_height() { return 1; }
48
 int lcd_glyph_height() { return 1; }
49
 
49
 
50
 typedef struct _TFTGLCD_charmap_t {
50
 typedef struct _TFTGLCD_charmap_t {
51
-  wchar_t uchar; // the unicode char
51
+  lchar_t uchar; // the unicode char
52
   uint8_t idx;   // the glyph of the char in the ROM
52
   uint8_t idx;   // the glyph of the char in the ROM
53
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
53
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
54
 } TFTGLCD_charmap_t;
54
 } TFTGLCD_charmap_t;
991
 
991
 
992
 // return < 0 on error
992
 // return < 0 on error
993
 // return the advanced cols
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
   // find the HD44780 internal ROM first
996
   // find the HD44780 internal ROM first
997
   int ret;
997
   int ret;
1049
   pixel_len_t ret = 0;
1049
   pixel_len_t ret = 0;
1050
   const uint8_t *p = (uint8_t *)utf8_str;
1050
   const uint8_t *p = (uint8_t *)utf8_str;
1051
   while (ret < max_length) {
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
     if (!ch) break;
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
   return (int)ret;
1057
   return (int)ret;
1058
 }
1058
 }

+ 9
- 9
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp View File

524
       UNUSED(blink);
524
       UNUSED(blink);
525
     #else
525
     #else
526
       if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) {
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
       else
531
       else
532
     #endif
532
     #endif
533
         lcd_put_u8str(i16tostr3left(t2));
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
     if (t2) picBits |= ICON_TEMP1;
538
     if (t2) picBits |= ICON_TEMP1;
539
     else    picBits &= ~ICON_TEMP1;
539
     else    picBits &= ~ICON_TEMP1;
545
 
545
 
546
   FORCE_INLINE void _draw_flowmeter_status() {
546
   FORCE_INLINE void _draw_flowmeter_status() {
547
     lcd_moveto(5, 5); lcd_put_u8str(F("FLOW"));
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
     lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
549
     lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
550
 
550
 
551
     if (cooler.flowrate)  picBits |= ICON_FAN;
551
     if (cooler.flowrate)  picBits |= ICON_FAN;
564
     {
564
     {
565
       lcd_put_u8str("mA");
565
       lcd_put_u8str("mA");
566
       lcd_moveto(10, 7);
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
     else {
569
     else {
570
       lcd_put_u8str(" A");
570
       lcd_put_u8str(" A");
585
     #if CUTTER_UNIT_IS(RPM)
585
     #if CUTTER_UNIT_IS(RPM)
586
       lcd_moveto(16, 6);  lcd_put_u8str(F("RPM"));
586
       lcd_moveto(16, 6);  lcd_put_u8str(F("RPM"));
587
       lcd_moveto(15, 7);  lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
587
       lcd_moveto(15, 7);  lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
588
-      lcd_put_wchar('K');
588
+      lcd_put_lchar('K');
589
     #elif CUTTER_UNIT_IS(PERCENT)
589
     #elif CUTTER_UNIT_IS(PERCENT)
590
-      lcd_moveto(17, 6);  lcd_put_wchar('%');
590
+      lcd_moveto(17, 6);  lcd_put_lchar('%');
591
       lcd_moveto(18, 7);  lcd_put_u8str(cutter_power2str(cutter.unitPower));
591
       lcd_moveto(18, 7);  lcd_put_u8str(cutter_power2str(cutter.unitPower));
592
     #else
592
     #else
593
       lcd_moveto(17, 7);  lcd_put_u8str(cutter_power2str(cutter.unitPower));
593
       lcd_moveto(17, 7);  lcd_put_u8str(cutter_power2str(cutter.unitPower));

+ 1
- 1
Marlin/src/lcd/dogm/lcdprint_u8g.cpp View File

28
 
28
 
29
 // return < 0 on error
29
 // return < 0 on error
30
 // return the advanced pixels
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
   if (c < 256) {
32
   if (c < 256) {
33
     u8g.print((char)c);
33
     u8g.print((char)c);
34
     return u8g_GetFontBBXWidth(u8g.getU8g());
34
     return u8g_GetFontBBXWidth(u8g.getU8g());

+ 18
- 18
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

371
 
371
 
372
       if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
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
       lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
377
       lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
378
-      lcd_put_wchar('/');
378
+      lcd_put_lchar('/');
379
 
379
 
380
       if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
380
       if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
381
         lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
381
         lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
421
                 vlen = vstr ? utf8_strlen(vstr) : 0;
421
                 vlen = vstr ? utf8_strlen(vstr) : 0;
422
       if (style & SS_CENTER) {
422
       if (style & SS_CENTER) {
423
         int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2;
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
       if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
427
       if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
428
       if (vlen) n -= lcd_put_u8str_max(vstr, n);
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
   void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
434
   void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
435
     if (mark_as_selected(row, sel)) {
435
     if (mark_as_selected(row, sel)) {
436
       pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
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
 
449
 
450
       pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
450
       pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
451
       if (vallen) {
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
         lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
454
         lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
455
         if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
455
         if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
456
       }
456
       }
494
 
494
 
495
     // If a value is included, print a colon, then print the value right-justified
495
     // If a value is included, print a colon, then print the value right-justified
496
     if (value) {
496
     if (value) {
497
-      lcd_put_wchar(':');
497
+      lcd_put_lchar(':');
498
       if (extra_row) {
498
       if (extra_row) {
499
         // Assume that value is numeric (with no descender)
499
         // Assume that value is numeric (with no descender)
500
         baseline += EDIT_FONT_ASCENT + 2;
500
         baseline += EDIT_FONT_ASCENT + 2;
501
         onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
501
         onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
502
       }
502
       }
503
       if (onpage) {
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
         lcd_put_u8str(value);
505
         lcd_put_u8str(value);
506
       }
506
       }
507
     }
507
     }
533
     void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
533
     void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
534
       if (mark_as_selected(row, sel)) {
534
       if (mark_as_selected(row, sel)) {
535
         const uint8_t maxlen = LCD_WIDTH - isDir;
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
         const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
537
         const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
538
         pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
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
 
611
 
612
       // Print plot position
612
       // Print plot position
613
       if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
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
         u8g.print(x_plot);
615
         u8g.print(x_plot);
616
-        lcd_put_wchar(',');
616
+        lcd_put_lchar(',');
617
         u8g.print(y_plot);
617
         u8g.print(y_plot);
618
-        lcd_put_wchar(')');
618
+        lcd_put_lchar(')');
619
 
619
 
620
         // Show the location value
620
         // Show the location value
621
         lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
621
         lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);

+ 22
- 22
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

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

+ 12
- 12
Marlin/src/lcd/dogm/u8g_fontutf8.cpp View File

60
   return 0;
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
   if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0)
69
   if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0)
70
     return nullptr;
70
     return nullptr;
73
   return vcmp.fntdata;
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
   uint8_t buf[2] = {0, 0};
77
   uint8_t buf[2] = {0, 0};
78
   const font_t * fntpqm = (font_t*)fontgroup_find(group, val);
78
   const font_t * fntpqm = (font_t*)fontgroup_find(group, val);
79
   if (!fntpqm) {
79
   if (!fntpqm) {
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) {
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
   const uint8_t *p = (uint8_t*)utf8_msg;
107
   const uint8_t *p = (uint8_t*)utf8_msg;
108
   for (;;) {
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
 }
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
  * @param pu8g : U8G pointer
154
  * @param pu8g : U8G pointer
155
  * @param x : position x axis
155
  * @param x : position x axis
156
  * @param y : position y axis
156
  * @param y : position y axis
157
- * @param ch : the wchar_t
157
+ * @param ch : the lchar_t
158
  * @param max_width : the pixel width of the string allowed
158
  * @param max_width : the pixel width of the string allowed
159
  *
159
  *
160
  * @return number of pixels advanced
160
  * @return number of pixels advanced
161
  *
161
  *
162
  * Draw a UTF-8 string at the specified position
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
   struct _uxg_drawu8_data_t data;
165
   struct _uxg_drawu8_data_t data;
166
   font_group_t *group = &g_fontgroup_root;
166
   font_group_t *group = &g_fontgroup_root;
167
   const font_t *fnt_default = uxg_GetFont(pu8g);
167
   const font_t *fnt_default = uxg_GetFont(pu8g);

+ 1
- 1
Marlin/src/lcd/dogm/u8g_fontutf8.h View File

26
 
26
 
27
 int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
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
 unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length);
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
 unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length);
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 View File

50
  *   @ displays an axis name such as XYZUVW, or E for an extruder
50
  *   @ displays an axis name such as XYZUVW, or E for an extruder
51
  */
51
  */
52
 void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) {
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
   while (*tpl) {
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
     if (ch == '=' || ch == '~' || ch == '*') {
60
     if (ch == '=' || ch == '~' || ch == '*') {
61
       if (index >= 0) {
61
       if (index >= 0) {
80
 }
80
 }
81
 
81
 
82
 void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
82
 void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
83
-  wchar_t wchar;
83
+  lchar_t ch;
84
   while (*cstr && max_len) {
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
     add_character(ch);
89
     add_character(ch);
90
     */
90
     */
91
-    add(wchar);
91
+    add(ch);
92
     max_len--;
92
     max_len--;
93
   }
93
   }
94
   eol();
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
   int ret;
98
   int ret;
99
   size_t idx = 0;
99
   size_t idx = 0;
100
   dwin_charmap_t pinval;
100
   dwin_charmap_t pinval;
101
   dwin_charmap_t *copy_address = nullptr;
101
   dwin_charmap_t *copy_address = nullptr;
102
-  pinval.uchar = character;
102
+  pinval.uchar = ch;
103
   pinval.idx = -1;
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
   char str[] = { '?', 0 };
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
   else {
110
   else {
111
     copy_address = nullptr;
111
     copy_address = nullptr;

+ 4
- 4
Marlin/src/lcd/e3v2/marlinui/dwin_string.h View File

29
 #include <stdint.h>
29
 #include <stdint.h>
30
 
30
 
31
 typedef struct _dwin_charmap_t {
31
 typedef struct _dwin_charmap_t {
32
-  wchar_t uchar; // the unicode char
32
+  lchar_t uchar; // the unicode char
33
   uint8_t idx;   // the glyph of the char in the ROM
33
   uint8_t idx;   // the glyph of the char in the ROM
34
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
34
   uint8_t idx2;  // the char used to be combined with the idx to simulate a single char
35
 } dwin_charmap_t;
35
 } dwin_charmap_t;
69
     /**
69
     /**
70
      * @brief Append a UTF-8 character
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
      * @brief Append / Set C-string
78
      * @brief Append / Set C-string

+ 3
- 3
Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp View File

63
 
63
 
64
 // return < 0 on error
64
 // return < 0 on error
65
 // return the advanced cols
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
   dwin_string.set(c);
67
   dwin_string.set(c);
68
   dwin_string.truncate(max_length);
68
   dwin_string.truncate(max_length);
69
   // Draw the char(s) at the cursor and advance the cursor
69
   // Draw the char(s) at the cursor and advance the cursor
87
   const uint8_t *p = (uint8_t *)utf8_str;
87
   const uint8_t *p = (uint8_t *)utf8_str;
88
   dwin_string.set();
88
   dwin_string.set();
89
   while (dwin_string.length < max_length) {
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
     if (!ch) break;
92
     if (!ch) break;
93
     dwin_string.add(ch);
93
     dwin_string.add(ch);
94
   }
94
   }

+ 4
- 4
Marlin/src/lcd/e3v2/marlinui/ui_common.cpp View File

213
         lcd_put_u8str(status_message);
213
         lcd_put_u8str(status_message);
214
 
214
 
215
         // Fill the rest with spaces
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
     else {
219
     else {
227
 
227
 
228
       // If the string doesn't completely fill the line...
228
       // If the string doesn't completely fill the line...
229
       if (rlen < max_status_chars) {
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
         uint8_t chars = max_status_chars - rlen;  // Amount of space left in characters
231
         uint8_t chars = max_status_chars - rlen;  // Amount of space left in characters
232
         if (--chars) {                        // Draw a second dot if there's space
232
         if (--chars) {                        // Draw a second dot if there's space
233
-          lcd_put_wchar('.');
233
+          lcd_put_lchar('.');
234
           if (--chars)
234
           if (--chars)
235
             lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
235
             lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
236
         }
236
         }
254
       lcd_put_u8str_max(status_message, max_status_chars);
254
       lcd_put_u8str_max(status_message, max_status_chars);
255
 
255
 
256
       // Fill the rest with spaces if there are missing spaces
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
   #endif
260
   #endif

+ 7
- 10
Marlin/src/lcd/fontutils.h View File

31
 #pragma once
31
 #pragma once
32
 
32
 
33
 #include <stdlib.h>
33
 #include <stdlib.h>
34
-#include <stddef.h> // wchar_t
35
 #include <stdint.h> // uint32_t
34
 #include <stdint.h> // uint32_t
36
 
35
 
37
 #include "../HAL/shared/Marduino.h"
36
 #include "../HAL/shared/Marduino.h"
38
 #include "../core/macros.h"
37
 #include "../core/macros.h"
39
 
38
 
39
+#define MAX_UTF8_CHAR_SIZE 4
40
+
40
 // read a byte from ROM or RAM
41
 // read a byte from ROM or RAM
41
 typedef uint8_t (*read_byte_cb_t)(const uint8_t * str);
42
 typedef uint8_t (*read_byte_cb_t)(const uint8_t * str);
42
 
43
 
43
 uint8_t read_byte_ram(const uint8_t *str);
44
 uint8_t read_byte_ram(const uint8_t *str);
44
 uint8_t read_byte_rom(const uint8_t *str);
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
 typedef uint16_t pixel_len_t;
50
 typedef uint16_t pixel_len_t;
54
 #define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1))
51
 #define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1))
55
 
52
 
56
 /* Perform binary search */
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
 int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx);
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
 /* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */
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
   return (const char *)get_utf8_value_cb((const uint8_t *)pstart, cb_read_byte, pval);
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 View File

47
   const uint8_t *p = (uint8_t*)ptpl;
47
   const uint8_t *p = (uint8_t*)ptpl;
48
   int8_t n = maxlen;
48
   int8_t n = maxlen;
49
   while (n > 0) {
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
     if (!ch) break;
52
     if (!ch) break;
53
     if (ch == '=' || ch == '~' || ch == '*') {
53
     if (ch == '=' || ch == '~' || ch == '*') {
54
       if (ind >= 0) {
54
       if (ind >= 0) {
55
-        if (ch == '*') { lcd_put_wchar('E'); n--; }
55
+        if (ch == '*') { lcd_put_lchar('E'); n--; }
56
         if (n) {
56
         if (n) {
57
           int8_t inum = ind + ((ch == '=') ? 0 : LCD_FIRST_TOOL);
57
           int8_t inum = ind + ((ch == '=') ? 0 : LCD_FIRST_TOOL);
58
           if (inum >= 10) {
58
           if (inum >= 10) {
59
-            lcd_put_wchar('0' + (inum / 10)); n--;
59
+            lcd_put_lchar('0' + (inum / 10)); n--;
60
             inum %= 10;
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
       else {
65
       else {
78
       n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
78
       n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
79
     }
79
     }
80
     else if (ch == '@') {
80
     else if (ch == '@') {
81
-      lcd_put_wchar(AXIS_CHAR(ind));
81
+      lcd_put_lchar(AXIS_CHAR(ind));
82
       n--;
82
       n--;
83
     }
83
     }
84
     else {
84
     else {
85
-      lcd_put_wchar(ch);
85
+      lcd_put_lchar(ch);
86
       n -= ch > 255 ? prop : 1;
86
       n -= ch > 255 ? prop : 1;
87
     }
87
     }
88
   }
88
   }
97
   int n = 0;
97
   int n = 0;
98
 
98
 
99
   do {
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
     if (!ch) break;
102
     if (!ch) break;
103
     n += (ch > 255) ? prop : 1;
103
     n += (ch > 255) ? prop : 1;
104
   } while (1);
104
   } while (1);

+ 5
- 5
Marlin/src/lcd/lcdprint.h View File

138
  *
138
  *
139
  * @return the output width (in pixels on GLCD)
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
  * @brief Draw a SRAM UTF-8 string
144
  * @brief Draw a SRAM UTF-8 string
267
 /**
267
 /**
268
  * @brief Draw a UTF-8 character with no width limit
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
  * @return the output width (in pixels on GLCD)
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
  * @param col
275
  * @param col
276
  * @param row
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
   lcd_moveto(col, row);
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 View File

417
         };
417
         };
418
 
418
 
419
         const uint8_t *p = (uint8_t*)string;
419
         const uint8_t *p = (uint8_t*)string;
420
-        wchar_t ch;
420
+        lchar_t ch;
421
         if (wordwrap) {
421
         if (wordwrap) {
422
           const uint8_t *wrd = nullptr;
422
           const uint8_t *wrd = nullptr;
423
           uint8_t c = 0;
423
           uint8_t c = 0;
424
           // find the end of the part
424
           // find the end of the part
425
           for (;;) {
425
           for (;;) {
426
             if (!wrd) wrd = p;            // Get word start /before/ advancing
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
             const bool eol = !ch;         // zero ends the string
428
             const bool eol = !ch;         // zero ends the string
429
             // End or a break between phrases?
429
             // End or a break between phrases?
430
             if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') {
430
             if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') {
435
               col += c;                   // advance col to new position
435
               col += c;                   // advance col to new position
436
               while (c) {                 // character countdown
436
               while (c) {                 // character countdown
437
                 --c;                      // count down to zero
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
               if (eol) break;             // all done!
441
               if (eol) break;             // all done!
442
               wrd = nullptr;              // set up for next word
442
               wrd = nullptr;              // set up for next word
446
         }
446
         }
447
         else {
447
         else {
448
           for (;;) {
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
             if (!ch) break;
450
             if (!ch) break;
451
-            lcd_put_wchar(ch);
451
+            lcd_put_lchar(ch);
452
             col++;
452
             col++;
453
             if (col >= LCD_WIDTH) _newline();
453
             if (col >= LCD_WIDTH) _newline();
454
           }
454
           }

+ 1
- 1
Marlin/src/lcd/menu/menu_bed_corners.cpp View File

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

+ 1
- 1
Marlin/src/lcd/menu/menu_configuration.cpp View File

79
     LIMIT(bar_percent, 0, 100);
79
     LIMIT(bar_percent, 0, 100);
80
     ui.encoderPosition = 0;
80
     ui.encoderPosition = 0;
81
     MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT);
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
     lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
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 View File

61
   FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT);
61
   FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT);
62
   EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered);
62
   EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered);
63
   MENU_ITEM_ADDON_START(utf8_strlen(label) + 1);
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
     SETCURSOR_X(LCD_WIDTH - 2);
66
     SETCURSOR_X(LCD_WIDTH - 2);
67
-    lcd_put_wchar('>');
67
+    lcd_put_lchar('>');
68
   MENU_ITEM_ADDON_END();
68
   MENU_ITEM_ADDON_END();
69
 
69
 
70
   ACTION_ITEM(MSG_START_OVER, start_over);
70
   ACTION_ITEM(MSG_START_OVER, start_over);

+ 2
- 2
Marlin/src/lcd/menu/menu_tune.cpp View File

76
           #if ENABLED(TFT_COLOR_UI)
76
           #if ENABLED(TFT_COLOR_UI)
77
             lcd_moveto(4, 3);
77
             lcd_moveto(4, 3);
78
             lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
78
             lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
79
-            lcd_put_wchar(':');
79
+            lcd_put_lchar(':');
80
             lcd_moveto(10, 3);
80
             lcd_moveto(10, 3);
81
           #else
81
           #else
82
             lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
82
             lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
83
             lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
83
             lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
84
-            lcd_put_wchar(':');
84
+            lcd_put_lchar(':');
85
           #endif
85
           #endif
86
           lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));
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 View File

94
  *   @ displays an axis name such as XYZUVW, or E for an extruder
94
  *   @ displays an axis name such as XYZUVW, or E for an extruder
95
  */
95
  */
96
 void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) {
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
   while (*tpl) {
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
     if (ch == '=' || ch == '~' || ch == '*') {
104
     if (ch == '=' || ch == '~' || ch == '*') {
105
       if (index >= 0) {
105
       if (index >= 0) {
124
 }
124
 }
125
 
125
 
126
 void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
126
 void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) {
127
-  wchar_t wchar;
127
+  lchar_t ch;
128
   while (*cstr && max_len) {
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
     add_character(ch);
132
     add_character(ch);
133
     max_len--;
133
     max_len--;
134
   }
134
   }

+ 1
- 1
Marlin/src/lcd/tft/tft_string.h View File

97
      * @param character The ASCII character
97
      * @param character The ASCII character
98
      */
98
      */
99
     static void add(const char character) { add_character(character); eol(); }
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
      * @brief Append / Set C-string
103
      * @brief Append / Set C-string

+ 1
- 1
Marlin/src/lcd/tft/ui_common.cpp View File

96
   lcd_gotopixel(int(col) * (TFT_COL_WIDTH), int(row) * MENU_LINE_HEIGHT);
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
   if (max_length < 1) return 0;
100
   if (max_length < 1) return 0;
101
   tft_string.set(c);
101
   tft_string.set(c);
102
   tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
102
   tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);

Loading…
Cancel
Save