Browse Source

Use PGM_P for PSTR pointers (#11977)

Scott Lahteine 6 years ago
parent
commit
11ac75edcb
No account linked to committer's email address
39 changed files with 166 additions and 165 deletions
  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 View File

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

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp View File

79
 // This extra chit-chat goes away soon, but is helpful for now
79
 // This extra chit-chat goes away soon, but is helpful for now
80
 // to see errors that are happening in read_data / write_data
80
 // to see errors that are happening in read_data / write_data
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) {
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
   SERIAL_PROTOCOLCHAR(' ');
83
   SERIAL_PROTOCOLCHAR(' ');
84
   serialprintPGM(rw_str);
84
   serialprintPGM(rw_str);
85
   SERIAL_PROTOCOLPAIR("_data(", pos);
85
   SERIAL_PROTOCOLPAIR("_data(", pos);

+ 1
- 1
Marlin/src/Marlin.cpp View File

599
  * Kill all activity and lock the machine.
599
  * Kill all activity and lock the machine.
600
  * After this the machine will need to be reset.
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
   SERIAL_ERROR_START();
603
   SERIAL_ERROR_START();
604
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
604
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
605
 
605
 

+ 1
- 1
Marlin/src/Marlin.h View File

180
 void disable_e_steppers();
180
 void disable_e_steppers();
181
 void disable_all_steppers();
181
 void disable_all_steppers();
182
 
182
 
183
-void kill(const char*);
183
+void kill(PGM_P);
184
 
184
 
185
 void quickstop_stepper();
185
 void quickstop_stepper();
186
 
186
 

+ 19
- 19
Marlin/src/core/serial.cpp View File

32
     while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch);
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
   void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); }
44
   void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); }
45
 #endif
45
 #endif
46
 
46
 
47
-void serialprintPGM(const char * str) {
47
+void serialprintPGM(PGM_P str) {
48
   while (char ch = pgm_read_byte(str++)) SERIAL_CHAR(ch);
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
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
60
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
61
 
61
 
63
 
63
 
64
   #include "enum.h"
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
     serialprintPGM(prefix);
67
     serialprintPGM(prefix);
68
     SERIAL_CHAR('(');
68
     SERIAL_CHAR('(');
69
     SERIAL_ECHO(x);
69
     SERIAL_ECHO(x);
73
     if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
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
     print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
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 View File

105
   #define SERIAL_ECHOPAIR_F_P(p,pre,value)          SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value))
105
   #define SERIAL_ECHOPAIR_F_P(p,pre,value)          SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value))
106
   #define SERIAL_ECHOLNPAIR_F_P(p,pre, value)       SERIAL_ECHOLNPAIR_P(p, pre, FIXFLOAT(value))
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
   void serial_spaces_P(const int8_t p, uint8_t count);
120
   void serial_spaces_P(const int8_t p, uint8_t count);
121
   #define SERIAL_ECHO_SP_P(p,C)     serial_spaces_P(p,C)
121
   #define SERIAL_ECHO_SP_P(p,C)     serial_spaces_P(p,C)
122
   #define SERIAL_ERROR_SP_P(p,C)    serial_spaces_P(p,C)
122
   #define SERIAL_ERROR_SP_P(p,C)    serial_spaces_P(p,C)
123
   #define SERIAL_PROTOCOL_SP_P(p,C) serial_spaces_P(p,C)
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
 #else
126
 #else
127
   #define SERIAL_CHAR_P(p,x)          SERIAL_CHAR(x)
127
   #define SERIAL_CHAR_P(p,x)          SERIAL_CHAR(x)
128
   #define SERIAL_PROTOCOL_P(p,x)      SERIAL_PROTOCOL(x)
128
   #define SERIAL_PROTOCOL_P(p,x)      SERIAL_PROTOCOL(x)
215
 #define SERIAL_ECHOPAIR_F(pre,value)        SERIAL_ECHOPAIR(pre, FIXFLOAT(value))
215
 #define SERIAL_ECHOPAIR_F(pre,value)        SERIAL_ECHOPAIR(pre, FIXFLOAT(value))
216
 #define SERIAL_ECHOLNPAIR_F(pre, value)     SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value))
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
 void serial_spaces(uint8_t count);
230
 void serial_spaces(uint8_t count);
231
 #define SERIAL_ECHO_SP(C)     serial_spaces(C)
231
 #define SERIAL_ECHO_SP(C)     serial_spaces(C)
235
 //
235
 //
236
 // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
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
 #if ENABLED(DEBUG_LEVELING_FEATURE)
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
   #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
243
   #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
244
 #endif
244
 #endif
245
 
245
 

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl.cpp View File

90
         SERIAL_ECHO_F(destination[X_AXIS], 6);
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
       // if the title message starts with a '!' it is so important, we are going to
95
       // if the title message starts with a '!' it is so important, we are going to
96
       // ignore the status of the g26_debug_flag
96
       // ignore the status of the g26_debug_flag
127
       SERIAL_ECHOPGM(", ");
127
       SERIAL_ECHOPGM(", ");
128
       debug_echo_axis(E_AXIS);
128
       debug_echo_axis(E_AXIS);
129
       SERIAL_ECHOPGM(" )   ");
129
       SERIAL_ECHOPGM(" )   ");
130
-      SERIAL_ECHO(title);
130
+      serialprintPGM(title);
131
       SERIAL_EOL();
131
       SERIAL_EOL();
132
 
132
 
133
     }
133
     }

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl.h View File

40
 // ubl_motion.cpp
40
 // ubl_motion.cpp
41
 
41
 
42
 #if ENABLED(UBL_DEVEL_DEBUGGING)
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
 #else
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
 #endif
46
 #endif
47
 
47
 
48
 // ubl_G29.cpp
48
 // ubl_G29.cpp

+ 1
- 1
Marlin/src/feature/tmc_util.cpp View File

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

+ 3
- 3
Marlin/src/gcode/calibrate/G33.cpp View File

108
   #endif
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
   SERIAL_PROTOCOLPGM("  ");
112
   SERIAL_PROTOCOLPGM("  ");
113
   serialprintPGM(prefix);
113
   serialprintPGM(prefix);
114
   SERIAL_PROTOCOLCHAR(':');
114
   SERIAL_PROTOCOLCHAR(':');
517
   }
517
   }
518
 
518
 
519
   // Report settings
519
   // Report settings
520
-  const char* checkingac = PSTR("Checking... AC");
520
+  PGM_P checkingac = PSTR("Checking... AC");
521
   serialprintPGM(checkingac);
521
   serialprintPGM(checkingac);
522
   if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
522
   if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
523
   if (set_up) SERIAL_PROTOCOLPGM("  (SET-UP)");
523
   if (set_up) SERIAL_PROTOCOLPGM("  (SET-UP)");
705
       }
705
       }
706
     }
706
     }
707
     else { // dry run
707
     else { // dry run
708
-      const char *enddryrun = PSTR("End DRY-RUN");
708
+      PGM_P enddryrun = PSTR("End DRY-RUN");
709
       serialprintPGM(enddryrun);
709
       serialprintPGM(enddryrun);
710
       SERIAL_PROTOCOL_SP(35);
710
       SERIAL_PROTOCOL_SP(35);
711
       SERIAL_PROTOCOLPGM("std dev:");
711
       SERIAL_PROTOCOLPGM("std dev:");

+ 10
- 9
Marlin/src/gcode/calibrate/M100.cpp View File

50
  *
50
  *
51
  * Also, there are two support functions that can be called from a developer's C code.
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
  * Initial version by Roxy-3D
56
  * Initial version by Roxy-3D
57
  */
57
  */
80
 // Count the number of test bytes at the specified location.
80
 // Count the number of test bytes at the specified location.
81
 inline int32_t count_test_bytes(const char * const ptr) {
81
 inline int32_t count_test_bytes(const char * const ptr) {
82
   for (uint32_t i = 0; i < 32000; i++)
82
   for (uint32_t i = 0; i < 32000; i++)
83
-    if (((char) ptr[i]) != TEST_BYTE)
83
+    if (char(ptr[i]) != TEST_BYTE)
84
       return i - 1;
84
       return i - 1;
85
 
85
 
86
   return -1;
86
   return -1;
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
     // Round the start and end locations to produce full lines of output
143
     // Round the start and end locations to produce full lines of output
143
     //
144
     //
148
 
149
 
149
 #endif // M100_FREE_MEMORY_DUMPER
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
   char *ptr = END_OF_HEAP(), *sp = top_of_stack();
155
   char *ptr = END_OF_HEAP(), *sp = top_of_stack();
155
   int n = sp - ptr;
156
   int n = sp - ptr;
171
     //   idle();
172
     //   idle();
172
     safe_delay(20);
173
     safe_delay(20);
173
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
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
     #endif
176
     #endif
176
   }
177
   }
177
 
178
 
239
     SERIAL_ECHOPAIR("\nLargest free block is ", max_cnt);
240
     SERIAL_ECHOPAIR("\nLargest free block is ", max_cnt);
240
     SERIAL_ECHOLNPAIR(" bytes at ", hex_address(max_addr));
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
 #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
246
 #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)

+ 1
- 1
Marlin/src/gcode/control/M111.cpp View File

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

+ 4
- 4
Marlin/src/gcode/gcode.cpp View File

170
 // Placeholders for non-migrated codes
170
 // Placeholders for non-migrated codes
171
 //
171
 //
172
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
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
 #endif
174
 #endif
175
 
175
 
176
 /**
176
 /**
700
     SERIAL_ECHOLN(current_command);
700
     SERIAL_ECHOLN(current_command);
701
     #if ENABLED(M100_FREE_MEMORY_WATCHER)
701
     #if ENABLED(M100_FREE_MEMORY_WATCHER)
702
       SERIAL_ECHOPAIR("slot:", cmd_queue_index_r);
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
     #endif
704
     #endif
705
   }
705
   }
706
 
706
 
714
    * Run a series of commands, bypassing the command queue to allow
714
    * Run a series of commands, bypassing the command queue to allow
715
    * G-code "macros" to be called from within other G-code handlers.
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
     // Save the parser state
718
     // Save the parser state
719
     char * const saved_cmd = parser.command_ptr;
719
     char * const saved_cmd = parser.command_ptr;
720
 
720
 
721
     // Process individual commands in string
721
     // Process individual commands in string
722
     while (pgm_read_byte_near(pgcode)) {
722
     while (pgm_read_byte_near(pgcode)) {
723
       // Break up string at '\n' delimiters
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
       size_t len = delim ? delim - pgcode : strlen_P(pgcode);
725
       size_t len = delim ? delim - pgcode : strlen_P(pgcode);
726
       char cmd[len + 1];
726
       char cmd[len + 1];
727
       strncpy_P(cmd, pgcode, len);
727
       strncpy_P(cmd, pgcode, len);

+ 1
- 1
Marlin/src/gcode/gcode.h View File

295
   static void process_next_command();
295
   static void process_next_command();
296
 
296
 
297
   #if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE)
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
   #endif
299
   #endif
300
 
300
 
301
   FORCE_INLINE static void home_all_axes() { G28(true); }
301
   FORCE_INLINE static void home_all_axes() { G28(true); }

+ 1
- 1
Marlin/src/gcode/host/M115.cpp View File

28
 #endif
28
 #endif
29
 
29
 
30
 #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
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
     SERIAL_PROTOCOLPGM("Cap:");
32
     SERIAL_PROTOCOLPGM("Cap:");
33
     serialprintPGM(name);
33
     serialprintPGM(name);
34
     SERIAL_CHAR(':');
34
     SERIAL_CHAR(':');

+ 1
- 1
Marlin/src/gcode/parser.h View File

258
       FORCE_INLINE static char temp_units_code() {
258
       FORCE_INLINE static char temp_units_code() {
259
         return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C';
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
         return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius");
262
         return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius");
263
       }
263
       }
264
       static inline float to_temp_units(const float &f) {
264
       static inline float to_temp_units(const float &f) {

+ 4
- 4
Marlin/src/gcode/queue.cpp View File

84
  * Used by Marlin internally to ensure that commands initiated from within
84
  * Used by Marlin internally to ensure that commands initiated from within
85
  * are enqueued ahead of any pending serial or sd card commands.
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
 void queue_setup() {
89
 void queue_setup() {
90
   // Send "ok" after commands by default
90
   // Send "ok" after commands by default
181
  * Aborts the current queue, if any.
181
  * Aborts the current queue, if any.
182
  * Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards
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
   injected_commands_P = pgcode;
185
   injected_commands_P = pgcode;
186
   (void)drain_injected_commands_P(); // first command executed asap (when possible)
186
   (void)drain_injected_commands_P(); // first command executed asap (when possible)
187
 }
187
 }
197
     /**
197
     /**
198
      * Enqueue from program memory and return only when commands are actually enqueued
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
       enqueue_and_echo_commands_P(pgcode);
201
       enqueue_and_echo_commands_P(pgcode);
202
       while (drain_injected_commands_P()) idle();
202
       while (drain_injected_commands_P()) idle();
203
     }
203
     }
249
   ok_to_send();
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
   SERIAL_ERROR_START_P(port);
253
   SERIAL_ERROR_START_P(port);
254
   serialprintPGM_P(port, err);
254
   serialprintPGM_P(port, err);
255
   SERIAL_ERRORLN_P(port, gcode_LastN);
255
   SERIAL_ERRORLN_P(port, gcode_LastN);

+ 2
- 2
Marlin/src/gcode/queue.h View File

90
  * Aborts the current queue, if any.
90
  * Aborts the current queue, if any.
91
  * Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards
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
  * Enqueue with Serial Echo
96
  * Enqueue with Serial Echo
109
     /**
109
     /**
110
      * Enqueue from program memory and return only when commands are actually enqueued
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
   #endif
113
   #endif
114
 #endif
114
 #endif
115
 
115
 

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

75
   while (*str && len--) write_byte(*str++);
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
   while (char c = pgm_read_byte_near(p_str++)) write_byte(c);
80
   while (char c = pgm_read_byte_near(p_str++)) write_byte(c);
81
 }
81
 }
82
 
82
 
83
 void ST7920_Lite_Status_Screen::write_str(progmem_str str) {
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
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
87
 void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
88
   char str[7];
88
   char str[7];
89
-  const char *fmt;
89
+  PGM_P fmt;
90
   switch (digits) {
90
   switch (digits) {
91
     case 6: fmt = PSTR("%6d"); break;
91
     case 6: fmt = PSTR("%6d"); break;
92
     case 5: fmt = PSTR("%5d"); break;
92
     case 5: fmt = PSTR("%5d"); break;

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

48
 
48
 
49
     static void write_str(const char *str);
49
     static void write_str(const char *str);
50
     static void write_str(const char *str, const uint8_t len);
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
     static void write_str(progmem_str str);
52
     static void write_str(progmem_str str);
53
     static void write_number(const int16_t value, const uint8_t digits=3);
53
     static void write_number(const int16_t value, const uint8_t digits=3);
54
 
54
 

+ 1
- 1
Marlin/src/lcd/fontutils.cpp View File

177
   return utf8_strlen_cb(pstart, read_byte_ram);
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
   return utf8_strlen_cb(pstart, read_byte_rom);
181
   return utf8_strlen_cb(pstart, read_byte_rom);
182
 }
182
 }
183
 
183
 

+ 1
- 1
Marlin/src/lcd/fontutils.h View File

44
 
44
 
45
 /* Returns lenght of string in CHARACTERS, NOT BYTES */
45
 /* Returns lenght of string in CHARACTERS, NOT BYTES */
46
 uint8_t utf8_strlen(const char *pstart);
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
 #endif // _FONT_UTILS_H
49
 #endif // _FONT_UTILS_H

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

45
  *
45
  *
46
  * Draw a ROM UTF-8 string
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
 void lcd_moveto(int col, int row);
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
 inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
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 View File

1036
   return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
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
   return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
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 View File

54
   return ret;
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
   unsigned int x = pu8g->getPrintCol(),
58
   unsigned int x = pu8g->getPrintCol(),
59
                y = pu8g->getPrintRow(),
59
                y = pu8g->getPrintRow(),
60
                ret = uxg_DrawUtf8StrP(pu8g->getU8g(), x, y, utf8_str_P, max_length);
60
                ret = uxg_DrawUtf8StrP(pu8g->getU8g(), x, y, utf8_str_P, max_length);

+ 2
- 2
Marlin/src/lcd/malyanlcd.cpp View File

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

+ 2
- 2
Marlin/src/lcd/u8g_fontutf8.cpp View File

233
  *
233
  *
234
  * Draw a ROM UTF-8 string at the specified position
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
   struct _uxg_drawu8_data_t data;
237
   struct _uxg_drawu8_data_t data;
238
   font_group_t *group = &g_fontgroup_root;
238
   font_group_t *group = &g_fontgroup_root;
239
   const font_t *fnt_default = uxg_GetFont(pu8g);
239
   const font_t *fnt_default = uxg_GetFont(pu8g);
302
  *
302
  *
303
  * Get the screen pixel width of a ROM UTF-8 string
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
   struct _uxg_drawu8_data_t data;
306
   struct _uxg_drawu8_data_t data;
307
   font_group_t *group = &g_fontgroup_root;
307
   font_group_t *group = &g_fontgroup_root;
308
   const font_t *fnt_default = uxg_GetFont(pu8g);
308
   const font_t *fnt_default = uxg_GetFont(pu8g);

+ 2
- 2
Marlin/src/lcd/u8g_fontutf8.h View File

30
 unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
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
 unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
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
 int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
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
 #define uxg_GetFont(puxg) ((puxg)->font)
38
 #define uxg_GetFont(puxg) ((puxg)->font)
39
 
39
 

+ 35
- 35
Marlin/src/lcd/ultralcd.cpp View File

125
 #if ENABLED(ULTIPANEL)
125
 #if ENABLED(ULTIPANEL)
126
 
126
 
127
   #define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \
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
       UNUSED(pstr2); \
129
       UNUSED(pstr2); \
130
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
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
       UNUSED(pstr2); \
133
       UNUSED(pstr2); \
134
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
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
       UNUSED(pstr2); UNUSED(pset); \
137
       UNUSED(pstr2); UNUSED(pset); \
138
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(pget())); \
138
       DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(pget())); \
139
     } \
139
     } \
254
   #define menu_action_back(dummy) _menu_action_back()
254
   #define menu_action_back(dummy) _menu_action_back()
255
   void _menu_action_back();
255
   void _menu_action_back();
256
   void menu_action_submenu(screenFunc_t data);
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
   void menu_action_function(menuAction_t data);
258
   void menu_action_function(menuAction_t data);
259
 
259
 
260
   #define DECLARE_MENU_EDIT_TYPE(_type, _name) \
260
   #define DECLARE_MENU_EDIT_TYPE(_type, _name) \
261
     bool _menu_edit_ ## _name(); \
261
     bool _menu_edit_ ## _name(); \
262
     void menu_edit_ ## _name(); \
262
     void menu_edit_ ## _name(); \
263
     void menu_edit_callback_ ## _name(); \
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
     typedef void _name##_void
267
     typedef void _name##_void
268
 
268
 
269
   DECLARE_MENU_EDIT_TYPE(int16_t, int3);
269
   DECLARE_MENU_EDIT_TYPE(int16_t, int3);
277
   DECLARE_MENU_EDIT_TYPE(float, float62);
277
   DECLARE_MENU_EDIT_TYPE(float, float62);
278
   DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
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
   #if ENABLED(SDSUPPORT)
283
   #if ENABLED(SDSUPPORT)
284
     void lcd_sdcard_menu();
284
     void lcd_sdcard_menu();
466
   bool screen_changed, defer_return_to_status;
466
   bool screen_changed, defer_return_to_status;
467
 
467
 
468
   // Value Editing
468
   // Value Editing
469
-  const char *editLabel;
469
+  PGM_P editLabel;
470
   void *editValue;
470
   void *editValue;
471
   int32_t minEditValue, maxEditValue;
471
   int32_t minEditValue, maxEditValue;
472
   screenFunc_t callbackFunc;
472
   screenFunc_t callbackFunc;
570
    * Show "Moving..." till moves are done, then revert to previous display.
570
    * Show "Moving..." till moves are done, then revert to previous display.
571
    */
571
    */
572
   static const char moving[] PROGMEM = MSG_MOVING;
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
   // Display the synchronize screen until moves are
576
   // Display the synchronize screen until moves are
591
 
591
 
592
   // Display the synchronize screen with a custom message
592
   // Display the synchronize screen with a custom message
593
   // ** This blocks the command queue! **
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
     sync_message = msg ? msg : moving;
595
     sync_message = msg ? msg : moving;
596
     _lcd_synchronize();
596
     _lcd_synchronize();
597
   }
597
   }
772
   static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
772
   static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
773
   static const char printing[] PROGMEM = MSG_PRINTING;
773
   static const char printing[] PROGMEM = MSG_PRINTING;
774
   static const char welcome[] PROGMEM = WELCOME_MSG;
774
   static const char welcome[] PROGMEM = WELCOME_MSG;
775
-  const char *msg;
775
+  PGM_P msg;
776
   if (print_job_timer.isPaused())
776
   if (print_job_timer.isPaused())
777
     msg = paused;
777
     msg = paused;
778
   #if ENABLED(SDSUPPORT)
778
   #if ENABLED(SDSUPPORT)
792
  * draw the kill screen
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
   lcd_init();
796
   lcd_init();
797
   lcd_setalertstatusPGM(lcd_msg);
797
   lcd_setalertstatusPGM(lcd_msg);
798
   lcd_kill_screen();
798
   lcd_kill_screen();
1080
       #define _DONE_SCRIPT ""
1080
       #define _DONE_SCRIPT ""
1081
     #endif
1081
     #endif
1082
 
1082
 
1083
-    void _lcd_user_gcode(const char * const cmd) {
1083
+    void _lcd_user_gcode(PGM_P const cmd) {
1084
       enqueue_and_echo_commands_P(cmd);
1084
       enqueue_and_echo_commands_P(cmd);
1085
       #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
1085
       #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
1086
         lcd_completion_feedback();
1086
         lcd_completion_feedback();
1288
 
1288
 
1289
   #if ENABLED(BABYSTEPPING)
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
       if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
1292
       if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
1293
       ENCODER_DIRECTION_NORMAL();
1293
       ENCODER_DIRECTION_NORMAL();
1294
       if (encoderPosition) {
1294
       if (encoderPosition) {
1373
                                                   // separate value that doesn't lose precision.
1373
                                                   // separate value that doesn't lose precision.
1374
     static int16_t ubl_encoderPosition = 0;
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
       defer_return_to_status = true;
1377
       defer_return_to_status = true;
1378
       if (ubl.encoder_diff) {
1378
       if (ubl.encoder_diff) {
1379
         ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
1379
         ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
1937
       no_reentry = false;
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
       no_reentry = true;
1941
       no_reentry = true;
1942
       enqueue_and_echo_commands_now_P(cmd);
1942
       enqueue_and_echo_commands_now_P(cmd);
1943
       no_reentry = false;
1943
       no_reentry = false;
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
     if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
3034
     if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
3035
     ENCODER_DIRECTION_NORMAL();
3035
     ENCODER_DIRECTION_NORMAL();
3036
     if (encoderPosition && !processing_manual_move) {
3036
     if (encoderPosition && !processing_manual_move) {
4508
     static AdvancedPauseMode _change_filament_temp_mode;
4508
     static AdvancedPauseMode _change_filament_temp_mode;
4509
     static int8_t _change_filament_temp_extruder;
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
       switch (_change_filament_temp_mode) {
4512
       switch (_change_filament_temp_mode) {
4513
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4513
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4514
           return PSTR("M701 T%d");
4514
           return PSTR("M701 T%d");
4531
     void _lcd_change_filament_temp_2_menu() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); }
4531
     void _lcd_change_filament_temp_2_menu() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); }
4532
     void _lcd_change_filament_temp_custom_menu() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); }
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
       switch (mode) {
4535
       switch (mode) {
4536
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4536
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4537
           return PSTR(MSG_FILAMENTLOAD);
4537
           return PSTR(MSG_FILAMENTLOAD);
4779
     static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT;
4779
     static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT;
4780
     static uint8_t hotend_status_extruder = 0;
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
       switch (advanced_pause_mode) {
4783
       switch (advanced_pause_mode) {
4784
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4784
         case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
4785
           return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
4785
           return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
5061
    *   bool _menu_edit_int3();
5061
    *   bool _menu_edit_int3();
5062
    *   void menu_edit_int3(); // edit int16_t (interactively)
5062
    *   void menu_edit_int3(); // edit int16_t (interactively)
5063
    *   void menu_edit_callback_int3(); // edit int16_t (interactively) with callback on completion
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
    * You can then use one of the menu macros to present the edit interface:
5068
    * You can then use one of the menu macros to present the edit interface:
5069
    *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
5069
    *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
5090
       return use_click(); \
5090
       return use_click(); \
5091
     } \
5091
     } \
5092
     void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \
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
       lcd_save_previous_screen(); \
5094
       lcd_save_previous_screen(); \
5095
       lcd_refresh(); \
5095
       lcd_refresh(); \
5096
       \
5096
       \
5100
       maxEditValue = maxValue * _scale - minEditValue; \
5100
       maxEditValue = maxValue * _scale - minEditValue; \
5101
       encoderPosition = (*ptr) * _scale - minEditValue; \
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
       _menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
5104
       _menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
5105
       currentScreen = menu_edit_ ## _name; \
5105
       currentScreen = menu_edit_ ## _name; \
5106
       callbackFunc = callback; \
5106
       callbackFunc = callback; \
5107
       liveEdit = live; \
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
       menu_action_setting_edit_callback_ ## _name(pstr, ptr, minValue, maxValue); \
5110
       menu_action_setting_edit_callback_ ## _name(pstr, ptr, minValue, maxValue); \
5111
     } \
5111
     } \
5112
     typedef void _name##_void
5112
     typedef void _name##_void
5219
    */
5219
    */
5220
   void _menu_action_back() { lcd_goto_previous_menu(); }
5220
   void _menu_action_back() { lcd_goto_previous_menu(); }
5221
   void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); }
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
   void menu_action_function(screenFunc_t func) { (*func)(); }
5223
   void menu_action_function(screenFunc_t func) { (*func)(); }
5224
 
5224
 
5225
   #if ENABLED(SDSUPPORT)
5225
   #if ENABLED(SDSUPPORT)
5246
 
5246
 
5247
   #endif // SDSUPPORT
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
     menu_action_setting_edit_bool(pstr, ptr);
5251
     menu_action_setting_edit_bool(pstr, ptr);
5252
     (*callback)();
5252
     (*callback)();
5253
   }
5253
   }
5694
   lcd_finishstatus(persist);
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
   if (level < 0) level = lcd_status_message_level = 0;
5698
   if (level < 0) level = lcd_status_message_level = 0;
5699
   if (level < lcd_status_message_level) return;
5699
   if (level < lcd_status_message_level) return;
5700
   lcd_status_message_level = level;
5700
   lcd_status_message_level = level;
5704
   // that there is no cutting in the middle of a multibyte character!
5704
   // that there is no cutting in the middle of a multibyte character!
5705
 
5705
 
5706
   // Get a pointer to the null terminator
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
   //  If length of supplied UTF8 string is greater than
5709
   //  If length of supplied UTF8 string is greater than
5710
   // our buffer size, start cutting whole UTF8 chars
5710
   // our buffer size, start cutting whole UTF8 chars
5721
   lcd_finishstatus(level > 0);
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
   if (level < lcd_status_message_level) return;
5725
   if (level < lcd_status_message_level) return;
5726
   lcd_status_message_level = level;
5726
   lcd_status_message_level = level;
5727
   va_list args;
5727
   va_list args;
5731
   lcd_finishstatus(level > 0);
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
   lcd_setstatusPGM(message, 1);
5735
   lcd_setstatusPGM(message, 1);
5736
   #if ENABLED(ULTIPANEL)
5736
   #if ENABLED(ULTIPANEL)
5737
     lcd_return_to_status();
5737
     lcd_return_to_status();

+ 8
- 8
Marlin/src/lcd/ultralcd.h View File

29
   void lcd_init();
29
   void lcd_init();
30
   bool lcd_detected();
30
   bool lcd_detected();
31
   void lcd_update();
31
   void lcd_update();
32
-  void lcd_setalertstatusPGM(const char* message);
32
+  void lcd_setalertstatusPGM(PGM_P message);
33
 #else
33
 #else
34
   inline void lcd_init() {}
34
   inline void lcd_init() {}
35
   inline bool lcd_detected() { return true; }
35
   inline bool lcd_detected() { return true; }
36
   inline void lcd_update() {}
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
 #endif
38
 #endif
39
 
39
 
40
 #if ENABLED(ULTRA_LCD)
40
 #if ENABLED(ULTRA_LCD)
49
   void lcd_return_to_status();
49
   void lcd_return_to_status();
50
   bool lcd_hasstatus();
50
   bool lcd_hasstatus();
51
   void lcd_setstatus(const char* message, const bool persist=false);
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
   void lcd_reset_alert_level();
54
   void lcd_reset_alert_level();
55
   void lcd_reset_status();
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
   void lcd_kill_screen();
57
   void lcd_kill_screen();
58
-  void kill_screen(const char* lcd_msg);
58
+  void kill_screen(PGM_P lcd_msg);
59
 
59
 
60
   extern uint8_t lcdDrawUpdate;
60
   extern uint8_t lcdDrawUpdate;
61
   inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
61
   inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
206
   inline void lcd_refresh() {}
206
   inline void lcd_refresh() {}
207
   inline bool lcd_hasstatus() { return false; }
207
   inline bool lcd_hasstatus() { return false; }
208
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
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
   inline void lcd_reset_alert_level() {}
211
   inline void lcd_reset_alert_level() {}
212
   inline void lcd_reset_status() {}
212
   inline void lcd_reset_status() {}
213
 
213
 

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

408
   }
408
   }
409
 
409
 
410
   // Draw a static line of text in the same idiom as a menu item
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
     if (lcd_implementation_mark_as_selected(row, invert)) {
413
     if (lcd_implementation_mark_as_selected(row, invert)) {
414
 
414
 
428
   }
428
   }
429
 
429
 
430
   // Draw a generic menu item
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
     UNUSED(pre_char);
432
     UNUSED(pre_char);
433
 
433
 
434
     if (lcd_implementation_mark_as_selected(row, isSelected)) {
434
     if (lcd_implementation_mark_as_selected(row, isSelected)) {
449
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
449
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
450
 
450
 
451
   // Draw a menu item with an editable value
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
     if (lcd_implementation_mark_as_selected(row, isSelected)) {
453
     if (lcd_implementation_mark_as_selected(row, isSelected)) {
454
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
454
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
455
       uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
455
       uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
469
   #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _src)
469
   #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _src)
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))
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
     const uint8_t labellen = utf8_strlen_P(pstr),
473
     const uint8_t labellen = utf8_strlen_P(pstr),
474
                   vallen = utf8_strlen(value);
474
                   vallen = utf8_strlen(value);
475
 
475
 
521
 
521
 
522
   #if ENABLED(SDSUPPORT)
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
       UNUSED(pstr);
525
       UNUSED(pstr);
526
 
526
 
527
       lcd_implementation_mark_as_selected(row, isSelected);
527
       lcd_implementation_mark_as_selected(row, isSelected);

+ 11
- 11
Marlin/src/lcd/ultralcd_impl_HD44780.h View File

347
   }
347
   }
348
 
348
 
349
   // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
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
     uint8_t slen = utf8_strlen_P(text);
351
     uint8_t slen = utf8_strlen_P(text);
352
     if (slen < len) {
352
     if (slen < len) {
353
       // Fits into,
353
       // Fits into,
360
       safe_delay(time);
360
       safe_delay(time);
361
     }
361
     }
362
     else {
362
     else {
363
-      const char* p = text;
363
+      PGM_P p = text;
364
       int dly = time / MAX(slen, 1);
364
       int dly = time / MAX(slen, 1);
365
       for (uint8_t i = 0; i <= slen; i++) {
365
       for (uint8_t i = 0; i <= slen; i++) {
366
 
366
 
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
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
391
     int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
392
     lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" ));  lcd_put_wchar('\x01');
392
     lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" ));  lcd_put_wchar('\x01');
393
     lcd_moveto(indent, 1);                        lcd_put_u8str_P(PSTR("|Marlin|"));  lcd_put_u8str_P(extra);
393
     lcd_moveto(indent, 1);                        lcd_put_u8str_P(PSTR("|Marlin|"));  lcd_put_u8str_P(extra);
867
 
867
 
868
   #endif // ADVANCED_PAUSE_FEATURE
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
     UNUSED(invert);
871
     UNUSED(invert);
872
     int8_t n = LCD_WIDTH;
872
     int8_t n = LCD_WIDTH;
873
     lcd_moveto(0, row);
873
     lcd_moveto(0, row);
880
     for (; n > 0; --n) lcd_put_wchar(' ');
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
     uint8_t n = LCD_WIDTH - 2;
884
     uint8_t n = LCD_WIDTH - 2;
885
     lcd_moveto(0, row);
885
     lcd_moveto(0, row);
886
     lcd_put_wchar(sel ? pre_char : ' ');
886
     lcd_put_wchar(sel ? pre_char : ' ');
889
     lcd_put_wchar(post_char);
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
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
893
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
894
     lcd_moveto(0, row);
894
     lcd_moveto(0, row);
895
     lcd_put_wchar(sel ? pre_char : ' ');
895
     lcd_put_wchar(sel ? pre_char : ' ');
898
     while (n--) lcd_put_wchar(' ');
898
     while (n--) lcd_put_wchar(' ');
899
     lcd_put_u8str(data);
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
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
902
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
903
     lcd_moveto(0, row);
903
     lcd_moveto(0, row);
904
     lcd_put_wchar(sel ? pre_char : ' ');
904
     lcd_put_wchar(sel ? pre_char : ' ');
911
   #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _src)
911
   #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _src)
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))
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
     lcd_moveto(1, 1);
915
     lcd_moveto(1, 1);
916
     lcd_put_u8str_P(pstr);
916
     lcd_put_u8str_P(pstr);
917
     if (value != NULL) {
917
     if (value != NULL) {
926
 
926
 
927
   #if ENABLED(SDSUPPORT)
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
       UNUSED(pstr);
930
       UNUSED(pstr);
931
       lcd_moveto(0, row);
931
       lcd_moveto(0, row);
932
       lcd_put_wchar(sel ? '>' : ' ');
932
       lcd_put_wchar(sel ? '>' : ' ');
960
       lcd_put_wchar(post_char);
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
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, ' ');
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
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, LCD_STR_FOLDER[0]);
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 View File

82
   z = _x * matrix.matrix[3 * 0 + 2] + _y * matrix.matrix[3 * 1 + 2] + z * matrix.matrix[3 * 2 + 2];
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
   serialprintPGM(title);
86
   serialprintPGM(title);
87
   SERIAL_PROTOCOLPGM(" x: ");
87
   SERIAL_PROTOCOLPGM(" x: ");
88
   SERIAL_PROTOCOL_F(x, 6);
88
   SERIAL_PROTOCOL_F(x, 6);
143
   return new_matrix;
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
   if (title != NULL) {
147
   if (title != NULL) {
148
     serialprintPGM(title);
148
     serialprintPGM(title);
149
     SERIAL_EOL();
149
     SERIAL_EOL();

+ 2
- 2
Marlin/src/libs/vector_3.h View File

57
   float get_length() const;
57
   float get_length() const;
58
   vector_3 get_normal() const;
58
   vector_3 get_normal() const;
59
 
59
 
60
-  void debug(const char * const title);
60
+  void debug(PGM_P const title);
61
   void apply_rotation(const matrix_3x3 &matrix);
61
   void apply_rotation(const matrix_3x3 &matrix);
62
 };
62
 };
63
 
63
 
70
 
70
 
71
   void set_to_identity();
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 View File

366
   prev_hit_state = hit_state;
366
   prev_hit_state = hit_state;
367
 } // Endstops::report_state
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
   if (label) serialprintPGM(label);
370
   if (label) serialprintPGM(label);
371
   SERIAL_PROTOCOLPGM(": ");
371
   SERIAL_PROTOCOLPGM(": ");
372
   serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));
372
   serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));

+ 1
- 1
Marlin/src/module/probe.cpp View File

435
         BUZZ(100, 659);
435
         BUZZ(100, 659);
436
         BUZZ(100, 698);
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
         lcd_setstatusPGM(ds_str);
439
         lcd_setstatusPGM(ds_str);
440
         serialprintPGM(ds_str);
440
         serialprintPGM(ds_str);
441
         SERIAL_EOL();
441
         SERIAL_EOL();

+ 1
- 1
Marlin/src/module/temperature.cpp View File

582
 //
582
 //
583
 // Temperature Error Handlers
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
   static bool killed = false;
586
   static bool killed = false;
587
   if (IsRunning()) {
587
   if (IsRunning()) {
588
     SERIAL_ERROR_START();
588
     SERIAL_ERROR_START();

+ 1
- 1
Marlin/src/module/temperature.h View File

637
       static float get_pid_output_bed();
637
       static float get_pid_output_bed();
638
     #endif
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
     static void min_temp_error(const int8_t e);
641
     static void min_temp_error(const int8_t e);
642
     static void max_temp_error(const int8_t e);
642
     static void max_temp_error(const int8_t e);
643
 
643
 

+ 1
- 1
Marlin/src/pins/pinsDebug.h View File

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

Loading…
Cancel
Save