浏览代码

🎨 Apply F() to various reports

Scott Lahteine 3 年前
父节点
当前提交
1dafd1887e

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

108
 
108
 
109
   #if ENABLED(MARLIN_DEV_MODE)
109
   #if ENABLED(MARLIN_DEV_MODE)
110
     void dump_delay_accuracy_check() {
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
         SERIAL_ECHOPGM("Calling ");
112
         SERIAL_ECHOPGM("Calling ");
113
-        SERIAL_ECHOPGM_P(name);
113
+        SERIAL_ECHOF(name);
114
         SERIAL_ECHOLNPGM(" for ", cycles);
114
         SERIAL_ECHOLNPGM(" for ", cycles);
115
-        SERIAL_ECHOPGM_P(unit);
115
+        SERIAL_ECHOF(unit);
116
         SERIAL_ECHOLNPGM(" took: ", total);
116
         SERIAL_ECHOLNPGM(" took: ", total);
117
-        SERIAL_ECHOPGM_P(unit);
117
+        SERIAL_CHAR(' ');
118
+        SERIAL_ECHOF(unit);
118
         if (do_flush) SERIAL_FLUSHTX();
119
         if (do_flush) SERIAL_FLUSHTX();
119
       };
120
       };
120
 
121
 
126
       constexpr uint32_t testValues[] = { 1, 5, 10, 20, 50, 100, 150, 200, 350, 500, 750, 1000 };
127
       constexpr uint32_t testValues[] = { 1, 5, 10, 20, 50, 100, 150, 200, 350, 500, 750, 1000 };
127
       for (auto i : testValues) {
128
       for (auto i : testValues) {
128
         s = micros(); DELAY_US(i); e = micros();
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
       if (HW_REG(_DWT_CTRL)) {
133
       if (HW_REG(_DWT_CTRL)) {
134
+        static FSTR_P cyc = F("cycles");
135
+        static FSTR_P dcd = F("DELAY_CYCLES directly ");
136
+
133
         for (auto i : testValues) {
137
         for (auto i : testValues) {
134
           s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(i); e = HW_REG(_DWT_CYCCNT);
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
         // Measure the delay to call a real function compared to a function pointer
142
         // Measure the delay to call a real function compared to a function pointer
139
         s = HW_REG(_DWT_CYCCNT); delay_dwt(1); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES( 1); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES( 5); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(10); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(20); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(50); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(100); e = HW_REG(_DWT_CYCCNT);
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
         s = HW_REG(_DWT_CYCCNT); DELAY_CYCLES(200); e = HW_REG(_DWT_CYCCNT);
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
   #endif // MARLIN_DEV_MODE
168
   #endif // MARLIN_DEV_MODE
170
 
172
 
171
   void calibrate_delay_loop() {}
173
   void calibrate_delay_loop() {}
172
   #if ENABLED(MARLIN_DEV_MODE)
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
   #endif
176
   #endif
175
 
177
 
176
 #endif
178
 #endif

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

1609
     }
1609
     }
1610
 
1610
 
1611
     if (DEBUGGING(LEVELING)) {
1611
     if (DEBUGGING(LEVELING)) {
1612
-      rotation.debug(PSTR("rotation matrix:\n"));
1612
+      rotation.debug(F("rotation matrix:\n"));
1613
       DEBUG_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7);
1613
       DEBUG_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7);
1614
       DEBUG_ECHOPAIR_F("  B=", lsf_results.B, 7);
1614
       DEBUG_ECHOPAIR_F("  B=", lsf_results.B, 7);
1615
       DEBUG_ECHOLNPAIR_F("  D=", lsf_results.D, 7);
1615
       DEBUG_ECHOLNPAIR_F("  D=", lsf_results.D, 7);
1636
         auto normed = [&](const xy_pos_t &pos, const_float_t zadd) {
1636
         auto normed = [&](const xy_pos_t &pos, const_float_t zadd) {
1637
           return normal.x * pos.x + normal.y * pos.y + zadd;
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
           DEBUG_ECHO_F(normed(pos, zadd), 6);
1641
           DEBUG_ECHO_F(normed(pos, zadd), 6);
1642
           DEBUG_ECHOLNPAIR_F("   Z error = ", zadd - get_z_correction(pos), 6);
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
         d_from(); DEBUG_ECHOPGM("safe home with Z=");
1647
         d_from(); DEBUG_ECHOPGM("safe home with Z=");
1648
         DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_homing_xy, 0), 6);
1648
         DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_homing_xy, 0), 6);
1649
         d_from(); DEBUG_ECHOPGM("safe home with Z=");
1649
         d_from(); DEBUG_ECHOPGM("safe home with Z=");

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

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

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

42
  * a Max7219_Set_Row().    The opposite is true for rotations of 0 or 180 degrees.
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
 #ifndef MAX7219_ROTATE
47
 #ifndef MAX7219_ROTATE
46
   #define MAX7219_ROTATE 0
48
   #define MAX7219_ROTATE 0
47
 #endif
49
 #endif
140
 
142
 
141
 private:
143
 private:
142
   static uint8_t suspended;
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
   static void noop();
146
   static void noop();
145
   static void set(const uint8_t line, const uint8_t bits);
147
   static void set(const uint8_t line, const uint8_t bits);
146
   static void send_row(const uint8_t row);
148
   static void send_row(const uint8_t row);

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

130
     (void)file.read(&info, sizeof(info));
130
     (void)file.read(&info, sizeof(info));
131
     close();
131
     close();
132
   }
132
   }
133
-  debug(PSTR("Load"));
133
+  debug(F("Load"));
134
 }
134
 }
135
 
135
 
136
 /**
136
 /**
311
  */
311
  */
312
 void PrintJobRecovery::write() {
312
 void PrintJobRecovery::write() {
313
 
313
 
314
-  debug(PSTR("Write"));
314
+  debug(F("Write"));
315
 
315
 
316
   open(false);
316
   open(false);
317
   file.seekSet(0);
317
   file.seekSet(0);
575
 
575
 
576
 #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
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
     DEBUG_ECHOLNPGM(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot);
580
     DEBUG_ECHOLNPGM(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot);
581
     if (info.valid_head) {
581
     if (info.valid_head) {
582
       if (info.valid_head == info.valid_foot) {
582
       if (info.valid_head == info.valid_foot) {

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

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

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

28
 
28
 
29
 static uint32_t axis_plug_backward = 0;
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
   SERIAL_ERROR_START();
32
   SERIAL_ERROR_START();
33
-  SERIAL_ECHOPGM_P(str);
33
+  SERIAL_ECHOF(fstr);
34
   SERIAL_ECHOLNPGM(" driver is backward!");
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
 void stepper_driver_backward_check() {
38
 void stepper_driver_backward_check() {
45
       delay(20); \
45
       delay(20); \
46
       if (READ(AXIS##_ENABLE_PIN) == false) { \
46
       if (READ(AXIS##_ENABLE_PIN) == false) { \
47
         SBI(axis_plug_backward, BIT); \
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
     }while(0)
50
     }while(0)
51
 
51
 
82
 void stepper_driver_backward_report() {
82
 void stepper_driver_backward_report() {
83
   if (!axis_plug_backward) return;
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
     if (TEST(axis_plug_backward, bit))
86
     if (TEST(axis_plug_backward, bit))
87
       stepper_driver_backward_error(axis);
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
   REPORT_BACKWARD(X,   0);
92
   REPORT_BACKWARD(X,   0);
93
   REPORT_BACKWARD(X2,  1);
93
   REPORT_BACKWARD(X2,  1);

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

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

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

142
      *
142
      *
143
      * @param bytes the number of bytes to request
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
      * @brief Echo data on the bus to serial
148
      * @brief Echo data on the bus to serial
151
      *
151
      *
152
      * @param bytes the number of bytes to request
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
      * @brief Echo data in the buffer to serial
157
      * @brief Echo data in the buffer to serial
160
      *
160
      *
161
      * @param bytes the number of bytes to request
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
      * @brief Request data from the slave device and wait.
166
      * @brief Request data from the slave device and wait.
237
        * @brief Prints a debug message
237
        * @brief Prints a debug message
238
        * @details Prints a simple debug message "TWIBus::function: value"
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
     #else
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
     #endif
248
     #endif
249
+    static inline void debug(FSTR_P const func, uint8_t v) { debug(func, (uint32_t)v); }
251
 };
250
 };
252
 
251
 
253
 extern TWIBus i2c;
252
 extern TWIBus i2c;

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

195
   // V to print the matrix or mesh
195
   // V to print the matrix or mesh
196
   if (seenV) {
196
   if (seenV) {
197
     #if ABL_PLANAR
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
     #else
199
     #else
200
       if (leveling_is_valid()) {
200
       if (leveling_is_valid()) {
201
         #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
201
         #if ENABLED(AUTO_BED_LEVELING_BILINEAR)

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

783
 
783
 
784
         float min_diff = 999;
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
           for (int8_t yy = abl.grid_points.y - 1; yy >= 0; yy--) {
788
           for (int8_t yy = abl.grid_points.y - 1; yy >= 0; yy--) {
789
             LOOP_L_N(xx, abl.grid_points.x) {
789
             LOOP_L_N(xx, abl.grid_points.x) {
790
               const int ind = abl.indexIntoAB[xx][yy];
790
               const int ind = abl.indexIntoAB[xx][yy];
802
           SERIAL_EOL();
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
         if (abl.verbose_level > 3)
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
       } // abl.topography_map
819
       } // abl.topography_map
820
 
820
 
825
       // For LINEAR and 3POINT leveling correct the current position
825
       // For LINEAR and 3POINT leveling correct the current position
826
 
826
 
827
       if (abl.verbose_level > 0)
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
       if (!abl.dryrun) {
830
       if (!abl.dryrun) {
831
         //
831
         //

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

269
   #endif
269
   #endif
270
 
270
 
271
   #if HAS_HOMING_CURRENT
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
     #if HAS_CURRENT_HOME(X)
275
     #if HAS_CURRENT_HOME(X)
276
       const int16_t tmc_save_current_X = stepperX.getMilliamps();
276
       const int16_t tmc_save_current_X = stepperX.getMilliamps();
277
       stepperX.rms_current(X_CURRENT_HOME);
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
     #endif
279
     #endif
280
     #if HAS_CURRENT_HOME(X2)
280
     #if HAS_CURRENT_HOME(X2)
281
       const int16_t tmc_save_current_X2 = stepperX2.getMilliamps();
281
       const int16_t tmc_save_current_X2 = stepperX2.getMilliamps();
282
       stepperX2.rms_current(X2_CURRENT_HOME);
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
     #endif
284
     #endif
285
     #if HAS_CURRENT_HOME(Y)
285
     #if HAS_CURRENT_HOME(Y)
286
       const int16_t tmc_save_current_Y = stepperY.getMilliamps();
286
       const int16_t tmc_save_current_Y = stepperY.getMilliamps();
287
       stepperY.rms_current(Y_CURRENT_HOME);
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
     #endif
289
     #endif
290
     #if HAS_CURRENT_HOME(Y2)
290
     #if HAS_CURRENT_HOME(Y2)
291
       const int16_t tmc_save_current_Y2 = stepperY2.getMilliamps();
291
       const int16_t tmc_save_current_Y2 = stepperY2.getMilliamps();
292
       stepperY2.rms_current(Y2_CURRENT_HOME);
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
     #endif
294
     #endif
295
     #if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
295
     #if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
296
       const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
296
       const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
297
       stepperZ.rms_current(Z_CURRENT_HOME);
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
     #endif
299
     #endif
300
   #endif
300
   #endif
301
 
301
 

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

97
   TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index, true));
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
   SERIAL_ECHOPGM("  ");
101
   SERIAL_ECHOPGM("  ");
102
-  SERIAL_ECHOPGM_P(prefix);
103
-  SERIAL_CHAR(':');
102
+  SERIAL_ECHOF(prefix, AS_CHAR(':'));
104
   if (f >= 0) SERIAL_CHAR('+');
103
   if (f >= 0) SERIAL_CHAR('+');
105
   SERIAL_ECHO_F(f, 2);
104
   SERIAL_ECHO_F(f, 2);
106
 }
105
 }
111
 static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
110
 static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
112
   SERIAL_ECHOPGM(".Height:", delta_height);
111
   SERIAL_ECHOPGM(".Height:", delta_height);
113
   if (end_stops) {
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
   if (end_stops && tower_angles) {
117
   if (end_stops && tower_angles) {
119
-    SERIAL_ECHOPGM("  Radius:", delta_radius);
120
-    SERIAL_EOL();
118
+    SERIAL_ECHOLNPGM("  Radius:", delta_radius);
121
     SERIAL_CHAR('.');
119
     SERIAL_CHAR('.');
122
     SERIAL_ECHO_SP(13);
120
     SERIAL_ECHO_SP(13);
123
   }
121
   }
124
   if (tower_angles) {
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
     SERIAL_ECHOPGM("  Radius:", delta_radius);
128
     SERIAL_ECHOPGM("  Radius:", delta_radius);
131
-  }
129
+
132
   SERIAL_EOL();
130
   SERIAL_EOL();
133
 }
131
 }
134
 
132
 
137
  */
135
  */
138
 static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
136
 static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
139
   SERIAL_ECHOPGM(".    ");
137
   SERIAL_ECHOPGM(".    ");
140
-  print_signed_float(PSTR("c"), z_pt[CEN]);
138
+  print_signed_float(F("c"), z_pt[CEN]);
141
   if (tower_points) {
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
   if (tower_points && opposite_points) {
144
   if (tower_points && opposite_points) {
147
     SERIAL_EOL();
145
     SERIAL_EOL();
149
     SERIAL_ECHO_SP(13);
147
     SERIAL_ECHO_SP(13);
150
   }
148
   }
151
   if (opposite_points) {
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
   SERIAL_EOL();
154
   SERIAL_EOL();
157
 }
155
 }
653
       }
651
       }
654
     }
652
     }
655
     else { // dry run
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
       SERIAL_ECHO_SP(35);
656
       SERIAL_ECHO_SP(35);
659
       SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
657
       SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
660
 
658
 
661
       char mess[21];
659
       char mess[21];
662
-      strcpy_P(mess, enddryrun);
660
+      strcpy_P(mess, FTOP(enddryrun));
663
       strcpy_P(&mess[11], PSTR(" sd:"));
661
       strcpy_P(&mess[11], PSTR(" sd:"));
664
       if (zero_std_dev < 1)
662
       if (zero_std_dev < 1)
665
         sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0f));
663
         sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0f));

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

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(PGM_P const free_memory_start);
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
  * Initial version by Roxy-3D
56
  * Initial version by Roxy-3D
57
  */
57
  */
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
     // Round the start and end locations to produce full lines of output
188
     // Round the start and end locations to produce full lines of output
189
     //
189
     //
196
 
196
 
197
 #endif // M100_FREE_MEMORY_DUMPER
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
   char *start_free_memory = free_memory_start, *end_free_memory = free_memory_end;
202
   char *start_free_memory = free_memory_start, *end_free_memory = free_memory_end;
203
   int n = end_free_memory - start_free_memory;
203
   int n = end_free_memory - start_free_memory;
217
     //  idle();
217
     //  idle();
218
     serial_delay(20);
218
     serial_delay(20);
219
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
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
     #endif
221
     #endif
222
   }
222
   }
223
 
223
 
281
     "\nMemory Corruption detected in free memory area."
281
     "\nMemory Corruption detected in free memory area."
282
     "\nLargest free block is ", max_cnt, " bytes at ", hex_address(max_addr)
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
 #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
287
 #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)

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

65
     pin_t pin = GET_PIN_MAP_PIN_M43(i);
65
     pin_t pin = GET_PIN_MAP_PIN_M43(i);
66
     if (!VALID_PIN(pin)) continue;
66
     if (!VALID_PIN(pin)) continue;
67
     if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) {
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
       SERIAL_EOL();
69
       SERIAL_EOL();
70
     }
70
     }
71
     else {
71
     else {
72
       watchdog_refresh();
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
       #ifdef __STM32F1__
74
       #ifdef __STM32F1__
75
         const auto prior_mode = _GET_MODE(i);
75
         const auto prior_mode = _GET_MODE(i);
76
       #else
76
       #else
303
   if (parser.seen('E')) {
303
   if (parser.seen('E')) {
304
     endstops.monitor_flag = parser.value_bool();
304
     endstops.monitor_flag = parser.value_bool();
305
     SERIAL_ECHOPGM("endstop monitor ");
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
     SERIAL_ECHOLNPGM("abled");
307
     SERIAL_ECHOLNPGM("abled");
308
     return;
308
     return;
309
   }
309
   }

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

57
 
57
 
58
 // Display current values when the link is active,
58
 // Display current values when the link is active,
59
 // otherwise show the stored values
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
   SERIAL_CHAR('M'); SERIAL_ECHO(cmd); SERIAL_CHAR(' ');
61
   SERIAL_CHAR('M'); SERIAL_ECHO(cmd); SERIAL_CHAR(' ');
62
   LOOP_L_N(i, 4) {
62
   LOOP_L_N(i, 4) {
63
     SERIAL_ECHO(ipo[i]);
63
     SERIAL_ECHO(ipo[i]);
64
     if (i < 3) SERIAL_CHAR('.');
64
     if (i < 3) SERIAL_CHAR('.');
65
   }
65
   }
66
   SERIAL_ECHOPGM(" ; ");
66
   SERIAL_ECHOPGM(" ; ");
67
-  SERIAL_ECHOLNPGM_P(post);
67
+  SERIAL_ECHOLNF(post);
68
 }
68
 }
69
 
69
 
70
 /**
70
 /**
98
 }
98
 }
99
 
99
 
100
 void GcodeSuite::M552_report() {
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
 }
112
 }
113
 
113
 
114
 void GcodeSuite::M553_report() {
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
 }
126
 }
127
 
127
 
128
 void GcodeSuite::M554_report() {
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
 #endif // HAS_ETHERNET
132
 #endif // HAS_ETHERNET

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

44
 
44
 
45
 void menu_job_recovery();
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
   #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
48
   #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
49
     DEBUG_ECHO_START();
49
     DEBUG_ECHO_START();
50
-    DEBUG_ECHOPGM_P(prefix);
50
+    DEBUG_ECHOF(prefix);
51
     DEBUG_ECHOLNPGM(" Job Recovery Data");
51
     DEBUG_ECHOLNPGM(" Job Recovery Data");
52
   #else
52
   #else
53
     UNUSED(prefix);
53
     UNUSED(prefix);
91
       recovery.resume();
91
       recovery.resume();
92
   }
92
   }
93
   else
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
     if (parser.seen("RL")) recovery.load();
47
     if (parser.seen("RL")) recovery.load();
48
     if (parser.seen_test('W')) recovery.save(true);
48
     if (parser.seen_test('W')) recovery.save(true);
49
     if (parser.seen_test('P')) recovery.purge();
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
     #if PIN_EXISTS(POWER_LOSS)
51
     #if PIN_EXISTS(POWER_LOSS)
52
       if (parser.seen_test('O')) recovery._outage();
52
       if (parser.seen_test('O')) recovery._outage();
53
     #endif
53
     #endif

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

141
 void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
141
 void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
142
   report_heading(forReplay, F(STR_DRIVER_STEPPING_MODE));
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
     if (!forReplay) SERIAL_ECHO_START();
145
     if (!forReplay) SERIAL_ECHO_START();
146
     SERIAL_ECHOPGM("  M569 S1");
146
     SERIAL_ECHOPGM("  M569 S1");
147
     if (etc) {
147
     if (etc) {
148
       SERIAL_CHAR(' ');
148
       SERIAL_CHAR(' ');
149
-      SERIAL_ECHOPGM_P(etc);
149
+      SERIAL_ECHOF(etc);
150
     }
150
     }
151
     if (eol) SERIAL_EOL();
151
     if (eol) SERIAL_EOL();
152
   };
152
   };
176
              chop_z2 = TERN0(Z2_HAS_STEALTHCHOP, stepperZ2.get_stored_stealthChop());
176
              chop_z2 = TERN0(Z2_HAS_STEALTHCHOP, stepperZ2.get_stored_stealthChop());
177
 
177
 
178
   if (chop_x2 || chop_y2 || chop_z2) {
178
   if (chop_x2 || chop_y2 || chop_z2) {
179
-    say_M569(forReplay, PSTR("I1"));
179
+    say_M569(forReplay, F("I1"));
180
     if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR);
180
     if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR);
181
     if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR);
181
     if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR);
182
     if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR);
182
     if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR);
183
     SERIAL_EOL();
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
 #endif // HAS_STEALTHCHOP
203
 #endif // HAS_STEALTHCHOP

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

1067
 }
1067
 }
1068
 
1068
 
1069
 #if ENABLED(M100_FREE_MEMORY_DUMPER)
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
 #endif
1071
 #endif
1072
 
1072
 
1073
 /**
1073
 /**
1086
     SERIAL_ECHOLN(command.buffer);
1086
     SERIAL_ECHOLN(command.buffer);
1087
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
1087
     #if ENABLED(M100_FREE_MEMORY_DUMPER)
1088
       SERIAL_ECHOPGM("slot:", queue.ring_buffer.index_r);
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
     #endif
1090
     #endif
1091
   }
1091
   }
1092
 
1092
 

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

34
 #endif
34
 #endif
35
 
35
 
36
 #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
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
     SERIAL_ECHOPGM("Cap:");
38
     SERIAL_ECHOPGM("Cap:");
39
-    SERIAL_ECHOPGM_P(name);
39
+    SERIAL_ECHOF(name);
40
     SERIAL_CHAR(':', '0' + ena);
40
     SERIAL_CHAR(':', '0' + ena);
41
     SERIAL_EOL();
41
     SERIAL_EOL();
42
   }
42
   }
68
     serial_index_t port = queue.ring_buffer.command_port();
68
     serial_index_t port = queue.ring_buffer.command_port();
69
 
69
 
70
     // PAREN_COMMENTS
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
     // QUOTED_STRINGS
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
     // SERIAL_XON_XOFF
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
     // BINARY_FILE_TRANSFER (M28 B1)
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
     // EEPROM (M500, M501)
82
     // EEPROM (M500, M501)
83
-    cap_line(PSTR("EEPROM"), ENABLED(EEPROM_SETTINGS));
83
+    cap_line(F("EEPROM"), ENABLED(EEPROM_SETTINGS));
84
 
84
 
85
     // Volumetric Extrusion (M200)
85
     // Volumetric Extrusion (M200)
86
-    cap_line(PSTR("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
86
+    cap_line(F("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
87
 
87
 
88
     // AUTOREPORT_POS (M154)
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
     // AUTOREPORT_TEMP (M155)
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
     // PROGRESS (M530 S L, M531 <file>, M532 X L)
94
     // PROGRESS (M530 S L, M531 <file>, M532 X L)
95
-    cap_line(PSTR("PROGRESS"));
95
+    cap_line(F("PROGRESS"));
96
 
96
 
97
     // Print Job timer M75, M76, M77
97
     // Print Job timer M75, M76, M77
98
-    cap_line(PSTR("PRINT_JOB"), true);
98
+    cap_line(F("PRINT_JOB"), true);
99
 
99
 
100
     // AUTOLEVEL (G29)
100
     // AUTOLEVEL (G29)
101
-    cap_line(PSTR("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
101
+    cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
102
 
102
 
103
     // RUNOUT (M412, M600)
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
     // Z_PROBE (G30)
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
     // MESH_REPORT (M420 V)
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
     // BUILD_PERCENT (M73)
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
     // SOFTWARE_POWER (M80, M81)
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
     // TOGGLE_LIGHTS (M355)
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
     // EMERGENCY_PARSER (M108, M112, M410, M876)
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
     // HOST ACTION COMMANDS (paused, resume, resumed, cancel, etc.)
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
     // PROMPT SUPPORT (M876)
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
     // SDCARD (M20, M23, M24, etc.)
131
     // SDCARD (M20, M23, M24, etc.)
132
-    cap_line(PSTR("SDCARD"), ENABLED(SDSUPPORT));
132
+    cap_line(F("SDCARD"), ENABLED(SDSUPPORT));
133
 
133
 
134
     // REPEAT (M808)
134
     // REPEAT (M808)
135
-    cap_line(PSTR("REPEAT"), ENABLED(GCODE_REPEAT_MARKERS));
135
+    cap_line(F("REPEAT"), ENABLED(GCODE_REPEAT_MARKERS));
136
 
136
 
137
     // SD_WRITE (M928, M28, M29)
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
     // AUTOREPORT_SD_STATUS (M27 extension)
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
     // LONG_FILENAME_HOST_SUPPORT (M33)
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
     // THERMAL_PROTECTION
146
     // THERMAL_PROTECTION
147
-    cap_line(PSTR("THERMAL_PROTECTION"), ENABLED(THERMALLY_SAFE));
147
+    cap_line(F("THERMAL_PROTECTION"), ENABLED(THERMALLY_SAFE));
148
 
148
 
149
     // MOTION_MODES (M80-M89)
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
     // ARC_SUPPORT (G2-G3)
152
     // ARC_SUPPORT (G2-G3)
153
-    cap_line(PSTR("ARCS"), ENABLED(ARC_SUPPORT));
153
+    cap_line(F("ARCS"), ENABLED(ARC_SUPPORT));
154
 
154
 
155
     // BABYSTEPPING (M290)
155
     // BABYSTEPPING (M290)
156
-    cap_line(PSTR("BABYSTEPPING"), ENABLED(BABYSTEPPING));
156
+    cap_line(F("BABYSTEPPING"), ENABLED(BABYSTEPPING));
157
 
157
 
158
     // CHAMBER_TEMPERATURE (M141, M191)
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
     // COOLER_TEMPERATURE (M143, M193)
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
     // MEATPACK Compression
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
     // Machine Geometry
167
     // Machine Geometry
168
     #if ENABLED(M115_GEOMETRY_REPORT)
168
     #if ENABLED(M115_GEOMETRY_REPORT)

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

43
   config_prefix(name, pref, ind);
43
   config_prefix(name, pref, ind);
44
   SERIAL_ECHOLN(val);
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
 static void config_line_e(const int8_t e, PGM_P const name, const float val) {
49
 static void config_line_e(const int8_t e, PGM_P const name, const float val) {
47
   config_line(name, val, PSTR("Extr."), e + 1);
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
  * M360: Report Firmware configuration
57
  * M360: Report Firmware configuration
60
   //
66
   //
61
   // Basics and Enabled items
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
   // Homing Directions
84
   // Homing Directions
87
   //
93
   //
88
   #if HAS_CLASSIC_JERK
94
   #if HAS_CLASSIC_JERK
89
     if (planner.max_jerk.x == planner.max_jerk.y)
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
     else {
97
     else {
92
       config_line(X_STR, planner.max_jerk.x, JERK_STR);
98
       config_line(X_STR, planner.max_jerk.x, JERK_STR);
93
       config_line(Y_STR, planner.max_jerk.y, JERK_STR);
99
       config_line(Y_STR, planner.max_jerk.y, JERK_STR);
98
   //
104
   //
99
   // Firmware Retraction
105
   // Firmware Retraction
100
   //
106
   //
101
-  config_line(PSTR("SupportG10G11"), ENABLED(FWRETRACT));
107
+  config_line(F("SupportG10G11"), ENABLED(FWRETRACT));
102
   #if ENABLED(FWRETRACT)
108
   #if ENABLED(FWRETRACT)
103
     PGMSTR(RET_STR, "Retraction");
109
     PGMSTR(RET_STR, "Retraction");
104
     PGMSTR(UNRET_STR, "RetractionUndo");
110
     PGMSTR(UNRET_STR, "RetractionUndo");
105
     PGMSTR(SPEED_STR, "Speed");
111
     PGMSTR(SPEED_STR, "Speed");
106
     // M10 Retract with swap (long) moves
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
     config_line(SPEED_STR,          fwretract.settings.retract_feedrate_mm_s, RET_STR);
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
     // M11 Recover (undo) with swap (long) moves
117
     // M11 Recover (undo) with swap (long) moves
112
     config_line(SPEED_STR,               fwretract.settings.retract_recover_feedrate_mm_s, UNRET_STR);
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
   #endif
122
   #endif
117
 
123
 
118
   //
124
   //
163
   //
169
   //
164
   // Heated Bed
170
   // Heated Bed
165
   //
171
   //
166
-  config_line(PSTR("HeatedBed"), ENABLED(HAS_HEATED_BED));
172
+  config_line(F("HeatedBed"), ENABLED(HAS_HEATED_BED));
167
   #if HAS_HEATED_BED
173
   #if HAS_HEATED_BED
168
-    config_line(PSTR("MaxBedTemp"), BED_MAX_TARGET);
174
+    config_line(F("MaxBedTemp"), BED_MAX_TARGET);
169
   #endif
175
   #endif
170
 
176
 
171
   //
177
   //
172
   // Per-Extruder settings
178
   // Per-Extruder settings
173
   //
179
   //
174
-  config_line(PSTR("NumExtruder"), EXTRUDERS);
180
+  config_line(F("NumExtruder"), EXTRUDERS);
175
   #if HAS_EXTRUDERS
181
   #if HAS_EXTRUDERS
176
     LOOP_L_N(e, EXTRUDERS) {
182
     LOOP_L_N(e, EXTRUDERS) {
177
       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)));
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
   #endif
189
   #endif
184
 }
190
 }

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

302
 
302
 
303
 inline int read_serial(const serial_index_t index) { return SERIAL_IMPL.read(index); }
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
   PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
306
   PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command
307
   SERIAL_ERROR_START();
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
   while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
309
   while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ?
310
   flush_and_request_resend(serial_ind);
310
   flush_and_request_resend(serial_ind);
311
   serial_state[serial_ind.index].count = 0;
311
   serial_state[serial_ind.index].count = 0;
470
 
470
 
471
           if (gcode_N != serial.last_N + 1 && !M110) {
471
           if (gcode_N != serial.last_N + 1 && !M110) {
472
             // In case of error on a serial port, don't prevent other serial port from making progress
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
             break;
474
             break;
475
           }
475
           }
476
 
476
 
480
             while (count) checksum ^= command[--count];
480
             while (count) checksum ^= command[--count];
481
             if (strtol(apos + 1, nullptr, 10) != checksum) {
481
             if (strtol(apos + 1, nullptr, 10) != checksum) {
482
               // In case of error on a serial port, don't prevent other serial port from making progress
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
               break;
484
               break;
485
             }
485
             }
486
           }
486
           }
487
           else {
487
           else {
488
             // In case of error on a serial port, don't prevent other serial port from making progress
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
             break;
490
             break;
491
           }
491
           }
492
 
492
 
495
         #if ENABLED(SDSUPPORT)
495
         #if ENABLED(SDSUPPORT)
496
           // Pronterface "M29" and "M29 " has no line number
496
           // Pronterface "M29" and "M29 " has no line number
497
           else if (card.flag.saving && !is_M29(command)) {
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
             break;
499
             break;
500
           }
500
           }
501
         #endif
501
         #endif

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

259
    */
259
    */
260
   static bool enqueue_one(const char *cmd);
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
   friend class GcodeSuite;
264
   friend class GcodeSuite;
265
 };
265
 };

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

34
 millis_t Stopwatch::stopTimestamp;
34
 millis_t Stopwatch::stopTimestamp;
35
 
35
 
36
 bool Stopwatch::stop() {
36
 bool Stopwatch::stop() {
37
-  Stopwatch::debug(PSTR("stop"));
37
+  debug(F("stop"));
38
 
38
 
39
   if (isRunning() || isPaused()) {
39
   if (isRunning() || isPaused()) {
40
     TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
40
     TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
46
 }
46
 }
47
 
47
 
48
 bool Stopwatch::pause() {
48
 bool Stopwatch::pause() {
49
-  Stopwatch::debug(PSTR("pause"));
49
+  debug(F("pause"));
50
 
50
 
51
   if (isRunning()) {
51
   if (isRunning()) {
52
     TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
52
     TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
58
 }
58
 }
59
 
59
 
60
 bool Stopwatch::start() {
60
 bool Stopwatch::start() {
61
-  Stopwatch::debug(PSTR("start"));
61
+  debug(F("start"));
62
 
62
 
63
   TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
63
   TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
64
 
64
 
74
 }
74
 }
75
 
75
 
76
 void Stopwatch::resume(const millis_t with_time) {
76
 void Stopwatch::resume(const millis_t with_time) {
77
-  Stopwatch::debug(PSTR("resume"));
77
+  debug(F("resume"));
78
 
78
 
79
   reset();
79
   reset();
80
   if ((accumulator = with_time)) state = RUNNING;
80
   if ((accumulator = with_time)) state = RUNNING;
81
 }
81
 }
82
 
82
 
83
 void Stopwatch::reset() {
83
 void Stopwatch::reset() {
84
-  Stopwatch::debug(PSTR("reset"));
84
+  debug(F("reset"));
85
 
85
 
86
   state = STOPPED;
86
   state = STOPPED;
87
   startTimestamp = 0;
87
   startTimestamp = 0;
95
 
95
 
96
 #if ENABLED(DEBUG_STOPWATCH)
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
 #endif
102
 #endif

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

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
+#include "../inc/MarlinConfig.h"
25
+
24
 // Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
26
 // Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
25
 //#define DEBUG_STOPWATCH
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
  * @brief Stopwatch class
30
  * @brief Stopwatch class
34
  * @details This class acts as a timer proving stopwatch functionality including
31
  * @details This class acts as a timer proving stopwatch functionality including
113
        * @brief Print a debug message
110
        * @brief Print a debug message
114
        * @details Print a simple debug message "Stopwatch::function"
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
     #else
115
     #else
119
 
116
 
120
-      static inline void debug(const char[]) {}
117
+      static inline void debug(FSTR_P const) {}
121
 
118
 
122
     #endif
119
     #endif
123
 };
120
 };

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

75
             matrix.vectors[0].z * _x + matrix.vectors[1].z * _y + matrix.vectors[2].z * _z };
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
   SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6);
80
   SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6);
81
   SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6);
81
   SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6);
82
   SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6);
82
   SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6);
100
 
100
 
101
 // Create a matrix from 3 vector_3 inputs
101
 // Create a matrix from 3 vector_3 inputs
102
 matrix_3x3 matrix_3x3::create_from_rows(const vector_3 &row_0, const vector_3 &row_1, const vector_3 &row_2) {
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
   matrix_3x3 new_matrix;
106
   matrix_3x3 new_matrix;
107
   new_matrix.vectors[0] = row_0;
107
   new_matrix.vectors[0] = row_0;
108
   new_matrix.vectors[1] = row_1;
108
   new_matrix.vectors[1] = row_1;
109
   new_matrix.vectors[2] = row_2;
109
   new_matrix.vectors[2] = row_2;
110
-  //new_matrix.debug(PSTR("new_matrix"));
110
+  //new_matrix.debug(F("new_matrix"));
111
   return new_matrix;
111
   return new_matrix;
112
 }
112
 }
113
 
113
 
117
                  x_row = vector_3(1, 0, -target.x / target.z).get_normal(),
117
                  x_row = vector_3(1, 0, -target.x / target.z).get_normal(),
118
                  y_row = vector_3::cross(z_row, x_row).get_normal();
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
   // create the matrix already correctly transposed
124
   // create the matrix already correctly transposed
125
   matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row);
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
   return rot;
128
   return rot;
129
 }
129
 }
130
 
130
 
137
   return new_matrix;
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
   LOOP_L_N(i, 3) {
142
   LOOP_L_N(i, 3) {
143
     LOOP_L_N(j, 3) {
143
     LOOP_L_N(j, 3) {
144
       if (vectors[i][j] >= 0.0) SERIAL_CHAR('+');
144
       if (vectors[i][j] >= 0.0) SERIAL_CHAR('+');

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

78
   operator xy_float_t() { return xy_float_t({ x, y }); }
78
   operator xy_float_t() { return xy_float_t({ x, y }); }
79
   operator xyz_float_t() { return xyz_float_t({ x, y, z }); }
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
 struct matrix_3x3 {
84
 struct matrix_3x3 {
91
 
91
 
92
   void set_to_identity();
92
   void set_to_identity();
93
 
93
 
94
-  void debug(PGM_P const title);
94
+  void debug(FSTR_P const title);
95
 
95
 
96
   void apply_rotation_xyz(float &x, float &y, float &z);
96
   void apply_rotation_xyz(float &x, float &y, float &z);
97
 };
97
 };

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

483
   #pragma GCC diagnostic ignored "-Wunused-function"
483
   #pragma GCC diagnostic ignored "-Wunused-function"
484
 #endif
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
   SERIAL_ECHOPGM(": ");
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
 #if GCC_VERSION <= 50000
492
 #if GCC_VERSION <= 50000
496
 void _O2 Endstops::report_states() {
496
 void _O2 Endstops::report_states() {
497
   TERN_(BLTOUCH, bltouch._set_SW_mode());
497
   TERN_(BLTOUCH, bltouch._set_SW_mode());
498
   SERIAL_ECHOLNPGM(STR_M119_REPORT);
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
   #if HAS_X_MIN
500
   #if HAS_X_MIN
501
     ES_REPORT(X_MIN);
501
     ES_REPORT(X_MIN);
502
   #endif
502
   #endif
564
     ES_REPORT(K_MAX);
564
     ES_REPORT(K_MAX);
565
   #endif
565
   #endif
566
   #if BOTH(MARLIN_DEV_MODE, PROBE_ACTIVATION_SWITCH)
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
   #endif
568
   #endif
569
   #if USES_Z_MIN_PROBE_PIN
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
   #endif
571
   #endif
572
   #if MULTI_FILAMENT_SENSOR
572
   #if MULTI_FILAMENT_SENSOR
573
     #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
573
     #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
584
     }
584
     }
585
     #undef _CASE_RUNOUT
585
     #undef _CASE_RUNOUT
586
   #elif HAS_FILAMENT_SENSOR
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
   #endif
588
   #endif
589
 
589
 
590
   TERN_(BLTOUCH, bltouch._reset_SW_mode());
590
   TERN_(BLTOUCH, bltouch._reset_SW_mode());

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

178
 }
178
 }
179
 
179
 
180
 // pretty report with PWM info
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
   char buffer[MAX_NAME_LENGTH + 1];   // for the sprintf statements
182
   char buffer[MAX_NAME_LENGTH + 1];   // for the sprintf statements
183
   bool found = false, multi_name_pin = false;
183
   bool found = false, multi_name_pin = false;
184
 
184
 
202
   LOOP_L_N(x, COUNT(pin_array))  {    // scan entire array and report all instances of this pin
202
   LOOP_L_N(x, COUNT(pin_array))  {    // scan entire array and report all instances of this pin
203
     if (GET_ARRAY_PIN(x) == pin) {
203
     if (GET_ARRAY_PIN(x) == pin) {
204
       if (!found) {    // report digital and analog pin number only on the first time through
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
         SERIAL_ECHOPGM("PIN: ");
206
         SERIAL_ECHOPGM("PIN: ");
207
         PRINT_PIN(pin);
207
         PRINT_PIN(pin);
208
         PRINT_PORT(pin);
208
         PRINT_PORT(pin);
211
       }
211
       }
212
       else {
212
       else {
213
         SERIAL_CHAR('.');
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
       PRINT_ARRAY_NAME(x);
216
       PRINT_ARRAY_NAME(x);
217
       if (extended) {
217
       if (extended) {
250
   } // end of for loop
250
   } // end of for loop
251
 
251
 
252
   if (!found) {
252
   if (!found) {
253
-    if (start_string) SERIAL_ECHOPGM_P(start_string);
253
+    if (start_string) SERIAL_ECHOF(start_string);
254
     SERIAL_ECHOPGM("PIN: ");
254
     SERIAL_ECHOPGM("PIN: ");
255
     PRINT_PIN(pin);
255
     PRINT_PIN(pin);
256
     PRINT_PORT(pin);
256
     PRINT_PORT(pin);

正在加载...
取消
保存