Browse Source

🎨 Apply F() to UTF-8/MMU2 string put

Scott Lahteine 3 years ago
parent
commit
eeffac697c

+ 1
- 1
Marlin/src/HAL/shared/progmem.h View File

111
 #define strrchr_P(str, c) strrchr((str), (c))
111
 #define strrchr_P(str, c) strrchr((str), (c))
112
 #endif
112
 #endif
113
 #ifndef strsep_P
113
 #ifndef strsep_P
114
-#define strsep_P(strp, delim) strsep((strp), (delim))
114
+#define strsep_P(pstr, delim) strsep((pstr), (delim))
115
 #endif
115
 #endif
116
 #ifndef strspn_P
116
 #ifndef strspn_P
117
 #define strspn_P(str, chrs) strspn((str), (chrs))
117
 #define strspn_P(str, chrs) strspn((str), (chrs))

+ 25
- 23
Marlin/src/feature/mmu/mmu2.cpp View File

54
 #define MMU_CMD_TIMEOUT 45000UL // 45s timeout for mmu commands (except P0)
54
 #define MMU_CMD_TIMEOUT 45000UL // 45s timeout for mmu commands (except P0)
55
 #define MMU_P0_TIMEOUT 3000UL   // Timeout for P0 command: 3seconds
55
 #define MMU_P0_TIMEOUT 3000UL   // Timeout for P0 command: 3seconds
56
 
56
 
57
-#define MMU2_COMMAND(S) tx_str_P(PSTR(S "\n"))
57
+#define MMU2_COMMAND(S) tx_str(F(S "\n"))
58
 
58
 
59
 #if ENABLED(MMU_EXTRUDER_SENSOR)
59
 #if ENABLED(MMU_EXTRUDER_SENSOR)
60
   uint8_t mmu_idl_sens = 0;
60
   uint8_t mmu_idl_sens = 0;
229
       if (cmd) {
229
       if (cmd) {
230
         if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T0 + EXTRUDERS - 1)) {
230
         if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T0 + EXTRUDERS - 1)) {
231
           // tool change
231
           // tool change
232
-          int filament = cmd - MMU_CMD_T0;
232
+          const int filament = cmd - MMU_CMD_T0;
233
           DEBUG_ECHOLNPGM("MMU <= T", filament);
233
           DEBUG_ECHOLNPGM("MMU <= T", filament);
234
-          tx_printf_P(PSTR("T%d\n"), filament);
234
+          tx_printf(F("T%d\n"), filament);
235
           TERN_(MMU_EXTRUDER_SENSOR, mmu_idl_sens = 1); // enable idler sensor, if any
235
           TERN_(MMU_EXTRUDER_SENSOR, mmu_idl_sens = 1); // enable idler sensor, if any
236
           state = 3; // wait for response
236
           state = 3; // wait for response
237
         }
237
         }
238
         else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L0 + EXTRUDERS - 1)) {
238
         else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L0 + EXTRUDERS - 1)) {
239
           // load
239
           // load
240
-          int filament = cmd - MMU_CMD_L0;
240
+          const int filament = cmd - MMU_CMD_L0;
241
           DEBUG_ECHOLNPGM("MMU <= L", filament);
241
           DEBUG_ECHOLNPGM("MMU <= L", filament);
242
-          tx_printf_P(PSTR("L%d\n"), filament);
242
+          tx_printf(F("L%d\n"), filament);
243
           state = 3; // wait for response
243
           state = 3; // wait for response
244
         }
244
         }
245
         else if (cmd == MMU_CMD_C0) {
245
         else if (cmd == MMU_CMD_C0) {
257
         }
257
         }
258
         else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E0 + EXTRUDERS - 1)) {
258
         else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E0 + EXTRUDERS - 1)) {
259
           // eject filament
259
           // eject filament
260
-          int filament = cmd - MMU_CMD_E0;
260
+          const int filament = cmd - MMU_CMD_E0;
261
           DEBUG_ECHOLNPGM("MMU <= E", filament);
261
           DEBUG_ECHOLNPGM("MMU <= E", filament);
262
-          tx_printf_P(PSTR("E%d\n"), filament);
262
+          tx_printf(F("E%d\n"), filament);
263
           state = 3; // wait for response
263
           state = 3; // wait for response
264
         }
264
         }
265
         else if (cmd == MMU_CMD_R0) {
265
         else if (cmd == MMU_CMD_R0) {
270
         }
270
         }
271
         else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F0 + EXTRUDERS - 1)) {
271
         else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F0 + EXTRUDERS - 1)) {
272
           // filament type
272
           // filament type
273
-          int filament = cmd - MMU_CMD_F0;
273
+          const int filament = cmd - MMU_CMD_F0;
274
           DEBUG_ECHOLNPGM("MMU <= F", filament, " ", cmd_arg);
274
           DEBUG_ECHOLNPGM("MMU <= F", filament, " ", cmd_arg);
275
-          tx_printf_P(PSTR("F%d %d\n"), filament, cmd_arg);
275
+          tx_printf(F("F%d %d\n"), filament, cmd_arg);
276
           state = 3; // wait for response
276
           state = 3; // wait for response
277
         }
277
         }
278
 
278
 
356
  */
356
  */
357
 bool MMU2::rx_start() {
357
 bool MMU2::rx_start() {
358
   // check for start message
358
   // check for start message
359
-  return rx_str_P(PSTR("start\n"));
359
+  return rx_str(F("start\n"));
360
 }
360
 }
361
 
361
 
362
 /**
362
 /**
363
  * Check if the data received ends with the given string.
363
  * Check if the data received ends with the given string.
364
  */
364
  */
365
-bool MMU2::rx_str_P(const char *str) {
365
+bool MMU2::rx_str(FSTR_P fstr) {
366
+  PGM_P pstr = FTOP(fstr);
367
+
366
   uint8_t i = strlen(rx_buffer);
368
   uint8_t i = strlen(rx_buffer);
367
 
369
 
368
   while (MMU2_SERIAL.available()) {
370
   while (MMU2_SERIAL.available()) {
375
   }
377
   }
376
   rx_buffer[i] = '\0';
378
   rx_buffer[i] = '\0';
377
 
379
 
378
-  uint8_t len = strlen_P(str);
380
+  uint8_t len = strlen_P(pstr);
379
 
381
 
380
   if (i < len) return false;
382
   if (i < len) return false;
381
 
383
 
382
-  str += len;
384
+  pstr += len;
383
 
385
 
384
   while (len--) {
386
   while (len--) {
385
-    char c0 = pgm_read_byte(str--), c1 = rx_buffer[i--];
387
+    char c0 = pgm_read_byte(pstr--), c1 = rx_buffer[i--];
386
     if (c0 == c1) continue;
388
     if (c0 == c1) continue;
387
     if (c0 == '\r' && c1 == '\n') continue;  // match cr as lf
389
     if (c0 == '\r' && c1 == '\n') continue;  // match cr as lf
388
     if (c0 == '\n' && c1 == '\r') continue;  // match lf as cr
390
     if (c0 == '\n' && c1 == '\r') continue;  // match lf as cr
394
 /**
396
 /**
395
  * Transfer data to MMU, no argument
397
  * Transfer data to MMU, no argument
396
  */
398
  */
397
-void MMU2::tx_str_P(const char *str) {
399
+void MMU2::tx_str(FSTR_P fstr) {
398
   clear_rx_buffer();
400
   clear_rx_buffer();
399
-  uint8_t len = strlen_P(str);
400
-  LOOP_L_N(i, len) MMU2_SERIAL.write(pgm_read_byte(str++));
401
+  PGM_P pstr = FTOP(fstr);
402
+  while (const char c = pgm_read_byte(pstr)) { MMU2_SERIAL.write(c); pstr++; }
401
   prev_request = millis();
403
   prev_request = millis();
402
 }
404
 }
403
 
405
 
404
 /**
406
 /**
405
  * Transfer data to MMU, single argument
407
  * Transfer data to MMU, single argument
406
  */
408
  */
407
-void MMU2::tx_printf_P(const char *format, int argument = -1) {
409
+void MMU2::tx_printf(FSTR_P format, int argument = -1) {
408
   clear_rx_buffer();
410
   clear_rx_buffer();
409
-  uint8_t len = sprintf_P(tx_buffer, format, argument);
411
+  const uint8_t len = sprintf_P(tx_buffer, FTOP(format), argument);
410
   LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
412
   LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
411
   prev_request = millis();
413
   prev_request = millis();
412
 }
414
 }
414
 /**
416
 /**
415
  * Transfer data to MMU, two arguments
417
  * Transfer data to MMU, two arguments
416
  */
418
  */
417
-void MMU2::tx_printf_P(const char *format, int argument1, int argument2) {
419
+void MMU2::tx_printf(FSTR_P format, int argument1, int argument2) {
418
   clear_rx_buffer();
420
   clear_rx_buffer();
419
-  uint8_t len = sprintf_P(tx_buffer, format, argument1, argument2);
421
+  const uint8_t len = sprintf_P(tx_buffer, FTOP(format), argument1, argument2);
420
   LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
422
   LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
421
   prev_request = millis();
423
   prev_request = millis();
422
 }
424
 }
433
  * Check if we received 'ok' from MMU
435
  * Check if we received 'ok' from MMU
434
  */
436
  */
435
 bool MMU2::rx_ok() {
437
 bool MMU2::rx_ok() {
436
-  if (rx_str_P(PSTR("ok\n"))) {
438
+  if (rx_str(F("ok\n"))) {
437
     prev_P0_request = millis();
439
     prev_P0_request = millis();
438
     return true;
440
     return true;
439
   }
441
   }
853
     if (cmd == MMU_CMD_NONE && last_cmd == MMU_CMD_C0) {
855
     if (cmd == MMU_CMD_NONE && last_cmd == MMU_CMD_C0) {
854
       if (present && !mmu2s_triggered) {
856
       if (present && !mmu2s_triggered) {
855
         DEBUG_ECHOLNPGM("MMU <= 'A'");
857
         DEBUG_ECHOLNPGM("MMU <= 'A'");
856
-        tx_str_P(PSTR("A\n"));
858
+        tx_str(F("A\n"));
857
       }
859
       }
858
       // Slowly spin the extruder during C0
860
       // Slowly spin the extruder during C0
859
       else {
861
       else {

+ 4
- 4
Marlin/src/feature/mmu/mmu2.h View File

57
   static bool eject_filament(const uint8_t index, const bool recover);
57
   static bool eject_filament(const uint8_t index, const bool recover);
58
 
58
 
59
 private:
59
 private:
60
-  static bool rx_str_P(const char *str);
61
-  static void tx_str_P(const char *str);
62
-  static void tx_printf_P(const char *format, const int argument);
63
-  static void tx_printf_P(const char *format, const int argument1, const int argument2);
60
+  static inline bool rx_str(FSTR_P fstr);
61
+  static inline void tx_str(FSTR_P fstr);
62
+  static inline void tx_printf(FSTR_P ffmt, const int argument);
63
+  static inline void tx_printf(FSTR_P ffmt, const int argument1, const int argument2);
64
   static void clear_rx_buffer();
64
   static void clear_rx_buffer();
65
 
65
 
66
   static bool rx_ok();
66
   static bool rx_ok();

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

1063
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
1063
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
1064
 }
1064
 }
1065
 
1065
 
1066
-int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
1067
-  return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
1066
+int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
1067
+  return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length);
1068
 }
1068
 }
1069
 
1069
 
1070
 #if ENABLED(DEBUG_LCDPRINT)
1070
 #if ENABLED(DEBUG_LCDPRINT)

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

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
412
-  void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, PGM_P const text, const uint8_t len, const int16_t time) {
413
-    uint8_t slen = utf8_strlen_P(text);
412
+  void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, FSTR_P const ftxt, const uint8_t len, const int16_t time) {
413
+    uint8_t slen = utf8_strlen_P(FTOP(ftxt));
414
     if (slen < len) {
414
     if (slen < len) {
415
-      lcd_put_u8str_max_P(col, line, text, 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_wchar(' ');
417
       safe_delay(time);
417
       safe_delay(time);
418
     }
418
     }
419
     else {
419
     else {
420
-      PGM_P p = text;
420
+      PGM_P p = FTOP(ftxt);
421
       int dly = time / _MAX(slen, 1);
421
       int dly = time / _MAX(slen, 1);
422
       LOOP_LE_N(i, slen) {
422
       LOOP_LE_N(i, slen) {
423
 
423
 
439
 
439
 
440
   static void logo_lines(PGM_P const extra) {
440
   static void logo_lines(PGM_P const extra) {
441
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
441
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
442
-    lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" ));  lcd_put_wchar('\x01');
443
-    lcd_put_u8str_P(indent, 1, PSTR("|Marlin|"));  lcd_put_u8str_P(extra);
444
-    lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" ));  lcd_put_wchar('\x03');
442
+    lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" ));  lcd_put_wchar('\x01');
443
+    lcd_put_u8str(indent, 1, F("|Marlin|"));  lcd_put_u8str_P(extra);
444
+    lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" ));  lcd_put_wchar('\x03');
445
   }
445
   }
446
 
446
 
447
   void MarlinUI::show_bootscreen() {
447
   void MarlinUI::show_bootscreen() {
450
 
450
 
451
     #define LCD_EXTRA_SPACE (LCD_WIDTH-8)
451
     #define LCD_EXTRA_SPACE (LCD_WIDTH-8)
452
 
452
 
453
-    #define CENTER_OR_SCROLL(STRING,DELAY) \
453
+    #define CENTER_OR_SCROLL(STRING,DELAY) { \
454
       lcd_erase_line(3); \
454
       lcd_erase_line(3); \
455
-      if (utf8_strlen(STRING) <= LCD_WIDTH) { \
456
-        lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
455
+      const int len = utf8_strlen(STRING); \
456
+      if (len <= LCD_WIDTH) { \
457
+        lcd_put_u8str((LCD_WIDTH - len) / 2, 3, F(STRING)); \
457
         safe_delay(DELAY); \
458
         safe_delay(DELAY); \
458
       } \
459
       } \
459
-      else { \
460
-        lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
461
-      }
460
+      else \
461
+        lcd_scroll(0, 3, F(STRING), LCD_WIDTH, DELAY); \
462
+    }
462
 
463
 
463
     //
464
     //
464
     // Show the Marlin logo with splash line 1
465
     // Show the Marlin logo with splash line 1
497
   lcd_put_u8str(0, 0, status_message);
498
   lcd_put_u8str(0, 0, status_message);
498
   lcd_uint_t y = 2;
499
   lcd_uint_t y = 2;
499
   #if LCD_HEIGHT >= 4
500
   #if LCD_HEIGHT >= 4
500
-    lcd_put_u8str_P(0, y++, GET_TEXT(MSG_HALTED));
501
+    lcd_put_u8str(0, y++, GET_TEXT_F(MSG_HALTED));
501
   #endif
502
   #endif
502
-  lcd_put_u8str_P(0, y, GET_TEXT(MSG_PLEASE_RESET));
503
+  lcd_put_u8str(0, y, GET_TEXT_F(MSG_PLEASE_RESET));
503
 }
504
 }
504
 
505
 
505
 //
506
 //
514
   else if (axis_should_home(axis))
515
   else if (axis_should_home(axis))
515
     while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
516
     while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
516
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
517
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
517
-    lcd_put_u8str_P(axis == Z_AXIS ? PSTR("       ") : PSTR("    "));
518
+    lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
518
   else
519
   else
519
     lcd_put_u8str(value);
520
     lcd_put_u8str(value);
520
 }
521
 }
613
 
614
 
614
   FORCE_INLINE void _draw_print_progress() {
615
   FORCE_INLINE void _draw_print_progress() {
615
     const uint8_t progress = ui.get_progress_percent();
616
     const uint8_t progress = ui.get_progress_percent();
616
-    lcd_put_u8str_P(PSTR(TERN(SDSUPPORT, "SD", "P:")));
617
+    lcd_put_u8str(F(TERN(SDSUPPORT, "SD", "P:")));
617
     if (progress)
618
     if (progress)
618
       lcd_put_u8str(ui8tostr3rj(progress));
619
       lcd_put_u8str(ui8tostr3rj(progress));
619
     else
620
     else
620
-      lcd_put_u8str_P(PSTR("---"));
621
+      lcd_put_u8str(F("---"));
621
     lcd_put_wchar('%');
622
     lcd_put_wchar('%');
622
   }
623
   }
623
 
624
 
661
 
662
 
662
     // Alternate Status message and Filament display
663
     // Alternate Status message and Filament display
663
     if (ELAPSED(millis(), next_filament_display)) {
664
     if (ELAPSED(millis(), next_filament_display)) {
664
-      lcd_put_u8str_P(PSTR("Dia "));
665
+      lcd_put_u8str(F("Dia "));
665
       lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
666
       lcd_put_u8str(ftostr12ns(filwidth.measured_mm));
666
-      lcd_put_u8str_P(PSTR(" V"));
667
+      lcd_put_u8str(F(" V"));
667
       lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
668
       lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
668
       lcd_put_wchar('%');
669
       lcd_put_wchar('%');
669
       return;
670
       return;
1473
         if (!isnan(ubl.z_values[x_plot][y_plot]))
1474
         if (!isnan(ubl.z_values[x_plot][y_plot]))
1474
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1475
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1475
         else
1476
         else
1476
-          lcd_put_u8str_P(PSTR(" -----"));
1477
+          lcd_put_u8str(F(" -----"));
1477
 
1478
 
1478
       #else                 // 16x4 or 20x4 display
1479
       #else                 // 16x4 or 20x4 display
1479
 
1480
 
1492
         if (!isnan(ubl.z_values[x_plot][y_plot]))
1493
         if (!isnan(ubl.z_values[x_plot][y_plot]))
1493
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1494
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1494
         else
1495
         else
1495
-          lcd_put_u8str_P(PSTR(" -----"));
1496
+          lcd_put_u8str(F(" -----"));
1496
 
1497
 
1497
       #endif // LCD_HEIGHT > 3
1498
       #endif // LCD_HEIGHT > 3
1498
     }
1499
     }

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

1061
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
1061
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
1062
 }
1062
 }
1063
 
1063
 
1064
-int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
1065
-  return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
1064
+int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
1065
+  return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length);
1066
 }
1066
 }
1067
 
1067
 
1068
 #if ENABLED(DEBUG_LCDPRINT)
1068
 #if ENABLED(DEBUG_LCDPRINT)

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

399
     uint8_t indent = (LCD_WIDTH - 8) / 2;
399
     uint8_t indent = (LCD_WIDTH - 8) / 2;
400
     // symbols 217 (bottom right corner) and 218 (top left corner) are using for letters in some languages
400
     // symbols 217 (bottom right corner) and 218 (top left corner) are using for letters in some languages
401
     // and they should be moved to beginning ASCII table as special symbols
401
     // and they should be moved to beginning ASCII table as special symbols
402
-    lcd.setCursor(indent, 0); lcd.write(TLC); lcd_put_u8str_P(PSTR("------"));  lcd.write(TRC);
403
-    lcd.setCursor(indent, 1); lcd.write(LR);  lcd_put_u8str_P(PSTR("Marlin"));  lcd.write(LR);
404
-    lcd.setCursor(indent, 2); lcd.write(BLC); lcd_put_u8str_P(PSTR("------"));  lcd.write(BRC);
402
+    lcd.setCursor(indent, 0); lcd.write(TLC); lcd_put_u8str(F("------"));  lcd.write(TRC);
403
+    lcd.setCursor(indent, 1); lcd.write(LR);  lcd_put_u8str(F("Marlin"));  lcd.write(LR);
404
+    lcd.setCursor(indent, 2); lcd.write(BLC); lcd_put_u8str(F("------"));  lcd.write(BRC);
405
     center_text_P(PSTR(SHORT_BUILD_VERSION), 3);
405
     center_text_P(PSTR(SHORT_BUILD_VERSION), 3);
406
     center_text_P(PSTR(MARLIN_WEBSITE_URL), 4);
406
     center_text_P(PSTR(MARLIN_WEBSITE_URL), 4);
407
     picBits = ICON_LOGO;
407
     picBits = ICON_LOGO;
437
   else if (axis_should_home(axis))
437
   else if (axis_should_home(axis))
438
     while (const char c = *value++) lcd.write(c <= '.' ? c : '?');
438
     while (const char c = *value++) lcd.write(c <= '.' ? c : '?');
439
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
439
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
440
-    lcd_put_u8str_P(axis == Z_AXIS ? PSTR("       ") : PSTR("    "));
440
+    lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
441
   else
441
   else
442
     lcd_put_u8str(value);
442
     lcd_put_u8str(value);
443
 }
443
 }
515
   FORCE_INLINE void _draw_cooler_status(const bool blink) {
515
   FORCE_INLINE void _draw_cooler_status(const bool blink) {
516
     const celsius_t t2 = thermalManager.degTargetCooler();
516
     const celsius_t t2 = thermalManager.degTargetCooler();
517
 
517
 
518
-    lcd.setCursor(0, 5); lcd_put_u8str_P(PSTR("COOL"));
518
+    lcd.setCursor(0, 5); lcd_put_u8str(F("COOL"));
519
     lcd.setCursor(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
519
     lcd.setCursor(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
520
     lcd.setCursor(1, 7);
520
     lcd.setCursor(1, 7);
521
 
521
 
543
 #if ENABLED(LASER_COOLANT_FLOW_METER)
543
 #if ENABLED(LASER_COOLANT_FLOW_METER)
544
 
544
 
545
   FORCE_INLINE void _draw_flowmeter_status() {
545
   FORCE_INLINE void _draw_flowmeter_status() {
546
-    lcd.setCursor(5, 5); lcd_put_u8str_P(PSTR("FLOW"));
546
+    lcd.setCursor(5, 5); lcd_put_u8str(F("FLOW"));
547
     lcd.setCursor(7, 6); lcd_put_wchar('L');
547
     lcd.setCursor(7, 6); lcd_put_wchar('L');
548
     lcd.setCursor(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
548
     lcd.setCursor(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate));
549
 
549
 
556
 #if ENABLED(I2C_AMMETER)
556
 #if ENABLED(I2C_AMMETER)
557
 
557
 
558
   FORCE_INLINE void _draw_ammeter_status() {
558
   FORCE_INLINE void _draw_ammeter_status() {
559
-    lcd.setCursor(10, 5); lcd_put_u8str_P(PSTR("ILAZ"));
559
+    lcd.setCursor(10, 5); lcd_put_u8str(F("ILAZ"));
560
     ammeter.read();
560
     ammeter.read();
561
     lcd.setCursor(11, 6);
561
     lcd.setCursor(11, 6);
562
     if (ammeter.current <= 0.999f)
562
     if (ammeter.current <= 0.999f)
580
 #if HAS_CUTTER
580
 #if HAS_CUTTER
581
 
581
 
582
   FORCE_INLINE void _draw_cutter_status() {
582
   FORCE_INLINE void _draw_cutter_status() {
583
-    lcd.setCursor(15, 5);  lcd_put_u8str_P(PSTR("CUTT"));
583
+    lcd.setCursor(15, 5);  lcd_put_u8str(F("CUTT"));
584
     #if CUTTER_UNIT_IS(RPM)
584
     #if CUTTER_UNIT_IS(RPM)
585
-      lcd.setCursor(16, 6);  lcd_put_u8str_P(PSTR("RPM"));
585
+      lcd.setCursor(16, 6);  lcd_put_u8str(F("RPM"));
586
       lcd.setCursor(15, 7);  lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
586
       lcd.setCursor(15, 7);  lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000));
587
       lcd_put_wchar('K');
587
       lcd_put_wchar('K');
588
     #elif CUTTER_UNIT_IS(PERCENT)
588
     #elif CUTTER_UNIT_IS(PERCENT)
604
     if (!PanelDetected) return;
604
     if (!PanelDetected) return;
605
     const uint8_t progress = ui._get_progress();
605
     const uint8_t progress = ui._get_progress();
606
     #if ENABLED(SDSUPPORT)
606
     #if ENABLED(SDSUPPORT)
607
-      lcd_put_u8str_P(PSTR("SD"));
607
+      lcd_put_u8str(F("SD"));
608
     #elif ENABLED(LCD_SET_PROGRESS_MANUALLY)
608
     #elif ENABLED(LCD_SET_PROGRESS_MANUALLY)
609
-      lcd_put_u8str_P(PSTR("P:"));
609
+      lcd_put_u8str(F("P:"));
610
     #endif
610
     #endif
611
     if (progress)
611
     if (progress)
612
       lcd.print(ui8tostr3rj(progress));
612
       lcd.print(ui8tostr3rj(progress));
613
     else
613
     else
614
-      lcd_put_u8str_P(PSTR("---"));
614
+      lcd_put_u8str(F("---"));
615
     lcd.write('%');
615
     lcd.write('%');
616
   }
616
   }
617
 
617
 
643
 
643
 
644
     // Alternate Status message and Filament display
644
     // Alternate Status message and Filament display
645
     if (ELAPSED(millis(), next_filament_display)) {
645
     if (ELAPSED(millis(), next_filament_display)) {
646
-      lcd_put_u8str_P(PSTR("Dia "));
646
+      lcd_put_u8str(F("Dia "));
647
       lcd.print(ftostr12ns(filament_width_meas));
647
       lcd.print(ftostr12ns(filament_width_meas));
648
-      lcd_put_u8str_P(PSTR(" V"));
648
+      lcd_put_u8str(F(" V"));
649
       lcd.print(i16tostr3rj(100.0 * (
649
       lcd.print(i16tostr3rj(100.0 * (
650
           parser.volumetric_enabled
650
           parser.volumetric_enabled
651
             ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]
651
             ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]
802
   //
802
   //
803
 
803
 
804
   lcd.setCursor(0, 1);
804
   lcd.setCursor(0, 1);
805
-  lcd_put_u8str_P(PSTR("FR")); lcd.print(i16tostr3rj(feedrate_percentage)); lcd.write('%');
805
+  lcd_put_u8str(F("FR")); lcd.print(i16tostr3rj(feedrate_percentage)); lcd.write('%');
806
 
806
 
807
   #if BOTH(SDSUPPORT, HAS_PRINT_PROGRESS)
807
   #if BOTH(SDSUPPORT, HAS_PRINT_PROGRESS)
808
     lcd.setCursor(LCD_WIDTH / 2 - 3, 1);
808
     lcd.setCursor(LCD_WIDTH / 2 - 3, 1);
895
       #else
895
       #else
896
         #define FANX 17
896
         #define FANX 17
897
       #endif
897
       #endif
898
-      lcd.setCursor(FANX, 5); lcd_put_u8str_P(PSTR("FAN"));
898
+      lcd.setCursor(FANX, 5); lcd_put_u8str(F("FAN"));
899
       lcd.setCursor(FANX + 1, 6); lcd.write('%');
899
       lcd.setCursor(FANX + 1, 6); lcd.write('%');
900
       lcd.setCursor(FANX, 7);
900
       lcd.setCursor(FANX, 7);
901
       lcd.print(i16tostr3rj(per));
901
       lcd.print(i16tostr3rj(per));
931
     void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
931
     void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
932
       if (!PanelDetected) return;
932
       if (!PanelDetected) return;
933
       lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
933
       lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
934
-      lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str_P(PSTR(" E")); lcd.write('1' + extruder); lcd.write(' ');
934
+      lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str(F(" E")); lcd.write('1' + extruder); lcd.write(' ');
935
       lcd.print(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
935
       lcd.print(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
936
       lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
936
       lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
937
       lcd.print_line();
937
       lcd.print_line();
1064
       *fb++ = ',';  lcd.print(i16tostr3left(y_plot)); *fb = ')';
1064
       *fb++ = ',';  lcd.print(i16tostr3left(y_plot)); *fb = ')';
1065
 
1065
 
1066
       // Show all values
1066
       // Show all values
1067
-      lcd.setCursor(_LCD_W_POS, 1); lcd_put_u8str_P(PSTR("X:"));
1067
+      lcd.setCursor(_LCD_W_POS, 1); lcd_put_u8str(F("X:"));
1068
       lcd.print(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
1068
       lcd.print(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
1069
-      lcd.setCursor(_LCD_W_POS, 2); lcd_put_u8str_P(PSTR("Y:"));
1069
+      lcd.setCursor(_LCD_W_POS, 2); lcd_put_u8str(F("Y:"));
1070
       lcd.print(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
1070
       lcd.print(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
1071
 
1071
 
1072
       // Show the location value
1072
       // Show the location value
1073
-      lcd.setCursor(_LCD_W_POS, 3); lcd_put_u8str_P(PSTR("Z:"));
1073
+      lcd.setCursor(_LCD_W_POS, 3); lcd_put_u8str(F("Z:"));
1074
 
1074
 
1075
       if (!isnan(ubl.z_values[x_plot][y_plot]))
1075
       if (!isnan(ubl.z_values[x_plot][y_plot]))
1076
         lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1076
         lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1077
       else
1077
       else
1078
-        lcd_put_u8str_P(PSTR(" -----"));
1078
+        lcd_put_u8str(F(" -----"));
1079
 
1079
 
1080
       center_text_P(GET_TEXT(MSG_UBL_FINE_TUNE_MESH), 8);
1080
       center_text_P(GET_TEXT(MSG_UBL_FINE_TUNE_MESH), 8);
1081
 
1081
 

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

46
   return ret;
46
   return ret;
47
 }
47
 }
48
 
48
 
49
-int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
49
+int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
50
   u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
50
   u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
51
-           ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length);
51
+           ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_pstr, max_length);
52
   u8g.setPrintPos(x + ret, y);
52
   u8g.setPrintPos(x + ret, y);
53
   return ret;
53
   return ret;
54
 }
54
 }

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

217
     auto _draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
217
     auto _draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
218
       u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
218
       u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
219
       set_font(FONT_MENU);
219
       set_font(FONT_MENU);
220
-      if (!two_part || !line2) lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(SHORT_BUILD_VERSION));
221
-      if (!two_part || line2) lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(MARLIN_WEBSITE_URL));
220
+      if (!two_part || !line2) lcd_put_u8str(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), F(SHORT_BUILD_VERSION));
221
+      if (!two_part || line2) lcd_put_u8str(txt_offx_2, txt_base, F(MARLIN_WEBSITE_URL));
222
     };
222
     };
223
 
223
 
224
     auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
224
     auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
331
   do {
331
   do {
332
     set_font(FONT_MENU);
332
     set_font(FONT_MENU);
333
     lcd_put_u8str(0, h4 * 1, status_message);
333
     lcd_put_u8str(0, h4 * 1, status_message);
334
-    lcd_put_u8str_P(0, h4 * 2, GET_TEXT(MSG_HALTED));
335
-    lcd_put_u8str_P(0, h4 * 3, GET_TEXT(MSG_PLEASE_RESET));
334
+    lcd_put_u8str(0, h4 * 2, GET_TEXT_F(MSG_HALTED));
335
+    lcd_put_u8str(0, h4 * 3, GET_TEXT_F(MSG_PLEASE_RESET));
336
   } while (u8g.nextPage());
336
   } while (u8g.nextPage());
337
 }
337
 }
338
 
338
 
611
         if (!isnan(ubl.z_values[x_plot][y_plot]))
611
         if (!isnan(ubl.z_values[x_plot][y_plot]))
612
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
612
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
613
         else
613
         else
614
-          lcd_put_u8str_P(PSTR(" -----"));
614
+          lcd_put_u8str(F(" -----"));
615
       }
615
       }
616
 
616
 
617
     }
617
     }

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

191
 
191
 
192
 FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
192
 FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
193
   if (temp < 0)
193
   if (temp < 0)
194
-    lcd_put_u8str(tx - 3 * (INFO_FONT_WIDTH) / 2 + 1, ty, "err");
194
+    lcd_put_u8str(tx - 3 * (INFO_FONT_WIDTH) / 2 + 1, ty, F("err"));
195
   else {
195
   else {
196
     const char *str = i16tostr3rj(temp);
196
     const char *str = i16tostr3rj(temp);
197
     const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
197
     const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
436
   else if (axis_should_home(axis))
436
   else if (axis_should_home(axis))
437
     while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
437
     while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
438
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
438
   else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
439
-    lcd_put_u8str_P(axis == Z_AXIS ? PSTR("       ") : PSTR("    "));
439
+    lcd_put_u8str(axis == Z_AXIS ? F("       ") : F("    "));
440
   else
440
   else
441
     lcd_put_u8str(value);
441
     lcd_put_u8str(value);
442
 }
442
 }
777
           }
777
           }
778
         }
778
         }
779
         else if (progress_state == 2 && estimation_string[0]) {
779
         else if (progress_state == 2 && estimation_string[0]) {
780
-          lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, PSTR("R:"));
780
+          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, F("R:"));
781
           lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
781
           lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
782
         }
782
         }
783
         else if (elapsed_string[0]) {
783
         else if (elapsed_string[0]) {
879
         if (show_e_total) {
879
         if (show_e_total) {
880
           #if ENABLED(LCD_SHOW_E_TOTAL)
880
           #if ENABLED(LCD_SHOW_E_TOTAL)
881
             _draw_axis_value(E_AXIS, xstring, true);
881
             _draw_axis_value(E_AXIS, xstring, true);
882
-            lcd_put_u8str_P(PSTR("       "));
882
+            lcd_put_u8str(F("       "));
883
           #endif
883
           #endif
884
         }
884
         }
885
         else {
885
         else {
918
       lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
918
       lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
919
       lcd_put_wchar('%');
919
       lcd_put_wchar('%');
920
       set_font(FONT_MENU);
920
       set_font(FONT_MENU);
921
-      lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
921
+      lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
922
       lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
922
       lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
923
     #endif
923
     #endif
924
   }
924
   }
932
     #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
932
     #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
933
       // Alternate Status message and Filament display
933
       // Alternate Status message and Filament display
934
       if (ELAPSED(millis(), next_filament_display)) {
934
       if (ELAPSED(millis(), next_filament_display)) {
935
-        lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
935
+        lcd_put_u8str(F(LCD_STR_FILAM_DIA));
936
         lcd_put_wchar(':');
936
         lcd_put_wchar(':');
937
         lcd_put_u8str(wstring);
937
         lcd_put_u8str(wstring);
938
-        lcd_put_u8str_P(PSTR("  " LCD_STR_FILAM_MUL));
938
+        lcd_put_u8str(F("  " LCD_STR_FILAM_MUL));
939
         lcd_put_wchar(':');
939
         lcd_put_wchar(':');
940
         lcd_put_u8str(mstring);
940
         lcd_put_u8str(mstring);
941
         lcd_put_wchar('%');
941
         lcd_put_wchar('%');

+ 6
- 6
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp View File

99
   while (*str && len--) write_byte(*str++);
99
   while (*str && len--) write_byte(*str++);
100
 }
100
 }
101
 
101
 
102
-void ST7920_Lite_Status_Screen::write_str_P(PGM_P const str) {
103
-  PGM_P p_str = (PGM_P)str;
104
-  while (char c = pgm_read_byte(p_str++)) write_byte(c);
102
+void ST7920_Lite_Status_Screen::write_str(FSTR_P const fstr) {
103
+  PGM_P pstr = FTOP(fstr);
104
+  while (char c = pgm_read_byte(pstr++)) write_byte(c);
105
 }
105
 }
106
 
106
 
107
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
107
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
500
   // Draw centered
500
   // Draw centered
501
   if (value > 9) {
501
   if (value > 9) {
502
     write_number(value, 4);
502
     write_number(value, 4);
503
-    write_str_P(PSTR("% "));
503
+    write_str(F("% "));
504
   }
504
   }
505
   else {
505
   else {
506
     write_number(value, 3);
506
     write_number(value, 3);
507
-    write_str_P(PSTR("%  "));
507
+    write_str(F("%  "));
508
   }
508
   }
509
 }
509
 }
510
 
510
 
559
   };
559
   };
560
 
560
 
561
   if (targetStateChange) {
561
   if (targetStateChange) {
562
-    if (!showTarget) write_str_P(PSTR("    "));
562
+    if (!showTarget) write_str(F("    "));
563
     draw_degree_symbol(5, line, !showTarget);
563
     draw_degree_symbol(5, line, !showTarget);
564
     draw_degree_symbol(9, line,  showTarget);
564
     draw_degree_symbol(9, line,  showTarget);
565
   }
565
   }

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

46
 
46
 
47
     static void write_str(const char *str);
47
     static void write_str(const char *str);
48
     static void write_str(const char *str, const uint8_t len);
48
     static void write_str(const char *str, const uint8_t len);
49
-    static void write_str_P(PGM_P const str);
49
+    static void write_str(FSTR_P const fstr);
50
     static void write_number(const int16_t value, const uint8_t digits=3);
50
     static void write_number(const int16_t value, const uint8_t digits=3);
51
 
51
 
52
     static void _extended_function_set(const bool extended, const bool graphics);
52
     static void _extended_function_set(const bool extended, const bool graphics);

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

101
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
101
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
102
 }
102
 }
103
 
103
 
104
-int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
105
-  return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
104
+int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
105
+  return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length);
106
 }
106
 }
107
 
107
 
108
 lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
108
 lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {

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

160
 
160
 
161
   slen = utf8_strlen(S(GET_TEXT_F(MSG_HALTED)));
161
   slen = utf8_strlen(S(GET_TEXT_F(MSG_HALTED)));
162
   lcd_moveto(cx - (slen / 2), cy);
162
   lcd_moveto(cx - (slen / 2), cy);
163
-  lcd_put_u8str_P((const char*)GET_TEXT_F(MSG_HALTED));
163
+  lcd_put_u8str(GET_TEXT_F(MSG_HALTED));
164
 
164
 
165
   slen = utf8_strlen(S(GET_TEXT_F(MSG_HALTED)));
165
   slen = utf8_strlen(S(GET_TEXT_F(MSG_HALTED)));
166
   lcd_moveto(cx - (slen / 2), cy + 1);
166
   lcd_moveto(cx - (slen / 2), cy + 1);
167
-  lcd_put_u8str_P((const char*)GET_TEXT_F(MSG_HALTED));
167
+  lcd_put_u8str(GET_TEXT_F(MSG_HALTED));
168
 }
168
 }
169
 
169
 
170
 //
170
 //

+ 17
- 6
Marlin/src/lcd/lcdprint.h View File

152
 /**
152
 /**
153
  * @brief Draw a ROM UTF-8 string
153
  * @brief Draw a ROM UTF-8 string
154
  *
154
  *
155
- * @param utf8_str_P : the ROM UTF-8 string
155
+ * @param utf8_pstr : the ROM UTF-8 string
156
  * @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
156
  * @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
157
  *
157
  *
158
  * @return the pixel width
158
  * @return the pixel width
159
  *
159
  *
160
  * Draw a ROM UTF-8 string
160
  * Draw a ROM UTF-8 string
161
  */
161
  */
162
-int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
163
-inline int lcd_put_u8str_max_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P utf8_str_P, pixel_len_t max_length) {
162
+int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length);
163
+inline int lcd_put_u8str_max_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P utf8_pstr, pixel_len_t max_length) {
164
   lcd_moveto(col, row);
164
   lcd_moveto(col, row);
165
-  return lcd_put_u8str_max_P(utf8_str_P, max_length);
165
+  return lcd_put_u8str_max_P(utf8_pstr, max_length);
166
+}
167
+inline int lcd_put_u8str_max(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const utf8_fstr, pixel_len_t max_length) {
168
+  return lcd_put_u8str_max_P(col, row, FTOP(utf8_fstr), max_length);
166
 }
169
 }
167
 
170
 
168
 void lcd_put_int(const int i);
171
 void lcd_put_int(const int i);
177
   return lcd_put_u8str_P(pstr);
180
   return lcd_put_u8str_P(pstr);
178
 }
181
 }
179
 
182
 
183
+inline int lcd_put_u8str(FSTR_P const fstr) { return lcd_put_u8str_P(FTOP(fstr)); }
184
+inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const fstr) {
185
+  return lcd_put_u8str_P(col, row, FTOP(fstr));
186
+}
187
+
180
 lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH);
188
 lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH);
181
 inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const int8_t ind, PGM_P const inStr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) {
189
 inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const int8_t ind, PGM_P const inStr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) {
182
   lcd_moveto(col, row);
190
   lcd_moveto(col, row);
183
   return lcd_put_u8str_ind_P(pstr, ind, inStr, maxlen);
191
   return lcd_put_u8str_ind_P(pstr, ind, inStr, maxlen);
184
 }
192
 }
193
+inline lcd_uint_t lcd_put_u8str_ind(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const fstr, const int8_t ind, FSTR_P const inFstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) {
194
+  return lcd_put_u8str_ind_P(col, row, FTOP(fstr), ind, FTOP(inFstr), maxlen);
195
+}
185
 
196
 
186
-inline int lcd_put_u8str(const char *str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
187
-inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, PGM_P const str) {
197
+inline int lcd_put_u8str(const char * const str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
198
+inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, const char * const str) {
188
   lcd_moveto(col, row);
199
   lcd_moveto(col, row);
189
   return lcd_put_u8str(str);
200
   return lcd_put_u8str(str);
190
 }
201
 }

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

48
     u8g.setColorIndex(0);
48
     u8g.setColorIndex(0);
49
     u8g.drawBox(lx - 1, ly - gohigh - 1, gowide + 2, gohigh + 2);
49
     u8g.drawBox(lx - 1, ly - gohigh - 1, gowide + 2, gohigh + 2);
50
     u8g.setColorIndex(1);
50
     u8g.setColorIndex(1);
51
-    if (ui.get_blink()) lcd_put_u8str_P(lx, ly, PSTR("GAME OVER"));
51
+    if (ui.get_blink()) lcd_put_u8str(lx, ly, F("GAME OVER"));
52
   }
52
   }
53
 }
53
 }
54
 
54
 

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

179
     // Display # of good points found vs total needed
179
     // Display # of good points found vs total needed
180
     if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) {
180
     if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) {
181
       SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy);
181
       SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy);
182
-      lcd_put_u8str_P(GET_TEXT(MSG_BED_TRAMMING_GOOD_POINTS));
182
+      lcd_put_u8str_(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS));
183
       IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy));
183
       IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy));
184
       lcd_put_u8str(GOOD_POINTS_TO_STR(good_points));
184
       lcd_put_u8str(GOOD_POINTS_TO_STR(good_points));
185
       lcd_put_wchar('/');
185
       lcd_put_wchar('/');
192
     // Display the Last Z value
192
     // Display the Last Z value
193
     if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) {
193
     if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) {
194
       SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy);
194
       SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy);
195
-      lcd_put_u8str_P(GET_TEXT(MSG_BED_TRAMMING_LAST_Z));
195
+      lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_LAST_Z));
196
       IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, 2));
196
       IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, 2));
197
       lcd_put_u8str(LAST_Z_TO_STR(last_z));
197
       lcd_put_u8str(LAST_Z_TO_STR(last_z));
198
     }
198
     }

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

57
     if (ui.should_draw()) {
57
     if (ui.should_draw()) {
58
       char tmp[16];
58
       char tmp[16];
59
       SETCURSOR(1, (LCD_HEIGHT - 1) / 2);
59
       SETCURSOR(1, (LCD_HEIGHT - 1) / 2);
60
-      lcd_put_u8str_P(isend ? GET_TEXT(MSG_END_Z) : GET_TEXT(MSG_START_Z));
60
+      lcd_put_u8str(isend ? GET_TEXT_F(MSG_END_Z) : GET_TEXT_F(MSG_START_Z));
61
       sprintf_P(tmp, PSTR("%4d.%d mm"), int(zvar), int(zvar * 10) % 10);
61
       sprintf_P(tmp, PSTR("%4d.%d mm"), int(zvar), int(zvar * 10) % 10);
62
       SETCURSOR_RJ(9, (LCD_HEIGHT - 1) / 2);
62
       SETCURSOR_RJ(9, (LCD_HEIGHT - 1) / 2);
63
       lcd_put_u8str(tmp);
63
       lcd_put_u8str(tmp);
114
   void _lcd_draw_mix(const uint8_t y) {
114
   void _lcd_draw_mix(const uint8_t y) {
115
     char tmp[20]; // "100%_100%"
115
     char tmp[20]; // "100%_100%"
116
     sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
116
     sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
117
-    SETCURSOR(2, y); lcd_put_u8str_P(GET_TEXT(MSG_MIX));
117
+    SETCURSOR(2, y); lcd_put_u8str(GET_TEXT_F(MSG_MIX));
118
     SETCURSOR_RJ(10, y); lcd_put_u8str(tmp);
118
     SETCURSOR_RJ(10, y); lcd_put_u8str(tmp);
119
   }
119
   }
120
 #endif
120
 #endif

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

73
           TERN_(HAS_MARLINUI_U8GLIB, ui.set_font(FONT_MENU));
73
           TERN_(HAS_MARLINUI_U8GLIB, ui.set_font(FONT_MENU));
74
           #if ENABLED(TFT_COLOR_UI)
74
           #if ENABLED(TFT_COLOR_UI)
75
             lcd_moveto(4, 3);
75
             lcd_moveto(4, 3);
76
-            lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
76
+            lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
77
             lcd_put_wchar(':');
77
             lcd_put_wchar(':');
78
             lcd_moveto(10, 3);
78
             lcd_moveto(10, 3);
79
           #else
79
           #else
80
             lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
80
             lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
81
-            lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
81
+            lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL));
82
             lcd_put_wchar(':');
82
             lcd_put_wchar(':');
83
           #endif
83
           #endif
84
           lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));
84
           lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)]));

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

105
   return tft_string.width();
105
   return tft_string.width();
106
 }
106
 }
107
 
107
 
108
-int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
108
+int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
109
   if (max_length < 1) return 0;
109
   if (max_length < 1) return 0;
110
-  tft_string.set(utf8_str_P);
110
+  tft_string.set(utf8_pstr);
111
   tft_string.trim();
111
   tft_string.trim();
112
   tft_string.truncate(max_length);
112
   tft_string.truncate(max_length);
113
   tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
113
   tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);

Loading…
Cancel
Save