瀏覽代碼

🎨 Apply F() to various reports

Scott Lahteine 2 年之前
父節點
當前提交
1dafd1887e

+ 19
- 17
Marlin/src/HAL/shared/Delay.cpp 查看文件

@@ -108,13 +108,14 @@
108 108
 
109 109
   #if ENABLED(MARLIN_DEV_MODE)
110 110
     void dump_delay_accuracy_check() {
111
-      auto report_call_time = [](PGM_P const name, PGM_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) {
111
+      auto report_call_time = [](FSTR_P const name, FSTR_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) {
112 112
         SERIAL_ECHOPGM("Calling ");
113
-        SERIAL_ECHOPGM_P(name);
113
+        SERIAL_ECHOF(name);
114 114
         SERIAL_ECHOLNPGM(" for ", cycles);
115
-        SERIAL_ECHOPGM_P(unit);
115
+        SERIAL_ECHOF(unit);
116 116
         SERIAL_ECHOLNPGM(" took: ", total);
117
-        SERIAL_ECHOPGM_P(unit);
117
+        SERIAL_CHAR(' ');
118
+        SERIAL_ECHOF(unit);
118 119
         if (do_flush) SERIAL_FLUSHTX();
119 120
       };
120 121
 
@@ -126,41 +127,42 @@
126 127
       constexpr uint32_t testValues[] = { 1, 5, 10, 20, 50, 100, 150, 200, 350, 500, 750, 1000 };
127 128
       for (auto i : testValues) {
128 129
         s = micros(); DELAY_US(i); e = micros();
129
-        report_call_time(PSTR("delay"), PSTR("us"), i, e - s);
130
+        report_call_time(F("delay"), F("us"), i, e - s);
130 131
       }
131 132
 
132 133
       if (HW_REG(_DWT_CTRL)) {
134
+        static FSTR_P cyc = F("cycles");
135
+        static FSTR_P dcd = F("DELAY_CYCLES directly ");
136
+
133 137
         for (auto i : testValues) {
134 138
           s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(i); e = HW_REG(_DWT_CYCCNT);
135
-          report_call_time(PSTR("runtime delay"), PSTR("cycles"), i, e - s);
139
+          report_call_time(F("runtime delay"), cyc, i, e - s);
136 140
         }
137 141
 
138 142
         // Measure the delay to call a real function compared to a function pointer
139 143
         s = HW_REG(_DWT_CYCCNT); delay_dwt(1); e = HW_REG(_DWT_CYCCNT);
140
-        report_call_time(PSTR("delay_dwt"), PSTR("cycles"), 1, e - s);
141
-
142
-        static PGMSTR(dcd, "DELAY_CYCLES directly ");
144
+        report_call_time(F("delay_dwt"), cyc, 1, e - s);
143 145
 
144 146
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES( 1); e = HW_REG(_DWT_CYCCNT);
145
-        report_call_time(dcd, PSTR("cycles"),  1, e - s, false);
147
+        report_call_time(dcd, cyc,  1, e - s, false);
146 148
 
147 149
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES( 5); e = HW_REG(_DWT_CYCCNT);
148
-        report_call_time(dcd, PSTR("cycles"),  5, e - s, false);
150
+        report_call_time(dcd, cyc,  5, e - s, false);
149 151
 
150 152
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(10); e = HW_REG(_DWT_CYCCNT);
151
-        report_call_time(dcd, PSTR("cycles"), 10, e - s, false);
153
+        report_call_time(dcd, cyc, 10, e - s, false);
152 154
 
153 155
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(20); e = HW_REG(_DWT_CYCCNT);
154
-        report_call_time(dcd, PSTR("cycles"), 20, e - s, false);
156
+        report_call_time(dcd, cyc, 20, e - s, false);
155 157
 
156 158
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(50); e = HW_REG(_DWT_CYCCNT);
157
-        report_call_time(dcd, PSTR("cycles"), 50, e - s, false);
159
+        report_call_time(dcd, cyc, 50, e - s, false);
158 160
 
159 161
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(100); e = HW_REG(_DWT_CYCCNT);
160
-        report_call_time(dcd, PSTR("cycles"), 100, e - s, false);
162
+        report_call_time(dcd, cyc, 100, e - s, false);
161 163
 
162 164
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(200); e = HW_REG(_DWT_CYCCNT);
163
-        report_call_time(dcd, PSTR("cycles"), 200, e - s, false);
165
+        report_call_time(dcd, cyc, 200, e - s, false);
164 166
       }
165 167
     }
166 168
   #endif // MARLIN_DEV_MODE
@@ -170,7 +172,7 @@
170 172
 
171 173
   void calibrate_delay_loop() {}
172 174
   #if ENABLED(MARLIN_DEV_MODE)
173
-    void dump_delay_accuracy_check() { SERIAL_ECHOPGM_P(PSTR("N/A on this platform")); }
175
+    void dump_delay_accuracy_check() { SERIAL_ECHOPGM("N/A on this platform"); }
174 176
   #endif
175 177
 
176 178
 #endif

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

@@ -1609,7 +1609,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1609 1609
     }
1610 1610
 
1611 1611
     if (DEBUGGING(LEVELING)) {
1612
-      rotation.debug(PSTR("rotation matrix:\n"));
1612
+      rotation.debug(F("rotation matrix:\n"));
1613 1613
       DEBUG_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7);
1614 1614
       DEBUG_ECHOPAIR_F("  B=", lsf_results.B, 7);
1615 1615
       DEBUG_ECHOLNPAIR_F("  D=", lsf_results.D, 7);
@@ -1636,14 +1636,14 @@ void unified_bed_leveling::smart_fill_mesh() {
1636 1636
         auto normed = [&](const xy_pos_t &pos, const_float_t zadd) {
1637 1637
           return normal.x * pos.x + normal.y * pos.y + zadd;
1638 1638
         };
1639
-        auto debug_pt = [](PGM_P const pre, const xy_pos_t &pos, const_float_t zadd) {
1640
-          d_from(); SERIAL_ECHOPGM_P(pre);
1639
+        auto debug_pt = [](FSTR_P const pre, const xy_pos_t &pos, const_float_t zadd) {
1640
+          d_from(); SERIAL_ECHOF(pre);
1641 1641
           DEBUG_ECHO_F(normed(pos, zadd), 6);
1642 1642
           DEBUG_ECHOLNPAIR_F("   Z error = ", zadd - get_z_correction(pos), 6);
1643 1643
         };
1644
-        debug_pt(PSTR("1st point: "), probe_pt[0], normal.z * z1);
1645
-        debug_pt(PSTR("2nd point: "), probe_pt[1], normal.z * z2);
1646
-        debug_pt(PSTR("3rd point: "), probe_pt[2], normal.z * z3);
1644
+        debug_pt(F("1st point: "), probe_pt[0], normal.z * z1);
1645
+        debug_pt(F("2nd point: "), probe_pt[1], normal.z * z2);
1646
+        debug_pt(F("3rd point: "), probe_pt[2], normal.z * z3);
1647 1647
         d_from(); DEBUG_ECHOPGM("safe home with Z=");
1648 1648
         DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_homing_xy, 0), 6);
1649 1649
         d_from(); DEBUG_ECHOPGM("safe home with Z=");

+ 20
- 21
Marlin/src/feature/max7219.cpp 查看文件

@@ -124,11 +124,10 @@ uint8_t Max7219::suspended; // = 0;
124 124
   #define SIG_DELAY() DELAY_NS(250)
125 125
 #endif
126 126
 
127
-void Max7219::error(const char * const func, const int32_t v1, const int32_t v2/*=-1*/) {
127
+void Max7219::error(FSTR_P const func, const int32_t v1, const int32_t v2/*=-1*/) {
128 128
   #if ENABLED(MAX7219_ERRORS)
129 129
     SERIAL_ECHOPGM("??? Max7219::");
130
-    SERIAL_ECHOPGM_P(func);
131
-    SERIAL_CHAR('(');
130
+    SERIAL_ECHOF(func, AS_CHAR('('));
132 131
     SERIAL_ECHO(v1);
133 132
     if (v2 > 0) SERIAL_ECHOPGM(", ", v2);
134 133
     SERIAL_CHAR(')');
@@ -268,24 +267,24 @@ void Max7219::set(const uint8_t line, const uint8_t bits) {
268 267
 
269 268
 // Modify a single LED bit and send the changed line
270 269
 void Max7219::led_set(const uint8_t x, const uint8_t y, const bool on) {
271
-  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(PSTR("led_set"), x, y);
270
+  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_set"), x, y);
272 271
   if (BIT_7219(x, y) == on) return;
273 272
   XOR_7219(x, y);
274 273
   refresh_unit_line(LED_IND(x, y));
275 274
 }
276 275
 
277 276
 void Max7219::led_on(const uint8_t x, const uint8_t y) {
278
-  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(PSTR("led_on"), x, y);
277
+  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_on"), x, y);
279 278
   led_set(x, y, true);
280 279
 }
281 280
 
282 281
 void Max7219::led_off(const uint8_t x, const uint8_t y) {
283
-  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(PSTR("led_off"), x, y);
282
+  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_off"), x, y);
284 283
   led_set(x, y, false);
285 284
 }
286 285
 
287 286
 void Max7219::led_toggle(const uint8_t x, const uint8_t y) {
288
-  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(PSTR("led_toggle"), x, y);
287
+  if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_toggle"), x, y);
289 288
   led_set(x, y, !BIT_7219(x, y));
290 289
 }
291 290
 
@@ -328,13 +327,13 @@ void Max7219::fill() {
328 327
 }
329 328
 
330 329
 void Max7219::clear_row(const uint8_t row) {
331
-  if (row >= MAX7219_Y_LEDS) return error(PSTR("clear_row"), row);
330
+  if (row >= MAX7219_Y_LEDS) return error(F("clear_row"), row);
332 331
   LOOP_L_N(x, MAX7219_X_LEDS) CLR_7219(x, row);
333 332
   send_row(row);
334 333
 }
335 334
 
336 335
 void Max7219::clear_column(const uint8_t col) {
337
-  if (col >= MAX7219_X_LEDS) return error(PSTR("set_column"), col);
336
+  if (col >= MAX7219_X_LEDS) return error(F("set_column"), col);
338 337
   LOOP_L_N(y, MAX7219_Y_LEDS) CLR_7219(col, y);
339 338
   send_column(col);
340 339
 }
@@ -345,7 +344,7 @@ void Max7219::clear_column(const uint8_t col) {
345 344
  * once with a single call to the function (if rotated 90° or 270°).
346 345
  */
347 346
 void Max7219::set_row(const uint8_t row, const uint32_t val) {
348
-  if (row >= MAX7219_Y_LEDS) return error(PSTR("set_row"), row);
347
+  if (row >= MAX7219_Y_LEDS) return error(F("set_row"), row);
349 348
   uint32_t mask = _BV32(MAX7219_X_LEDS - 1);
350 349
   LOOP_L_N(x, MAX7219_X_LEDS) {
351 350
     if (val & mask) SET_7219(x, row); else CLR_7219(x, row);
@@ -360,7 +359,7 @@ void Max7219::set_row(const uint8_t row, const uint32_t val) {
360 359
  * once with a single call to the function (if rotated 0° or 180°).
361 360
  */
362 361
 void Max7219::set_column(const uint8_t col, const uint32_t val) {
363
-  if (col >= MAX7219_X_LEDS) return error(PSTR("set_column"), col);
362
+  if (col >= MAX7219_X_LEDS) return error(F("set_column"), col);
364 363
   uint32_t mask = _BV32(MAX7219_Y_LEDS - 1);
365 364
   LOOP_L_N(y, MAX7219_Y_LEDS) {
366 365
     if (val & mask) SET_7219(col, y); else CLR_7219(col, y);
@@ -371,56 +370,56 @@ void Max7219::set_column(const uint8_t col, const uint32_t val) {
371 370
 
372 371
 void Max7219::set_rows_16bits(const uint8_t y, uint32_t val) {
373 372
   #if MAX7219_X_LEDS == 8
374
-    if (y > MAX7219_Y_LEDS - 2) return error(PSTR("set_rows_16bits"), y, val);
373
+    if (y > MAX7219_Y_LEDS - 2) return error(F("set_rows_16bits"), y, val);
375 374
     set_row(y + 1, val); val >>= 8;
376 375
     set_row(y + 0, val);
377 376
   #else // at least 16 bits on each row
378
-    if (y > MAX7219_Y_LEDS - 1) return error(PSTR("set_rows_16bits"), y, val);
377
+    if (y > MAX7219_Y_LEDS - 1) return error(F("set_rows_16bits"), y, val);
379 378
     set_row(y, val);
380 379
   #endif
381 380
 }
382 381
 
383 382
 void Max7219::set_rows_32bits(const uint8_t y, uint32_t val) {
384 383
   #if MAX7219_X_LEDS == 8
385
-    if (y > MAX7219_Y_LEDS - 4) return error(PSTR("set_rows_32bits"), y, val);
384
+    if (y > MAX7219_Y_LEDS - 4) return error(F("set_rows_32bits"), y, val);
386 385
     set_row(y + 3, val); val >>= 8;
387 386
     set_row(y + 2, val); val >>= 8;
388 387
     set_row(y + 1, val); val >>= 8;
389 388
     set_row(y + 0, val);
390 389
   #elif MAX7219_X_LEDS == 16
391
-    if (y > MAX7219_Y_LEDS - 2) return error(PSTR("set_rows_32bits"), y, val);
390
+    if (y > MAX7219_Y_LEDS - 2) return error(F("set_rows_32bits"), y, val);
392 391
     set_row(y + 1, val); val >>= 16;
393 392
     set_row(y + 0, val);
394 393
   #else // at least 24 bits on each row.  In the 3 matrix case, just display the low 24 bits
395
-    if (y > MAX7219_Y_LEDS - 1) return error(PSTR("set_rows_32bits"), y, val);
394
+    if (y > MAX7219_Y_LEDS - 1) return error(F("set_rows_32bits"), y, val);
396 395
     set_row(y, val);
397 396
   #endif
398 397
 }
399 398
 
400 399
 void Max7219::set_columns_16bits(const uint8_t x, uint32_t val) {
401 400
   #if MAX7219_Y_LEDS == 8
402
-    if (x > MAX7219_X_LEDS - 2) return error(PSTR("set_columns_16bits"), x, val);
401
+    if (x > MAX7219_X_LEDS - 2) return error(F("set_columns_16bits"), x, val);
403 402
     set_column(x + 0, val); val >>= 8;
404 403
     set_column(x + 1, val);
405 404
   #else // at least 16 bits in each column
406
-    if (x > MAX7219_X_LEDS - 1) return error(PSTR("set_columns_16bits"), x, val);
405
+    if (x > MAX7219_X_LEDS - 1) return error(F("set_columns_16bits"), x, val);
407 406
     set_column(x, val);
408 407
   #endif
409 408
 }
410 409
 
411 410
 void Max7219::set_columns_32bits(const uint8_t x, uint32_t val) {
412 411
   #if MAX7219_Y_LEDS == 8
413
-    if (x > MAX7219_X_LEDS - 4) return error(PSTR("set_rows_32bits"), x, val);
412
+    if (x > MAX7219_X_LEDS - 4) return error(F("set_rows_32bits"), x, val);
414 413
     set_column(x + 3, val); val >>= 8;
415 414
     set_column(x + 2, val); val >>= 8;
416 415
     set_column(x + 1, val); val >>= 8;
417 416
     set_column(x + 0, val);
418 417
   #elif MAX7219_Y_LEDS == 16
419
-    if (x > MAX7219_X_LEDS - 2) return error(PSTR("set_rows_32bits"), x, val);
418
+    if (x > MAX7219_X_LEDS - 2) return error(F("set_rows_32bits"), x, val);
420 419
     set_column(x + 1, val); val >>= 16;
421 420
     set_column(x + 0, val);
422 421
   #else // at least 24 bits on each row.  In the 3 matrix case, just display the low 24 bits
423
-    if (x > MAX7219_X_LEDS - 1) return error(PSTR("set_rows_32bits"), x, val);
422
+    if (x > MAX7219_X_LEDS - 1) return error(F("set_rows_32bits"), x, val);
424 423
     set_column(x, val);
425 424
   #endif
426 425
 }

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

@@ -42,6 +42,8 @@
42 42
  * a Max7219_Set_Row().    The opposite is true for rotations of 0 or 180 degrees.
43 43
  */
44 44
 
45
+#include "../inc/MarlinConfig.h"
46
+
45 47
 #ifndef MAX7219_ROTATE
46 48
   #define MAX7219_ROTATE 0
47 49
 #endif
@@ -140,7 +142,7 @@ public:
140 142
 
141 143
 private:
142 144
   static uint8_t suspended;
143
-  static void error(const char * const func, const int32_t v1, const int32_t v2=-1);
145
+  static void error(FSTR_P const func, const int32_t v1, const int32_t v2=-1);
144 146
   static void noop();
145 147
   static void set(const uint8_t line, const uint8_t bits);
146 148
   static void send_row(const uint8_t row);

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

@@ -130,7 +130,7 @@ void PrintJobRecovery::load() {
130 130
     (void)file.read(&info, sizeof(info));
131 131
     close();
132 132
   }
133
-  debug(PSTR("Load"));
133
+  debug(F("Load"));
134 134
 }
135 135
 
136 136
 /**
@@ -311,7 +311,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
311 311
  */
312 312
 void PrintJobRecovery::write() {
313 313
 
314
-  debug(PSTR("Write"));
314
+  debug(F("Write"));
315 315
 
316 316
   open(false);
317 317
   file.seekSet(0);
@@ -575,8 +575,8 @@ void PrintJobRecovery::resume() {
575 575
 
576 576
 #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
577 577
 
578
-  void PrintJobRecovery::debug(PGM_P const prefix) {
579
-    DEBUG_ECHOPGM_P(prefix);
578
+  void PrintJobRecovery::debug(FSTR_P const prefix) {
579
+    DEBUG_ECHOF(prefix);
580 580
     DEBUG_ECHOLNPGM(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot);
581 581
     if (info.valid_head) {
582 582
       if (info.valid_head == info.valid_foot) {

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

@@ -204,9 +204,9 @@ class PrintJobRecovery {
204 204
     static inline bool valid() { return info.valid() && interrupted_file_exists(); }
205 205
 
206 206
     #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
207
-      static void debug(PGM_P const prefix);
207
+      static void debug(FSTR_P const prefix);
208 208
     #else
209
-      static inline void debug(PGM_P const) {}
209
+      static inline void debug(FSTR_P const) {}
210 210
     #endif
211 211
 
212 212
   private:

+ 6
- 6
Marlin/src/feature/stepper_driver_safety.cpp 查看文件

@@ -28,11 +28,11 @@
28 28
 
29 29
 static uint32_t axis_plug_backward = 0;
30 30
 
31
-void stepper_driver_backward_error(PGM_P str) {
31
+void stepper_driver_backward_error(FSTR_P const fstr) {
32 32
   SERIAL_ERROR_START();
33
-  SERIAL_ECHOPGM_P(str);
33
+  SERIAL_ECHOF(fstr);
34 34
   SERIAL_ECHOLNPGM(" driver is backward!");
35
-  ui.status_printf(2, F(S_FMT S_FMT), str, GET_TEXT(MSG_DRIVER_BACKWARD));
35
+  ui.status_printf(2, F(S_FMT S_FMT), FTOP(fstr), GET_TEXT(MSG_DRIVER_BACKWARD));
36 36
 }
37 37
 
38 38
 void stepper_driver_backward_check() {
@@ -45,7 +45,7 @@ void stepper_driver_backward_check() {
45 45
       delay(20); \
46 46
       if (READ(AXIS##_ENABLE_PIN) == false) { \
47 47
         SBI(axis_plug_backward, BIT); \
48
-        stepper_driver_backward_error(PSTR(STRINGIFY(AXIS))); \
48
+        stepper_driver_backward_error(F(STRINGIFY(AXIS))); \
49 49
       } \
50 50
     }while(0)
51 51
 
@@ -82,12 +82,12 @@ void stepper_driver_backward_check() {
82 82
 void stepper_driver_backward_report() {
83 83
   if (!axis_plug_backward) return;
84 84
 
85
-  auto _report_if_backward = [](PGM_P axis, uint8_t bit) {
85
+  auto _report_if_backward = [](FSTR_P const axis, uint8_t bit) {
86 86
     if (TEST(axis_plug_backward, bit))
87 87
       stepper_driver_backward_error(axis);
88 88
   };
89 89
 
90
-  #define REPORT_BACKWARD(axis, bit) TERN_(HAS_##axis##_ENABLE, _report_if_backward(PSTR(STRINGIFY(axis)), bit))
90
+  #define REPORT_BACKWARD(axis, bit) TERN_(HAS_##axis##_ENABLE, _report_if_backward(F(STRINGIFY(axis)), bit))
91 91
 
92 92
   REPORT_BACKWARD(X,   0);
93 93
   REPORT_BACKWARD(X2,  1);

+ 22
- 24
Marlin/src/feature/twibus.cpp 查看文件

@@ -51,27 +51,27 @@ void TWIBus::address(const uint8_t adr) {
51 51
 
52 52
   addr = adr;
53 53
 
54
-  debug(PSTR("address"), adr);
54
+  debug(F("address"), adr);
55 55
 }
56 56
 
57 57
 void TWIBus::addbyte(const char c) {
58 58
   if (buffer_s >= COUNT(buffer)) return;
59 59
   buffer[buffer_s++] = c;
60
-  debug(PSTR("addbyte"), c);
60
+  debug(F("addbyte"), c);
61 61
 }
62 62
 
63 63
 void TWIBus::addbytes(char src[], uint8_t bytes) {
64
-  debug(PSTR("addbytes"), bytes);
64
+  debug(F("addbytes"), bytes);
65 65
   while (bytes--) addbyte(*src++);
66 66
 }
67 67
 
68 68
 void TWIBus::addstring(char str[]) {
69
-  debug(PSTR("addstring"), str);
69
+  debug(F("addstring"), str);
70 70
   while (char c = *str++) addbyte(c);
71 71
 }
72 72
 
73 73
 void TWIBus::send() {
74
-  debug(PSTR("send"), addr);
74
+  debug(F("send"), addr);
75 75
 
76 76
   Wire.beginTransmission(I2C_ADDRESS(addr));
77 77
   Wire.write(buffer, buffer_s);
@@ -81,20 +81,20 @@ void TWIBus::send() {
81 81
 }
82 82
 
83 83
 // static
84
-void TWIBus::echoprefix(uint8_t bytes, const char pref[], uint8_t adr) {
84
+void TWIBus::echoprefix(uint8_t bytes, FSTR_P const pref, uint8_t adr) {
85 85
   SERIAL_ECHO_START();
86
-  SERIAL_ECHOPGM_P(pref);
86
+  SERIAL_ECHOF(pref);
87 87
   SERIAL_ECHOPGM(": from:", adr, " bytes:", bytes, " data:");
88 88
 }
89 89
 
90 90
 // static
91
-void TWIBus::echodata(uint8_t bytes, const char pref[], uint8_t adr) {
91
+void TWIBus::echodata(uint8_t bytes, FSTR_P const pref, uint8_t adr) {
92 92
   echoprefix(bytes, pref, adr);
93 93
   while (bytes-- && Wire.available()) SERIAL_CHAR(Wire.read());
94 94
   SERIAL_EOL();
95 95
 }
96 96
 
97
-void TWIBus::echobuffer(const char pref[], uint8_t adr) {
97
+void TWIBus::echobuffer(FSTR_P const pref, uint8_t adr) {
98 98
   echoprefix(buffer_s, pref, adr);
99 99
   LOOP_L_N(i, buffer_s) SERIAL_CHAR(buffer[i]);
100 100
   SERIAL_EOL();
@@ -103,11 +103,11 @@ void TWIBus::echobuffer(const char pref[], uint8_t adr) {
103 103
 bool TWIBus::request(const uint8_t bytes) {
104 104
   if (!addr) return false;
105 105
 
106
-  debug(PSTR("request"), bytes);
106
+  debug(F("request"), bytes);
107 107
 
108 108
   // requestFrom() is a blocking function
109 109
   if (Wire.requestFrom(I2C_ADDRESS(addr), bytes) == 0) {
110
-    debug("request fail", I2C_ADDRESS(addr));
110
+    debug(F("request fail"), I2C_ADDRESS(addr));
111 111
     return false;
112 112
   }
113 113
 
@@ -115,10 +115,10 @@ bool TWIBus::request(const uint8_t bytes) {
115 115
 }
116 116
 
117 117
 void TWIBus::relay(const uint8_t bytes) {
118
-  debug(PSTR("relay"), bytes);
118
+  debug(F("relay"), bytes);
119 119
 
120 120
   if (request(bytes))
121
-    echodata(bytes, PSTR("i2c-reply"), addr);
121
+    echodata(bytes, F("i2c-reply"), addr);
122 122
 }
123 123
 
124 124
 uint8_t TWIBus::capture(char *dst, const uint8_t bytes) {
@@ -127,7 +127,7 @@ uint8_t TWIBus::capture(char *dst, const uint8_t bytes) {
127 127
   while (count < bytes && Wire.available())
128 128
     dst[count++] = Wire.read();
129 129
 
130
-  debug(PSTR("capture"), count);
130
+  debug(F("capture"), count);
131 131
 
132 132
   return count;
133 133
 }
@@ -140,12 +140,12 @@ void TWIBus::flush() {
140 140
 #if I2C_SLAVE_ADDRESS > 0
141 141
 
142 142
   void TWIBus::receive(uint8_t bytes) {
143
-    debug(PSTR("receive"), bytes);
144
-    echodata(bytes, PSTR("i2c-receive"), 0);
143
+    debug(F("receive"), bytes);
144
+    echodata(bytes, F("i2c-receive"), 0);
145 145
   }
146 146
 
147 147
   void TWIBus::reply(char str[]/*=nullptr*/) {
148
-    debug(PSTR("reply"), str);
148
+    debug(F("reply"), str);
149 149
 
150 150
     if (str) {
151 151
       reset();
@@ -170,18 +170,16 @@ void TWIBus::flush() {
170 170
 #if ENABLED(DEBUG_TWIBUS)
171 171
 
172 172
   // static
173
-  void TWIBus::prefix(const char func[]) {
174
-    SERIAL_ECHOPGM("TWIBus::");
175
-    SERIAL_ECHOPGM_P(func);
176
-    SERIAL_ECHOPGM(": ");
173
+  void TWIBus::prefix(FSTR_P const func) {
174
+    SERIAL_ECHOPGM("TWIBus::", func, ": ");
177 175
   }
178
-  void TWIBus::debug(const char func[], uint32_t adr) {
176
+  void TWIBus::debug(FSTR_P const func, uint32_t adr) {
179 177
     if (DEBUGGING(INFO)) { prefix(func); SERIAL_ECHOLN(adr); }
180 178
   }
181
-  void TWIBus::debug(const char func[], char c) {
179
+  void TWIBus::debug(FSTR_P const func, char c) {
182 180
     if (DEBUGGING(INFO)) { prefix(func); SERIAL_ECHOLN(c); }
183 181
   }
184
-  void TWIBus::debug(const char func[], char str[]) {
182
+  void TWIBus::debug(FSTR_P const func, char str[]) {
185 183
     if (DEBUGGING(INFO)) { prefix(func); SERIAL_ECHOLN(str); }
186 184
   }
187 185
 

+ 11
- 12
Marlin/src/feature/twibus.h 查看文件

@@ -142,7 +142,7 @@ class TWIBus {
142 142
      *
143 143
      * @param bytes the number of bytes to request
144 144
      */
145
-    static void echoprefix(uint8_t bytes, const char prefix[], uint8_t adr);
145
+    static void echoprefix(uint8_t bytes, FSTR_P prefix, uint8_t adr);
146 146
 
147 147
     /**
148 148
      * @brief Echo data on the bus to serial
@@ -151,7 +151,7 @@ class TWIBus {
151 151
      *
152 152
      * @param bytes the number of bytes to request
153 153
      */
154
-    static void echodata(uint8_t bytes, const char prefix[], uint8_t adr);
154
+    static void echodata(uint8_t bytes, FSTR_P prefix, uint8_t adr);
155 155
 
156 156
     /**
157 157
      * @brief Echo data in the buffer to serial
@@ -160,7 +160,7 @@ class TWIBus {
160 160
      *
161 161
      * @param bytes the number of bytes to request
162 162
      */
163
-    void echobuffer(const char prefix[], uint8_t adr);
163
+    void echobuffer(FSTR_P prefix, uint8_t adr);
164 164
 
165 165
     /**
166 166
      * @brief Request data from the slave device and wait.
@@ -237,17 +237,16 @@ class TWIBus {
237 237
        * @brief Prints a debug message
238 238
        * @details Prints a simple debug message "TWIBus::function: value"
239 239
        */
240
-      static void prefix(const char func[]);
241
-      static void debug(const char func[], uint32_t adr);
242
-      static void debug(const char func[], char c);
243
-      static void debug(const char func[], char adr[]);
244
-      static inline void debug(const char func[], uint8_t v) { debug(func, (uint32_t)v); }
240
+      static void prefix(FSTR_P const func);
241
+      static void debug(FSTR_P const func, uint32_t adr);
242
+      static void debug(FSTR_P const func, char c);
243
+      static void debug(FSTR_P const func, char adr[]);
245 244
     #else
246
-      static inline void debug(const char[], uint32_t) {}
247
-      static inline void debug(const char[], char) {}
248
-      static inline void debug(const char[], char[]) {}
249
-      static inline void debug(const char[], uint8_t) {}
245
+      static inline void debug(FSTR_P const, uint32_t) {}
246
+      static inline void debug(FSTR_P const, char) {}
247
+      static inline void debug(FSTR_P const, char[]) {}
250 248
     #endif
249
+    static inline void debug(FSTR_P const func, uint8_t v) { debug(func, (uint32_t)v); }
251 250
 };
252 251
 
253 252
 extern TWIBus i2c;

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

@@ -195,7 +195,7 @@ void GcodeSuite::M420() {
195 195
   // V to print the matrix or mesh
196 196
   if (seenV) {
197 197
     #if ABL_PLANAR
198
-      planner.bed_level_matrix.debug(PSTR("Bed Level Correction Matrix:"));
198
+      planner.bed_level_matrix.debug(F("Bed Level Correction Matrix:"));
199 199
     #else
200 200
       if (leveling_is_valid()) {
201 201
         #if ENABLED(AUTO_BED_LEVELING_BILINEAR)

+ 15
- 15
Marlin/src/gcode/bedlevel/abl/G29.cpp 查看文件

@@ -783,8 +783,8 @@ G29_TYPE GcodeSuite::G29() {
783 783
 
784 784
         float min_diff = 999;
785 785
 
786
-        auto print_topo_map = [&](PGM_P const title, const bool get_min) {
787
-          SERIAL_ECHOPGM_P(title);
786
+        auto print_topo_map = [&](FSTR_P const title, const bool get_min) {
787
+          SERIAL_ECHOF(title);
788 788
           for (int8_t yy = abl.grid_points.y - 1; yy >= 0; yy--) {
789 789
             LOOP_L_N(xx, abl.grid_points.x) {
790 790
               const int ind = abl.indexIntoAB[xx][yy];
@@ -802,19 +802,19 @@ G29_TYPE GcodeSuite::G29() {
802 802
           SERIAL_EOL();
803 803
         };
804 804
 
805
-        print_topo_map(PSTR("\nBed Height Topography:\n"
806
-                               "   +--- BACK --+\n"
807
-                               "   |           |\n"
808
-                               " L |    (+)    | R\n"
809
-                               " E |           | I\n"
810
-                               " F | (-) N (+) | G\n"
811
-                               " T |           | H\n"
812
-                               "   |    (-)    | T\n"
813
-                               "   |           |\n"
814
-                               "   O-- FRONT --+\n"
815
-                               " (0,0)\n"), true);
805
+        print_topo_map(F("\nBed Height Topography:\n"
806
+                           "   +--- BACK --+\n"
807
+                           "   |           |\n"
808
+                           " L |    (+)    | R\n"
809
+                           " E |           | I\n"
810
+                           " F | (-) N (+) | G\n"
811
+                           " T |           | H\n"
812
+                           "   |    (-)    | T\n"
813
+                           "   |           |\n"
814
+                           "   O-- FRONT --+\n"
815
+                           " (0,0)\n"), true);
816 816
         if (abl.verbose_level > 3)
817
-          print_topo_map(PSTR("\nCorrected Bed Height vs. Bed Topology:\n"), false);
817
+          print_topo_map(F("\nCorrected Bed Height vs. Bed Topology:\n"), false);
818 818
 
819 819
       } // abl.topography_map
820 820
 
@@ -825,7 +825,7 @@ G29_TYPE GcodeSuite::G29() {
825 825
       // For LINEAR and 3POINT leveling correct the current position
826 826
 
827 827
       if (abl.verbose_level > 0)
828
-        planner.bed_level_matrix.debug(PSTR("\n\nBed Level Correction Matrix:"));
828
+        planner.bed_level_matrix.debug(F("\n\nBed Level Correction Matrix:"));
829 829
 
830 830
       if (!abl.dryrun) {
831 831
         //

+ 7
- 7
Marlin/src/gcode/calibrate/G28.cpp 查看文件

@@ -269,33 +269,33 @@ void GcodeSuite::G28() {
269 269
   #endif
270 270
 
271 271
   #if HAS_HOMING_CURRENT
272
-    auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b) {
273
-      DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b);
272
+    auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) {
273
+      DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b);
274 274
     };
275 275
     #if HAS_CURRENT_HOME(X)
276 276
       const int16_t tmc_save_current_X = stepperX.getMilliamps();
277 277
       stepperX.rms_current(X_CURRENT_HOME);
278
-      if (DEBUGGING(LEVELING)) debug_current(PSTR("X"), tmc_save_current_X, X_CURRENT_HOME);
278
+      if (DEBUGGING(LEVELING)) debug_current(F("X"), tmc_save_current_X, X_CURRENT_HOME);
279 279
     #endif
280 280
     #if HAS_CURRENT_HOME(X2)
281 281
       const int16_t tmc_save_current_X2 = stepperX2.getMilliamps();
282 282
       stepperX2.rms_current(X2_CURRENT_HOME);
283
-      if (DEBUGGING(LEVELING)) debug_current(PSTR("X2"), tmc_save_current_X2, X2_CURRENT_HOME);
283
+      if (DEBUGGING(LEVELING)) debug_current(F("X2"), tmc_save_current_X2, X2_CURRENT_HOME);
284 284
     #endif
285 285
     #if HAS_CURRENT_HOME(Y)
286 286
       const int16_t tmc_save_current_Y = stepperY.getMilliamps();
287 287
       stepperY.rms_current(Y_CURRENT_HOME);
288
-      if (DEBUGGING(LEVELING)) debug_current(PSTR("Y"), tmc_save_current_Y, Y_CURRENT_HOME);
288
+      if (DEBUGGING(LEVELING)) debug_current(F("Y"), tmc_save_current_Y, Y_CURRENT_HOME);
289 289
     #endif
290 290
     #if HAS_CURRENT_HOME(Y2)
291 291
       const int16_t tmc_save_current_Y2 = stepperY2.getMilliamps();
292 292
       stepperY2.rms_current(Y2_CURRENT_HOME);
293
-      if (DEBUGGING(LEVELING)) debug_current(PSTR("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME);
293
+      if (DEBUGGING(LEVELING)) debug_current(F("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME);
294 294
     #endif
295 295
     #if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
296 296
       const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
297 297
       stepperZ.rms_current(Z_CURRENT_HOME);
298
-      if (DEBUGGING(LEVELING)) debug_current(PSTR("Z"), tmc_save_current_Z, Z_CURRENT_HOME);
298
+      if (DEBUGGING(LEVELING)) debug_current(F("Z"), tmc_save_current_Z, Z_CURRENT_HOME);
299 299
     #endif
300 300
   #endif
301 301
 

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

@@ -97,10 +97,9 @@ void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) {
97 97
   TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, true));
98 98
 }
99 99
 
100
-void print_signed_float(PGM_P const prefix, const_float_t f) {
100
+void print_signed_float(FSTR_P const prefix, const_float_t f) {
101 101
   SERIAL_ECHOPGM("  ");
102
-  SERIAL_ECHOPGM_P(prefix);
103
-  SERIAL_CHAR(':');
102
+  SERIAL_ECHOF(prefix, AS_CHAR(':'));
104 103
   if (f >= 0) SERIAL_CHAR('+');
105 104
   SERIAL_ECHO_F(f, 2);
106 105
 }
@@ -111,24 +110,23 @@ void print_signed_float(PGM_P const prefix, const_float_t f) {
111 110
 static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
112 111
   SERIAL_ECHOPGM(".Height:", delta_height);
113 112
   if (end_stops) {
114
-    print_signed_float(PSTR("Ex"), delta_endstop_adj.a);
115
-    print_signed_float(PSTR("Ey"), delta_endstop_adj.b);
116
-    print_signed_float(PSTR("Ez"), delta_endstop_adj.c);
113
+    print_signed_float(F("Ex"), delta_endstop_adj.a);
114
+    print_signed_float(F("Ey"), delta_endstop_adj.b);
115
+    print_signed_float(F("Ez"), delta_endstop_adj.c);
117 116
   }
118 117
   if (end_stops && tower_angles) {
119
-    SERIAL_ECHOPGM("  Radius:", delta_radius);
120
-    SERIAL_EOL();
118
+    SERIAL_ECHOLNPGM("  Radius:", delta_radius);
121 119
     SERIAL_CHAR('.');
122 120
     SERIAL_ECHO_SP(13);
123 121
   }
124 122
   if (tower_angles) {
125
-    print_signed_float(PSTR("Tx"), delta_tower_angle_trim.a);
126
-    print_signed_float(PSTR("Ty"), delta_tower_angle_trim.b);
127
-    print_signed_float(PSTR("Tz"), delta_tower_angle_trim.c);
123
+    print_signed_float(F("Tx"), delta_tower_angle_trim.a);
124
+    print_signed_float(F("Ty"), delta_tower_angle_trim.b);
125
+    print_signed_float(F("Tz"), delta_tower_angle_trim.c);
128 126
   }
129
-  if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
127
+  if (end_stops != tower_angles)
130 128
     SERIAL_ECHOPGM("  Radius:", delta_radius);
131
-  }
129
+
132 130
   SERIAL_EOL();
133 131
 }
134 132
 
@@ -137,11 +135,11 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an
137 135
  */
138 136
 static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
139 137
   SERIAL_ECHOPGM(".    ");
140
-  print_signed_float(PSTR("c"), z_pt[CEN]);
138
+  print_signed_float(F("c"), z_pt[CEN]);
141 139
   if (tower_points) {
142
-    print_signed_float(PSTR(" x"), z_pt[__A]);
143
-    print_signed_float(PSTR(" y"), z_pt[__B]);
144
-    print_signed_float(PSTR(" z"), z_pt[__C]);
140
+    print_signed_float(F(" x"), z_pt[__A]);
141
+    print_signed_float(F(" y"), z_pt[__B]);
142
+    print_signed_float(F(" z"), z_pt[__C]);
145 143
   }
146 144
   if (tower_points && opposite_points) {
147 145
     SERIAL_EOL();
@@ -149,9 +147,9 @@ static void print_calibration_results(const float z_pt[NPP + 1], const bool towe
149 147
     SERIAL_ECHO_SP(13);
150 148
   }
151 149
   if (opposite_points) {
152
-    print_signed_float(PSTR("yz"), z_pt[_BC]);
153
-    print_signed_float(PSTR("zx"), z_pt[_CA]);
154
-    print_signed_float(PSTR("xy"), z_pt[_AB]);
150
+    print_signed_float(F("yz"), z_pt[_BC]);
151
+    print_signed_float(F("zx"), z_pt[_CA]);
152
+    print_signed_float(F("xy"), z_pt[_AB]);
155 153
   }
156 154
   SERIAL_EOL();
157 155
 }
@@ -653,13 +651,13 @@ void GcodeSuite::G33() {
653 651
       }
654 652
     }
655 653
     else { // dry run
656
-      PGM_P const enddryrun = PSTR("End DRY-RUN");
657
-      SERIAL_ECHOPGM_P(enddryrun);
654
+      FSTR_P const enddryrun = F("End DRY-RUN");
655
+      SERIAL_ECHOF(enddryrun);
658 656
       SERIAL_ECHO_SP(35);
659 657
       SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
660 658
 
661 659
       char mess[21];
662
-      strcpy_P(mess, enddryrun);
660
+      strcpy_P(mess, FTOP(enddryrun));
663 661
       strcpy_P(&mess[11], PSTR(" sd:"));
664 662
       if (zero_std_dev < 1)
665 663
         sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0f));

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

@@ -51,7 +51,7 @@
51 51
  * Also, there are two support functions that can be called from a developer's C code.
52 52
  *
53 53
  *    uint16_t check_for_free_memory_corruption(PGM_P const free_memory_start);
54
- *    void M100_dump_routine(PGM_P const title, const char * const start, const uintptr_t size);
54
+ *    void M100_dump_routine(FSTR_P const title, const char * const start, const uintptr_t size);
55 55
  *
56 56
  * Initial version by Roxy-3D
57 57
  */
@@ -182,8 +182,8 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
182 182
     }
183 183
   }
184 184
 
185
-  void M100_dump_routine(PGM_P const title, const char * const start, const uintptr_t size) {
186
-    SERIAL_ECHOLNPGM_P(title);
185
+  void M100_dump_routine(FSTR_P const title, const char * const start, const uintptr_t size) {
186
+    SERIAL_ECHOLNF(title);
187 187
     //
188 188
     // Round the start and end locations to produce full lines of output
189 189
     //
@@ -196,8 +196,8 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
196 196
 
197 197
 #endif // M100_FREE_MEMORY_DUMPER
198 198
 
199
-inline int check_for_free_memory_corruption(PGM_P const title) {
200
-  SERIAL_ECHOPGM_P(title);
199
+inline int check_for_free_memory_corruption(FSTR_P const title) {
200
+  SERIAL_ECHOF(title);
201 201
 
202 202
   char *start_free_memory = free_memory_start, *end_free_memory = free_memory_end;
203 203
   int n = end_free_memory - start_free_memory;
@@ -217,7 +217,7 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
217 217
     //  idle();
218 218
     serial_delay(20);
219 219
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
220
-      M100_dump_routine(PSTR("   Memory corruption detected with end_free_memory<Heap\n"), (const char*)0x1B80, 0x0680);
220
+      M100_dump_routine(F("   Memory corruption detected with end_free_memory<Heap\n"), (const char*)0x1B80, 0x0680);
221 221
     #endif
222 222
   }
223 223
 
@@ -281,7 +281,7 @@ inline void free_memory_pool_report(char * const start_free_memory, const int32_
281 281
     "\nMemory Corruption detected in free memory area."
282 282
     "\nLargest free block is ", max_cnt, " bytes at ", hex_address(max_addr)
283 283
   );
284
-  SERIAL_ECHOLNPGM("check_for_free_memory_corruption() = ", check_for_free_memory_corruption(PSTR("M100 F ")));
284
+  SERIAL_ECHOLNPGM("check_for_free_memory_corruption() = ", check_for_free_memory_corruption(F("M100 F ")));
285 285
 }
286 286
 
287 287
 #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)

+ 3
- 3
Marlin/src/gcode/config/M43.cpp 查看文件

@@ -65,12 +65,12 @@ inline void toggle_pins() {
65 65
     pin_t pin = GET_PIN_MAP_PIN_M43(i);
66 66
     if (!VALID_PIN(pin)) continue;
67 67
     if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) {
68
-      report_pin_state_extended(pin, ignore_protection, true, PSTR("Untouched "));
68
+      report_pin_state_extended(pin, ignore_protection, true, F("Untouched "));
69 69
       SERIAL_EOL();
70 70
     }
71 71
     else {
72 72
       watchdog_refresh();
73
-      report_pin_state_extended(pin, ignore_protection, true, PSTR("Pulsing   "));
73
+      report_pin_state_extended(pin, ignore_protection, true, F("Pulsing   "));
74 74
       #ifdef __STM32F1__
75 75
         const auto prior_mode = _GET_MODE(i);
76 76
       #else
@@ -303,7 +303,7 @@ void GcodeSuite::M43() {
303 303
   if (parser.seen('E')) {
304 304
     endstops.monitor_flag = parser.value_bool();
305 305
     SERIAL_ECHOPGM("endstop monitor ");
306
-    SERIAL_ECHOPGM_P(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
306
+    SERIAL_ECHOF(endstops.monitor_flag ? F("en") : F("dis"));
307 307
     SERIAL_ECHOLNPGM("abled");
308 308
     return;
309 309
   }

+ 5
- 5
Marlin/src/gcode/feature/network/M552-M554.cpp 查看文件

@@ -57,14 +57,14 @@ void MAC_report() {
57 57
 
58 58
 // Display current values when the link is active,
59 59
 // otherwise show the stored values
60
-void ip_report(const uint16_t cmd, PGM_P const post, const IPAddress &ipo) {
60
+void ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo) {
61 61
   SERIAL_CHAR('M'); SERIAL_ECHO(cmd); SERIAL_CHAR(' ');
62 62
   LOOP_L_N(i, 4) {
63 63
     SERIAL_ECHO(ipo[i]);
64 64
     if (i < 3) SERIAL_CHAR('.');
65 65
   }
66 66
   SERIAL_ECHOPGM(" ; ");
67
-  SERIAL_ECHOLNPGM_P(post);
67
+  SERIAL_ECHOLNF(post);
68 68
 }
69 69
 
70 70
 /**
@@ -98,7 +98,7 @@ void GcodeSuite::M552() {
98 98
 }
99 99
 
100 100
 void GcodeSuite::M552_report() {
101
-  ip_report(552, PSTR("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip);
101
+  ip_report(552, F("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip);
102 102
 }
103 103
 
104 104
 /**
@@ -112,7 +112,7 @@ void GcodeSuite::M553() {
112 112
 }
113 113
 
114 114
 void GcodeSuite::M553_report() {
115
-  ip_report(553, PSTR("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet);
115
+  ip_report(553, F("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet);
116 116
 }
117 117
 
118 118
 /**
@@ -126,7 +126,7 @@ void GcodeSuite::M554() {
126 126
 }
127 127
 
128 128
 void GcodeSuite::M554_report() {
129
-  ip_report(554, PSTR("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway);
129
+  ip_report(554, F("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway);
130 130
 }
131 131
 
132 132
 #endif // HAS_ETHERNET

+ 3
- 3
Marlin/src/gcode/feature/powerloss/M1000.cpp 查看文件

@@ -44,10 +44,10 @@
44 44
 
45 45
 void menu_job_recovery();
46 46
 
47
-inline void plr_error(PGM_P const prefix) {
47
+inline void plr_error(FSTR_P const prefix) {
48 48
   #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
49 49
     DEBUG_ECHO_START();
50
-    DEBUG_ECHOPGM_P(prefix);
50
+    DEBUG_ECHOF(prefix);
51 51
     DEBUG_ECHOLNPGM(" Job Recovery Data");
52 52
   #else
53 53
     UNUSED(prefix);
@@ -91,7 +91,7 @@ void GcodeSuite::M1000() {
91 91
       recovery.resume();
92 92
   }
93 93
   else
94
-    plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
94
+    plr_error(recovery.info.valid_head ? F("No") : F("Invalid"));
95 95
 
96 96
 }
97 97
 

+ 1
- 1
Marlin/src/gcode/feature/powerloss/M413.cpp 查看文件

@@ -47,7 +47,7 @@ void GcodeSuite::M413() {
47 47
     if (parser.seen("RL")) recovery.load();
48 48
     if (parser.seen_test('W')) recovery.save(true);
49 49
     if (parser.seen_test('P')) recovery.purge();
50
-    if (parser.seen_test('D')) recovery.debug(PSTR("M413"));
50
+    if (parser.seen_test('D')) recovery.debug(F("M413"));
51 51
     #if PIN_EXISTS(POWER_LOSS)
52 52
       if (parser.seen_test('O')) recovery._outage();
53 53
     #endif

+ 18
- 18
Marlin/src/gcode/feature/trinamic/M569.cpp 查看文件

@@ -141,12 +141,12 @@ void GcodeSuite::M569() {
141 141
 void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
142 142
   report_heading(forReplay, F(STR_DRIVER_STEPPING_MODE));
143 143
 
144
-  auto say_M569 = [](const bool forReplay, const char * const etc=nullptr, const bool eol=false) {
144
+  auto say_M569 = [](const bool forReplay, FSTR_P const etc=nullptr, const bool eol=false) {
145 145
     if (!forReplay) SERIAL_ECHO_START();
146 146
     SERIAL_ECHOPGM("  M569 S1");
147 147
     if (etc) {
148 148
       SERIAL_CHAR(' ');
149
-      SERIAL_ECHOPGM_P(etc);
149
+      SERIAL_ECHOF(etc);
150 150
     }
151 151
     if (eol) SERIAL_EOL();
152 152
   };
@@ -176,28 +176,28 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
176 176
              chop_z2 = TERN0(Z2_HAS_STEALTHCHOP, stepperZ2.get_stored_stealthChop());
177 177
 
178 178
   if (chop_x2 || chop_y2 || chop_z2) {
179
-    say_M569(forReplay, PSTR("I1"));
179
+    say_M569(forReplay, F("I1"));
180 180
     if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR);
181 181
     if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR);
182 182
     if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR);
183 183
     SERIAL_EOL();
184 184
   }
185 185
 
186
-  if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, PSTR("I2 Z"), true); }
187
-  if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, PSTR("I3 Z"), true); }
188
-
189
-  if (TERN0( I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop()))  { say_M569(forReplay, SP_I_STR, true); }
190
-  if (TERN0( J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop()))  { say_M569(forReplay, SP_J_STR, true); }
191
-  if (TERN0( K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop()))  { say_M569(forReplay, SP_K_STR, true); }
192
-
193
-  if (TERN0(E0_HAS_STEALTHCHOP, stepperE0.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T0 E"), true); }
194
-  if (TERN0(E1_HAS_STEALTHCHOP, stepperE1.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T1 E"), true); }
195
-  if (TERN0(E2_HAS_STEALTHCHOP, stepperE2.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T2 E"), true); }
196
-  if (TERN0(E3_HAS_STEALTHCHOP, stepperE3.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T3 E"), true); }
197
-  if (TERN0(E4_HAS_STEALTHCHOP, stepperE4.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T4 E"), true); }
198
-  if (TERN0(E5_HAS_STEALTHCHOP, stepperE5.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T5 E"), true); }
199
-  if (TERN0(E6_HAS_STEALTHCHOP, stepperE6.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T6 E"), true); }
200
-  if (TERN0(E7_HAS_STEALTHCHOP, stepperE7.get_stored_stealthChop())) { say_M569(forReplay, PSTR("T7 E"), true); }
186
+  if (TERN0(Z3_HAS_STEALTHCHOP, stepperZ3.get_stored_stealthChop())) { say_M569(forReplay, F("I2 Z"), true); }
187
+  if (TERN0(Z4_HAS_STEALTHCHOP, stepperZ4.get_stored_stealthChop())) { say_M569(forReplay, F("I3 Z"), true); }
188
+
189
+  if (TERN0( I_HAS_STEALTHCHOP, stepperI.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_I_STR), true); }
190
+  if (TERN0( J_HAS_STEALTHCHOP, stepperJ.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_J_STR), true); }
191
+  if (TERN0( K_HAS_STEALTHCHOP, stepperK.get_stored_stealthChop()))  { say_M569(forReplay, FPSTR(SP_K_STR), true); }
192
+
193
+  if (TERN0(E0_HAS_STEALTHCHOP, stepperE0.get_stored_stealthChop())) { say_M569(forReplay, F("T0 E"), true); }
194
+  if (TERN0(E1_HAS_STEALTHCHOP, stepperE1.get_stored_stealthChop())) { say_M569(forReplay, F("T1 E"), true); }
195
+  if (TERN0(E2_HAS_STEALTHCHOP, stepperE2.get_stored_stealthChop())) { say_M569(forReplay, F("T2 E"), true); }
196
+  if (TERN0(E3_HAS_STEALTHCHOP, stepperE3.get_stored_stealthChop())) { say_M569(forReplay, F("T3 E"), true); }
197
+  if (TERN0(E4_HAS_STEALTHCHOP, stepperE4.get_stored_stealthChop())) { say_M569(forReplay, F("T4 E"), true); }
198
+  if (TERN0(E5_HAS_STEALTHCHOP, stepperE5.get_stored_stealthChop())) { say_M569(forReplay, F("T5 E"), true); }
199
+  if (TERN0(E6_HAS_STEALTHCHOP, stepperE6.get_stored_stealthChop())) { say_M569(forReplay, F("T6 E"), true); }
200
+  if (TERN0(E7_HAS_STEALTHCHOP, stepperE7.get_stored_stealthChop())) { say_M569(forReplay, F("T7 E"), true); }
201 201
 }
202 202
 
203 203
 #endif // HAS_STEALTHCHOP

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

@@ -1067,7 +1067,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
1067 1067
 }
1068 1068
 
1069 1069
 #if ENABLED(M100_FREE_MEMORY_DUMPER)
1070
-  void M100_dump_routine(PGM_P const title, const char * const start, const uintptr_t size);
1070
+  void M100_dump_routine(FSTR_P const title, const char * const start, const uintptr_t size);
1071 1071
 #endif
1072 1072
 
1073 1073
 /**
@@ -1086,7 +1086,7 @@ void GcodeSuite::process_next_command() {
1086 1086
     SERIAL_ECHOLN(command.buffer);
1087 1087
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
1088 1088
       SERIAL_ECHOPGM("slot:", queue.ring_buffer.index_r);
1089
-      M100_dump_routine(PSTR("   Command Queue:"), (const char*)&queue.ring_buffer, sizeof(queue.ring_buffer));
1089
+      M100_dump_routine(F("   Command Queue:"), (const char*)&queue.ring_buffer, sizeof(queue.ring_buffer));
1090 1090
     #endif
1091 1091
   }
1092 1092
 

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

@@ -34,9 +34,9 @@
34 34
 #endif
35 35
 
36 36
 #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
37
-  static void cap_line(PGM_P const name, bool ena=false) {
37
+  static void cap_line(FSTR_P const name, bool ena=false) {
38 38
     SERIAL_ECHOPGM("Cap:");
39
-    SERIAL_ECHOPGM_P(name);
39
+    SERIAL_ECHOF(name);
40 40
     SERIAL_CHAR(':', '0' + ena);
41 41
     SERIAL_EOL();
42 42
   }
@@ -68,101 +68,101 @@ void GcodeSuite::M115() {
68 68
     serial_index_t port = queue.ring_buffer.command_port();
69 69
 
70 70
     // PAREN_COMMENTS
71
-    TERN_(PAREN_COMMENTS, cap_line(PSTR("PAREN_COMMENTS"), true));
71
+    TERN_(PAREN_COMMENTS, cap_line(F("PAREN_COMMENTS"), true));
72 72
 
73 73
     // QUOTED_STRINGS
74
-    TERN_(GCODE_QUOTED_STRINGS, cap_line(PSTR("QUOTED_STRINGS"), true));
74
+    TERN_(GCODE_QUOTED_STRINGS, cap_line(F("QUOTED_STRINGS"), true));
75 75
 
76 76
     // SERIAL_XON_XOFF
77
-    cap_line(PSTR("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
77
+    cap_line(F("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
78 78
 
79 79
     // BINARY_FILE_TRANSFER (M28 B1)
80
-    cap_line(PSTR("BINARY_FILE_TRANSFER"), ENABLED(BINARY_FILE_TRANSFER)); // TODO: Use SERIAL_IMPL.has_feature(port, SerialFeature::BinaryFileTransfer) once implemented
80
+    cap_line(F("BINARY_FILE_TRANSFER"), ENABLED(BINARY_FILE_TRANSFER)); // TODO: Use SERIAL_IMPL.has_feature(port, SerialFeature::BinaryFileTransfer) once implemented
81 81
 
82 82
     // EEPROM (M500, M501)
83
-    cap_line(PSTR("EEPROM"), ENABLED(EEPROM_SETTINGS));
83
+    cap_line(F("EEPROM"), ENABLED(EEPROM_SETTINGS));
84 84
 
85 85
     // Volumetric Extrusion (M200)
86
-    cap_line(PSTR("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
86
+    cap_line(F("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
87 87
 
88 88
     // AUTOREPORT_POS (M154)
89
-    cap_line(PSTR("AUTOREPORT_POS"), ENABLED(AUTO_REPORT_POSITION));
89
+    cap_line(F("AUTOREPORT_POS"), ENABLED(AUTO_REPORT_POSITION));
90 90
 
91 91
     // AUTOREPORT_TEMP (M155)
92
-    cap_line(PSTR("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
92
+    cap_line(F("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
93 93
 
94 94
     // PROGRESS (M530 S L, M531 <file>, M532 X L)
95
-    cap_line(PSTR("PROGRESS"));
95
+    cap_line(F("PROGRESS"));
96 96
 
97 97
     // Print Job timer M75, M76, M77
98
-    cap_line(PSTR("PRINT_JOB"), true);
98
+    cap_line(F("PRINT_JOB"), true);
99 99
 
100 100
     // AUTOLEVEL (G29)
101
-    cap_line(PSTR("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
101
+    cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
102 102
 
103 103
     // RUNOUT (M412, M600)
104
-    cap_line(PSTR("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
104
+    cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
105 105
 
106 106
     // Z_PROBE (G30)
107
-    cap_line(PSTR("Z_PROBE"), ENABLED(HAS_BED_PROBE));
107
+    cap_line(F("Z_PROBE"), ENABLED(HAS_BED_PROBE));
108 108
 
109 109
     // MESH_REPORT (M420 V)
110
-    cap_line(PSTR("LEVELING_DATA"), ENABLED(HAS_LEVELING));
110
+    cap_line(F("LEVELING_DATA"), ENABLED(HAS_LEVELING));
111 111
 
112 112
     // BUILD_PERCENT (M73)
113
-    cap_line(PSTR("BUILD_PERCENT"), ENABLED(LCD_SET_PROGRESS_MANUALLY));
113
+    cap_line(F("BUILD_PERCENT"), ENABLED(LCD_SET_PROGRESS_MANUALLY));
114 114
 
115 115
     // SOFTWARE_POWER (M80, M81)
116
-    cap_line(PSTR("SOFTWARE_POWER"), ENABLED(PSU_CONTROL));
116
+    cap_line(F("SOFTWARE_POWER"), ENABLED(PSU_CONTROL));
117 117
 
118 118
     // TOGGLE_LIGHTS (M355)
119
-    cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(CASE_LIGHT_ENABLE));
120
-    cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(CASE_LIGHT_ENABLE, caselight.has_brightness()));
119
+    cap_line(F("TOGGLE_LIGHTS"), ENABLED(CASE_LIGHT_ENABLE));
120
+    cap_line(F("CASE_LIGHT_BRIGHTNESS"), TERN0(CASE_LIGHT_ENABLE, caselight.has_brightness()));
121 121
 
122 122
     // EMERGENCY_PARSER (M108, M112, M410, M876)
123
-    cap_line(PSTR("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
123
+    cap_line(F("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
124 124
 
125 125
     // HOST ACTION COMMANDS (paused, resume, resumed, cancel, etc.)
126
-    cap_line(PSTR("HOST_ACTION_COMMANDS"), ENABLED(HOST_ACTION_COMMANDS));
126
+    cap_line(F("HOST_ACTION_COMMANDS"), ENABLED(HOST_ACTION_COMMANDS));
127 127
 
128 128
     // PROMPT SUPPORT (M876)
129
-    cap_line(PSTR("PROMPT_SUPPORT"), ENABLED(HOST_PROMPT_SUPPORT));
129
+    cap_line(F("PROMPT_SUPPORT"), ENABLED(HOST_PROMPT_SUPPORT));
130 130
 
131 131
     // SDCARD (M20, M23, M24, etc.)
132
-    cap_line(PSTR("SDCARD"), ENABLED(SDSUPPORT));
132
+    cap_line(F("SDCARD"), ENABLED(SDSUPPORT));
133 133
 
134 134
     // REPEAT (M808)
135
-    cap_line(PSTR("REPEAT"), ENABLED(GCODE_REPEAT_MARKERS));
135
+    cap_line(F("REPEAT"), ENABLED(GCODE_REPEAT_MARKERS));
136 136
 
137 137
     // SD_WRITE (M928, M28, M29)
138
-    cap_line(PSTR("SD_WRITE"), ENABLED(SDSUPPORT) && DISABLED(SDCARD_READONLY));
138
+    cap_line(F("SD_WRITE"), ENABLED(SDSUPPORT) && DISABLED(SDCARD_READONLY));
139 139
 
140 140
     // AUTOREPORT_SD_STATUS (M27 extension)
141
-    cap_line(PSTR("AUTOREPORT_SD_STATUS"), ENABLED(AUTO_REPORT_SD_STATUS));
141
+    cap_line(F("AUTOREPORT_SD_STATUS"), ENABLED(AUTO_REPORT_SD_STATUS));
142 142
 
143 143
     // LONG_FILENAME_HOST_SUPPORT (M33)
144
-    cap_line(PSTR("LONG_FILENAME"), ENABLED(LONG_FILENAME_HOST_SUPPORT));
144
+    cap_line(F("LONG_FILENAME"), ENABLED(LONG_FILENAME_HOST_SUPPORT));
145 145
 
146 146
     // THERMAL_PROTECTION
147
-    cap_line(PSTR("THERMAL_PROTECTION"), ENABLED(THERMALLY_SAFE));
147
+    cap_line(F("THERMAL_PROTECTION"), ENABLED(THERMALLY_SAFE));
148 148
 
149 149
     // MOTION_MODES (M80-M89)
150
-    cap_line(PSTR("MOTION_MODES"), ENABLED(GCODE_MOTION_MODES));
150
+    cap_line(F("MOTION_MODES"), ENABLED(GCODE_MOTION_MODES));
151 151
 
152 152
     // ARC_SUPPORT (G2-G3)
153
-    cap_line(PSTR("ARCS"), ENABLED(ARC_SUPPORT));
153
+    cap_line(F("ARCS"), ENABLED(ARC_SUPPORT));
154 154
 
155 155
     // BABYSTEPPING (M290)
156
-    cap_line(PSTR("BABYSTEPPING"), ENABLED(BABYSTEPPING));
156
+    cap_line(F("BABYSTEPPING"), ENABLED(BABYSTEPPING));
157 157
 
158 158
     // CHAMBER_TEMPERATURE (M141, M191)
159
-    cap_line(PSTR("CHAMBER_TEMPERATURE"), ENABLED(HAS_HEATED_CHAMBER));
159
+    cap_line(F("CHAMBER_TEMPERATURE"), ENABLED(HAS_HEATED_CHAMBER));
160 160
 
161 161
     // COOLER_TEMPERATURE (M143, M193)
162
-    cap_line(PSTR("COOLER_TEMPERATURE"), ENABLED(HAS_COOLER));
162
+    cap_line(F("COOLER_TEMPERATURE"), ENABLED(HAS_COOLER));
163 163
 
164 164
     // MEATPACK Compression
165
-    cap_line(PSTR("MEATPACK"), SERIAL_IMPL.has_feature(port, SerialFeature::MeatPack));
165
+    cap_line(F("MEATPACK"), SERIAL_IMPL.has_feature(port, SerialFeature::MeatPack));
166 166
 
167 167
     // Machine Geometry
168 168
     #if ENABLED(M115_GEOMETRY_REPORT)

+ 34
- 28
Marlin/src/gcode/host/M360.cpp 查看文件

@@ -43,9 +43,15 @@ static void config_line(PGM_P const name, const float val, PGM_P const pref=null
43 43
   config_prefix(name, pref, ind);
44 44
   SERIAL_ECHOLN(val);
45 45
 }
46
+static void config_line(FSTR_P const name, const float val, FSTR_P const pref=nullptr, const int8_t ind=-1) {
47
+  config_line(FTOP(name), val, FTOP(pref) , ind);
48
+}
46 49
 static void config_line_e(const int8_t e, PGM_P const name, const float val) {
47 50
   config_line(name, val, PSTR("Extr."), e + 1);
48 51
 }
52
+static void config_line_e(const int8_t e, FSTR_P const name, const float val) {
53
+  config_line_e(e, FTOP(name), val);
54
+}
49 55
 
50 56
 /**
51 57
  * M360: Report Firmware configuration
@@ -60,19 +66,19 @@ void GcodeSuite::M360() {
60 66
   //
61 67
   // Basics and Enabled items
62 68
   //
63
-  config_line(PSTR("Baudrate"),                   BAUDRATE);
64
-  config_line(PSTR("InputBuffer"),                MAX_CMD_SIZE);
65
-  config_line(PSTR("PrintlineCache"),             BUFSIZE);
66
-  config_line(PSTR("MixingExtruder"),             ENABLED(MIXING_EXTRUDER));
67
-  config_line(PSTR("SDCard"),                     ENABLED(SDSUPPORT));
68
-  config_line(PSTR("Fan"),                        ENABLED(HAS_FAN));
69
-  config_line(PSTR("LCD"),                        ENABLED(HAS_DISPLAY));
70
-  config_line(PSTR("SoftwarePowerSwitch"), 1);
71
-  config_line(PSTR("SupportLocalFilamentchange"), ENABLED(ADVANCED_PAUSE_FEATURE));
72
-  config_line(PSTR("CaseLights"),                 ENABLED(CASE_LIGHT_ENABLE));
73
-  config_line(PSTR("ZProbe"),                     ENABLED(HAS_BED_PROBE));
74
-  config_line(PSTR("Autolevel"),                  ENABLED(HAS_LEVELING));
75
-  config_line(PSTR("EEPROM"),                     ENABLED(EEPROM_SETTINGS));
69
+  config_line(F("Baudrate"),                    BAUDRATE);
70
+  config_line(F("InputBuffer"),                 MAX_CMD_SIZE);
71
+  config_line(F("PrintlineCache"),              BUFSIZE);
72
+  config_line(F("MixingExtruder"),              ENABLED(MIXING_EXTRUDER));
73
+  config_line(F("SDCard"),                      ENABLED(SDSUPPORT));
74
+  config_line(F("Fan"),                         ENABLED(HAS_FAN));
75
+  config_line(F("LCD"),                         ENABLED(HAS_DISPLAY));
76
+  config_line(F("SoftwarePowerSwitch"),         1);
77
+  config_line(F("SupportLocalFilamentchange"),  ENABLED(ADVANCED_PAUSE_FEATURE));
78
+  config_line(F("CaseLights"),                  ENABLED(CASE_LIGHT_ENABLE));
79
+  config_line(F("ZProbe"),                      ENABLED(HAS_BED_PROBE));
80
+  config_line(F("Autolevel"),                   ENABLED(HAS_LEVELING));
81
+  config_line(F("EEPROM"),                      ENABLED(EEPROM_SETTINGS));
76 82
 
77 83
   //
78 84
   // Homing Directions
@@ -87,7 +93,7 @@ void GcodeSuite::M360() {
87 93
   //
88 94
   #if HAS_CLASSIC_JERK
89 95
     if (planner.max_jerk.x == planner.max_jerk.y)
90
-      config_line(PSTR("XY"), planner.max_jerk.x, JERK_STR);
96
+      config_line(F("XY"), planner.max_jerk.x, JERK_STR);
91 97
     else {
92 98
       config_line(X_STR, planner.max_jerk.x, JERK_STR);
93 99
       config_line(Y_STR, planner.max_jerk.y, JERK_STR);
@@ -98,21 +104,21 @@ void GcodeSuite::M360() {
98 104
   //
99 105
   // Firmware Retraction
100 106
   //
101
-  config_line(PSTR("SupportG10G11"), ENABLED(FWRETRACT));
107
+  config_line(F("SupportG10G11"), ENABLED(FWRETRACT));
102 108
   #if ENABLED(FWRETRACT)
103 109
     PGMSTR(RET_STR, "Retraction");
104 110
     PGMSTR(UNRET_STR, "RetractionUndo");
105 111
     PGMSTR(SPEED_STR, "Speed");
106 112
     // M10 Retract with swap (long) moves
107
-    config_line(PSTR("Length"),     fwretract.settings.retract_length, RET_STR);
113
+    config_line(F("Length"),     fwretract.settings.retract_length, RET_STR);
108 114
     config_line(SPEED_STR,          fwretract.settings.retract_feedrate_mm_s, RET_STR);
109
-    config_line(PSTR("ZLift"),      fwretract.settings.retract_zraise, RET_STR);
110
-    config_line(PSTR("LongLength"), fwretract.settings.swap_retract_length, RET_STR);
115
+    config_line(F("ZLift"),      fwretract.settings.retract_zraise, RET_STR);
116
+    config_line(F("LongLength"), fwretract.settings.swap_retract_length, RET_STR);
111 117
     // M11 Recover (undo) with swap (long) moves
112 118
     config_line(SPEED_STR,               fwretract.settings.retract_recover_feedrate_mm_s, UNRET_STR);
113
-    config_line(PSTR("ExtraLength"),     fwretract.settings.retract_recover_extra, UNRET_STR);
114
-    config_line(PSTR("ExtraLongLength"), fwretract.settings.swap_retract_recover_extra, UNRET_STR);
115
-    config_line(PSTR("LongSpeed"),       fwretract.settings.swap_retract_recover_feedrate_mm_s, UNRET_STR);
119
+    config_line(F("ExtraLength"),     fwretract.settings.retract_recover_extra, UNRET_STR);
120
+    config_line(F("ExtraLongLength"), fwretract.settings.swap_retract_recover_extra, UNRET_STR);
121
+    config_line(F("LongSpeed"),       fwretract.settings.swap_retract_recover_feedrate_mm_s, UNRET_STR);
116 122
   #endif
117 123
 
118 124
   //
@@ -163,22 +169,22 @@ void GcodeSuite::M360() {
163 169
   //
164 170
   // Heated Bed
165 171
   //
166
-  config_line(PSTR("HeatedBed"), ENABLED(HAS_HEATED_BED));
172
+  config_line(F("HeatedBed"), ENABLED(HAS_HEATED_BED));
167 173
   #if HAS_HEATED_BED
168
-    config_line(PSTR("MaxBedTemp"), BED_MAX_TARGET);
174
+    config_line(F("MaxBedTemp"), BED_MAX_TARGET);
169 175
   #endif
170 176
 
171 177
   //
172 178
   // Per-Extruder settings
173 179
   //
174
-  config_line(PSTR("NumExtruder"), EXTRUDERS);
180
+  config_line(F("NumExtruder"), EXTRUDERS);
175 181
   #if HAS_EXTRUDERS
176 182
     LOOP_L_N(e, EXTRUDERS) {
177 183
       config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK)));
178
-      config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
179
-      config_line_e(e, PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
180
-      config_line_e(e, PSTR("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
181
-      config_line_e(e, PSTR("MaxTemp"), thermalManager.hotend_maxtemp[e]);
184
+      config_line_e(e, F("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
185
+      config_line_e(e, F("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
186
+      config_line_e(e, F("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
187
+      config_line_e(e, F("MaxTemp"), thermalManager.hotend_maxtemp[e]);
182 188
     }
183 189
   #endif
184 190
 }

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

@@ -302,10 +302,10 @@ static bool serial_data_available(serial_index_t index) {
302 302
 
303 303
 inline int read_serial(const serial_index_t index) { return SERIAL_IMPL.read(index); }
304 304
 
305
-void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) {
305
+void GCodeQueue::gcode_line_error(FSTR_P const ferr, const serial_index_t serial_ind) {
306 306
   PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
307 307
   SERIAL_ERROR_START();
308
-  SERIAL_ECHOLNPGM_P(err, serial_state[serial_ind.index].last_N);
308
+  SERIAL_ECHOLNF(ferr, serial_state[serial_ind.index].last_N);
309 309
   while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
310 310
   flush_and_request_resend(serial_ind);
311 311
   serial_state[serial_ind.index].count = 0;
@@ -470,7 +470,7 @@ void GCodeQueue::get_serial_commands() {
470 470
 
471 471
           if (gcode_N != serial.last_N + 1 && !M110) {
472 472
             // In case of error on a serial port, don't prevent other serial port from making progress
473
-            gcode_line_error(PSTR(STR_ERR_LINE_NO), p);
473
+            gcode_line_error(F(STR_ERR_LINE_NO), p);
474 474
             break;
475 475
           }
476 476
 
@@ -480,13 +480,13 @@ void GCodeQueue::get_serial_commands() {
480 480
             while (count) checksum ^= command[--count];
481 481
             if (strtol(apos + 1, nullptr, 10) != checksum) {
482 482
               // In case of error on a serial port, don't prevent other serial port from making progress
483
-              gcode_line_error(PSTR(STR_ERR_CHECKSUM_MISMATCH), p);
483
+              gcode_line_error(F(STR_ERR_CHECKSUM_MISMATCH), p);
484 484
               break;
485 485
             }
486 486
           }
487 487
           else {
488 488
             // In case of error on a serial port, don't prevent other serial port from making progress
489
-            gcode_line_error(PSTR(STR_ERR_NO_CHECKSUM), p);
489
+            gcode_line_error(F(STR_ERR_NO_CHECKSUM), p);
490 490
             break;
491 491
           }
492 492
 
@@ -495,7 +495,7 @@ void GCodeQueue::get_serial_commands() {
495 495
         #if ENABLED(SDSUPPORT)
496 496
           // Pronterface "M29" and "M29 " has no line number
497 497
           else if (card.flag.saving && !is_M29(command)) {
498
-            gcode_line_error(PSTR(STR_ERR_NO_CHECKSUM), p);
498
+            gcode_line_error(F(STR_ERR_NO_CHECKSUM), p);
499 499
             break;
500 500
           }
501 501
         #endif

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

@@ -259,7 +259,7 @@ private:
259 259
    */
260 260
   static bool enqueue_one(const char *cmd);
261 261
 
262
-  static void gcode_line_error(PGM_P const err, const serial_index_t serial_ind);
262
+  static void gcode_line_error(FSTR_P const ferr, const serial_index_t serial_ind);
263 263
 
264 264
   friend class GcodeSuite;
265 265
 };

+ 7
- 11
Marlin/src/libs/stopwatch.cpp 查看文件

@@ -34,7 +34,7 @@ millis_t Stopwatch::startTimestamp;
34 34
 millis_t Stopwatch::stopTimestamp;
35 35
 
36 36
 bool Stopwatch::stop() {
37
-  Stopwatch::debug(PSTR("stop"));
37
+  debug(F("stop"));
38 38
 
39 39
   if (isRunning() || isPaused()) {
40 40
     TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
@@ -46,7 +46,7 @@ bool Stopwatch::stop() {
46 46
 }
47 47
 
48 48
 bool Stopwatch::pause() {
49
-  Stopwatch::debug(PSTR("pause"));
49
+  debug(F("pause"));
50 50
 
51 51
   if (isRunning()) {
52 52
     TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
@@ -58,7 +58,7 @@ bool Stopwatch::pause() {
58 58
 }
59 59
 
60 60
 bool Stopwatch::start() {
61
-  Stopwatch::debug(PSTR("start"));
61
+  debug(F("start"));
62 62
 
63 63
   TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
64 64
 
@@ -74,14 +74,14 @@ bool Stopwatch::start() {
74 74
 }
75 75
 
76 76
 void Stopwatch::resume(const millis_t with_time) {
77
-  Stopwatch::debug(PSTR("resume"));
77
+  debug(F("resume"));
78 78
 
79 79
   reset();
80 80
   if ((accumulator = with_time)) state = RUNNING;
81 81
 }
82 82
 
83 83
 void Stopwatch::reset() {
84
-  Stopwatch::debug(PSTR("reset"));
84
+  debug(F("reset"));
85 85
 
86 86
   state = STOPPED;
87 87
   startTimestamp = 0;
@@ -95,12 +95,8 @@ millis_t Stopwatch::duration() {
95 95
 
96 96
 #if ENABLED(DEBUG_STOPWATCH)
97 97
 
98
-  void Stopwatch::debug(const char func[]) {
99
-    if (DEBUGGING(INFO)) {
100
-      SERIAL_ECHOPGM("Stopwatch::");
101
-      SERIAL_ECHOPGM_P(func);
102
-      SERIAL_ECHOLNPGM("()");
103
-    }
98
+  void Stopwatch::debug(FSTR_P const func) {
99
+    if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::", func, "()");
104 100
   }
105 101
 
106 102
 #endif

+ 4
- 7
Marlin/src/libs/stopwatch.h 查看文件

@@ -21,14 +21,11 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
+#include "../inc/MarlinConfig.h"
25
+
24 26
 // Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
25 27
 //#define DEBUG_STOPWATCH
26 28
 
27
-#include "../core/macros.h" // for FORCE_INLINE
28
-
29
-#include <stdint.h>
30
-typedef uint32_t millis_t;
31
-
32 29
 /**
33 30
  * @brief Stopwatch class
34 31
  * @details This class acts as a timer proving stopwatch functionality including
@@ -113,11 +110,11 @@ class Stopwatch {
113 110
        * @brief Print a debug message
114 111
        * @details Print a simple debug message "Stopwatch::function"
115 112
        */
116
-      static void debug(const char func[]);
113
+      static void debug(FSTR_P const);
117 114
 
118 115
     #else
119 116
 
120
-      static inline void debug(const char[]) {}
117
+      static inline void debug(FSTR_P const) {}
121 118
 
122 119
     #endif
123 120
 };

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

@@ -75,8 +75,8 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) {
75 75
             matrix.vectors[0].z * _x + matrix.vectors[1].z * _y + matrix.vectors[2].z * _z };
76 76
 }
77 77
 
78
-void vector_3::debug(PGM_P const title) {
79
-  SERIAL_ECHOPGM_P(title);
78
+void vector_3::debug(FSTR_P const title) {
79
+  SERIAL_ECHOF(title);
80 80
   SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6);
81 81
   SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6);
82 82
   SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6);
@@ -100,14 +100,14 @@ void matrix_3x3::set_to_identity() {
100 100
 
101 101
 // Create a matrix from 3 vector_3 inputs
102 102
 matrix_3x3 matrix_3x3::create_from_rows(const vector_3 &row_0, const vector_3 &row_1, const vector_3 &row_2) {
103
-  //row_0.debug(PSTR("row_0"));
104
-  //row_1.debug(PSTR("row_1"));
105
-  //row_2.debug(PSTR("row_2"));
103
+  //row_0.debug(F("row_0"));
104
+  //row_1.debug(F("row_1"));
105
+  //row_2.debug(F("row_2"));
106 106
   matrix_3x3 new_matrix;
107 107
   new_matrix.vectors[0] = row_0;
108 108
   new_matrix.vectors[1] = row_1;
109 109
   new_matrix.vectors[2] = row_2;
110
-  //new_matrix.debug(PSTR("new_matrix"));
110
+  //new_matrix.debug(F("new_matrix"));
111 111
   return new_matrix;
112 112
 }
113 113
 
@@ -117,14 +117,14 @@ matrix_3x3 matrix_3x3::create_look_at(const vector_3 &target) {
117 117
                  x_row = vector_3(1, 0, -target.x / target.z).get_normal(),
118 118
                  y_row = vector_3::cross(z_row, x_row).get_normal();
119 119
 
120
-  // x_row.debug(PSTR("x_row"));
121
-  // y_row.debug(PSTR("y_row"));
122
-  // z_row.debug(PSTR("z_row"));
120
+  // x_row.debug(F("x_row"));
121
+  // y_row.debug(F("y_row"));
122
+  // z_row.debug(F("z_row"));
123 123
 
124 124
   // create the matrix already correctly transposed
125 125
   matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row);
126 126
 
127
-  // rot.debug(PSTR("rot"));
127
+  // rot.debug(F("rot"));
128 128
   return rot;
129 129
 }
130 130
 
@@ -137,8 +137,8 @@ matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) {
137 137
   return new_matrix;
138 138
 }
139 139
 
140
-void matrix_3x3::debug(PGM_P const title) {
141
-  if (title) SERIAL_ECHOLNPGM_P(title);
140
+void matrix_3x3::debug(FSTR_P const title) {
141
+  if (title) SERIAL_ECHOLNF(title);
142 142
   LOOP_L_N(i, 3) {
143 143
     LOOP_L_N(j, 3) {
144 144
       if (vectors[i][j] >= 0.0) SERIAL_CHAR('+');

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

@@ -78,7 +78,7 @@ struct vector_3 {
78 78
   operator xy_float_t() { return xy_float_t({ x, y }); }
79 79
   operator xyz_float_t() { return xyz_float_t({ x, y, z }); }
80 80
 
81
-  void debug(PGM_P const title);
81
+  void debug(FSTR_P const title);
82 82
 };
83 83
 
84 84
 struct matrix_3x3 {
@@ -91,7 +91,7 @@ struct matrix_3x3 {
91 91
 
92 92
   void set_to_identity();
93 93
 
94
-  void debug(PGM_P const title);
94
+  void debug(FSTR_P const title);
95 95
 
96 96
   void apply_rotation_xyz(float &x, float &y, float &z);
97 97
 };

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

@@ -483,10 +483,10 @@ void Endstops::event_handler() {
483 483
   #pragma GCC diagnostic ignored "-Wunused-function"
484 484
 #endif
485 485
 
486
-static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
487
-  if (label) SERIAL_ECHOPGM_P(label);
486
+static void print_es_state(const bool is_hit, FSTR_P const flabel=nullptr) {
487
+  if (flabel) SERIAL_ECHOF(flabel);
488 488
   SERIAL_ECHOPGM(": ");
489
-  SERIAL_ECHOLNPGM_P(is_hit ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN));
489
+  SERIAL_ECHOLNF(is_hit ? F(STR_ENDSTOP_HIT) : F(STR_ENDSTOP_OPEN));
490 490
 }
491 491
 
492 492
 #if GCC_VERSION <= 50000
@@ -496,7 +496,7 @@ static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
496 496
 void _O2 Endstops::report_states() {
497 497
   TERN_(BLTOUCH, bltouch._set_SW_mode());
498 498
   SERIAL_ECHOLNPGM(STR_M119_REPORT);
499
-  #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(STR_##S))
499
+  #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, F(STR_##S))
500 500
   #if HAS_X_MIN
501 501
     ES_REPORT(X_MIN);
502 502
   #endif
@@ -564,10 +564,10 @@ void _O2 Endstops::report_states() {
564 564
     ES_REPORT(K_MAX);
565 565
   #endif
566 566
   #if BOTH(MARLIN_DEV_MODE, PROBE_ACTIVATION_SWITCH)
567
-    print_es_state(probe_switch_activated(), PSTR(STR_PROBE_EN));
567
+    print_es_state(probe_switch_activated(), F(STR_PROBE_EN));
568 568
   #endif
569 569
   #if USES_Z_MIN_PROBE_PIN
570
-    print_es_state(PROBE_TRIGGERED(), PSTR(STR_Z_PROBE));
570
+    print_es_state(PROBE_TRIGGERED(), F(STR_Z_PROBE));
571 571
   #endif
572 572
   #if MULTI_FILAMENT_SENSOR
573 573
     #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
@@ -584,7 +584,7 @@ void _O2 Endstops::report_states() {
584 584
     }
585 585
     #undef _CASE_RUNOUT
586 586
   #elif HAS_FILAMENT_SENSOR
587
-    print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, PSTR(STR_FILAMENT));
587
+    print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, F(STR_FILAMENT));
588 588
   #endif
589 589
 
590 590
   TERN_(BLTOUCH, bltouch._reset_SW_mode());

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

@@ -178,7 +178,7 @@ static void print_input_or_output(const bool isout) {
178 178
 }
179 179
 
180 180
 // pretty report with PWM info
181
-inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool extended=false, PGM_P const start_string=nullptr) {
181
+inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool extended=false, FSTR_P const start_string=nullptr) {
182 182
   char buffer[MAX_NAME_LENGTH + 1];   // for the sprintf statements
183 183
   bool found = false, multi_name_pin = false;
184 184
 
@@ -202,7 +202,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e
202 202
   LOOP_L_N(x, COUNT(pin_array))  {    // scan entire array and report all instances of this pin
203 203
     if (GET_ARRAY_PIN(x) == pin) {
204 204
       if (!found) {    // report digital and analog pin number only on the first time through
205
-        if (start_string) SERIAL_ECHOPGM_P(start_string);
205
+        if (start_string) SERIAL_ECHOF(start_string);
206 206
         SERIAL_ECHOPGM("PIN: ");
207 207
         PRINT_PIN(pin);
208 208
         PRINT_PORT(pin);
@@ -211,7 +211,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e
211 211
       }
212 212
       else {
213 213
         SERIAL_CHAR('.');
214
-        SERIAL_ECHO_SP(MULTI_NAME_PAD + (start_string ? strlen_P(start_string) : 0));  // add padding if not the first instance found
214
+        SERIAL_ECHO_SP(MULTI_NAME_PAD + (start_string ? strlen_P(FTOP(start_string)) : 0));  // add padding if not the first instance found
215 215
       }
216 216
       PRINT_ARRAY_NAME(x);
217 217
       if (extended) {
@@ -250,7 +250,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e
250 250
   } // end of for loop
251 251
 
252 252
   if (!found) {
253
-    if (start_string) SERIAL_ECHOPGM_P(start_string);
253
+    if (start_string) SERIAL_ECHOF(start_string);
254 254
     SERIAL_ECHOPGM("PIN: ");
255 255
     PRINT_PIN(pin);
256 256
     PRINT_PORT(pin);

Loading…
取消
儲存