瀏覽代碼

Use PGM_P for PSTR pointers (#11977)

Scott Lahteine 6 年之前
父節點
當前提交
11ac75edcb
沒有連結到貢獻者的電子郵件帳戶。
共有 39 個檔案被更改,包括 166 行新增165 行删除
  1. 1
    1
      Marlin/src/HAL/HAL_LPC1768/HAL.cpp
  2. 1
    1
      Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp
  3. 1
    1
      Marlin/src/Marlin.cpp
  4. 1
    1
      Marlin/src/Marlin.h
  5. 19
    19
      Marlin/src/core/serial.cpp
  6. 26
    26
      Marlin/src/core/serial.h
  7. 2
    2
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  8. 2
    2
      Marlin/src/feature/bedlevel/ubl/ubl.h
  9. 1
    1
      Marlin/src/feature/tmc_util.cpp
  10. 3
    3
      Marlin/src/gcode/calibrate/G33.cpp
  11. 10
    9
      Marlin/src/gcode/calibrate/M100.cpp
  12. 1
    1
      Marlin/src/gcode/control/M111.cpp
  13. 4
    4
      Marlin/src/gcode/gcode.cpp
  14. 1
    1
      Marlin/src/gcode/gcode.h
  15. 1
    1
      Marlin/src/gcode/host/M115.cpp
  16. 1
    1
      Marlin/src/gcode/parser.h
  17. 4
    4
      Marlin/src/gcode/queue.cpp
  18. 2
    2
      Marlin/src/gcode/queue.h
  19. 4
    4
      Marlin/src/lcd/dogm/status_screen_lite_ST7920.h
  20. 1
    1
      Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h
  21. 1
    1
      Marlin/src/lcd/fontutils.cpp
  22. 1
    1
      Marlin/src/lcd/fontutils.h
  23. 2
    2
      Marlin/src/lcd/lcdprint.h
  24. 1
    1
      Marlin/src/lcd/lcdprint_hd44780.cpp
  25. 1
    1
      Marlin/src/lcd/lcdprint_u8g.cpp
  26. 2
    2
      Marlin/src/lcd/malyanlcd.cpp
  27. 2
    2
      Marlin/src/lcd/u8g_fontutf8.cpp
  28. 2
    2
      Marlin/src/lcd/u8g_fontutf8.h
  29. 35
    35
      Marlin/src/lcd/ultralcd.cpp
  30. 8
    8
      Marlin/src/lcd/ultralcd.h
  31. 5
    5
      Marlin/src/lcd/ultralcd_impl_DOGM.h
  32. 11
    11
      Marlin/src/lcd/ultralcd_impl_HD44780.h
  33. 2
    2
      Marlin/src/libs/vector_3.cpp
  34. 2
    2
      Marlin/src/libs/vector_3.h
  35. 1
    1
      Marlin/src/module/endstops.cpp
  36. 1
    1
      Marlin/src/module/probe.cpp
  37. 1
    1
      Marlin/src/module/temperature.cpp
  38. 1
    1
      Marlin/src/module/temperature.h
  39. 1
    1
      Marlin/src/pins/pinsDebug.h

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/HAL.cpp 查看文件

@@ -74,7 +74,7 @@ void HAL_adc_init(void) {
74 74
 // externals need to make the call to KILL compile
75 75
 #include "../../core/language.h"
76 76
 
77
-extern void kill(const char*);
77
+extern void kill(PGM_P);
78 78
 extern const char errormagic[];
79 79
 
80 80
 void HAL_adc_enable_channel(int ch) {

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp 查看文件

@@ -79,7 +79,7 @@ bool PersistentStore::access_finish() {
79 79
 // This extra chit-chat goes away soon, but is helpful for now
80 80
 // to see errors that are happening in read_data / write_data
81 81
 static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
82
-  const char * const rw_str = write ? PSTR("write") : PSTR("read");
82
+  PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
83 83
   SERIAL_PROTOCOLCHAR(' ');
84 84
   serialprintPGM(rw_str);
85 85
   SERIAL_PROTOCOLPAIR("_data(", pos);

+ 1
- 1
Marlin/src/Marlin.cpp 查看文件

@@ -599,7 +599,7 @@ void idle(
599 599
  * Kill all activity and lock the machine.
600 600
  * After this the machine will need to be reset.
601 601
  */
602
-void kill(const char* lcd_msg) {
602
+void kill(PGM_P lcd_msg) {
603 603
   SERIAL_ERROR_START();
604 604
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
605 605
 

+ 1
- 1
Marlin/src/Marlin.h 查看文件

@@ -180,7 +180,7 @@ void disable_e_stepper(const uint8_t e);
180 180
 void disable_e_steppers();
181 181
 void disable_all_steppers();
182 182
 
183
-void kill(const char*);
183
+void kill(PGM_P);
184 184
 
185 185
 void quickstop_stepper();
186 186
 

+ 19
- 19
Marlin/src/core/serial.cpp 查看文件

@@ -32,30 +32,30 @@ const char echomagic[] PROGMEM = "echo:";
32 32
     while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch);
33 33
   }
34 34
 
35
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, const char *v)   { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
36
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, char v)          { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); }
37
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, int v)           { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
38
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, long v)          { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
39
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, float v)         { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
40
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, double v)        { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
41
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned int v)  { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
42
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
35
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v)   { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
36
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v)          { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); }
37
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v)           { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
38
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v)          { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
39
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v)         { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
40
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v)        { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
41
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v)  { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
42
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
43 43
 
44 44
   void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); }
45 45
 #endif
46 46
 
47
-void serialprintPGM(const char * str) {
47
+void serialprintPGM(PGM_P str) {
48 48
   while (char ch = pgm_read_byte(str++)) SERIAL_CHAR(ch);
49 49
 }
50 50
 
51
-void serial_echopair_PGM(const char* s_P, const char *v)   { serialprintPGM(s_P); SERIAL_ECHO(v); }
52
-void serial_echopair_PGM(const char* s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
53
-void serial_echopair_PGM(const char* s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
54
-void serial_echopair_PGM(const char* s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
55
-void serial_echopair_PGM(const char* s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
56
-void serial_echopair_PGM(const char* s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
57
-void serial_echopair_PGM(const char* s_P, unsigned int v)  { serialprintPGM(s_P); SERIAL_ECHO(v); }
58
-void serial_echopair_PGM(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
51
+void serial_echopair_PGM(PGM_P s_P, const char *v)   { serialprintPGM(s_P); SERIAL_ECHO(v); }
52
+void serial_echopair_PGM(PGM_P s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
53
+void serial_echopair_PGM(PGM_P s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
54
+void serial_echopair_PGM(PGM_P s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
55
+void serial_echopair_PGM(PGM_P s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
56
+void serial_echopair_PGM(PGM_P s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
57
+void serial_echopair_PGM(PGM_P s_P, unsigned int v)  { serialprintPGM(s_P); SERIAL_ECHO(v); }
58
+void serial_echopair_PGM(PGM_P s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
59 59
 
60 60
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
61 61
 
@@ -63,7 +63,7 @@ void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (c
63 63
 
64 64
   #include "enum.h"
65 65
 
66
-  void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) {
66
+  void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z) {
67 67
     serialprintPGM(prefix);
68 68
     SERIAL_CHAR('(');
69 69
     SERIAL_ECHO(x);
@@ -73,7 +73,7 @@ void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (c
73 73
     if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
74 74
   }
75 75
 
76
-  void print_xyz(const char* prefix, const char* suffix, const float xyz[]) {
76
+  void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]) {
77 77
     print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
78 78
   }
79 79
 

+ 26
- 26
Marlin/src/core/serial.h 查看文件

@@ -105,24 +105,24 @@ extern const char errormagic[] PROGMEM;
105 105
   #define SERIAL_ECHOPAIR_F_P(p,pre,value)          SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value))
106 106
   #define SERIAL_ECHOLNPAIR_F_P(p,pre, value)       SERIAL_ECHOLNPAIR_P(p, pre, FIXFLOAT(value))
107 107
 
108
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, const char *v);
109
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, char v);
110
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, int v);
111
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, long v);
112
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, float v);
113
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, double v);
114
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned int v);
115
-  void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned long v);
116
-  FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, const char* s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); }
117
-  FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, const char* s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); }
118
-  FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, const char* s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); }
108
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v);
109
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v);
110
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v);
111
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v);
112
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v);
113
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v);
114
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v);
115
+  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v);
116
+  FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); }
117
+  FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); }
118
+  FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); }
119 119
 
120 120
   void serial_spaces_P(const int8_t p, uint8_t count);
121 121
   #define SERIAL_ECHO_SP_P(p,C)     serial_spaces_P(p,C)
122 122
   #define SERIAL_ERROR_SP_P(p,C)    serial_spaces_P(p,C)
123 123
   #define SERIAL_PROTOCOL_SP_P(p,C) serial_spaces_P(p,C)
124 124
 
125
-  void serialprintPGM_P(const int8_t p, const char* str);
125
+  void serialprintPGM_P(const int8_t p, PGM_P str);
126 126
 #else
127 127
   #define SERIAL_CHAR_P(p,x)          SERIAL_CHAR(x)
128 128
   #define SERIAL_PROTOCOL_P(p,x)      SERIAL_PROTOCOL(x)
@@ -215,17 +215,17 @@ extern const char errormagic[] PROGMEM;
215 215
 #define SERIAL_ECHOPAIR_F(pre,value)        SERIAL_ECHOPAIR(pre, FIXFLOAT(value))
216 216
 #define SERIAL_ECHOLNPAIR_F(pre, value)     SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value))
217 217
 
218
-void serial_echopair_PGM(const char* s_P, const char *v);
219
-void serial_echopair_PGM(const char* s_P, char v);
220
-void serial_echopair_PGM(const char* s_P, int v);
221
-void serial_echopair_PGM(const char* s_P, long v);
222
-void serial_echopair_PGM(const char* s_P, float v);
223
-void serial_echopair_PGM(const char* s_P, double v);
224
-void serial_echopair_PGM(const char* s_P, unsigned int v);
225
-void serial_echopair_PGM(const char* s_P, unsigned long v);
226
-FORCE_INLINE void serial_echopair_PGM(const char* s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
227
-FORCE_INLINE void serial_echopair_PGM(const char* s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
228
-FORCE_INLINE void serial_echopair_PGM(const char* s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); }
218
+void serial_echopair_PGM(PGM_P s_P, const char *v);
219
+void serial_echopair_PGM(PGM_P s_P, char v);
220
+void serial_echopair_PGM(PGM_P s_P, int v);
221
+void serial_echopair_PGM(PGM_P s_P, long v);
222
+void serial_echopair_PGM(PGM_P s_P, float v);
223
+void serial_echopair_PGM(PGM_P s_P, double v);
224
+void serial_echopair_PGM(PGM_P s_P, unsigned int v);
225
+void serial_echopair_PGM(PGM_P s_P, unsigned long v);
226
+FORCE_INLINE void serial_echopair_PGM(PGM_P s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
227
+FORCE_INLINE void serial_echopair_PGM(PGM_P s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
228
+FORCE_INLINE void serial_echopair_PGM(PGM_P s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); }
229 229
 
230 230
 void serial_spaces(uint8_t count);
231 231
 #define SERIAL_ECHO_SP(C)     serial_spaces(C)
@@ -235,11 +235,11 @@ void serial_spaces(uint8_t count);
235 235
 //
236 236
 // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
237 237
 //
238
-void serialprintPGM(const char* str);
238
+void serialprintPGM(PGM_P str);
239 239
 
240 240
 #if ENABLED(DEBUG_LEVELING_FEATURE)
241
-  void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z);
242
-  void print_xyz(const char* prefix, const char* suffix, const float xyz[]);
241
+  void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z);
242
+  void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]);
243 243
   #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
244 244
 #endif
245 245
 

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl.cpp 查看文件

@@ -90,7 +90,7 @@
90 90
         SERIAL_ECHO_F(destination[X_AXIS], 6);
91 91
     }
92 92
 
93
-    void debug_current_and_destination(const char *title) {
93
+    void debug_current_and_destination(PGM_P title) {
94 94
 
95 95
       // if the title message starts with a '!' it is so important, we are going to
96 96
       // ignore the status of the g26_debug_flag
@@ -127,7 +127,7 @@
127 127
       SERIAL_ECHOPGM(", ");
128 128
       debug_echo_axis(E_AXIS);
129 129
       SERIAL_ECHOPGM(" )   ");
130
-      SERIAL_ECHO(title);
130
+      serialprintPGM(title);
131 131
       SERIAL_EOL();
132 132
 
133 133
     }

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl.h 查看文件

@@ -40,9 +40,9 @@
40 40
 // ubl_motion.cpp
41 41
 
42 42
 #if ENABLED(UBL_DEVEL_DEBUGGING)
43
-  void debug_current_and_destination(const char * const title);
43
+  void debug_current_and_destination(PGM_P const title);
44 44
 #else
45
-  FORCE_INLINE void debug_current_and_destination(const char * const title) { UNUSED(title); }
45
+  FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); }
46 46
 #endif
47 47
 
48 48
 // ubl_G29.cpp

+ 1
- 1
Marlin/src/feature/tmc_util.cpp 查看文件

@@ -258,7 +258,7 @@ void _tmc_say_axis(const TMC_AxisEnum axis) {
258 258
     #endif
259 259
   ;
260 260
 
261
-  static const char* const tmc_axes[] PROGMEM = {
261
+  static PGM_P const tmc_axes[] PROGMEM = {
262 262
     ext_X, ext_Y, ext_Z
263 263
     #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
264 264
       , ext_X2

+ 3
- 3
Marlin/src/gcode/calibrate/G33.cpp 查看文件

@@ -108,7 +108,7 @@ void ac_cleanup(
108 108
   #endif
109 109
 }
110 110
 
111
-void print_signed_float(const char * const prefix, const float &f) {
111
+void print_signed_float(PGM_P const prefix, const float &f) {
112 112
   SERIAL_PROTOCOLPGM("  ");
113 113
   serialprintPGM(prefix);
114 114
   SERIAL_PROTOCOLCHAR(':');
@@ -517,7 +517,7 @@ void GcodeSuite::G33() {
517 517
   }
518 518
 
519 519
   // Report settings
520
-  const char* checkingac = PSTR("Checking... AC");
520
+  PGM_P checkingac = PSTR("Checking... AC");
521 521
   serialprintPGM(checkingac);
522 522
   if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
523 523
   if (set_up) SERIAL_PROTOCOLPGM("  (SET-UP)");
@@ -705,7 +705,7 @@ void GcodeSuite::G33() {
705 705
       }
706 706
     }
707 707
     else { // dry run
708
-      const char *enddryrun = PSTR("End DRY-RUN");
708
+      PGM_P enddryrun = PSTR("End DRY-RUN");
709 709
       serialprintPGM(enddryrun);
710 710
       SERIAL_PROTOCOL_SP(35);
711 711
       SERIAL_PROTOCOLPGM("std dev:");

+ 10
- 9
Marlin/src/gcode/calibrate/M100.cpp 查看文件

@@ -50,8 +50,8 @@
50 50
  *
51 51
  * Also, there are two support functions that can be called from a developer's C code.
52 52
  *
53
- *    uint16_t check_for_free_memory_corruption(const char * const ptr);
54
- *    void M100_dump_routine(const char * const title, const char *start, const char *end);
53
+ *    uint16_t check_for_free_memory_corruption(PGM_P const ptr);
54
+ *    void M100_dump_routine(PGM_P const title, const char *start, const char *end);
55 55
  *
56 56
  * Initial version by Roxy-3D
57 57
  */
@@ -80,7 +80,7 @@ char* top_of_stack() {
80 80
 // Count the number of test bytes at the specified location.
81 81
 inline int32_t count_test_bytes(const char * const ptr) {
82 82
   for (uint32_t i = 0; i < 32000; i++)
83
-    if (((char) ptr[i]) != TEST_BYTE)
83
+    if (char(ptr[i]) != TEST_BYTE)
84 84
       return i - 1;
85 85
 
86 86
   return -1;
@@ -136,8 +136,9 @@ inline int32_t count_test_bytes(const char * const ptr) {
136 136
     }
137 137
   }
138 138
 
139
-  void M100_dump_routine(const char * const title, const char *start, const char *end) {
140
-    SERIAL_ECHOLN(title);
139
+  void M100_dump_routine(PGM_P const title, const char *start, const char *end) {
140
+    serialprintPGM(title);
141
+    SERIAL_EOL();
141 142
     //
142 143
     // Round the start and end locations to produce full lines of output
143 144
     //
@@ -148,8 +149,8 @@ inline int32_t count_test_bytes(const char * const ptr) {
148 149
 
149 150
 #endif // M100_FREE_MEMORY_DUMPER
150 151
 
151
-inline int check_for_free_memory_corruption(const char * const title) {
152
-  SERIAL_ECHO(title);
152
+inline int check_for_free_memory_corruption(PGM_P const title) {
153
+  serialprintPGM(title);
153 154
 
154 155
   char *ptr = END_OF_HEAP(), *sp = top_of_stack();
155 156
   int n = sp - ptr;
@@ -171,7 +172,7 @@ inline int check_for_free_memory_corruption(const char * const title) {
171 172
     //   idle();
172 173
     safe_delay(20);
173 174
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
174
-      M100_dump_routine("   Memory corruption detected with sp<Heap\n", (char*)0x1B80, (char*)0x21FF);
175
+      M100_dump_routine(PSTR("   Memory corruption detected with sp<Heap\n"), (char*)0x1B80, (char*)0x21FF);
175 176
     #endif
176 177
   }
177 178
 
@@ -239,7 +240,7 @@ inline void free_memory_pool_report(char * const ptr, const int32_t size) {
239 240
     SERIAL_ECHOPAIR("\nLargest free block is ", max_cnt);
240 241
     SERIAL_ECHOLNPAIR(" bytes at ", hex_address(max_addr));
241 242
   }
242
-  SERIAL_ECHOLNPAIR("check_for_free_memory_corruption() = ", check_for_free_memory_corruption("M100 F "));
243
+  SERIAL_ECHOLNPAIR("check_for_free_memory_corruption() = ", check_for_free_memory_corruption(PSTR("M100 F ")));
243 244
 }
244 245
 
245 246
 #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)

+ 1
- 1
Marlin/src/gcode/control/M111.cpp 查看文件

@@ -38,7 +38,7 @@ void GcodeSuite::M111() {
38 38
                     #endif
39 39
                     ;
40 40
 
41
-  static const char* const debug_strings[] PROGMEM = {
41
+  static PGM_P const debug_strings[] PROGMEM = {
42 42
     str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16
43 43
     #if ENABLED(DEBUG_LEVELING_FEATURE)
44 44
       , str_debug_32

+ 4
- 4
Marlin/src/gcode/gcode.cpp 查看文件

@@ -170,7 +170,7 @@ void GcodeSuite::dwell(millis_t time) {
170 170
 // Placeholders for non-migrated codes
171 171
 //
172 172
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
173
-  extern void M100_dump_routine(const char * const title, const char *start, const char *end);
173
+  extern void M100_dump_routine(PGM_P const title, const char *start, const char *end);
174 174
 #endif
175 175
 
176 176
 /**
@@ -700,7 +700,7 @@ void GcodeSuite::process_next_command() {
700 700
     SERIAL_ECHOLN(current_command);
701 701
     #if ENABLED(M100_FREE_MEMORY_WATCHER)
702 702
       SERIAL_ECHOPAIR("slot:", cmd_queue_index_r);
703
-      M100_dump_routine("   Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue)));
703
+      M100_dump_routine(PSTR("   Command Queue:"), (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue)));
704 704
     #endif
705 705
   }
706 706
 
@@ -714,14 +714,14 @@ void GcodeSuite::process_next_command() {
714 714
    * Run a series of commands, bypassing the command queue to allow
715 715
    * G-code "macros" to be called from within other G-code handlers.
716 716
    */
717
-  void GcodeSuite::process_subcommands_now_P(const char *pgcode) {
717
+  void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) {
718 718
     // Save the parser state
719 719
     char * const saved_cmd = parser.command_ptr;
720 720
 
721 721
     // Process individual commands in string
722 722
     while (pgm_read_byte_near(pgcode)) {
723 723
       // Break up string at '\n' delimiters
724
-      const char *delim = strchr_P(pgcode, '\n');
724
+      PGM_P const delim = strchr_P(pgcode, '\n');
725 725
       size_t len = delim ? delim - pgcode : strlen_P(pgcode);
726 726
       char cmd[len + 1];
727 727
       strncpy_P(cmd, pgcode, len);

+ 1
- 1
Marlin/src/gcode/gcode.h 查看文件

@@ -295,7 +295,7 @@ public:
295 295
   static void process_next_command();
296 296
 
297 297
   #if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE)
298
-    static void process_subcommands_now_P(const char *pgcode);
298
+    static void process_subcommands_now_P(PGM_P pgcode);
299 299
   #endif
300 300
 
301 301
   FORCE_INLINE static void home_all_axes() { G28(true); }

+ 1
- 1
Marlin/src/gcode/host/M115.cpp 查看文件

@@ -28,7 +28,7 @@
28 28
 #endif
29 29
 
30 30
 #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
31
-  static void cap_line(const char * const name, bool ena=false) {
31
+  static void cap_line(PGM_P const name, bool ena=false) {
32 32
     SERIAL_PROTOCOLPGM("Cap:");
33 33
     serialprintPGM(name);
34 34
     SERIAL_CHAR(':');

+ 1
- 1
Marlin/src/gcode/parser.h 查看文件

@@ -258,7 +258,7 @@ public:
258 258
       FORCE_INLINE static char temp_units_code() {
259 259
         return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C';
260 260
       }
261
-      FORCE_INLINE static const char* temp_units_name() {
261
+      FORCE_INLINE static PGM_P temp_units_name() {
262 262
         return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius");
263 263
       }
264 264
       static inline float to_temp_units(const float &f) {

+ 4
- 4
Marlin/src/gcode/queue.cpp 查看文件

@@ -84,7 +84,7 @@ bool send_ok[BUFSIZE];
84 84
  * Used by Marlin internally to ensure that commands initiated from within
85 85
  * are enqueued ahead of any pending serial or sd card commands.
86 86
  */
87
-static const char *injected_commands_P = NULL;
87
+static PGM_P injected_commands_P = NULL;
88 88
 
89 89
 void queue_setup() {
90 90
   // Send "ok" after commands by default
@@ -181,7 +181,7 @@ static bool drain_injected_commands_P() {
181 181
  * Aborts the current queue, if any.
182 182
  * Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards
183 183
  */
184
-void enqueue_and_echo_commands_P(const char * const pgcode) {
184
+void enqueue_and_echo_commands_P(PGM_P const pgcode) {
185 185
   injected_commands_P = pgcode;
186 186
   (void)drain_injected_commands_P(); // first command executed asap (when possible)
187 187
 }
@@ -197,7 +197,7 @@ void enqueue_and_echo_commands_P(const char * const pgcode) {
197 197
     /**
198 198
      * Enqueue from program memory and return only when commands are actually enqueued
199 199
      */
200
-    void enqueue_and_echo_commands_now_P(const char * const pgcode) {
200
+    void enqueue_and_echo_commands_now_P(PGM_P const pgcode) {
201 201
       enqueue_and_echo_commands_P(pgcode);
202 202
       while (drain_injected_commands_P()) idle();
203 203
     }
@@ -249,7 +249,7 @@ void flush_and_request_resend() {
249 249
   ok_to_send();
250 250
 }
251 251
 
252
-void gcode_line_error(const char* err, uint8_t port) {
252
+void gcode_line_error(PGM_P err, uint8_t port) {
253 253
   SERIAL_ERROR_START_P(port);
254 254
   serialprintPGM_P(port, err);
255 255
   SERIAL_ERRORLN_P(port, gcode_LastN);

+ 2
- 2
Marlin/src/gcode/queue.h 查看文件

@@ -90,7 +90,7 @@ void ok_to_send();
90 90
  * Aborts the current queue, if any.
91 91
  * Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards
92 92
  */
93
-void enqueue_and_echo_commands_P(const char * const pgcode);
93
+void enqueue_and_echo_commands_P(PGM_P const pgcode);
94 94
 
95 95
 /**
96 96
  * Enqueue with Serial Echo
@@ -109,7 +109,7 @@ bool enqueue_and_echo_command(const char* cmd);
109 109
     /**
110 110
      * Enqueue from program memory and return only when commands are actually enqueued
111 111
      */
112
-    void enqueue_and_echo_commands_now_P(const char * const cmd);
112
+    void enqueue_and_echo_commands_now_P(PGM_P const cmd);
113 113
   #endif
114 114
 #endif
115 115
 

+ 4
- 4
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h 查看文件

@@ -75,18 +75,18 @@ void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) {
75 75
   while (*str && len--) write_byte(*str++);
76 76
 }
77 77
 
78
-void ST7920_Lite_Status_Screen::write_str_P(const char * const str) {
79
-  const char *p_str = (const char *)str;
78
+void ST7920_Lite_Status_Screen::write_str_P(PGM_P const str) {
79
+  PGM_P p_str = (PGM_P)str;
80 80
   while (char c = pgm_read_byte_near(p_str++)) write_byte(c);
81 81
 }
82 82
 
83 83
 void ST7920_Lite_Status_Screen::write_str(progmem_str str) {
84
-  write_str_P((const char*)str);
84
+  write_str_P((PGM_P)str);
85 85
 }
86 86
 
87 87
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
88 88
   char str[7];
89
-  const char *fmt;
89
+  PGM_P fmt;
90 90
   switch (digits) {
91 91
     case 6: fmt = PSTR("%6d"); break;
92 92
     case 5: fmt = PSTR("%5d"); break;

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h 查看文件

@@ -48,7 +48,7 @@ class ST7920_Lite_Status_Screen {
48 48
 
49 49
     static void write_str(const char *str);
50 50
     static void write_str(const char *str, const uint8_t len);
51
-    static void write_str_P(const char * const str);
51
+    static void write_str_P(PGM_P const str);
52 52
     static void write_str(progmem_str str);
53 53
     static void write_number(const int16_t value, const uint8_t digits=3);
54 54
 

+ 1
- 1
Marlin/src/lcd/fontutils.cpp 查看文件

@@ -177,7 +177,7 @@ uint8_t utf8_strlen(const char *pstart) {
177 177
   return utf8_strlen_cb(pstart, read_byte_ram);
178 178
 }
179 179
 
180
-uint8_t utf8_strlen_P(const char *pstart) {
180
+uint8_t utf8_strlen_P(PGM_P pstart) {
181 181
   return utf8_strlen_cb(pstart, read_byte_rom);
182 182
 }
183 183
 

+ 1
- 1
Marlin/src/lcd/fontutils.h 查看文件

@@ -44,6 +44,6 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t
44 44
 
45 45
 /* Returns lenght of string in CHARACTERS, NOT BYTES */
46 46
 uint8_t utf8_strlen(const char *pstart);
47
-uint8_t utf8_strlen_P(const char *pstart);
47
+uint8_t utf8_strlen_P(PGM_P pstart);
48 48
 
49 49
 #endif // _FONT_UTILS_H

+ 2
- 2
Marlin/src/lcd/lcdprint.h 查看文件

@@ -45,11 +45,11 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
45 45
  *
46 46
  * Draw a ROM UTF-8 string
47 47
  */
48
-int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length);
48
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
49 49
 
50 50
 void lcd_moveto(int col, int row);
51 51
 
52
-inline int lcd_put_u8str_P(const char *str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); }
52
+inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); }
53 53
 
54 54
 inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
55 55
 

+ 1
- 1
Marlin/src/lcd/lcdprint_hd44780.cpp 查看文件

@@ -1036,7 +1036,7 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
1036 1036
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
1037 1037
 }
1038 1038
 
1039
-int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length) {
1039
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
1040 1040
   return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
1041 1041
 }
1042 1042
 

+ 1
- 1
Marlin/src/lcd/lcdprint_u8g.cpp 查看文件

@@ -54,7 +54,7 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
54 54
   return ret;
55 55
 }
56 56
 
57
-int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length) {
57
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
58 58
   unsigned int x = pu8g->getPrintCol(),
59 59
                y = pu8g->getPrintRow(),
60 60
                ret = uxg_DrawUtf8StrP(pu8g->getU8g(), x, y, utf8_str_P, max_length);

+ 2
- 2
Marlin/src/lcd/malyanlcd.cpp 查看文件

@@ -81,7 +81,7 @@ int inbound_count;
81 81
 bool last_printing_status = false;
82 82
 
83 83
 // Everything written needs the high bit set.
84
-void write_to_lcd_P(const char * const message) {
84
+void write_to_lcd_P(PGM_P const message) {
85 85
   char encoded_message[MAX_CURLY_COMMAND];
86 86
   uint8_t message_length = MIN(strlen_P(message), sizeof(encoded_message));
87 87
 
@@ -481,7 +481,7 @@ void lcd_init() {
481 481
 /**
482 482
  * Set an alert.
483 483
  */
484
-void lcd_setalertstatusPGM(const char* message) {
484
+void lcd_setalertstatusPGM(PGM_P message) {
485 485
   char message_buffer[MAX_CURLY_COMMAND];
486 486
   sprintf_P(message_buffer, PSTR("{E:%s}"), message);
487 487
   write_to_lcd(message_buffer);

+ 2
- 2
Marlin/src/lcd/u8g_fontutf8.cpp 查看文件

@@ -233,7 +233,7 @@ unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const
233 233
  *
234 234
  * Draw a ROM UTF-8 string at the specified position
235 235
  */
236
-unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_width) {
236
+unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_width) {
237 237
   struct _uxg_drawu8_data_t data;
238 238
   font_group_t *group = &g_fontgroup_root;
239 239
   const font_t *fnt_default = uxg_GetFont(pu8g);
@@ -302,7 +302,7 @@ int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg) {
302 302
  *
303 303
  * Get the screen pixel width of a ROM UTF-8 string
304 304
  */
305
-int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg) {
305
+int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg) {
306 306
   struct _uxg_drawu8_data_t data;
307 307
   font_group_t *group = &g_fontgroup_root;
308 308
   const font_t *fnt_default = uxg_GetFont(pu8g);

+ 2
- 2
Marlin/src/lcd/u8g_fontutf8.h 查看文件

@@ -30,10 +30,10 @@ int uxg_SetUtf8Fonts (const uxg_fontinfo_t * fntinfo, int number); // fntinfo is
30 30
 unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
31 31
 
32 32
 unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
33
-unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
33
+unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_length);
34 34
 
35 35
 int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
36
-int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg);
36
+int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
37 37
 
38 38
 #define uxg_GetFont(puxg) ((puxg)->font)
39 39
 

+ 35
- 35
Marlin/src/lcd/ultralcd.cpp 查看文件

@@ -125,15 +125,15 @@ uint16_t max_display_update_time = 0;
125 125
 #if ENABLED(ULTIPANEL)
126 126
 
127 127
   #define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \
128
-    inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
128
+    inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, _type * const data, ...) { \
129 129
       UNUSED(pstr2); \
130 130
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
131 131
     } \
132
-    inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
132
+    inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, _type * const data, ...) { \
133 133
       UNUSED(pstr2); \
134 134
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
135 135
     } \
136
-    inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
136
+    inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
137 137
       UNUSED(pstr2); UNUSED(pset); \
138 138
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(pget())); \
139 139
     } \
@@ -254,16 +254,16 @@ uint16_t max_display_update_time = 0;
254 254
   #define menu_action_back(dummy) _menu_action_back()
255 255
   void _menu_action_back();
256 256
   void menu_action_submenu(screenFunc_t data);
257
-  void menu_action_gcode(const char* pgcode);
257
+  void menu_action_gcode(PGM_P pgcode);
258 258
   void menu_action_function(menuAction_t data);
259 259
 
260 260
   #define DECLARE_MENU_EDIT_TYPE(_type, _name) \
261 261
     bool _menu_edit_ ## _name(); \
262 262
     void menu_edit_ ## _name(); \
263 263
     void menu_edit_callback_ ## _name(); \
264
-    void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
265
-    void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
266
-    void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback=NULL, const bool live=false); \
264
+    void _menu_action_setting_edit_ ## _name(PGM_P const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
265
+    void menu_action_setting_edit_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
266
+    void menu_action_setting_edit_callback_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback=NULL, const bool live=false); \
267 267
     typedef void _name##_void
268 268
 
269 269
   DECLARE_MENU_EDIT_TYPE(int16_t, int3);
@@ -277,8 +277,8 @@ uint16_t max_display_update_time = 0;
277 277
   DECLARE_MENU_EDIT_TYPE(float, float62);
278 278
   DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
279 279
 
280
-  void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
281
-  void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
280
+  void menu_action_setting_edit_bool(PGM_P pstr, bool* ptr);
281
+  void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t callbackFunc);
282 282
 
283 283
   #if ENABLED(SDSUPPORT)
284 284
     void lcd_sdcard_menu();
@@ -466,7 +466,7 @@ uint16_t max_display_update_time = 0;
466 466
   bool screen_changed, defer_return_to_status;
467 467
 
468 468
   // Value Editing
469
-  const char *editLabel;
469
+  PGM_P editLabel;
470 470
   void *editValue;
471 471
   int32_t minEditValue, maxEditValue;
472 472
   screenFunc_t callbackFunc;
@@ -570,7 +570,7 @@ uint16_t max_display_update_time = 0;
570 570
    * Show "Moving..." till moves are done, then revert to previous display.
571 571
    */
572 572
   static const char moving[] PROGMEM = MSG_MOVING;
573
-  static const char *sync_message = moving;
573
+  static PGM_P sync_message = moving;
574 574
 
575 575
   //
576 576
   // Display the synchronize screen until moves are
@@ -591,7 +591,7 @@ uint16_t max_display_update_time = 0;
591 591
 
592 592
   // Display the synchronize screen with a custom message
593 593
   // ** This blocks the command queue! **
594
-  void lcd_synchronize(const char * const msg=NULL) {
594
+  void lcd_synchronize(PGM_P const msg=NULL) {
595 595
     sync_message = msg ? msg : moving;
596 596
     _lcd_synchronize();
597 597
   }
@@ -772,7 +772,7 @@ void lcd_reset_status() {
772 772
   static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
773 773
   static const char printing[] PROGMEM = MSG_PRINTING;
774 774
   static const char welcome[] PROGMEM = WELCOME_MSG;
775
-  const char *msg;
775
+  PGM_P msg;
776 776
   if (print_job_timer.isPaused())
777 777
     msg = paused;
778 778
   #if ENABLED(SDSUPPORT)
@@ -792,7 +792,7 @@ void lcd_reset_status() {
792 792
  * draw the kill screen
793 793
  *
794 794
  */
795
-void kill_screen(const char* lcd_msg) {
795
+void kill_screen(PGM_P lcd_msg) {
796 796
   lcd_init();
797 797
   lcd_setalertstatusPGM(lcd_msg);
798 798
   lcd_kill_screen();
@@ -1080,7 +1080,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
1080 1080
       #define _DONE_SCRIPT ""
1081 1081
     #endif
1082 1082
 
1083
-    void _lcd_user_gcode(const char * const cmd) {
1083
+    void _lcd_user_gcode(PGM_P const cmd) {
1084 1084
       enqueue_and_echo_commands_P(cmd);
1085 1085
       #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
1086 1086
         lcd_completion_feedback();
@@ -1288,7 +1288,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
1288 1288
 
1289 1289
   #if ENABLED(BABYSTEPPING)
1290 1290
 
1291
-    void _lcd_babystep(const AxisEnum axis, const char* msg) {
1291
+    void _lcd_babystep(const AxisEnum axis, PGM_P msg) {
1292 1292
       if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
1293 1293
       ENCODER_DIRECTION_NORMAL();
1294 1294
       if (encoderPosition) {
@@ -1373,7 +1373,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
1373 1373
                                                   // separate value that doesn't lose precision.
1374 1374
     static int16_t ubl_encoderPosition = 0;
1375 1375
 
1376
-    static void _lcd_mesh_fine_tune(const char* msg) {
1376
+    static void _lcd_mesh_fine_tune(PGM_P msg) {
1377 1377
       defer_return_to_status = true;
1378 1378
       if (ubl.encoder_diff) {
1379 1379
         ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
@@ -1937,7 +1937,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
1937 1937
       no_reentry = false;
1938 1938
     }
1939 1939
 
1940
-    void lcd_enqueue_commands_P(const char * const cmd) {
1940
+    void lcd_enqueue_commands_P(PGM_P const cmd) {
1941 1941
       no_reentry = true;
1942 1942
       enqueue_and_echo_commands_now_P(cmd);
1943 1943
       no_reentry = false;
@@ -3030,7 +3030,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
3030 3030
    *
3031 3031
    */
3032 3032
 
3033
-  void _lcd_move_xyz(const char* name, AxisEnum axis) {
3033
+  void _lcd_move_xyz(PGM_P name, AxisEnum axis) {
3034 3034
     if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
3035 3035
     ENCODER_DIRECTION_NORMAL();
3036 3036
     if (encoderPosition && !processing_manual_move) {
@@ -4508,7 +4508,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
4508 4508
     static AdvancedPauseMode _change_filament_temp_mode;
4509 4509
     static int8_t _change_filament_temp_extruder;
4510 4510
 
4511
-    static const char* _change_filament_temp_command() {
4511
+    static PGM_P _change_filament_temp_command() {
4512 4512
       switch (_change_filament_temp_mode) {
4513 4513
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4514 4514
           return PSTR("M701 T%d");
@@ -4531,7 +4531,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
4531 4531
     void _lcd_change_filament_temp_2_menu() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); }
4532 4532
     void _lcd_change_filament_temp_custom_menu() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); }
4533 4533
 
4534
-    static const char* change_filament_header(const AdvancedPauseMode mode) {
4534
+    static PGM_P change_filament_header(const AdvancedPauseMode mode) {
4535 4535
       switch (mode) {
4536 4536
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4537 4537
           return PSTR(MSG_FILAMENTLOAD);
@@ -4779,7 +4779,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
4779 4779
     static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT;
4780 4780
     static uint8_t hotend_status_extruder = 0;
4781 4781
 
4782
-    static const char* advanced_pause_header() {
4782
+    static PGM_P advanced_pause_header() {
4783 4783
       switch (advanced_pause_mode) {
4784 4784
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4785 4785
           return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
@@ -5061,9 +5061,9 @@ void lcd_quick_feedback(const bool clear_buttons) {
5061 5061
    *   bool _menu_edit_int3();
5062 5062
    *   void menu_edit_int3(); // edit int16_t (interactively)
5063 5063
    *   void menu_edit_callback_int3(); // edit int16_t (interactively) with callback on completion
5064
-   *   void _menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
5065
-   *   void menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
5066
-   *   void menu_action_setting_edit_callback_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback, const bool live); // edit int16_t with callback
5064
+   *   void _menu_action_setting_edit_int3(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
5065
+   *   void menu_action_setting_edit_int3(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
5066
+   *   void menu_action_setting_edit_callback_int3(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback, const bool live); // edit int16_t with callback
5067 5067
    *
5068 5068
    * You can then use one of the menu macros to present the edit interface:
5069 5069
    *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
@@ -5090,7 +5090,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
5090 5090
       return use_click(); \
5091 5091
     } \
5092 5092
     void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \
5093
-    void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \
5093
+    void _menu_action_setting_edit_ ## _name(PGM_P const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \
5094 5094
       lcd_save_previous_screen(); \
5095 5095
       lcd_refresh(); \
5096 5096
       \
@@ -5100,13 +5100,13 @@ void lcd_quick_feedback(const bool clear_buttons) {
5100 5100
       maxEditValue = maxValue * _scale - minEditValue; \
5101 5101
       encoderPosition = (*ptr) * _scale - minEditValue; \
5102 5102
     } \
5103
-    void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live) { \
5103
+    void menu_action_setting_edit_callback_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live) { \
5104 5104
       _menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
5105 5105
       currentScreen = menu_edit_ ## _name; \
5106 5106
       callbackFunc = callback; \
5107 5107
       liveEdit = live; \
5108 5108
     } \
5109
-    FORCE_INLINE void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
5109
+    FORCE_INLINE void menu_action_setting_edit_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
5110 5110
       menu_action_setting_edit_callback_ ## _name(pstr, ptr, minValue, maxValue); \
5111 5111
     } \
5112 5112
     typedef void _name##_void
@@ -5219,7 +5219,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
5219 5219
    */
5220 5220
   void _menu_action_back() { lcd_goto_previous_menu(); }
5221 5221
   void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); }
5222
-  void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
5222
+  void menu_action_gcode(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); }
5223 5223
   void menu_action_function(screenFunc_t func) { (*func)(); }
5224 5224
 
5225 5225
   #if ENABLED(SDSUPPORT)
@@ -5246,8 +5246,8 @@ void lcd_quick_feedback(const bool clear_buttons) {
5246 5246
 
5247 5247
   #endif // SDSUPPORT
5248 5248
 
5249
-  void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { UNUSED(pstr); *ptr ^= true; lcd_refresh(); }
5250
-  void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
5249
+  void menu_action_setting_edit_bool(PGM_P pstr, bool* ptr) { UNUSED(pstr); *ptr ^= true; lcd_refresh(); }
5250
+  void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t callback) {
5251 5251
     menu_action_setting_edit_bool(pstr, ptr);
5252 5252
     (*callback)();
5253 5253
   }
@@ -5694,7 +5694,7 @@ void lcd_setstatus(const char * const message, const bool persist) {
5694 5694
   lcd_finishstatus(persist);
5695 5695
 }
5696 5696
 
5697
-void lcd_setstatusPGM(const char * const message, int8_t level) {
5697
+void lcd_setstatusPGM(PGM_P const message, int8_t level) {
5698 5698
   if (level < 0) level = lcd_status_message_level = 0;
5699 5699
   if (level < lcd_status_message_level) return;
5700 5700
   lcd_status_message_level = level;
@@ -5704,7 +5704,7 @@ void lcd_setstatusPGM(const char * const message, int8_t level) {
5704 5704
   // that there is no cutting in the middle of a multibyte character!
5705 5705
 
5706 5706
   // Get a pointer to the null terminator
5707
-  const char* pend = message + strlen_P(message);
5707
+  PGM_P pend = message + strlen_P(message);
5708 5708
 
5709 5709
   //  If length of supplied UTF8 string is greater than
5710 5710
   // our buffer size, start cutting whole UTF8 chars
@@ -5721,7 +5721,7 @@ void lcd_setstatusPGM(const char * const message, int8_t level) {
5721 5721
   lcd_finishstatus(level > 0);
5722 5722
 }
5723 5723
 
5724
-void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
5724
+void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
5725 5725
   if (level < lcd_status_message_level) return;
5726 5726
   lcd_status_message_level = level;
5727 5727
   va_list args;
@@ -5731,7 +5731,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
5731 5731
   lcd_finishstatus(level > 0);
5732 5732
 }
5733 5733
 
5734
-void lcd_setalertstatusPGM(const char * const message) {
5734
+void lcd_setalertstatusPGM(PGM_P const message) {
5735 5735
   lcd_setstatusPGM(message, 1);
5736 5736
   #if ENABLED(ULTIPANEL)
5737 5737
     lcd_return_to_status();

+ 8
- 8
Marlin/src/lcd/ultralcd.h 查看文件

@@ -29,12 +29,12 @@
29 29
   void lcd_init();
30 30
   bool lcd_detected();
31 31
   void lcd_update();
32
-  void lcd_setalertstatusPGM(const char* message);
32
+  void lcd_setalertstatusPGM(PGM_P message);
33 33
 #else
34 34
   inline void lcd_init() {}
35 35
   inline bool lcd_detected() { return true; }
36 36
   inline void lcd_update() {}
37
-  inline void lcd_setalertstatusPGM(const char* message) { UNUSED(message); }
37
+  inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
38 38
 #endif
39 39
 
40 40
 #if ENABLED(ULTRA_LCD)
@@ -49,13 +49,13 @@
49 49
   void lcd_return_to_status();
50 50
   bool lcd_hasstatus();
51 51
   void lcd_setstatus(const char* message, const bool persist=false);
52
-  void lcd_setstatusPGM(const char* message, const int8_t level=0);
53
-  void lcd_setalertstatusPGM(const char* message);
52
+  void lcd_setstatusPGM(PGM_P message, const int8_t level=0);
53
+  void lcd_setalertstatusPGM(PGM_P message);
54 54
   void lcd_reset_alert_level();
55 55
   void lcd_reset_status();
56
-  void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
56
+  void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...);
57 57
   void lcd_kill_screen();
58
-  void kill_screen(const char* lcd_msg);
58
+  void kill_screen(PGM_P lcd_msg);
59 59
 
60 60
   extern uint8_t lcdDrawUpdate;
61 61
   inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
@@ -206,8 +206,8 @@
206 206
   inline void lcd_refresh() {}
207 207
   inline bool lcd_hasstatus() { return false; }
208 208
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
209
-  inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
210
-  inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
209
+  inline void lcd_setstatusPGM(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
210
+  inline void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
211 211
   inline void lcd_reset_alert_level() {}
212 212
   inline void lcd_reset_status() {}
213 213
 

+ 5
- 5
Marlin/src/lcd/ultralcd_impl_DOGM.h 查看文件

@@ -408,7 +408,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
408 408
   }
409 409
 
410 410
   // Draw a static line of text in the same idiom as a menu item
411
-  static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
411
+  static void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
412 412
 
413 413
     if (lcd_implementation_mark_as_selected(row, invert)) {
414 414
 
@@ -428,7 +428,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
428 428
   }
429 429
 
430 430
   // Draw a generic menu item
431
-  static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
431
+  static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
432 432
     UNUSED(pre_char);
433 433
 
434 434
     if (lcd_implementation_mark_as_selected(row, isSelected)) {
@@ -449,7 +449,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
449 449
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
450 450
 
451 451
   // Draw a menu item with an editable value
452
-  static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm) {
452
+  static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
453 453
     if (lcd_implementation_mark_as_selected(row, isSelected)) {
454 454
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
455 455
       uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
@@ -469,7 +469,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
469 469
   #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _src)
470 470
   #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
471 471
 
472
-  void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL) {
472
+  void lcd_implementation_drawedit(PGM_P const pstr, const char* const value=NULL) {
473 473
     const uint8_t labellen = utf8_strlen_P(pstr),
474 474
                   vallen = utf8_strlen(value);
475 475
 
@@ -521,7 +521,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
521 521
 
522 522
   #if ENABLED(SDSUPPORT)
523 523
 
524
-    static void _drawmenu_sd(const bool isSelected, const uint8_t row, const char* const pstr, CardReader &theCard, const bool isDir) {
524
+    static void _drawmenu_sd(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
525 525
       UNUSED(pstr);
526 526
 
527 527
       lcd_implementation_mark_as_selected(row, isSelected);

+ 11
- 11
Marlin/src/lcd/ultralcd_impl_HD44780.h 查看文件

@@ -347,7 +347,7 @@ void lcd_implementation_clear() { lcd.clear(); }
347 347
   }
348 348
 
349 349
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
350
-  void lcd_scroll(const uint8_t col, const uint8_t line, const char* const text, const uint8_t len, const int16_t time) {
350
+  void lcd_scroll(const uint8_t col, const uint8_t line, PGM_P const text, const uint8_t len, const int16_t time) {
351 351
     uint8_t slen = utf8_strlen_P(text);
352 352
     if (slen < len) {
353 353
       // Fits into,
@@ -360,7 +360,7 @@ void lcd_implementation_clear() { lcd.clear(); }
360 360
       safe_delay(time);
361 361
     }
362 362
     else {
363
-      const char* p = text;
363
+      PGM_P p = text;
364 364
       int dly = time / MAX(slen, 1);
365 365
       for (uint8_t i = 0; i <= slen; i++) {
366 366
 
@@ -387,7 +387,7 @@ void lcd_implementation_clear() { lcd.clear(); }
387 387
     }
388 388
   }
389 389
 
390
-  static void logo_lines(const char* const extra) {
390
+  static void logo_lines(PGM_P const extra) {
391 391
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
392 392
     lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" ));  lcd_put_wchar('\x01');
393 393
     lcd_moveto(indent, 1);                        lcd_put_u8str_P(PSTR("|Marlin|"));  lcd_put_u8str_P(extra);
@@ -867,7 +867,7 @@ static void lcd_implementation_status_screen() {
867 867
 
868 868
   #endif // ADVANCED_PAUSE_FEATURE
869 869
 
870
-  static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
870
+  static void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
871 871
     UNUSED(invert);
872 872
     int8_t n = LCD_WIDTH;
873 873
     lcd_moveto(0, row);
@@ -880,7 +880,7 @@ static void lcd_implementation_status_screen() {
880 880
     for (; n > 0; --n) lcd_put_wchar(' ');
881 881
   }
882 882
 
883
-  static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
883
+  static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
884 884
     uint8_t n = LCD_WIDTH - 2;
885 885
     lcd_moveto(0, row);
886 886
     lcd_put_wchar(sel ? pre_char : ' ');
@@ -889,7 +889,7 @@ static void lcd_implementation_status_screen() {
889 889
     lcd_put_wchar(post_char);
890 890
   }
891 891
 
892
-  static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
892
+  static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
893 893
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
894 894
     lcd_moveto(0, row);
895 895
     lcd_put_wchar(sel ? pre_char : ' ');
@@ -898,7 +898,7 @@ static void lcd_implementation_status_screen() {
898 898
     while (n--) lcd_put_wchar(' ');
899 899
     lcd_put_u8str(data);
900 900
   }
901
-  static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
901
+  static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
902 902
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
903 903
     lcd_moveto(0, row);
904 904
     lcd_put_wchar(sel ? pre_char : ' ');
@@ -911,7 +911,7 @@ static void lcd_implementation_status_screen() {
911 911
   #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _src)
912 912
   #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
913 913
 
914
-  void lcd_implementation_drawedit(const char* pstr, const char* const value=NULL) {
914
+  void lcd_implementation_drawedit(PGM_P pstr, const char* const value=NULL) {
915 915
     lcd_moveto(1, 1);
916 916
     lcd_put_u8str_P(pstr);
917 917
     if (value != NULL) {
@@ -926,7 +926,7 @@ static void lcd_implementation_status_screen() {
926 926
 
927 927
   #if ENABLED(SDSUPPORT)
928 928
 
929
-    static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, const char* const pstr, CardReader &theCard, const uint8_t concat, const char post_char) {
929
+    static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const uint8_t concat, const char post_char) {
930 930
       UNUSED(pstr);
931 931
       lcd_moveto(0, row);
932 932
       lcd_put_wchar(sel ? '>' : ' ');
@@ -960,11 +960,11 @@ static void lcd_implementation_status_screen() {
960 960
       lcd_put_wchar(post_char);
961 961
     }
962 962
 
963
-    static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, const char* pstr, CardReader &theCard) {
963
+    static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
964 964
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, ' ');
965 965
     }
966 966
 
967
-    static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, const char* pstr, CardReader &theCard) {
967
+    static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
968 968
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, LCD_STR_FOLDER[0]);
969 969
     }
970 970
 

+ 2
- 2
Marlin/src/libs/vector_3.cpp 查看文件

@@ -82,7 +82,7 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) {
82 82
   z = _x * matrix.matrix[3 * 0 + 2] + _y * matrix.matrix[3 * 1 + 2] + z * matrix.matrix[3 * 2 + 2];
83 83
 }
84 84
 
85
-void vector_3::debug(const char * const title) {
85
+void vector_3::debug(PGM_P const title) {
86 86
   serialprintPGM(title);
87 87
   SERIAL_PROTOCOLPGM(" x: ");
88 88
   SERIAL_PROTOCOL_F(x, 6);
@@ -143,7 +143,7 @@ matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) {
143 143
   return new_matrix;
144 144
 }
145 145
 
146
-void matrix_3x3::debug(const char * const title) {
146
+void matrix_3x3::debug(PGM_P const title) {
147 147
   if (title != NULL) {
148 148
     serialprintPGM(title);
149 149
     SERIAL_EOL();

+ 2
- 2
Marlin/src/libs/vector_3.h 查看文件

@@ -57,7 +57,7 @@ struct vector_3 {
57 57
   float get_length() const;
58 58
   vector_3 get_normal() const;
59 59
 
60
-  void debug(const char * const title);
60
+  void debug(PGM_P const title);
61 61
   void apply_rotation(const matrix_3x3 &matrix);
62 62
 };
63 63
 
@@ -70,7 +70,7 @@ struct matrix_3x3 {
70 70
 
71 71
   void set_to_identity();
72 72
 
73
-  void debug(const char * const title);
73
+  void debug(PGM_P const title);
74 74
 };
75 75
 
76 76
 

+ 1
- 1
Marlin/src/module/endstops.cpp 查看文件

@@ -366,7 +366,7 @@ void Endstops::event_handler() {
366 366
   prev_hit_state = hit_state;
367 367
 } // Endstops::report_state
368 368
 
369
-static void print_es_state(const bool is_hit, const char * const label=NULL) {
369
+static void print_es_state(const bool is_hit, PGM_P const label=NULL) {
370 370
   if (label) serialprintPGM(label);
371 371
   SERIAL_PROTOCOLPGM(": ");
372 372
   serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));

+ 1
- 1
Marlin/src/module/probe.cpp 查看文件

@@ -435,7 +435,7 @@ bool set_probe_deployed(const bool deploy) {
435 435
         BUZZ(100, 659);
436 436
         BUZZ(100, 698);
437 437
 
438
-        const char * const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
438
+        PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
439 439
         lcd_setstatusPGM(ds_str);
440 440
         serialprintPGM(ds_str);
441 441
         SERIAL_EOL();

+ 1
- 1
Marlin/src/module/temperature.cpp 查看文件

@@ -582,7 +582,7 @@ int Temperature::getHeaterPower(const int heater) {
582 582
 //
583 583
 // Temperature Error Handlers
584 584
 //
585
-void Temperature::_temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg) {
585
+void Temperature::_temp_error(const int8_t e, PGM_P const serial_msg, PGM_P const lcd_msg) {
586 586
   static bool killed = false;
587 587
   if (IsRunning()) {
588 588
     SERIAL_ERROR_START();

+ 1
- 1
Marlin/src/module/temperature.h 查看文件

@@ -637,7 +637,7 @@ class Temperature {
637 637
       static float get_pid_output_bed();
638 638
     #endif
639 639
 
640
-    static void _temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg);
640
+    static void _temp_error(const int8_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
641 641
     static void min_temp_error(const int8_t e);
642 642
     static void max_temp_error(const int8_t e);
643 643
 

+ 1
- 1
Marlin/src/pins/pinsDebug.h 查看文件

@@ -67,7 +67,7 @@
67 67
 
68 68
 
69 69
 typedef struct {
70
-  const char * const name;
70
+  PGM_P const name;
71 71
   pin_t pin;
72 72
   bool is_digital;
73 73
 } PinInfo;

Loading…
取消
儲存