瀏覽代碼

A single SERIAL_ECHO macro type (#12557)

Scott Lahteine 6 年之前
父節點
當前提交
c986239837
沒有連結到貢獻者的電子郵件帳戶。
共有 86 個檔案被更改,包括 1026 行新增1366 行删除
  1. 1
    2
      Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp
  2. 34
    34
      Marlin/src/HAL/HAL_AVR/pinsDebug.h
  3. 1
    2
      Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp
  4. 2
    2
      Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp
  5. 1
    2
      Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp
  6. 1
    1
      Marlin/src/HAL/HAL_DUE/pinsDebug.h
  7. 2
    2
      Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp
  8. 11
    11
      Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp
  9. 1
    2
      Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp
  10. 1
    2
      Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp
  11. 1
    2
      Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp
  12. 1
    2
      Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp
  13. 1
    2
      Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp
  14. 1
    2
      Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp
  15. 1
    1
      Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h
  16. 1
    2
      Marlin/src/HAL/shared/backtrace/backtrace.cpp
  17. 6
    11
      Marlin/src/Marlin.cpp
  18. 18
    18
      Marlin/src/core/serial.cpp
  19. 126
    160
      Marlin/src/core/serial.h
  20. 17
    28
      Marlin/src/feature/I2CPositionEncoder.cpp
  21. 2
    2
      Marlin/src/feature/I2CPositionEncoder.h
  22. 16
    16
      Marlin/src/feature/bedlevel/bedlevel.cpp
  23. 2
    3
      Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp
  24. 17
    19
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  25. 3
    9
      Marlin/src/feature/bedlevel/ubl/ubl.h
  26. 122
    163
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  27. 1
    2
      Marlin/src/feature/dac/stepper_dac.cpp
  28. 4
    8
      Marlin/src/feature/pause.cpp
  29. 3
    3
      Marlin/src/feature/runout.h
  30. 1
    2
      Marlin/src/feature/solenoid.cpp
  31. 4
    4
      Marlin/src/feature/tmc_util.cpp
  32. 1
    2
      Marlin/src/feature/twibus.cpp
  33. 12
    12
      Marlin/src/gcode/bedlevel/G26.cpp
  34. 6
    8
      Marlin/src/gcode/bedlevel/M420.cpp
  35. 31
    39
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  36. 4
    8
      Marlin/src/gcode/bedlevel/abl/M421.cpp
  37. 12
    12
      Marlin/src/gcode/bedlevel/mbl/G29.cpp
  38. 4
    8
      Marlin/src/gcode/bedlevel/mbl/M421.cpp
  39. 4
    8
      Marlin/src/gcode/bedlevel/ubl/M421.cpp
  40. 1
    1
      Marlin/src/gcode/bedlevel/ubl/M49.cpp
  41. 2
    4
      Marlin/src/gcode/calibrate/G28.cpp
  42. 28
    33
      Marlin/src/gcode/calibrate/G33.cpp
  43. 3
    3
      Marlin/src/gcode/calibrate/G34_M422.cpp
  44. 21
    35
      Marlin/src/gcode/calibrate/M48.cpp
  45. 2
    4
      Marlin/src/gcode/calibrate/M665.cpp
  46. 1
    3
      Marlin/src/gcode/calibrate/M852.cpp
  47. 2
    4
      Marlin/src/gcode/config/M200-M205.cpp
  48. 2
    4
      Marlin/src/gcode/config/M301.cpp
  49. 32
    34
      Marlin/src/gcode/config/M43.cpp
  50. 2
    4
      Marlin/src/gcode/eeprom/M500-M504.cpp
  51. 2
    2
      Marlin/src/gcode/feature/advance/M900.cpp
  52. 1
    2
      Marlin/src/gcode/feature/caselight/M355.cpp
  53. 3
    6
      Marlin/src/gcode/feature/filwidth/M404-M407.cpp
  54. 3
    6
      Marlin/src/gcode/feature/i2c/M260_M261.cpp
  55. 2
    4
      Marlin/src/gcode/feature/macro/M810-M819.cpp
  56. 3
    6
      Marlin/src/gcode/gcode.cpp
  57. 1
    1
      Marlin/src/gcode/geometry/G53-G59.cpp
  58. 1
    2
      Marlin/src/gcode/geometry/M206_M428.cpp
  59. 12
    12
      Marlin/src/gcode/host/M114.cpp
  60. 3
    3
      Marlin/src/gcode/host/M115.cpp
  61. 2
    4
      Marlin/src/gcode/lcd/M145.cpp
  62. 1
    1
      Marlin/src/gcode/lcd/M250.cpp
  63. 5
    9
      Marlin/src/gcode/motion/G2_G3.cpp
  64. 1
    2
      Marlin/src/gcode/motion/G5.cpp
  65. 3
    3
      Marlin/src/gcode/probe/G30.cpp
  66. 1
    4
      Marlin/src/gcode/probe/G38.cpp
  67. 3
    8
      Marlin/src/gcode/probe/M851.cpp
  68. 13
    14
      Marlin/src/gcode/queue.cpp
  69. 2
    2
      Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp
  70. 2
    3
      Marlin/src/gcode/temperature/M105.cpp
  71. 1
    1
      Marlin/src/lcd/menu/menu_ubl.cpp
  72. 6
    10
      Marlin/src/libs/vector_3.cpp
  73. 180
    280
      Marlin/src/module/configuration_store.cpp
  74. 19
    19
      Marlin/src/module/endstops.cpp
  75. 7
    14
      Marlin/src/module/motion.cpp
  76. 2
    4
      Marlin/src/module/planner.cpp
  77. 3
    3
      Marlin/src/module/printcounter.cpp
  78. 7
    15
      Marlin/src/module/probe.cpp
  79. 2
    2
      Marlin/src/module/scara.cpp
  80. 46
    47
      Marlin/src/module/stepper.cpp
  81. 62
    62
      Marlin/src/module/temperature.cpp
  82. 1
    2
      Marlin/src/module/tool_change.cpp
  83. 10
    10
      Marlin/src/pins/pinsDebug.h
  84. 1
    1
      Marlin/src/sd/SdBaseFile.cpp
  85. 1
    1
      Marlin/src/sd/SdBaseFile.h
  86. 41
    56
      Marlin/src/sd/cardreader.cpp

+ 1
- 2
Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp 查看文件

39
     if (v != eeprom_read_byte(p)) {
39
     if (v != eeprom_read_byte(p)) {
40
       eeprom_write_byte(p, v);
40
       eeprom_write_byte(p, v);
41
       if (eeprom_read_byte(p) != v) {
41
       if (eeprom_read_byte(p) != v) {
42
-        SERIAL_ECHO_START();
43
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
42
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
44
         return true;
43
         return true;
45
       }
44
       }
46
     }
45
     }

+ 34
- 34
Marlin/src/HAL/HAL_AVR/pinsDebug.h 查看文件

150
     default:
150
     default:
151
       return false;
151
       return false;
152
   }
152
   }
153
-  SERIAL_PROTOCOL_SP(2);
153
+  SERIAL_ECHO_SP(2);
154
 } // pwm_status
154
 } // pwm_status
155
 
155
 
156
 
156
 
222
 
222
 
223
 #define OCR_VAL(T, L)   pgm_read_word(&PWM_OCR[T][L])
223
 #define OCR_VAL(T, L)   pgm_read_word(&PWM_OCR[T][L])
224
 
224
 
225
-static void err_is_counter()     { SERIAL_PROTOCOLPGM("   non-standard PWM mode"); }
226
-static void err_is_interrupt()   { SERIAL_PROTOCOLPGM("   compare interrupt enabled"); }
227
-static void err_prob_interrupt() { SERIAL_PROTOCOLPGM("   overflow interrupt enabled"); }
228
-static void print_is_also_tied() { SERIAL_PROTOCOLPGM(" is also tied to this pin"); SERIAL_PROTOCOL_SP(14); }
225
+static void err_is_counter()     { SERIAL_ECHOPGM("   non-standard PWM mode"); }
226
+static void err_is_interrupt()   { SERIAL_ECHOPGM("   compare interrupt enabled"); }
227
+static void err_prob_interrupt() { SERIAL_ECHOPGM("   overflow interrupt enabled"); }
228
+static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); SERIAL_ECHO_SP(14); }
229
 
229
 
230
 void com_print(uint8_t N, uint8_t Z) {
230
 void com_print(uint8_t N, uint8_t Z) {
231
   const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
231
   const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
232
-  SERIAL_PROTOCOLPGM("    COM");
233
-  SERIAL_PROTOCOLCHAR(N + '0');
232
+  SERIAL_ECHOPGM("    COM");
233
+  SERIAL_CHAR(N + '0');
234
   switch (Z) {
234
   switch (Z) {
235
     case 'A':
235
     case 'A':
236
-      SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
236
+      SERIAL_ECHOPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
237
       break;
237
       break;
238
     case 'B':
238
     case 'B':
239
-      SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
239
+      SERIAL_ECHOPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
240
       break;
240
       break;
241
     case 'C':
241
     case 'C':
242
-      SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
242
+      SERIAL_ECHOPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
243
       break;
243
       break;
244
   }
244
   }
245
 }
245
 }
251
   uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1))));
251
   uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1))));
252
   if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
252
   if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
253
 
253
 
254
-  SERIAL_PROTOCOLPGM("    TIMER");
255
-  SERIAL_PROTOCOLCHAR(T + '0');
256
-  SERIAL_PROTOCOLCHAR(L);
257
-  SERIAL_PROTOCOL_SP(3);
254
+  SERIAL_ECHOPGM("    TIMER");
255
+  SERIAL_CHAR(T + '0');
256
+  SERIAL_CHAR(L);
257
+  SERIAL_ECHO_SP(3);
258
 
258
 
259
   if (N == 3) {
259
   if (N == 3) {
260
     const uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A');
260
     const uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A');
264
     const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
264
     const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
265
     PWM_PRINT(*OCRVAL16);
265
     PWM_PRINT(*OCRVAL16);
266
   }
266
   }
267
-  SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
267
+  SERIAL_ECHOPAIR("    WGM: ", WGM);
268
   com_print(T,L);
268
   com_print(T,L);
269
-  SERIAL_PROTOCOLPAIR("    CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
269
+  SERIAL_ECHOPAIR("    CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
270
 
270
 
271
-  SERIAL_PROTOCOLPGM("    TCCR");
272
-  SERIAL_PROTOCOLCHAR(T + '0');
273
-  SERIAL_PROTOCOLPAIR("A: ", *TCCRA);
271
+  SERIAL_ECHOPGM("    TCCR");
272
+  SERIAL_CHAR(T + '0');
273
+  SERIAL_ECHOPAIR("A: ", *TCCRA);
274
 
274
 
275
-  SERIAL_PROTOCOLPGM("    TCCR");
276
-  SERIAL_PROTOCOLCHAR(T + '0');
277
-  SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
275
+  SERIAL_ECHOPGM("    TCCR");
276
+  SERIAL_CHAR(T + '0');
277
+  SERIAL_ECHOPAIR("B: ", *TCCRB);
278
 
278
 
279
   const uint8_t *TMSK = (uint8_t*)TIMSK(T);
279
   const uint8_t *TMSK = (uint8_t*)TIMSK(T);
280
-  SERIAL_PROTOCOLPGM("    TIMSK");
281
-  SERIAL_PROTOCOLCHAR(T + '0');
282
-  SERIAL_PROTOCOLPAIR(": ", *TMSK);
280
+  SERIAL_ECHOPGM("    TIMSK");
281
+  SERIAL_CHAR(T + '0');
282
+  SERIAL_ECHOPAIR(": ", *TMSK);
283
 
283
 
284
   const uint8_t OCIE = L - 'A' + 1;
284
   const uint8_t OCIE = L - 'A' + 1;
285
   if (N == 3) { if (WGM == 0 || WGM == 2 || WGM ==  4 || WGM ==  6) err_is_counter(); }
285
   if (N == 3) { if (WGM == 0 || WGM == 2 || WGM ==  4 || WGM ==  6) err_is_counter(); }
336
     case NOT_ON_TIMER: break;
336
     case NOT_ON_TIMER: break;
337
 
337
 
338
   }
338
   }
339
-  SERIAL_PROTOCOLPGM("  ");
339
+  SERIAL_ECHOPGM("  ");
340
 
340
 
341
   // on pins that have two PWMs, print info on second PWM
341
   // on pins that have two PWMs, print info on second PWM
342
   #if AVR_ATmega2560_FAMILY || AVR_AT90USB1286_FAMILY
342
   #if AVR_ATmega2560_FAMILY || AVR_AT90USB1286_FAMILY
343
     // looking for port B7 - PWMs 0A and 1C
343
     // looking for port B7 - PWMs 0A and 1C
344
     if (digitalPinToPort_DEBUG(pin) == 'B' - 64 && 0x80 == digitalPinToBitMask_DEBUG(pin)) {
344
     if (digitalPinToPort_DEBUG(pin) == 'B' - 64 && 0x80 == digitalPinToBitMask_DEBUG(pin)) {
345
       #if !AVR_AT90USB1286_FAMILY
345
       #if !AVR_AT90USB1286_FAMILY
346
-        SERIAL_PROTOCOLPGM("\n .");
347
-        SERIAL_PROTOCOL_SP(18);
348
-        SERIAL_PROTOCOLPGM("TIMER1C");
346
+        SERIAL_ECHOPGM("\n .");
347
+        SERIAL_ECHO_SP(18);
348
+        SERIAL_ECHOPGM("TIMER1C");
349
         print_is_also_tied();
349
         print_is_also_tied();
350
         timer_prefix(1, 'C', 4);
350
         timer_prefix(1, 'C', 4);
351
       #else
351
       #else
352
-        SERIAL_PROTOCOLPGM("\n .");
353
-        SERIAL_PROTOCOL_SP(18);
354
-        SERIAL_PROTOCOLPGM("TIMER0A");
352
+        SERIAL_ECHOPGM("\n .");
353
+        SERIAL_ECHO_SP(18);
354
+        SERIAL_ECHOPGM("TIMER0A");
355
         print_is_also_tied();
355
         print_is_also_tied();
356
         timer_prefix(0, 'A', 3);
356
         timer_prefix(0, 'A', 3);
357
       #endif
357
       #endif
372
   void print_port(int8_t pin) {   // print port number
372
   void print_port(int8_t pin) {   // print port number
373
     #ifdef digitalPinToPort_DEBUG
373
     #ifdef digitalPinToPort_DEBUG
374
       uint8_t x;
374
       uint8_t x;
375
-      SERIAL_PROTOCOLPGM("  Port: ");
375
+      SERIAL_ECHOPGM("  Port: ");
376
       #if AVR_AT90USB1286_FAMILY
376
       #if AVR_AT90USB1286_FAMILY
377
         x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64;
377
         x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64;
378
       #else
378
       #else
395
       #endif
395
       #endif
396
       SERIAL_CHAR(x);
396
       SERIAL_CHAR(x);
397
     #else
397
     #else
398
-      SERIAL_PROTOCOL_SP(10);
398
+      SERIAL_ECHO_SP(10);
399
     #endif
399
     #endif
400
   }
400
   }
401
 
401
 

+ 1
- 2
Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp 查看文件

62
 #if ENABLED(WATCHDOG_RESET_MANUAL)
62
 #if ENABLED(WATCHDOG_RESET_MANUAL)
63
   ISR(WDT_vect) {
63
   ISR(WDT_vect) {
64
     sei();  // With the interrupt driven serial we need to allow interrupts.
64
     sei();  // With the interrupt driven serial we need to allow interrupts.
65
-    SERIAL_ERROR_START();
66
-    SERIAL_ERRORLNPGM(MSG_WATCHDOG_FIRED);
65
+    SERIAL_ERROR_MSG(MSG_WATCHDOG_FIRED);
67
     minkill();  // interrupt-safe final kill and infinite loop
66
     minkill();  // interrupt-safe final kill and infinite loop
68
   }
67
   }
69
 #endif // WATCHDOG_RESET_MANUAL
68
 #endif // WATCHDOG_RESET_MANUAL

+ 2
- 2
Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp 查看文件

121
     char buffer[80];
121
     char buffer[80];
122
 
122
 
123
     sprintf(buffer, "Page: %d (0x%04x)\n", page, page);
123
     sprintf(buffer, "Page: %d (0x%04x)\n", page, page);
124
-    SERIAL_PROTOCOL(buffer);
124
+    SERIAL_ECHO(buffer);
125
 
125
 
126
     char* p = &buffer[0];
126
     char* p = &buffer[0];
127
     for (int i = 0; i< PageSize; ++i) {
127
     for (int i = 0; i< PageSize; ++i) {
131
       if ((i & 0xF) == 0xF) {
131
       if ((i & 0xF) == 0xF) {
132
         *p++ = '\n';
132
         *p++ = '\n';
133
         *p = 0;
133
         *p = 0;
134
-        SERIAL_PROTOCOL(buffer);
134
+        SERIAL_ECHO(buffer);
135
         p = &buffer[0];
135
         p = &buffer[0];
136
       }
136
       }
137
     }
137
     }

+ 1
- 2
Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp 查看文件

53
     if (v != eeprom_read_byte(p)) {
53
     if (v != eeprom_read_byte(p)) {
54
       eeprom_write_byte(p, v);
54
       eeprom_write_byte(p, v);
55
       if (eeprom_read_byte(p) != v) {
55
       if (eeprom_read_byte(p) != v) {
56
-        SERIAL_ECHO_START();
57
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
56
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
58
         return true;
57
         return true;
59
       }
58
       }
60
     }
59
     }

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

93
 void pwm_details(int32_t pin) {
93
 void pwm_details(int32_t pin) {
94
   if (pwm_status(pin)) {
94
   if (pwm_status(pin)) {
95
     uint32_t chan = g_APinDescription[pin].ulPWMChannel;
95
     uint32_t chan = g_APinDescription[pin].ulPWMChannel;
96
-    SERIAL_PROTOCOLPAIR("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY);
96
+    SERIAL_ECHOPAIR("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY);
97
   }
97
   }
98
 }
98
 }
99
 
99
 

+ 2
- 2
Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp 查看文件

67
   #ifdef DEBUG_MMC
67
   #ifdef DEBUG_MMC
68
     char buffer[80];
68
     char buffer[80];
69
     sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr);
69
     sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr);
70
-    SERIAL_PROTOCOL_P(0, buffer);
70
+    SERIAL_ECHO_P(0, buffer);
71
   #endif
71
   #endif
72
 
72
 
73
   // Start reading
73
   // Start reading
101
   #ifdef DEBUG_MMC
101
   #ifdef DEBUG_MMC
102
     char buffer[80];
102
     char buffer[80];
103
     sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr);
103
     sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr);
104
-    SERIAL_PROTOCOL_P(0, buffer);
104
+    SERIAL_ECHO_P(0, buffer);
105
   #endif
105
   #endif
106
 
106
 
107
   if (!card.getSd2Card().writeStart(addr, nb_sector))
107
   if (!card.getSd2Card().writeStart(addr, nb_sector))

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

80
 // to see errors that are happening in read_data / write_data
80
 // to see errors that are happening in read_data / write_data
81
 static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
81
 static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
82
   PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
82
   PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
83
-  SERIAL_PROTOCOLCHAR(' ');
83
+  SERIAL_CHAR(' ');
84
   serialprintPGM(rw_str);
84
   serialprintPGM(rw_str);
85
-  SERIAL_PROTOCOLPAIR("_data(", pos);
86
-  SERIAL_PROTOCOLPAIR(",", (int)value);
87
-  SERIAL_PROTOCOLPAIR(",", (int)size);
88
-  SERIAL_PROTOCOLLNPGM(", ...)");
85
+  SERIAL_ECHOPAIR("_data(", pos);
86
+  SERIAL_ECHOPAIR(",", (int)value);
87
+  SERIAL_ECHOPAIR(",", (int)size);
88
+  SERIAL_ECHOLNPGM(", ...)");
89
   if (total) {
89
   if (total) {
90
-    SERIAL_PROTOCOLPGM(" f_");
90
+    SERIAL_ECHOPGM(" f_");
91
     serialprintPGM(rw_str);
91
     serialprintPGM(rw_str);
92
-    SERIAL_PROTOCOLPAIR("()=", (int)s);
93
-    SERIAL_PROTOCOLPAIR("\n size=", size);
94
-    SERIAL_PROTOCOLPGM("\n bytes_");
92
+    SERIAL_ECHOPAIR("()=", (int)s);
93
+    SERIAL_ECHOPAIR("\n size=", size);
94
+    SERIAL_ECHOPGM("\n bytes_");
95
     serialprintPGM(write ? PSTR("written=") : PSTR("read="));
95
     serialprintPGM(write ? PSTR("written=") : PSTR("read="));
96
-    SERIAL_PROTOCOLLN(total);
96
+    SERIAL_ECHOLN(total);
97
   }
97
   }
98
   else
98
   else
99
-    SERIAL_PROTOCOLLNPAIR(" f_lseek()=", (int)s);
99
+    SERIAL_ECHOLNPAIR(" f_lseek()=", (int)s);
100
 }
100
 }
101
 
101
 
102
 // File function return codes for type FRESULT. This goes away soon, but
102
 // File function return codes for type FRESULT. This goes away soon, but

+ 1
- 2
Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp 查看文件

62
       if (v != eeprom_read_byte(p)) {
62
       if (v != eeprom_read_byte(p)) {
63
         eeprom_write_byte(p, v);
63
         eeprom_write_byte(p, v);
64
         if (eeprom_read_byte(p) != v) {
64
         if (eeprom_read_byte(p) != v) {
65
-          SERIAL_ECHO_START();
66
-          SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
65
+          SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
67
           return true;
66
           return true;
68
         }
67
         }
69
       }
68
       }

+ 1
- 2
Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp 查看文件

41
     if (v != eeprom_read_byte(p)) {
41
     if (v != eeprom_read_byte(p)) {
42
       eeprom_write_byte(p, v);
42
       eeprom_write_byte(p, v);
43
       if (eeprom_read_byte(p) != v) {
43
       if (eeprom_read_byte(p) != v) {
44
-        SERIAL_ECHO_START();
45
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
44
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
46
         return true;
45
         return true;
47
       }
46
       }
48
     }
47
     }

+ 1
- 2
Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp 查看文件

41
     if (v != eeprom_read_byte(p)) {
41
     if (v != eeprom_read_byte(p)) {
42
       eeprom_write_byte(p, v);
42
       eeprom_write_byte(p, v);
43
       if (eeprom_read_byte(p) != v) {
43
       if (eeprom_read_byte(p) != v) {
44
-        SERIAL_ECHO_START();
45
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
44
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
46
         return true;
45
         return true;
47
       }
46
       }
48
     }
47
     }

+ 1
- 2
Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp 查看文件

21
     if (v != eeprom_read_byte(p)) {
21
     if (v != eeprom_read_byte(p)) {
22
       eeprom_write_byte(p, v);
22
       eeprom_write_byte(p, v);
23
       if (eeprom_read_byte(p) != v) {
23
       if (eeprom_read_byte(p) != v) {
24
-        SERIAL_ECHO_START();
25
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
24
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
26
         return true;
25
         return true;
27
       }
26
       }
28
     }
27
     }

+ 1
- 2
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp 查看文件

42
     if (v != eeprom_read_byte(p)) {
42
     if (v != eeprom_read_byte(p)) {
43
       eeprom_write_byte(p, v);
43
       eeprom_write_byte(p, v);
44
       if (eeprom_read_byte(p) != v) {
44
       if (eeprom_read_byte(p) != v) {
45
-        SERIAL_ECHO_START();
46
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
45
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
47
         return true;
46
         return true;
48
       }
47
       }
49
     }
48
     }

+ 1
- 2
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp 查看文件

21
     if (v != eeprom_read_byte(p)) {
21
     if (v != eeprom_read_byte(p)) {
22
       eeprom_write_byte(p, v);
22
       eeprom_write_byte(p, v);
23
       if (eeprom_read_byte(p) != v) {
23
       if (eeprom_read_byte(p) != v) {
24
-        SERIAL_ECHO_START();
25
-        SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
24
+        SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
26
         return true;
25
         return true;
27
       }
26
       }
28
     }
27
     }

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

102
     default:
102
     default:
103
       return false;
103
       return false;
104
   }
104
   }
105
-  SERIAL_PROTOCOLPGM("  ");
105
+  SERIAL_ECHOPGM("  ");
106
 }
106
 }
107
 
107
 
108
 static void HAL_pwm_details(uint8_t pin) { /* TODO */ }
108
 static void HAL_pwm_details(uint8_t pin) { /* TODO */ }

+ 1
- 2
Marlin/src/HAL/shared/backtrace/backtrace.cpp 查看文件

88
   btf.pc = pc | 1; // Force Thumb, as CORTEX only support it
88
   btf.pc = pc | 1; // Force Thumb, as CORTEX only support it
89
 
89
 
90
   // Perform a backtrace
90
   // Perform a backtrace
91
-  SERIAL_ERROR_START();
92
-  SERIAL_ERRORLNPGM("Backtrace:");
91
+  SERIAL_ERROR_MSG("Backtrace:");
93
   int ctr = 0;
92
   int ctr = 0;
94
   UnwindStart(&btf, &UnwCallbacks, &ctr);
93
   UnwindStart(&btf, &UnwCallbacks, &ctr);
95
 }
94
 }

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

264
 }
264
 }
265
 
265
 
266
 void protected_pin_err() {
266
 void protected_pin_err() {
267
-  SERIAL_ERROR_START();
268
-  SERIAL_ERRORLNPGM(MSG_ERR_PROTECTED_PIN);
267
+  SERIAL_ERROR_MSG(MSG_ERR_PROTECTED_PIN);
269
 }
268
 }
270
 
269
 
271
 void quickstop_stepper() {
270
 void quickstop_stepper() {
400
     // KILL the machine
399
     // KILL the machine
401
     // ----------------------------------------------------------------
400
     // ----------------------------------------------------------------
402
     if (killCount >= KILL_DELAY) {
401
     if (killCount >= KILL_DELAY) {
403
-      SERIAL_ERROR_START();
404
-      SERIAL_ERRORLNPGM(MSG_KILL_BUTTON);
402
+      SERIAL_ERROR_MSG(MSG_KILL_BUTTON);
405
       kill();
403
       kill();
406
     }
404
     }
407
   #endif
405
   #endif
606
 void kill(PGM_P const lcd_msg/*=NULL*/) {
604
 void kill(PGM_P const lcd_msg/*=NULL*/) {
607
   thermalManager.disable_all_heaters();
605
   thermalManager.disable_all_heaters();
608
 
606
 
609
-  SERIAL_ERROR_START();
610
-  SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
607
+  SERIAL_ERROR_MSG(MSG_ERR_KILLED);
611
 
608
 
612
   #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
609
   #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
613
     ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED));
610
     ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED));
663
 
660
 
664
   if (IsRunning()) {
661
   if (IsRunning()) {
665
     Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
662
     Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
666
-    SERIAL_ERROR_START();
667
-    SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
663
+    SERIAL_ERROR_MSG(MSG_ERR_STOPPED);
668
     LCD_MESSAGEPGM(MSG_STOPPED);
664
     LCD_MESSAGEPGM(MSG_STOPPED);
669
     safe_delay(350);       // allow enough time for messages to get out before stopping
665
     safe_delay(350);       // allow enough time for messages to get out before stopping
670
     Running = false;
666
     Running = false;
745
     #endif
741
     #endif
746
   #endif
742
   #endif
747
 
743
 
748
-  SERIAL_PROTOCOLLNPGM("start");
744
+  SERIAL_ECHOLNPGM("start");
749
   SERIAL_ECHO_START();
745
   SERIAL_ECHO_START();
750
 
746
 
751
   #if TMC_HAS_SPI
747
   #if TMC_HAS_SPI
781
     SERIAL_ECHOPGM(MSG_CONFIGURATION_VER);
777
     SERIAL_ECHOPGM(MSG_CONFIGURATION_VER);
782
     SERIAL_ECHOPGM(STRING_DISTRIBUTION_DATE);
778
     SERIAL_ECHOPGM(STRING_DISTRIBUTION_DATE);
783
     SERIAL_ECHOLNPGM(MSG_AUTHOR STRING_CONFIG_H_AUTHOR);
779
     SERIAL_ECHOLNPGM(MSG_AUTHOR STRING_CONFIG_H_AUTHOR);
784
-    SERIAL_ECHO_START();
785
-    SERIAL_ECHOLNPGM("Compiled: " __DATE__);
780
+    SERIAL_ECHO_MSG("Compiled: " __DATE__);
786
   #endif
781
   #endif
787
 
782
 
788
   SERIAL_ECHO_START();
783
   SERIAL_ECHO_START();

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

33
     while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch);
33
     while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch);
34
   }
34
   }
35
 
35
 
36
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v)   { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
37
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v)          { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); }
38
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v)           { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
39
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v)          { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
40
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v)         { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
41
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v)        { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
42
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v)  { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
43
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
36
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, const char *v)   { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
37
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, char v)          { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); }
38
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, int v)           { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
39
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, long v)          { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
40
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, float v)         { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
41
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, double v)        { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
42
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned int v)  { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
43
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); }
44
 
44
 
45
   void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); }
45
   void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); }
46
 
46
 
56
 void serial_echo_start()  { serialprintPGM(echomagic); }
56
 void serial_echo_start()  { serialprintPGM(echomagic); }
57
 void serial_error_start() { serialprintPGM(errormagic); }
57
 void serial_error_start() { serialprintPGM(errormagic); }
58
 
58
 
59
-void serial_echopair_PGM(PGM_P s_P, const char *v)   { serialprintPGM(s_P); SERIAL_ECHO(v); }
60
-void serial_echopair_PGM(PGM_P s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
61
-void serial_echopair_PGM(PGM_P s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
62
-void serial_echopair_PGM(PGM_P s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
63
-void serial_echopair_PGM(PGM_P s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
64
-void serial_echopair_PGM(PGM_P s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
65
-void serial_echopair_PGM(PGM_P s_P, unsigned int v)  { serialprintPGM(s_P); SERIAL_ECHO(v); }
66
-void serial_echopair_PGM(PGM_P s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
59
+void serial_echopair_PGM(PGM_P const s_P, const char *v)   { serialprintPGM(s_P); SERIAL_ECHO(v); }
60
+void serial_echopair_PGM(PGM_P const s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
61
+void serial_echopair_PGM(PGM_P const s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
62
+void serial_echopair_PGM(PGM_P const s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
63
+void serial_echopair_PGM(PGM_P const s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
64
+void serial_echopair_PGM(PGM_P const s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
65
+void serial_echopair_PGM(PGM_P const s_P, unsigned int v)  { serialprintPGM(s_P); SERIAL_ECHO(v); }
66
+void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
67
 
67
 
68
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
68
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
69
 
69
 
74
 
74
 
75
   #include "enum.h"
75
   #include "enum.h"
76
 
76
 
77
-  void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z) {
77
+  void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) {
78
     serialprintPGM(prefix);
78
     serialprintPGM(prefix);
79
     SERIAL_CHAR('(');
79
     SERIAL_CHAR('(');
80
     SERIAL_ECHO(x);
80
     SERIAL_ECHO(x);
84
     if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
84
     if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
85
   }
85
   }
86
 
86
 
87
-  void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]) {
87
+  void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) {
88
     print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
88
     print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
89
   }
89
   }
90
 
90
 

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

48
 #endif
48
 #endif
49
 
49
 
50
 #if NUM_SERIAL > 1
50
 #if NUM_SERIAL > 1
51
-  #define SERIAL_CHAR_P(p,x)                        (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x))
52
-  #define SERIAL_PROTOCOL_P(p,x)                    (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_PROTOCOL(x))
53
-  #define SERIAL_PROTOCOL_F_P(p,x,y)                (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_PROTOCOL_F(x,y))
54
-  #define SERIAL_PROTOCOLLN_P(p,x)                  (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_PROTOCOLLN(x))
55
-  #define SERIAL_PRINT_P(p,x,b)                     (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b))
56
-  #define SERIAL_PRINTLN_P(p,x,b)                   (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b))
57
-  #define SERIAL_PRINTF_P(p,args...)                (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args))
58
-
59
-  #define SERIAL_CHAR(x)                            (MYSERIAL0.write(x), MYSERIAL1.write(x))
60
-  #define SERIAL_PROTOCOL(x)                        (MYSERIAL0.print(x), MYSERIAL1.print(x))
61
-  #define SERIAL_PROTOCOL_F(x,y)                    (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y))
62
-  #define SERIAL_PROTOCOLLN(x)                      (MYSERIAL0.println(x), MYSERIAL1.println(x))
63
-  #define SERIAL_PRINT(x,b)                         (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b))
64
-  #define SERIAL_PRINTLN(x,b)                       (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b))
65
-  #define SERIAL_PRINTF(args...)                    (MYSERIAL0.printf(args), MYSERIAL1.printf(args))
66
-
67
-  #define SERIAL_FLUSH_P(p)                         (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH())
68
-  #define SERIAL_FLUSH()                            (MYSERIAL0.flush(), MYSERIAL1.flush())
51
+
52
+  //
53
+  // Serial out to all ports
54
+  //
55
+  #define SERIAL_CHAR(x)                    (MYSERIAL0.write(x), MYSERIAL1.write(x))
56
+  #define SERIAL_ECHO(x)                    (MYSERIAL0.print(x), MYSERIAL1.print(x))
57
+  #define SERIAL_ECHO_F(x,y)                (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y))
58
+  #define SERIAL_ECHOLN(x)                  (MYSERIAL0.println(x), MYSERIAL1.println(x))
59
+  #define SERIAL_PRINT(x,b)                 (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b))
60
+  #define SERIAL_PRINTLN(x,b)               (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b))
61
+  #define SERIAL_PRINTF(args...)            (MYSERIAL0.printf(args), MYSERIAL1.printf(args))
62
+  #define SERIAL_FLUSH()                    (MYSERIAL0.flush(), MYSERIAL1.flush())
63
+  #if TX_BUFFER_SIZE > 0
64
+    #define SERIAL_FLUSHTX()                (MYSERIAL0.flushTX(), MYSERIAL1.flushTX())
65
+  #endif
66
+
67
+  //
68
+  // Serial out with port redirect
69
+  //
70
+  #define SERIAL_CHAR_P(p,x)                (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x))
71
+  #define SERIAL_ECHO_P(p,x)                (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_ECHO(x))
72
+  #define SERIAL_ECHO_F_P(p,x,y)            (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_ECHO_F(x,y))
73
+  #define SERIAL_ECHOLN_P(p,x)              (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_ECHOLN(x))
74
+  #define SERIAL_PRINT_P(p,x,b)             (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b))
75
+  #define SERIAL_PRINTLN_P(p,x,b)           (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b))
76
+  #define SERIAL_PRINTF_P(p,args...)        (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args))
77
+  #define SERIAL_FLUSH_P(p)                 (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH())
69
   #if TX_BUFFER_SIZE > 0
78
   #if TX_BUFFER_SIZE > 0
70
-    #define SERIAL_FLUSHTX_P(p)                     (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX())
71
-    #define SERIAL_FLUSHTX()                        (MYSERIAL0.flushTX(), MYSERIAL1.flushTX())
79
+    #define SERIAL_FLUSHTX_P(p)             (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX())
72
   #endif
80
   #endif
73
 
81
 
74
-  #define SERIAL_EOL_P(p) SERIAL_CHAR_P(p,'\n')
75
-
76
-  #define SERIAL_PROTOCOLCHAR_P(p,x)                SERIAL_CHAR_P(p,x)
77
-  #define SERIAL_PROTOCOLPGM_P(p,x)                 (serialprintPGM_P(p,PSTR(x)))
78
-  #define SERIAL_PROTOCOLLNPGM_P(p,x)               (serialprintPGM_P(p,PSTR(x "\n")))
79
-  #define SERIAL_PROTOCOLPAIR_P(p, pre, value)      (serial_echopair_PGM_P(p,PSTR(pre),(value)))
80
-  #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value)    do{ SERIAL_PROTOCOLPAIR_P(p, pre, value); SERIAL_EOL_P(p); }while(0)
81
-
82
-  #define SERIAL_ECHO_START_P(p)                    serial_echo_start_P(p)
83
-  #define SERIAL_ECHO_P(p,x)                        SERIAL_PROTOCOL_P(p,x)
84
-  #define SERIAL_ECHOPGM_P(p,x)                     SERIAL_PROTOCOLPGM_P(p,x)
85
-  #define SERIAL_ECHOLN_P(p,x)                      SERIAL_PROTOCOLLN_P(p,x)
86
-  #define SERIAL_ECHOLNPGM_P(p,x)                   SERIAL_PROTOCOLLNPGM_P(p,x)
87
-  #define SERIAL_ECHOPAIR_P(p,pre,value)            SERIAL_PROTOCOLPAIR_P(p, pre, value)
88
-  #define SERIAL_ECHOLNPAIR_P(p,pre, value)         SERIAL_PROTOCOLLNPAIR_P(p, pre, value)
89
-  #define SERIAL_ECHO_F_P(p,x,y)                    SERIAL_PROTOCOL_F_P(p,x,y)
90
-
91
-  #define SERIAL_ERROR_START_P(p)                   serial_error_start_P(p)
92
-  #define SERIAL_ERROR_P(p,x)                       SERIAL_PROTOCOL_P(p,x)
93
-  #define SERIAL_ERRORPGM_P(p,x)                    SERIAL_PROTOCOLPGM_P(p,x)
94
-  #define SERIAL_ERRORLN_P(p,x)                     SERIAL_PROTOCOLLN_P(p,x)
95
-  #define SERIAL_ERRORLNPGM_P(p,x)                  SERIAL_PROTOCOLLNPGM_P(p,x)
96
-
97
-  // These macros compensate for float imprecision
98
-  #define SERIAL_PROTOCOLPAIR_F_P(p, pre, value)    SERIAL_PROTOCOLPAIR_P(p, pre, FIXFLOAT(value))
99
-  #define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value)  SERIAL_PROTOCOLLNPAIR_P(p, pre, FIXFLOAT(value))
100
-  #define SERIAL_ECHOPAIR_F_P(p,pre,value)          SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value))
101
-  #define SERIAL_ECHOLNPAIR_F_P(p,pre, value)       SERIAL_ECHOLNPAIR_P(p, pre, FIXFLOAT(value))
102
-
103
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v);
104
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v);
105
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v);
106
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v);
107
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v);
108
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v);
109
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v);
110
-  void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v);
111
-  inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); }
112
-  inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, bool v)    { serial_echopair_PGM_P(p, s_P, (int)v); }
113
-  inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, void *v)   { serial_echopair_PGM_P(p, s_P, (unsigned long)v); }
82
+  #define SERIAL_ECHOPGM_P(p,x)             (serialprintPGM_P(p,PSTR(x)))
83
+  #define SERIAL_ECHOLNPGM_P(p,x)           (serialprintPGM_P(p,PSTR(x "\n")))
84
+  #define SERIAL_ECHOPAIR_P(p, pre, value)  (serial_echopair_PGM_P(p,PSTR(pre),(value)))
85
+
86
+  #define SERIAL_ECHO_START_P(p)            serial_echo_start_P(p)
87
+  #define SERIAL_ERROR_START_P(p)           serial_error_start_P(p)
88
+  #define SERIAL_EOL_P(p)                   SERIAL_CHAR_P(p,'\n')
89
+
90
+  #define SERIAL_ECHOPAIR_F_P(p, pre, value, y)   do{ SERIAL_ECHO_P(p, pre); SERIAL_ECHO_F_P(p, value, y); }while(0)
91
+  #define SERIAL_ECHOLNPAIR_F_P(p, pre, value, y) do{ SERIAL_ECHOPAIR_F_P(p, pre, value, y); SERIAL_EOL_P(p); }while(0)
92
+
93
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, const char *v);
94
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, char v);
95
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, int v);
96
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, long v);
97
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, float v);
98
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, double v);
99
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned int v);
100
+  void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, unsigned long v);
101
+  inline void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); }
102
+  inline void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, bool v)    { serial_echopair_PGM_P(p, s_P, (int)v); }
103
+  inline void serial_echopair_PGM_P(const int8_t p, PGM_P const s_P, void *v)   { serial_echopair_PGM_P(p, s_P, (unsigned long)v); }
114
 
104
 
115
   void serial_spaces_P(const int8_t p, uint8_t count);
105
   void serial_spaces_P(const int8_t p, uint8_t count);
116
-  #define SERIAL_ECHO_SP_P(p,C)                     serial_spaces_P(p,C)
117
-  #define SERIAL_ERROR_SP_P(p,C)                    serial_spaces_P(p,C)
118
-  #define SERIAL_PROTOCOL_SP_P(p,C)                 serial_spaces_P(p,C)
106
+  #define SERIAL_ECHO_SP_P(p,C)             serial_spaces_P(p,C)
119
 
107
 
120
   void serialprintPGM_P(const int8_t p, PGM_P str);
108
   void serialprintPGM_P(const int8_t p, PGM_P str);
121
   void serial_echo_start_P(const int8_t p);
109
   void serial_echo_start_P(const int8_t p);
122
   void serial_error_start_P(const int8_t p);
110
   void serial_error_start_P(const int8_t p);
123
 
111
 
124
-#else // NUM_SERIAL < 2
125
-
126
-  #define SERIAL_CHAR_P(p,x)                        SERIAL_CHAR(x)
127
-  #define SERIAL_PROTOCOL_P(p,x)                    SERIAL_PROTOCOL(x)
128
-  #define SERIAL_PROTOCOL_F_P(p,x,y)                SERIAL_PROTOCOL_F(x,y)
129
-  #define SERIAL_PROTOCOLLN_P(p,x)                  SERIAL_PROTOCOLLN(x)
130
-  #define SERIAL_PRINT_P(p,x,b)                     SERIAL_PRINT(x,b)
131
-  #define SERIAL_PRINTLN_P(p,x,b)                   SERIAL_PRINTLN(x,b)
132
-  #define SERIAL_PRINTF_P(p,args...)                SERIAL_PRINTF(args)
133
-
134
-  #define SERIAL_CHAR(x)                            MYSERIAL0.write(x)
135
-  #define SERIAL_PROTOCOL(x)                        MYSERIAL0.print(x)
136
-  #define SERIAL_PROTOCOL_F(x,y)                    MYSERIAL0.print(x,y)
137
-  #define SERIAL_PROTOCOLLN(x)                      MYSERIAL0.println(x)
138
-  #define SERIAL_PRINT(x,b)                         MYSERIAL0.print(x,b)
139
-  #define SERIAL_PRINTLN(x,b)                       MYSERIAL0.println(x,b)
140
-  #define SERIAL_PRINTF(args...)                    MYSERIAL0.printf(args)
141
-
142
-  #define SERIAL_FLUSH_P(p)                         SERIAL_FLUSH()
143
-  #define SERIAL_FLUSH()                            MYSERIAL0.flush()
112
+#else // NUM_SERIAL <= 1
113
+
114
+  //
115
+  // Serial out to all ports
116
+  //
117
+  #define SERIAL_CHAR(x)                    MYSERIAL0.write(x)
118
+  #define SERIAL_ECHO(x)                    MYSERIAL0.print(x)
119
+  #define SERIAL_ECHO_F(x,y)                MYSERIAL0.print(x,y)
120
+  #define SERIAL_ECHOLN(x)                  MYSERIAL0.println(x)
121
+  #define SERIAL_PRINT(x,b)                 MYSERIAL0.print(x,b)
122
+  #define SERIAL_PRINTLN(x,b)               MYSERIAL0.println(x,b)
123
+  #define SERIAL_PRINTF(args...)            MYSERIAL0.printf(args)
124
+  #define SERIAL_FLUSH()                    MYSERIAL0.flush()
144
   #if TX_BUFFER_SIZE > 0
125
   #if TX_BUFFER_SIZE > 0
145
-    #define SERIAL_FLUSHTX_P(p)                     SERIAL_FLUSHTX()
146
-    #define SERIAL_FLUSHTX()                        MYSERIAL0.flushTX()
126
+    #define SERIAL_FLUSHTX()                MYSERIAL0.flushTX()
147
   #endif
127
   #endif
148
 
128
 
149
-  #define SERIAL_EOL_P(p) SERIAL_EOL()
129
+  //
130
+  // Serial out with port redirect
131
+  //
132
+  #define SERIAL_CHAR_P(p,x)                SERIAL_CHAR(x)
133
+  #define SERIAL_ECHO_P(p,x)                SERIAL_ECHO(x)
134
+  #define SERIAL_ECHO_F_P(p,x,y)            SERIAL_ECHO_F(x,y)
135
+  #define SERIAL_ECHOLN_P(p,x)              SERIAL_ECHOLN(x)
136
+  #define SERIAL_PRINT_P(p,x,b)             SERIAL_PRINT(x,b)
137
+  #define SERIAL_PRINTLN_P(p,x,b)           SERIAL_PRINTLN(x,b)
138
+  #define SERIAL_PRINTF_P(p,args...)        SERIAL_PRINTF(args)
139
+  #define SERIAL_FLUSH_P(p)                 SERIAL_FLUSH()
140
+  #if TX_BUFFER_SIZE > 0
141
+    #define SERIAL_FLUSHTX_P(p)             SERIAL_FLUSHTX()
142
+  #endif
150
 
143
 
151
-  #define SERIAL_PROTOCOLCHAR_P(p,x)                SERIAL_PROTOCOLCHAR(x)
152
-  #define SERIAL_PROTOCOLPGM_P(p,x)                 SERIAL_PROTOCOLPGM(x)
153
-  #define SERIAL_PROTOCOLLNPGM_P(p,x)               SERIAL_PROTOCOLLNPGM(x)
154
-  #define SERIAL_PROTOCOLPAIR_P(p, pre, value)      SERIAL_PROTOCOLPAIR(pre, value)
155
-  #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value)    SERIAL_PROTOCOLLNPAIR(pre, value)
144
+  #define SERIAL_ECHOPGM_P(p,x)             SERIAL_ECHOPGM(x)
145
+  #define SERIAL_ECHOLNPGM_P(p,x)           SERIAL_ECHOLNPGM(x)
146
+  #define SERIAL_ECHOPAIR_P(p, pre, value)  SERIAL_ECHOPAIR(pre, value)
156
 
147
 
157
-  #define SERIAL_ECHO_START_P(p)                    SERIAL_ECHO_START()
158
-  #define SERIAL_ECHO_P(p,x)                        SERIAL_ECHO(x)
159
-  #define SERIAL_ECHOPGM_P(p,x)                     SERIAL_ECHOPGM(x)
160
-  #define SERIAL_ECHOLN_P(p,x)                      SERIAL_ECHOLN(x)
161
-  #define SERIAL_ECHOLNPGM_P(p,x)                   SERIAL_ECHOLNPGM(x)
162
-  #define SERIAL_ECHOPAIR_P(p,pre,value)            SERIAL_ECHOPAIR(pre, value)
163
-  #define SERIAL_ECHOLNPAIR_P(p,pre, value)         SERIAL_ECHOLNPAIR(pre, value)
164
-  #define SERIAL_ECHO_F_P(p,x,y)                    SERIAL_ECHO_F(x,y)
148
+  #define SERIAL_ECHO_P(p,x)                SERIAL_ECHO(x)
149
+  #define SERIAL_ECHOLN_P(p,x)              SERIAL_ECHOLN(x)
165
 
150
 
166
-  #define SERIAL_ERROR_START_P(p)                   SERIAL_ERROR_START()
167
-  #define SERIAL_ERROR_P(p,x)                       SERIAL_ERROR(x)
168
-  #define SERIAL_ERRORPGM_P(p,x)                    SERIAL_ERRORPGM(x)
169
-  #define SERIAL_ERRORLN_P(p,x)                     SERIAL_ERRORLN(x)
170
-  #define SERIAL_ERRORLNPGM_P(p,x)                  SERIAL_ERRORLNPGM(x)
151
+  #define SERIAL_ECHO_START_P(p)            SERIAL_ECHO_START()
152
+  #define SERIAL_ERROR_START_P(p)           SERIAL_ERROR_START()
153
+  #define SERIAL_EOL_P(p)                   SERIAL_EOL()
171
 
154
 
172
-  // These macros compensate for float imprecision
173
-  #define SERIAL_PROTOCOLPAIR_F_P(p, pre, value)    SERIAL_PROTOCOLPAIR_F(pre, value)
174
-  #define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value)  SERIAL_PROTOCOLLNPAIR_F(pre, value)
175
-  #define SERIAL_ECHOPAIR_F_P(p,pre,value)          SERIAL_ECHOPAIR_F(pre, value)
176
-  #define SERIAL_ECHOLNPAIR_F_P(p,pre, value)       SERIAL_ECHOLNPAIR_F(pre, value)
155
+  #define SERIAL_ECHOPAIR_F_P(p, pre, value, y)   SERIAL_ECHOPAIR_F(pre, value, y)
156
+  #define SERIAL_ECHOLNPAIR_F_P(p, pre, value, y) SERIAL_ECHOLNPAIR_F(pre, value, y)
177
 
157
 
178
-  #define serial_echopair_PGM_P(p,s_P,v)            serial_echopair_PGM(s_P, v)
158
+  #define serial_echopair_PGM_P(p,s_P,v)    serial_echopair_PGM(s_P, v)
179
 
159
 
180
-  #define serial_spaces_P(p,c)                      serial_spaces(c)
181
-  #define SERIAL_ECHO_SP_P(p,C)                     SERIAL_ECHO_SP(C)
182
-  #define SERIAL_ERROR_SP_P(p,C)                    SERIAL_ERROR_SP(C)
183
-  #define SERIAL_PROTOCOL_SP_P(p,C)                 SERIAL_PROTOCOL_SP(C)
160
+  #define serial_spaces_P(p,c)              serial_spaces(c)
161
+  #define SERIAL_ECHO_SP_P(p,C)             SERIAL_ECHO_SP(C)
184
 
162
 
185
-  #define serialprintPGM_P(p,s)                     serialprintPGM(s)
163
+  #define serialprintPGM_P(p,s)             serialprintPGM(s)
186
 
164
 
187
 #endif // NUM_SERIAL < 2
165
 #endif // NUM_SERIAL < 2
188
 
166
 
189
-#define SERIAL_EOL() SERIAL_CHAR('\n')
190
-
191
-#define SERIAL_PROTOCOLCHAR(x)                      SERIAL_CHAR(x)
192
-#define SERIAL_PROTOCOLPGM(x)                       (serialprintPGM(PSTR(x)))
193
-#define SERIAL_PROTOCOLLNPGM(x)                     (serialprintPGM(PSTR(x "\n")))
194
-#define SERIAL_PROTOCOLPAIR(pre, value)             (serial_echopair_PGM(PSTR(pre), value))
195
-#define SERIAL_PROTOCOLLNPAIR(pre, value)           do { SERIAL_PROTOCOLPAIR(pre, value); SERIAL_EOL(); } while(0)
196
-
197
-#define SERIAL_ECHO_START()                         serial_echo_start()
198
-#define SERIAL_ECHO(x)                              SERIAL_PROTOCOL(x)
199
-#define SERIAL_ECHOPGM(x)                           SERIAL_PROTOCOLPGM(x)
200
-#define SERIAL_ECHOLN(x)                            SERIAL_PROTOCOLLN(x)
201
-#define SERIAL_ECHOLNPGM(x)                         SERIAL_PROTOCOLLNPGM(x)
202
-#define SERIAL_ECHOPAIR(pre,value)                  SERIAL_PROTOCOLPAIR(pre, value)
203
-#define SERIAL_ECHOLNPAIR(pre, value)               SERIAL_PROTOCOLLNPAIR(pre, value)
204
-#define SERIAL_ECHO_F(x,y)                          SERIAL_PROTOCOL_F(x, y)
205
-
206
-#define SERIAL_ERROR_START()                        serial_error_start()
207
-#define SERIAL_ERROR(x)                             SERIAL_PROTOCOL(x)
208
-#define SERIAL_ERRORPGM(x)                          SERIAL_PROTOCOLPGM(x)
209
-#define SERIAL_ERRORLN(x)                           SERIAL_PROTOCOLLN(x)
210
-#define SERIAL_ERRORLNPGM(x)                        SERIAL_PROTOCOLLNPGM(x)
211
-
212
-// These macros compensate for float imprecision
213
-#define SERIAL_PROTOCOLPAIR_F(pre, value)           SERIAL_PROTOCOLPAIR(pre, FIXFLOAT(value))
214
-#define SERIAL_PROTOCOLLNPAIR_F(pre, value)         SERIAL_PROTOCOLLNPAIR(pre, FIXFLOAT(value))
215
-#define SERIAL_ECHOPAIR_F(pre,value)                SERIAL_ECHOPAIR(pre, FIXFLOAT(value))
216
-#define SERIAL_ECHOLNPAIR_F(pre, value)             SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value))
217
-
218
-void serial_echopair_PGM(PGM_P s_P, const char *v);
219
-void serial_echopair_PGM(PGM_P s_P, char v);
220
-void serial_echopair_PGM(PGM_P s_P, int v);
221
-void serial_echopair_PGM(PGM_P s_P, long v);
222
-void serial_echopair_PGM(PGM_P s_P, float v);
223
-void serial_echopair_PGM(PGM_P s_P, double v);
224
-void serial_echopair_PGM(PGM_P s_P, unsigned int v);
225
-void serial_echopair_PGM(PGM_P s_P, unsigned long v);
226
-inline void serial_echopair_PGM(PGM_P s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
227
-inline void serial_echopair_PGM(PGM_P s_P, bool v)    { serial_echopair_PGM(s_P, (int)v); }
228
-inline void serial_echopair_PGM(PGM_P s_P, void *v)   { serial_echopair_PGM(s_P, (unsigned long)v); }
167
+#define SERIAL_ECHOPGM(x)                   (serialprintPGM(PSTR(x)))
168
+#define SERIAL_ECHOLNPGM(x)                 (serialprintPGM(PSTR(x "\n")))
169
+#define SERIAL_ECHOPAIR(pre, value)         (serial_echopair_PGM(PSTR(pre), value))
170
+#define SERIAL_ECHOLNPAIR(pre, value)       do { SERIAL_ECHOPAIR(pre, value); SERIAL_EOL(); } while(0)
171
+
172
+#define SERIAL_ECHOPAIR_F(pre, value, y)    do{ SERIAL_ECHO(pre); SERIAL_ECHO_F(value, y); }while(0)
173
+#define SERIAL_ECHOLNPAIR_F(pre, value, y)  do{ SERIAL_ECHOPAIR_F(pre, value, y); SERIAL_EOL(); }while(0)
174
+
175
+#define SERIAL_ECHO_START()                 serial_echo_start()
176
+#define SERIAL_ERROR_START()                serial_error_start()
177
+#define SERIAL_EOL()                        SERIAL_CHAR('\n')
178
+
179
+#define SERIAL_ECHO_MSG(STR)                do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(STR); }while(0)
180
+#define SERIAL_ECHO_MSG_P(p, STR)           do{ SERIAL_ECHO_START_P(p); SERIAL_ECHOLNPGM_P(p, STR); }while(0)
181
+#define SERIAL_ERROR_MSG(STR)               do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(STR); }while(0)
182
+#define SERIAL_ERROR_MSG_P(p, STR)          do{ SERIAL_ERROR_START_P(p); SERIAL_ECHOLNPGM_P(p, STR); }while(0)
183
+
184
+#define SERIAL_ECHOLNPAIR_P(p, pre, value)  do{ SERIAL_ECHOPAIR_P(p, pre, value); SERIAL_EOL_P(p); }while(0)
229
 
185
 
230
 void serial_spaces(uint8_t count);
186
 void serial_spaces(uint8_t count);
231
-#define SERIAL_ECHO_SP(C)                           serial_spaces(C)
232
-#define SERIAL_ERROR_SP(C)                          serial_spaces(C)
233
-#define SERIAL_PROTOCOL_SP(C)                       serial_spaces(C)
187
+#define SERIAL_ECHO_SP(C)                   serial_spaces(C)
234
 
188
 
235
 //
189
 //
236
 // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
190
 // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
237
 //
191
 //
192
+void serial_echopair_PGM(PGM_P const s_P, const char *v);
193
+void serial_echopair_PGM(PGM_P const s_P, char v);
194
+void serial_echopair_PGM(PGM_P const s_P, int v);
195
+void serial_echopair_PGM(PGM_P const s_P, long v);
196
+void serial_echopair_PGM(PGM_P const s_P, float v);
197
+void serial_echopair_PGM(PGM_P const s_P, double v);
198
+void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
199
+void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
200
+inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
201
+inline void serial_echopair_PGM(PGM_P const s_P, bool v)    { serial_echopair_PGM(s_P, (int)v); }
202
+inline void serial_echopair_PGM(PGM_P const s_P, void *v)   { serial_echopair_PGM(s_P, (unsigned long)v); }
203
+
238
 void serialprintPGM(PGM_P str);
204
 void serialprintPGM(PGM_P str);
239
 void serial_echo_start();
205
 void serial_echo_start();
240
 void serial_error_start();
206
 void serial_error_start();
242
 void serialprintln_onoff(const bool onoff);
208
 void serialprintln_onoff(const bool onoff);
243
 
209
 
244
 #if ENABLED(DEBUG_LEVELING_FEATURE)
210
 #if ENABLED(DEBUG_LEVELING_FEATURE)
245
-  void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z);
246
-  void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]);
211
+  void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
212
+  void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
247
   #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
213
   #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
248
 #endif
214
 #endif

+ 17
- 28
Marlin/src/feature/I2CPositionEncoder.cpp 查看文件

66
     /*
66
     /*
67
     if (trusted) { //commented out as part of the note below
67
     if (trusted) { //commented out as part of the note below
68
       trusted = false;
68
       trusted = false;
69
-      SERIAL_ECHOPGM("Fault detected on ");
70
-      SERIAL_ECHO(axis_codes[encoderAxis]);
69
+      SERIAL_ECHOPAIR("Fault detected on ", axis_codes[encoderAxis]);
71
       SERIAL_ECHOLNPGM(" axis encoder. Disengaging error correction until module is trusted again.");
70
       SERIAL_ECHOLNPGM(" axis encoder. Disengaging error correction until module is trusted again.");
72
     }
71
     }
73
     */
72
     */
93
       if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
92
       if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
94
         trusted = true;
93
         trusted = true;
95
 
94
 
96
-        SERIAL_ECHOPGM("Untrusted encoder module on ");
97
-        SERIAL_ECHO(axis_codes[encoderAxis]);
95
+        SERIAL_ECHOPAIR("Untrusted encoder module on ", axis_codes[encoderAxis]);
98
         SERIAL_ECHOLNPGM(" axis has been fault-free for set duration, reinstating error correction.");
96
         SERIAL_ECHOLNPGM(" axis has been fault-free for set duration, reinstating error correction.");
99
 
97
 
100
         //the encoder likely lost its place when the error occured, so we'll reset and use the printer's
98
         //the encoder likely lost its place when the error occured, so we'll reset and use the printer's
106
         zeroOffset -= (positionInTicks - get_position());
104
         zeroOffset -= (positionInTicks - get_position());
107
 
105
 
108
         #ifdef I2CPE_DEBUG
106
         #ifdef I2CPE_DEBUG
109
-          SERIAL_ECHOPGM("Current position is ");
110
-          SERIAL_ECHOLN(pos);
111
-
112
-          SERIAL_ECHOPGM("Position in encoder ticks is ");
113
-          SERIAL_ECHOLN(positionInTicks);
114
-
115
-          SERIAL_ECHOPGM("New zero-offset of ");
116
-          SERIAL_ECHOLN(zeroOffset);
117
-
118
-          SERIAL_ECHOPGM("New position reads as ");
119
-          SERIAL_ECHO(get_position());
107
+          SERIAL_ECHOLNPAIR("Current position is ", pos);
108
+          SERIAL_ECHOLNPAIR("Position in encoder ticks is ", positionInTicks);
109
+          SERIAL_ECHOLNPAIR("New zero-offset of ", zeroOffset);
110
+          SERIAL_ECHOPAIR("New position reads as ", get_position());
120
           SERIAL_CHAR('(');
111
           SERIAL_CHAR('(');
121
           SERIAL_ECHO(mm_from_count(get_position()));
112
           SERIAL_ECHO(mm_from_count(get_position()));
122
           SERIAL_ECHOLNPGM(")");
113
           SERIAL_ECHOLNPGM(")");
159
       const int32_t error = get_axis_error_steps(false);
150
       const int32_t error = get_axis_error_steps(false);
160
     #endif
151
     #endif
161
 
152
 
162
-    //SERIAL_ECHOPGM("Axis error steps: ");
163
-    //SERIAL_ECHOLN(error);
153
+    //SERIAL_ECHOLNPAIR("Axis error steps: ", error);
164
 
154
 
165
     #ifdef I2CPE_ERR_THRESH_ABORT
155
     #ifdef I2CPE_ERR_THRESH_ABORT
166
       if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) {
156
       if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) {
167
         //kill(PSTR("Significant Error"));
157
         //kill(PSTR("Significant Error"));
168
-        SERIAL_ECHOPGM("Axis error greater than set threshold, aborting!");
169
-        SERIAL_ECHOLN(error);
158
+        SERIAL_ECHOLNPAIR("Axis error greater than set threshold, aborting!", error);
170
         safe_delay(5000);
159
         safe_delay(5000);
171
       }
160
       }
172
     #endif
161
     #endif
800
   if (parser.seen('A')) {
789
   if (parser.seen('A')) {
801
 
790
 
802
     if (!parser.has_value()) {
791
     if (!parser.has_value()) {
803
-      SERIAL_PROTOCOLLNPGM("?A seen, but no address specified! [30-200]");
792
+      SERIAL_ECHOLNPGM("?A seen, but no address specified! [30-200]");
804
       return I2CPE_PARSE_ERR;
793
       return I2CPE_PARSE_ERR;
805
     };
794
     };
806
 
795
 
807
     I2CPE_addr = parser.value_byte();
796
     I2CPE_addr = parser.value_byte();
808
     if (!WITHIN(I2CPE_addr, 30, 200)) { // reserve the first 30 and last 55
797
     if (!WITHIN(I2CPE_addr, 30, 200)) { // reserve the first 30 and last 55
809
-      SERIAL_PROTOCOLLNPGM("?Address out of range. [30-200]");
798
+      SERIAL_ECHOLNPGM("?Address out of range. [30-200]");
810
       return I2CPE_PARSE_ERR;
799
       return I2CPE_PARSE_ERR;
811
     }
800
     }
812
 
801
 
813
     I2CPE_idx = idx_from_addr(I2CPE_addr);
802
     I2CPE_idx = idx_from_addr(I2CPE_addr);
814
     if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
803
     if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
815
-      SERIAL_PROTOCOLLNPGM("?No device with this address!");
804
+      SERIAL_ECHOLNPGM("?No device with this address!");
816
       return I2CPE_PARSE_ERR;
805
       return I2CPE_PARSE_ERR;
817
     }
806
     }
818
   }
807
   }
819
   else if (parser.seenval('I')) {
808
   else if (parser.seenval('I')) {
820
 
809
 
821
     if (!parser.has_value()) {
810
     if (!parser.has_value()) {
822
-      SERIAL_PROTOCOLLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1);
823
-      SERIAL_PROTOCOLLNPGM("]");
811
+      SERIAL_ECHOLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1);
812
+      SERIAL_ECHOLNPGM("]");
824
       return I2CPE_PARSE_ERR;
813
       return I2CPE_PARSE_ERR;
825
     };
814
     };
826
 
815
 
827
     I2CPE_idx = parser.value_byte();
816
     I2CPE_idx = parser.value_byte();
828
     if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
817
     if (I2CPE_idx >= I2CPE_ENCODER_CNT) {
829
-      SERIAL_PROTOCOLLNPAIR("?Index out of range. [0-", I2CPE_ENCODER_CNT - 1);
818
+      SERIAL_ECHOLNPAIR("?Index out of range. [0-", I2CPE_ENCODER_CNT - 1);
830
       SERIAL_ECHOLNPGM("]");
819
       SERIAL_ECHOLNPGM("]");
831
       return I2CPE_PARSE_ERR;
820
       return I2CPE_PARSE_ERR;
832
     }
821
     }
984
 
973
 
985
   if (parser.seen('S')) {
974
   if (parser.seen('S')) {
986
     if (!parser.has_value()) {
975
     if (!parser.has_value()) {
987
-      SERIAL_PROTOCOLLNPGM("?S seen, but no address specified! [30-200]");
976
+      SERIAL_ECHOLNPGM("?S seen, but no address specified! [30-200]");
988
       return;
977
       return;
989
     };
978
     };
990
 
979
 
991
     newAddress = parser.value_byte();
980
     newAddress = parser.value_byte();
992
     if (!WITHIN(newAddress, 30, 200)) {
981
     if (!WITHIN(newAddress, 30, 200)) {
993
-      SERIAL_PROTOCOLLNPGM("?New address out of range. [30-200]");
982
+      SERIAL_ECHOLNPGM("?New address out of range. [30-200]");
994
       return;
983
       return;
995
     }
984
     }
996
   }
985
   }
997
   else if (!I2CPE_anyaxis) {
986
   else if (!I2CPE_anyaxis) {
998
-    SERIAL_PROTOCOLLNPGM("?You must specify S or [XYZE].");
987
+    SERIAL_ECHOLNPGM("?You must specify S or [XYZE].");
999
     return;
988
     return;
1000
   }
989
   }
1001
   else {
990
   else {

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

288
       CHECK_IDX();
288
       CHECK_IDX();
289
       encoders[idx].set_ec_threshold(newThreshold);
289
       encoders[idx].set_ec_threshold(newThreshold);
290
       SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
290
       SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
291
-      SERIAL_ECHOPAIR_F(" axis set to ", newThreshold);
291
+      SERIAL_ECHOPAIR(" axis set to ", FIXFLOAT(newThreshold));
292
       SERIAL_ECHOLNPGM("mm.");
292
       SERIAL_ECHOLNPGM("mm.");
293
     }
293
     }
294
 
294
 
296
       CHECK_IDX();
296
       CHECK_IDX();
297
       const float threshold = encoders[idx].get_ec_threshold();
297
       const float threshold = encoders[idx].get_ec_threshold();
298
       SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
298
       SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
299
-      SERIAL_ECHOPAIR_F(" axis is ", threshold);
299
+      SERIAL_ECHOPAIR(" axis is ", FIXFLOAT(threshold));
300
       SERIAL_ECHOLNPGM("mm.");
300
       SERIAL_ECHOLNPGM("mm.");
301
     }
301
     }
302
 
302
 

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

160
     #ifndef SCAD_MESH_OUTPUT
160
     #ifndef SCAD_MESH_OUTPUT
161
       for (uint8_t x = 0; x < sx; x++) {
161
       for (uint8_t x = 0; x < sx; x++) {
162
         serial_spaces(precision + (x < 10 ? 3 : 2));
162
         serial_spaces(precision + (x < 10 ? 3 : 2));
163
-        SERIAL_PROTOCOL(int(x));
163
+        SERIAL_ECHO(int(x));
164
       }
164
       }
165
       SERIAL_EOL();
165
       SERIAL_EOL();
166
     #endif
166
     #endif
167
     #ifdef SCAD_MESH_OUTPUT
167
     #ifdef SCAD_MESH_OUTPUT
168
-      SERIAL_PROTOCOLLNPGM("measured_z = ["); // open 2D array
168
+      SERIAL_ECHOLNPGM("measured_z = ["); // open 2D array
169
     #endif
169
     #endif
170
     for (uint8_t y = 0; y < sy; y++) {
170
     for (uint8_t y = 0; y < sy; y++) {
171
       #ifdef SCAD_MESH_OUTPUT
171
       #ifdef SCAD_MESH_OUTPUT
172
-        SERIAL_PROTOCOLPGM(" [");           // open sub-array
172
+        SERIAL_ECHOPGM(" [");           // open sub-array
173
       #else
173
       #else
174
-        if (y < 10) SERIAL_PROTOCOLCHAR(' ');
175
-        SERIAL_PROTOCOL(int(y));
174
+        if (y < 10) SERIAL_CHAR(' ');
175
+        SERIAL_ECHO(int(y));
176
       #endif
176
       #endif
177
       for (uint8_t x = 0; x < sx; x++) {
177
       for (uint8_t x = 0; x < sx; x++) {
178
-        SERIAL_PROTOCOLCHAR(' ');
178
+        SERIAL_CHAR(' ');
179
         const float offset = fn(x, y);
179
         const float offset = fn(x, y);
180
         if (!isnan(offset)) {
180
         if (!isnan(offset)) {
181
-          if (offset >= 0) SERIAL_PROTOCOLCHAR('+');
182
-          SERIAL_PROTOCOL_F(offset, int(precision));
181
+          if (offset >= 0) SERIAL_CHAR('+');
182
+          SERIAL_ECHO_F(offset, int(precision));
183
         }
183
         }
184
         else {
184
         else {
185
           #ifdef SCAD_MESH_OUTPUT
185
           #ifdef SCAD_MESH_OUTPUT
186
             for (uint8_t i = 3; i < precision + 3; i++)
186
             for (uint8_t i = 3; i < precision + 3; i++)
187
-              SERIAL_PROTOCOLCHAR(' ');
188
-            SERIAL_PROTOCOLPGM("NAN");
187
+              SERIAL_CHAR(' ');
188
+            SERIAL_ECHOPGM("NAN");
189
           #else
189
           #else
190
             for (uint8_t i = 0; i < precision + 3; i++)
190
             for (uint8_t i = 0; i < precision + 3; i++)
191
-              SERIAL_PROTOCOLCHAR(i ? '=' : ' ');
191
+              SERIAL_CHAR(i ? '=' : ' ');
192
           #endif
192
           #endif
193
         }
193
         }
194
         #ifdef SCAD_MESH_OUTPUT
194
         #ifdef SCAD_MESH_OUTPUT
195
-          if (x < sx - 1) SERIAL_PROTOCOLCHAR(',');
195
+          if (x < sx - 1) SERIAL_CHAR(',');
196
         #endif
196
         #endif
197
       }
197
       }
198
       #ifdef SCAD_MESH_OUTPUT
198
       #ifdef SCAD_MESH_OUTPUT
199
-        SERIAL_PROTOCOLCHAR(' ');
200
-        SERIAL_PROTOCOLCHAR(']');                     // close sub-array
201
-        if (y < sy - 1) SERIAL_PROTOCOLCHAR(',');
199
+        SERIAL_CHAR(' ');
200
+        SERIAL_CHAR(']');                     // close sub-array
201
+        if (y < sy - 1) SERIAL_CHAR(',');
202
       #endif
202
       #endif
203
       SERIAL_EOL();
203
       SERIAL_EOL();
204
     }
204
     }
205
     #ifdef SCAD_MESH_OUTPUT
205
     #ifdef SCAD_MESH_OUTPUT
206
-      SERIAL_PROTOCOLPGM("];");                       // close 2D array
206
+      SERIAL_ECHOPGM("];");                       // close 2D array
207
     #endif
207
     #endif
208
     SERIAL_EOL();
208
     SERIAL_EOL();
209
   }
209
   }

+ 2
- 3
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp 查看文件

119
   #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES
119
   #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES
120
 
120
 
121
   void mesh_bed_leveling::report_mesh() {
121
   void mesh_bed_leveling::report_mesh() {
122
-    SERIAL_PROTOCOLPGM(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: ");
123
-    SERIAL_PROTOCOL_F(z_offset, 5);
124
-    SERIAL_PROTOCOLLNPGM("\nMeasured points:");
122
+    SERIAL_ECHOPAIR_F(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: ", z_offset, 5);
123
+    SERIAL_ECHOLNPGM("\nMeasured points:");
125
     print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 5,
124
     print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 5,
126
       [](const uint8_t ix, const uint8_t iy) { return z_values[ix][iy]; }
125
       [](const uint8_t ix, const uint8_t iy) { return z_values[ix][iy]; }
127
     );
126
     );

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

39
       const int8_t port/*= -1*/
39
       const int8_t port/*= -1*/
40
     #endif
40
     #endif
41
   ) {
41
   ) {
42
-    SERIAL_PROTOCOLPGM_P(port, "Unified Bed Leveling");
42
+    SERIAL_ECHOPGM_P(port, "Unified Bed Leveling");
43
   }
43
   }
44
 
44
 
45
   void unified_bed_leveling::report_current_mesh(
45
   void unified_bed_leveling::report_current_mesh(
48
     #endif
48
     #endif
49
   ) {
49
   ) {
50
     if (!leveling_is_valid()) return;
50
     if (!leveling_is_valid()) return;
51
-    SERIAL_ECHO_START_P(port);
52
-    SERIAL_ECHOLNPGM_P(port, "  G29 I99");
51
+    SERIAL_ECHO_MSG_P(port, "  G29 I99");
53
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
52
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
54
       for (uint8_t y = 0;  y < GRID_MAX_POINTS_Y; y++)
53
       for (uint8_t y = 0;  y < GRID_MAX_POINTS_Y; y++)
55
         if (!isnan(z_values[x][y])) {
54
         if (!isnan(z_values[x][y])) {
56
           SERIAL_ECHO_START_P(port);
55
           SERIAL_ECHO_START_P(port);
57
           SERIAL_ECHOPAIR_P(port, "  M421 I", x);
56
           SERIAL_ECHOPAIR_P(port, "  M421 I", x);
58
           SERIAL_ECHOPAIR_P(port, " J", y);
57
           SERIAL_ECHOPAIR_P(port, " J", y);
59
-          SERIAL_ECHOPGM_P(port, " Z");
60
-          SERIAL_ECHO_F_P(port, z_values[x][y], 2);
58
+          SERIAL_ECHOPAIR_F_P(port, " Z", z_values[x][y], 2);
61
           SERIAL_EOL_P(port);
59
           SERIAL_EOL_P(port);
62
           serial_delay(75); // Prevent Printrun from exploding
60
           serial_delay(75); // Prevent Printrun from exploding
63
         }
61
         }
73
         port
71
         port
74
       #endif
72
       #endif
75
     );
73
     );
76
-    SERIAL_PROTOCOLPGM_P(port, " System v" UBL_VERSION " ");
77
-    if (!planner.leveling_active) SERIAL_PROTOCOLPGM_P(port, "in");
78
-    SERIAL_PROTOCOLLNPGM_P(port, "active.");
74
+    SERIAL_ECHOPGM_P(port, " System v" UBL_VERSION " ");
75
+    if (!planner.leveling_active) SERIAL_ECHOPGM_P(port, "in");
76
+    SERIAL_ECHOLNPGM_P(port, "active.");
79
     serial_delay(50);
77
     serial_delay(50);
80
   }
78
   }
81
 
79
 
105
       if (xy_dist == 0.0) return;
103
       if (xy_dist == 0.0) return;
106
 
104
 
107
       const float fpmm = de / xy_dist;
105
       const float fpmm = de / xy_dist;
108
-      SERIAL_ECHOPGM("   fpmm="); SERIAL_ECHO_F(fpmm, 6);
109
-      SERIAL_ECHOPGM("    current=( ");
110
-      SERIAL_ECHO_F(current_position[X_AXIS], 6); SERIAL_ECHOPGM(", ");
111
-      SERIAL_ECHO_F(current_position[Y_AXIS], 6); SERIAL_ECHOPGM(", ");
112
-      SERIAL_ECHO_F(current_position[Z_AXIS], 6); SERIAL_ECHOPGM(", ");
113
-      SERIAL_ECHO_F(current_position[E_AXIS], 6); SERIAL_ECHOPGM(" )   destination=( ");
114
-      debug_echo_axis(X_AXIS); SERIAL_ECHOPGM(", ");
115
-      debug_echo_axis(Y_AXIS); SERIAL_ECHOPGM(", ");
116
-      debug_echo_axis(Z_AXIS); SERIAL_ECHOPGM(", ");
117
-      debug_echo_axis(E_AXIS); SERIAL_ECHOPGM(" )   ");
106
+      SERIAL_ECHOPAIR_F("   fpmm=", fpmm, 6);
107
+      SERIAL_ECHOPAIR_F("    current=( ", current_position[X_AXIS], 6);
108
+      SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6);
109
+      SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6);
110
+      SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6);
111
+      SERIAL_ECHOPGM(" )   destination=( "); debug_echo_axis(X_AXIS);
112
+      SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS);
113
+      SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS);
114
+      SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS);
115
+      SERIAL_ECHOPGM(" )   ");
118
       serialprintPGM(title);
116
       serialprintPGM(title);
119
       SERIAL_EOL();
117
       SERIAL_EOL();
120
     }
118
     }
279
     uint8_t error_flag = 0;
277
     uint8_t error_flag = 0;
280
 
278
 
281
     if (settings.calc_num_meshes() < 1) {
279
     if (settings.calc_num_meshes() < 1) {
282
-      SERIAL_PROTOCOLLNPGM("?Mesh too big for EEPROM.");
280
+      SERIAL_ECHOLNPGM("?Mesh too big for EEPROM.");
283
       error_flag++;
281
       error_flag++;
284
     }
282
     }
285
 
283
 

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

308
       #if ENABLED(DEBUG_LEVELING_FEATURE)
308
       #if ENABLED(DEBUG_LEVELING_FEATURE)
309
         if (DEBUGGING(MESH_ADJUST)) {
309
         if (DEBUGGING(MESH_ADJUST)) {
310
           SERIAL_ECHOPAIR(" raw get_z_correction(", rx0);
310
           SERIAL_ECHOPAIR(" raw get_z_correction(", rx0);
311
-          SERIAL_CHAR(',');
312
-          SERIAL_ECHO(ry0);
313
-          SERIAL_ECHOPGM(") = ");
314
-          SERIAL_ECHO_F(z0, 6);
311
+          SERIAL_CHAR(','); SERIAL_ECHO(ry0);
312
+          SERIAL_ECHOPAIR_F(") = ", z0, 6);
315
         }
313
         }
316
       #endif
314
       #endif
317
 
315
 
318
       #if ENABLED(DEBUG_LEVELING_FEATURE)
316
       #if ENABLED(DEBUG_LEVELING_FEATURE)
319
-        if (DEBUGGING(MESH_ADJUST)) {
320
-          SERIAL_ECHOPGM(" >>>---> ");
321
-          SERIAL_ECHO_F(z0, 6);
322
-          SERIAL_EOL();
323
-        }
317
+        if (DEBUGGING(MESH_ADJUST)) SERIAL_ECHOLNPAIR_F(" >>>---> ", z0, 6);
324
       #endif
318
       #endif
325
 
319
 
326
       if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN
320
       if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN

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

331
             // meant to invalidate the ENTIRE mesh, which cannot be done with
331
             // meant to invalidate the ENTIRE mesh, which cannot be done with
332
             // find_closest_mesh_point loop which only returns REACHABLE points.
332
             // find_closest_mesh_point loop which only returns REACHABLE points.
333
             set_all_mesh_points_to_value(NAN);
333
             set_all_mesh_points_to_value(NAN);
334
-            SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
334
+            SERIAL_ECHOLNPGM("Entire Mesh invalidated.\n");
335
             break;            // No more invalid Mesh Points to populate
335
             break;            // No more invalid Mesh Points to populate
336
           }
336
           }
337
           z_values[location.x_index][location.y_index] = NAN;
337
           z_values[location.x_index][location.y_index] = NAN;
338
           cnt++;
338
           cnt++;
339
         }
339
         }
340
       }
340
       }
341
-      SERIAL_PROTOCOLLNPGM("Locations invalidated.\n");
341
+      SERIAL_ECHOLNPGM("Locations invalidated.\n");
342
     }
342
     }
343
 
343
 
344
     if (parser.seen('Q')) {
344
     if (parser.seen('Q')) {
345
       const int test_pattern = parser.has_value() ? parser.value_int() : -99;
345
       const int test_pattern = parser.has_value() ? parser.value_int() : -99;
346
       if (!WITHIN(test_pattern, -1, 2)) {
346
       if (!WITHIN(test_pattern, -1, 2)) {
347
-        SERIAL_PROTOCOLLNPGM("Invalid test_pattern value. (-1 to 2)\n");
347
+        SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n");
348
         return;
348
         return;
349
       }
349
       }
350
-      SERIAL_PROTOCOLLNPGM("Loading test_pattern values.\n");
350
+      SERIAL_ECHOLNPGM("Loading test_pattern values.\n");
351
       switch (test_pattern) {
351
       switch (test_pattern) {
352
 
352
 
353
         #if ENABLED(UBL_DEVEL_DEBUGGING)
353
         #if ENABLED(UBL_DEVEL_DEBUGGING)
405
     if (parser.seen('P')) {
405
     if (parser.seen('P')) {
406
       if (WITHIN(g29_phase_value, 0, 1) && storage_slot == -1) {
406
       if (WITHIN(g29_phase_value, 0, 1) && storage_slot == -1) {
407
         storage_slot = 0;
407
         storage_slot = 0;
408
-        SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected.");
408
+        SERIAL_ECHOLNPGM("Default storage slot 0 selected.");
409
       }
409
       }
410
 
410
 
411
       switch (g29_phase_value) {
411
       switch (g29_phase_value) {
414
           // Zero Mesh Data
414
           // Zero Mesh Data
415
           //
415
           //
416
           reset();
416
           reset();
417
-          SERIAL_PROTOCOLLNPGM("Mesh zeroed.");
417
+          SERIAL_ECHOLNPGM("Mesh zeroed.");
418
           break;
418
           break;
419
 
419
 
420
         #if HAS_BED_PROBE
420
         #if HAS_BED_PROBE
425
             //
425
             //
426
             if (!parser.seen('C')) {
426
             if (!parser.seen('C')) {
427
               invalidate();
427
               invalidate();
428
-              SERIAL_PROTOCOLLNPGM("Mesh invalidated. Probing mesh.");
428
+              SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh.");
429
             }
429
             }
430
             if (g29_verbose_level > 1) {
430
             if (g29_verbose_level > 1) {
431
-              SERIAL_PROTOCOLPAIR("Probing Mesh Points Closest to (", g29_x_pos);
432
-              SERIAL_PROTOCOLCHAR(',');
433
-              SERIAL_PROTOCOL(g29_y_pos);
434
-              SERIAL_PROTOCOLLNPGM(").\n");
431
+              SERIAL_ECHOPAIR("Probing Mesh Points Closest to (", g29_x_pos);
432
+              SERIAL_CHAR(',');
433
+              SERIAL_ECHO(g29_y_pos);
434
+              SERIAL_ECHOLNPGM(").\n");
435
             }
435
             }
436
             probe_entire_mesh(g29_x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, g29_y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER,
436
             probe_entire_mesh(g29_x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, g29_y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER,
437
                               parser.seen('T'), parser.seen('E'), parser.seen('U'));
437
                               parser.seen('T'), parser.seen('E'), parser.seen('U'));
446
             //
446
             //
447
             // Manually Probe Mesh in areas that can't be reached by the probe
447
             // Manually Probe Mesh in areas that can't be reached by the probe
448
             //
448
             //
449
-            SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations.");
449
+            SERIAL_ECHOLNPGM("Manually probing unreachable mesh locations.");
450
             do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
450
             do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
451
 
451
 
452
             if (parser.seen('C') && !g29_x_flag && !g29_y_flag) {
452
             if (parser.seen('C') && !g29_x_flag && !g29_y_flag) {
469
             if (parser.seen('B')) {
469
             if (parser.seen('B')) {
470
               g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness((float) Z_CLEARANCE_BETWEEN_PROBES);
470
               g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness((float) Z_CLEARANCE_BETWEEN_PROBES);
471
               if (ABS(g29_card_thickness) > 1.5f) {
471
               if (ABS(g29_card_thickness) > 1.5f) {
472
-                SERIAL_PROTOCOLLNPGM("?Error in Business Card measurement.");
472
+                SERIAL_ECHOLNPGM("?Error in Business Card measurement.");
473
                 return;
473
                 return;
474
               }
474
               }
475
             }
475
             }
476
 
476
 
477
             if (!position_is_reachable(g29_x_pos, g29_y_pos)) {
477
             if (!position_is_reachable(g29_x_pos, g29_y_pos)) {
478
-              SERIAL_PROTOCOLLNPGM("XY outside printable radius.");
478
+              SERIAL_ECHOLNPGM("XY outside printable radius.");
479
               return;
479
               return;
480
             }
480
             }
481
 
481
 
482
             const float height = parser.floatval('H', Z_CLEARANCE_BETWEEN_PROBES);
482
             const float height = parser.floatval('H', Z_CLEARANCE_BETWEEN_PROBES);
483
             manually_probe_remaining_mesh(g29_x_pos, g29_y_pos, height, g29_card_thickness, parser.seen('T'));
483
             manually_probe_remaining_mesh(g29_x_pos, g29_y_pos, height, g29_card_thickness, parser.seen('T'));
484
 
484
 
485
-            SERIAL_PROTOCOLLNPGM("G29 P2 finished.");
485
+            SERIAL_ECHOLNPGM("G29 P2 finished.");
486
 
486
 
487
             report_current_position();
487
             report_current_position();
488
 
488
 
489
           #else
489
           #else
490
 
490
 
491
-            SERIAL_PROTOCOLLNPGM("?P2 is only available when an LCD is present.");
491
+            SERIAL_ECHOLNPGM("?P2 is only available when an LCD is present.");
492
             return;
492
             return;
493
 
493
 
494
           #endif
494
           #endif
553
           #if HAS_LCD_MENU
553
           #if HAS_LCD_MENU
554
             fine_tune_mesh(g29_x_pos, g29_y_pos, parser.seen('T'));
554
             fine_tune_mesh(g29_x_pos, g29_y_pos, parser.seen('T'));
555
           #else
555
           #else
556
-            SERIAL_PROTOCOLLNPGM("?P4 is only available when an LCD is present.");
556
+            SERIAL_ECHOLNPGM("?P4 is only available when an LCD is present.");
557
             return;
557
             return;
558
           #endif
558
           #endif
559
           break;
559
           break;
593
       int16_t a = settings.calc_num_meshes();
593
       int16_t a = settings.calc_num_meshes();
594
 
594
 
595
       if (!a) {
595
       if (!a) {
596
-        SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
596
+        SERIAL_ECHOLNPGM("?EEPROM storage not available.");
597
         return;
597
         return;
598
       }
598
       }
599
 
599
 
600
       if (!WITHIN(g29_storage_slot, 0, a - 1)) {
600
       if (!WITHIN(g29_storage_slot, 0, a - 1)) {
601
-        SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
602
-        SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
601
+        SERIAL_ECHOLNPGM("?Invalid storage slot.");
602
+        SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
603
         return;
603
         return;
604
       }
604
       }
605
 
605
 
606
       settings.load_mesh(g29_storage_slot);
606
       settings.load_mesh(g29_storage_slot);
607
       storage_slot = g29_storage_slot;
607
       storage_slot = g29_storage_slot;
608
 
608
 
609
-      SERIAL_PROTOCOLLNPGM("Done.");
609
+      SERIAL_ECHOLNPGM("Done.");
610
     }
610
     }
611
 
611
 
612
     //
612
     //
622
       int16_t a = settings.calc_num_meshes();
622
       int16_t a = settings.calc_num_meshes();
623
 
623
 
624
       if (!a) {
624
       if (!a) {
625
-        SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
625
+        SERIAL_ECHOLNPGM("?EEPROM storage not available.");
626
         goto LEAVE;
626
         goto LEAVE;
627
       }
627
       }
628
 
628
 
629
       if (!WITHIN(g29_storage_slot, 0, a - 1)) {
629
       if (!WITHIN(g29_storage_slot, 0, a - 1)) {
630
-        SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
631
-        SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
630
+        SERIAL_ECHOLNPGM("?Invalid storage slot.");
631
+        SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
632
         goto LEAVE;
632
         goto LEAVE;
633
       }
633
       }
634
 
634
 
635
       settings.store_mesh(g29_storage_slot);
635
       settings.store_mesh(g29_storage_slot);
636
       storage_slot = g29_storage_slot;
636
       storage_slot = g29_storage_slot;
637
 
637
 
638
-      SERIAL_PROTOCOLLNPGM("Done.");
638
+      SERIAL_ECHOLNPGM("Done.");
639
     }
639
     }
640
 
640
 
641
     if (parser.seen('T'))
641
     if (parser.seen('T'))
675
           sum_of_diff_squared += sq(z_values[x][y] - mean);
675
           sum_of_diff_squared += sq(z_values[x][y] - mean);
676
 
676
 
677
     SERIAL_ECHOLNPAIR("# of samples: ", n);
677
     SERIAL_ECHOLNPAIR("# of samples: ", n);
678
-    SERIAL_ECHOPGM("Mean Mesh Height: ");
679
-    SERIAL_ECHO_F(mean, 6);
680
-    SERIAL_EOL();
678
+    SERIAL_ECHOLNPAIR_F("Mean Mesh Height: ", mean, 6);
681
 
679
 
682
     const float sigma = SQRT(sum_of_diff_squared / (n + 1));
680
     const float sigma = SQRT(sum_of_diff_squared / (n + 1));
683
-    SERIAL_ECHOPGM("Standard Deviation: ");
684
-    SERIAL_ECHO_F(sigma, 6);
685
-    SERIAL_EOL();
681
+    SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6);
686
 
682
 
687
     if (cflag)
683
     if (cflag)
688
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
684
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
721
         #if HAS_LCD_MENU
717
         #if HAS_LCD_MENU
722
           if (ui.button_pressed()) {
718
           if (ui.button_pressed()) {
723
             ui.quick_feedback(false); // Preserve button state for click-and-hold
719
             ui.quick_feedback(false); // Preserve button state for click-and-hold
724
-            SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n");
720
+            SERIAL_ECHOLNPGM("\nMesh only partially populated.\n");
725
             STOW_PROBE();
721
             STOW_PROBE();
726
             ui.wait_for_release();
722
             ui.wait_for_release();
727
             ui.quick_feedback();
723
             ui.quick_feedback();
803
       return current_position[Z_AXIS];
799
       return current_position[Z_AXIS];
804
     }
800
     }
805
 
801
 
806
-    static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
802
+    static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }
807
 
803
 
808
     float unified_bed_leveling::measure_business_card_thickness(float in_height) {
804
     float unified_bed_leveling::measure_business_card_thickness(float in_height) {
809
       ui.capture();
805
       ui.capture();
813
         //, MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f);
809
         //, MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f);
814
       planner.synchronize();
810
       planner.synchronize();
815
 
811
 
816
-      SERIAL_PROTOCOLPGM("Place shim under nozzle");
812
+      SERIAL_ECHOPGM("Place shim under nozzle");
817
       LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
813
       LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
818
       ui.return_to_status();
814
       ui.return_to_status();
819
       echo_and_take_a_measurement();
815
       echo_and_take_a_measurement();
822
       do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
818
       do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
823
       planner.synchronize();
819
       planner.synchronize();
824
 
820
 
825
-      SERIAL_PROTOCOLPGM("Remove shim");
821
+      SERIAL_ECHOPGM("Remove shim");
826
       LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE);
822
       LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE);
827
       echo_and_take_a_measurement();
823
       echo_and_take_a_measurement();
828
 
824
 
833
       const float thickness = ABS(z1 - z2);
829
       const float thickness = ABS(z1 - z2);
834
 
830
 
835
       if (g29_verbose_level > 1) {
831
       if (g29_verbose_level > 1) {
836
-        SERIAL_PROTOCOLPGM("Business Card is ");
837
-        SERIAL_PROTOCOL_F(thickness, 4);
838
-        SERIAL_PROTOCOLLNPGM("mm thick.");
832
+        SERIAL_ECHOPAIR_F("Business Card is ", thickness, 4);
833
+        SERIAL_ECHOLNPGM("mm thick.");
839
       }
834
       }
840
 
835
 
841
       ui.release();
836
       ui.release();
846
     }
841
     }
847
 
842
 
848
     void abort_manual_probe_remaining_mesh() {
843
     void abort_manual_probe_remaining_mesh() {
849
-      SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
844
+      SERIAL_ECHOLNPGM("\nMesh only partially populated.");
850
       do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
845
       do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
851
       ui.release();
846
       ui.release();
852
       KEEPALIVE_STATE(IN_HANDLER);
847
       KEEPALIVE_STATE(IN_HANDLER);
892
         move_z_with_encoder(z_step);
887
         move_z_with_encoder(z_step);
893
 
888
 
894
         if (click_and_hold()) {
889
         if (click_and_hold()) {
895
-          SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
890
+          SERIAL_ECHOLNPGM("\nMesh only partially populated.");
896
           do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
891
           do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
897
           ui.release();
892
           ui.release();
898
           KEEPALIVE_STATE(IN_HANDLER);
893
           KEEPALIVE_STATE(IN_HANDLER);
901
         }
896
         }
902
 
897
 
903
         z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick;
898
         z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick;
904
-        if (g29_verbose_level > 2) {
905
-          SERIAL_PROTOCOLPGM("Mesh Point Measured at: ");
906
-          SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6);
907
-          SERIAL_EOL();
908
-        }
899
+        if (g29_verbose_level > 2)
900
+          SERIAL_ECHOLNPAIR_F("Mesh Point Measured at: ", z_values[location.x_index][location.y_index], 6);
909
         SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
901
         SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
910
       } while (location.x_index >= 0 && location.y_index >= 0);
902
       } while (location.x_index >= 0 && location.y_index >= 0);
911
 
903
 
934
       #if ENABLED(UBL_MESH_EDIT_MOVES_Z)
926
       #if ENABLED(UBL_MESH_EDIT_MOVES_Z)
935
         const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0;
927
         const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0;
936
         if (!WITHIN(h_offset, 0, 10)) {
928
         if (!WITHIN(h_offset, 0, 10)) {
937
-          SERIAL_PROTOCOLLNPGM("Offset out of bounds. (0 to 10mm)\n");
929
+          SERIAL_ECHOLNPGM("Offset out of bounds. (0 to 10mm)\n");
938
           return;
930
           return;
939
         }
931
         }
940
       #endif
932
       #endif
942
       mesh_index_pair location;
934
       mesh_index_pair location;
943
 
935
 
944
       if (!position_is_reachable(rx, ry)) {
936
       if (!position_is_reachable(rx, ry)) {
945
-        SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius.");
937
+        SERIAL_ECHOLNPGM("(X,Y) outside printable radius.");
946
         return;
938
         return;
947
       }
939
       }
948
 
940
 
1050
       g29_repetition_cnt = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS;
1042
       g29_repetition_cnt = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS;
1051
       NOMORE(g29_repetition_cnt, GRID_MAX_POINTS);
1043
       NOMORE(g29_repetition_cnt, GRID_MAX_POINTS);
1052
       if (g29_repetition_cnt < 1) {
1044
       if (g29_repetition_cnt < 1) {
1053
-        SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
1045
+        SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n");
1054
         return UBL_ERR;
1046
         return UBL_ERR;
1055
       }
1047
       }
1056
     }
1048
     }
1057
 
1049
 
1058
     g29_verbose_level = parser.seen('V') ? parser.value_int() : 0;
1050
     g29_verbose_level = parser.seen('V') ? parser.value_int() : 0;
1059
     if (!WITHIN(g29_verbose_level, 0, 4)) {
1051
     if (!WITHIN(g29_verbose_level, 0, 4)) {
1060
-      SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).\n");
1052
+      SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).\n");
1061
       err_flag = true;
1053
       err_flag = true;
1062
     }
1054
     }
1063
 
1055
 
1065
       const int pv = parser.value_int();
1057
       const int pv = parser.value_int();
1066
       #if !HAS_BED_PROBE
1058
       #if !HAS_BED_PROBE
1067
         if (pv == 1) {
1059
         if (pv == 1) {
1068
-          SERIAL_PROTOCOLLNPGM("G29 P1 requires a probe.\n");
1060
+          SERIAL_ECHOLNPGM("G29 P1 requires a probe.\n");
1069
           err_flag = true;
1061
           err_flag = true;
1070
         }
1062
         }
1071
         else
1063
         else
1073
         {
1065
         {
1074
           g29_phase_value = pv;
1066
           g29_phase_value = pv;
1075
           if (!WITHIN(g29_phase_value, 0, 6)) {
1067
           if (!WITHIN(g29_phase_value, 0, 6)) {
1076
-            SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
1068
+            SERIAL_ECHOLNPGM("?(P)hase value invalid (0-6).\n");
1077
             err_flag = true;
1069
             err_flag = true;
1078
           }
1070
           }
1079
         }
1071
         }
1083
       #if HAS_BED_PROBE
1075
       #if HAS_BED_PROBE
1084
         g29_grid_size = parser.has_value() ? parser.value_int() : 0;
1076
         g29_grid_size = parser.has_value() ? parser.value_int() : 0;
1085
         if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) {
1077
         if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) {
1086
-          SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n");
1078
+          SERIAL_ECHOLNPGM("?Invalid grid size (J) specified (2-9).\n");
1087
           err_flag = true;
1079
           err_flag = true;
1088
         }
1080
         }
1089
       #else
1081
       #else
1090
-        SERIAL_PROTOCOLLNPGM("G29 J action requires a probe.\n");
1082
+        SERIAL_ECHOLNPGM("G29 J action requires a probe.\n");
1091
         err_flag = true;
1083
         err_flag = true;
1092
       #endif
1084
       #endif
1093
     }
1085
     }
1094
 
1086
 
1095
     if (g29_x_flag != g29_y_flag) {
1087
     if (g29_x_flag != g29_y_flag) {
1096
-      SERIAL_PROTOCOLLNPGM("Both X & Y locations must be specified.\n");
1088
+      SERIAL_ECHOLNPGM("Both X & Y locations must be specified.\n");
1097
       err_flag = true;
1089
       err_flag = true;
1098
     }
1090
     }
1099
 
1091
 
1111
      */
1103
      */
1112
     if (parser.seen('A')) {
1104
     if (parser.seen('A')) {
1113
       if (parser.seen('D')) {
1105
       if (parser.seen('D')) {
1114
-        SERIAL_PROTOCOLLNPGM("?Can't activate and deactivate at the same time.\n");
1106
+        SERIAL_ECHOLNPGM("?Can't activate and deactivate at the same time.\n");
1115
         return UBL_ERR;
1107
         return UBL_ERR;
1116
       }
1108
       }
1117
       set_bed_leveling_enabled(true);
1109
       set_bed_leveling_enabled(true);
1130
       if (parser.seenval('F')) {
1122
       if (parser.seenval('F')) {
1131
         const float fh = parser.value_float();
1123
         const float fh = parser.value_float();
1132
         if (!WITHIN(fh, 0, 100)) {
1124
         if (!WITHIN(fh, 0, 100)) {
1133
-          SERIAL_PROTOCOLLNPGM("?(F)ade height for Bed Level Correction not plausible.\n");
1125
+          SERIAL_ECHOLNPGM("?(F)ade height for Bed Level Correction not plausible.\n");
1134
           return UBL_ERR;
1126
           return UBL_ERR;
1135
         }
1127
         }
1136
         set_z_fade_height(fh);
1128
         set_z_fade_height(fh);
1139
 
1131
 
1140
     g29_map_type = parser.intval('T');
1132
     g29_map_type = parser.intval('T');
1141
     if (!WITHIN(g29_map_type, 0, 2)) {
1133
     if (!WITHIN(g29_map_type, 0, 2)) {
1142
-      SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
1134
+      SERIAL_ECHOLNPGM("Invalid map type.\n");
1143
       return UBL_ERR;
1135
       return UBL_ERR;
1144
     }
1136
     }
1145
     return UBL_OK;
1137
     return UBL_OK;
1435
               #if ENABLED(DEBUG_LEVELING_FEATURE)
1427
               #if ENABLED(DEBUG_LEVELING_FEATURE)
1436
                 if (DEBUGGING(LEVELING)) {
1428
                 if (DEBUGGING(LEVELING)) {
1437
                   SERIAL_CHAR('(');
1429
                   SERIAL_CHAR('(');
1438
-                  SERIAL_PROTOCOL_F(rx, 7);
1430
+                  SERIAL_ECHO_F(rx, 7);
1439
                   SERIAL_CHAR(',');
1431
                   SERIAL_CHAR(',');
1440
-                  SERIAL_PROTOCOL_F(ry, 7);
1432
+                  SERIAL_ECHO_F(ry, 7);
1441
                   SERIAL_ECHOPGM(")   logical: ");
1433
                   SERIAL_ECHOPGM(")   logical: ");
1442
                   SERIAL_CHAR('(');
1434
                   SERIAL_CHAR('(');
1443
-                  SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 7);
1435
+                  SERIAL_ECHO_F(LOGICAL_X_POSITION(rx), 7);
1444
                   SERIAL_CHAR(',');
1436
                   SERIAL_CHAR(',');
1445
-                  SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(ry), 7);
1446
-                  SERIAL_ECHOPGM(")   measured: ");
1447
-                  SERIAL_PROTOCOL_F(measured_z, 7);
1448
-                  SERIAL_ECHOPGM("   correction: ");
1449
-                  SERIAL_PROTOCOL_F(get_z_correction(rx, ry), 7);
1437
+                  SERIAL_ECHO_F(LOGICAL_Y_POSITION(ry), 7);
1438
+                  SERIAL_ECHOPAIR_F(")   measured: ", measured_z, 7);
1439
+                  SERIAL_ECHOPAIR_F("   correction: ", get_z_correction(rx, ry), 7);
1450
                 }
1440
                 }
1451
               #endif
1441
               #endif
1452
 
1442
 
1453
               measured_z -= get_z_correction(rx, ry) /* + zprobe_zoffset */ ;
1443
               measured_z -= get_z_correction(rx, ry) /* + zprobe_zoffset */ ;
1454
 
1444
 
1455
               #if ENABLED(DEBUG_LEVELING_FEATURE)
1445
               #if ENABLED(DEBUG_LEVELING_FEATURE)
1456
-                if (DEBUGGING(LEVELING)) {
1457
-                  SERIAL_ECHOPGM("   final >>>---> ");
1458
-                  SERIAL_PROTOCOL_F(measured_z, 7);
1459
-                  SERIAL_EOL();
1460
-                }
1446
+                if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR_F("   final >>>---> ", measured_z, 7);
1461
               #endif
1447
               #endif
1462
               if (g29_verbose_level > 3) {
1448
               if (g29_verbose_level > 3) {
1463
                 serial_spaces(16);
1449
                 serial_spaces(16);
1483
       vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal();
1469
       vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal();
1484
 
1470
 
1485
       if (g29_verbose_level > 2) {
1471
       if (g29_verbose_level > 2) {
1486
-        SERIAL_ECHOPGM("bed plane normal = [");
1487
-        SERIAL_PROTOCOL_F(normal.x, 7);
1488
-        SERIAL_PROTOCOLCHAR(',');
1489
-        SERIAL_PROTOCOL_F(normal.y, 7);
1490
-        SERIAL_PROTOCOLCHAR(',');
1491
-        SERIAL_PROTOCOL_F(normal.z, 7);
1472
+        SERIAL_ECHOPAIR_F("bed plane normal = [", normal.x, 7);
1473
+        SERIAL_CHAR(',');
1474
+        SERIAL_ECHO_F(normal.y, 7);
1475
+        SERIAL_CHAR(',');
1476
+        SERIAL_ECHO_F(normal.z, 7);
1492
         SERIAL_ECHOLNPGM("]");
1477
         SERIAL_ECHOLNPGM("]");
1493
       }
1478
       }
1494
 
1479
 
1502
 
1487
 
1503
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1488
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1504
             if (DEBUGGING(LEVELING)) {
1489
             if (DEBUGGING(LEVELING)) {
1505
-              SERIAL_ECHOPGM("before rotation = [");
1506
-              SERIAL_PROTOCOL_F(x_tmp, 7);
1507
-              SERIAL_PROTOCOLCHAR(',');
1508
-              SERIAL_PROTOCOL_F(y_tmp, 7);
1509
-              SERIAL_PROTOCOLCHAR(',');
1510
-              SERIAL_PROTOCOL_F(z_tmp, 7);
1490
+              SERIAL_ECHOPAIR_F("before rotation = [", x_tmp, 7);
1491
+              SERIAL_CHAR(',');
1492
+              SERIAL_ECHO_F(y_tmp, 7);
1493
+              SERIAL_CHAR(',');
1494
+              SERIAL_ECHO_F(z_tmp, 7);
1511
               SERIAL_ECHOPGM("]   ---> ");
1495
               SERIAL_ECHOPGM("]   ---> ");
1512
               serial_delay(20);
1496
               serial_delay(20);
1513
             }
1497
             }
1517
 
1501
 
1518
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1502
           #if ENABLED(DEBUG_LEVELING_FEATURE)
1519
             if (DEBUGGING(LEVELING)) {
1503
             if (DEBUGGING(LEVELING)) {
1520
-              SERIAL_ECHOPGM("after rotation = [");
1521
-              SERIAL_PROTOCOL_F(x_tmp, 7);
1522
-              SERIAL_PROTOCOLCHAR(',');
1523
-              SERIAL_PROTOCOL_F(y_tmp, 7);
1524
-              SERIAL_PROTOCOLCHAR(',');
1525
-              SERIAL_PROTOCOL_F(z_tmp, 7);
1504
+              SERIAL_ECHOPAIR_F("after rotation = [", x_tmp, 7);
1505
+              SERIAL_CHAR(',');
1506
+              SERIAL_ECHO_F(y_tmp, 7);
1507
+              SERIAL_CHAR(',');
1508
+              SERIAL_ECHO_F(z_tmp, 7);
1526
               SERIAL_ECHOLNPGM("]");
1509
               SERIAL_ECHOLNPGM("]");
1527
               serial_delay(55);
1510
               serial_delay(55);
1528
             }
1511
             }
1535
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1518
       #if ENABLED(DEBUG_LEVELING_FEATURE)
1536
         if (DEBUGGING(LEVELING)) {
1519
         if (DEBUGGING(LEVELING)) {
1537
           rotation.debug(PSTR("rotation matrix:\n"));
1520
           rotation.debug(PSTR("rotation matrix:\n"));
1538
-          SERIAL_ECHOPGM("LSF Results A=");
1539
-          SERIAL_PROTOCOL_F(lsf_results.A, 7);
1540
-          SERIAL_ECHOPGM("  B=");
1541
-          SERIAL_PROTOCOL_F(lsf_results.B, 7);
1542
-          SERIAL_ECHOPGM("  D=");
1543
-          SERIAL_PROTOCOL_F(lsf_results.D, 7);
1544
-          SERIAL_EOL();
1521
+          SERIAL_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7);
1522
+          SERIAL_ECHOPAIR_F("  B=", lsf_results.B, 7);
1523
+          SERIAL_ECHOLNPAIR_F("  D=", lsf_results.D, 7);
1545
           serial_delay(55);
1524
           serial_delay(55);
1546
 
1525
 
1547
-          SERIAL_ECHOPGM("bed plane normal = [");
1548
-          SERIAL_PROTOCOL_F(normal.x, 7);
1549
-          SERIAL_PROTOCOLCHAR(',');
1550
-          SERIAL_PROTOCOL_F(normal.y, 7);
1551
-          SERIAL_PROTOCOLCHAR(',');
1552
-          SERIAL_PROTOCOL_F(normal.z, 7);
1553
-          SERIAL_ECHOPGM("]\n");
1526
+          SERIAL_ECHOPAIR_F("bed plane normal = [", normal.x, 7);
1527
+          SERIAL_CHAR(',');
1528
+          SERIAL_ECHO_F(normal.y, 7);
1529
+          SERIAL_CHAR(',');
1530
+          SERIAL_ECHO_F(normal.z, 7);
1531
+          SERIAL_ECHOLNPGM("]");
1554
           SERIAL_EOL();
1532
           SERIAL_EOL();
1555
 
1533
 
1556
           /**
1534
           /**
1565
           float t, t1, d;
1543
           float t, t1, d;
1566
           t = normal.x * (PROBE_PT_1_X) + normal.y * (PROBE_PT_1_Y);
1544
           t = normal.x * (PROBE_PT_1_X) + normal.y * (PROBE_PT_1_Y);
1567
           d = t + normal.z * z1;
1545
           d = t + normal.z * z1;
1568
-          SERIAL_ECHOPGM("D from 1st point: ");
1569
-          SERIAL_ECHO_F(d, 6);
1570
-          SERIAL_ECHOPGM("   Z error: ");
1571
-          SERIAL_ECHO_F(normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6);
1572
-          SERIAL_EOL();
1546
+          SERIAL_ECHOPAIR_F("D from 1st point: ", d, 6);
1547
+          SERIAL_ECHOLNPAIR_F("   Z error: ", normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6);
1573
 
1548
 
1574
           t = normal.x * (PROBE_PT_2_X) + normal.y * (PROBE_PT_2_Y);
1549
           t = normal.x * (PROBE_PT_2_X) + normal.y * (PROBE_PT_2_Y);
1575
           d = t + normal.z * z2;
1550
           d = t + normal.z * z2;
1576
           SERIAL_EOL();
1551
           SERIAL_EOL();
1577
-          SERIAL_ECHOPGM("D from 2nd point: ");
1578
-          SERIAL_ECHO_F(d, 6);
1579
-          SERIAL_ECHOPGM("   Z error: ");
1580
-          SERIAL_ECHO_F(normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6);
1581
-          SERIAL_EOL();
1552
+          SERIAL_ECHOPAIR_F("D from 2nd point: ", d, 6);
1553
+          SERIAL_ECHOLNPAIR_F("   Z error: ", normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6);
1582
 
1554
 
1583
           t = normal.x * (PROBE_PT_3_X) + normal.y * (PROBE_PT_3_Y);
1555
           t = normal.x * (PROBE_PT_3_X) + normal.y * (PROBE_PT_3_Y);
1584
           d = t + normal.z * z3;
1556
           d = t + normal.z * z3;
1585
-          SERIAL_ECHOPGM("D from 3rd point: ");
1586
-          SERIAL_ECHO_F(d, 6);
1587
-          SERIAL_ECHOPGM("   Z error: ");
1588
-          SERIAL_ECHO_F(normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6);
1589
-          SERIAL_EOL();
1557
+          SERIAL_ECHOPAIR_F("D from 3rd point: ", d, 6);
1558
+          SERIAL_ECHOLNPAIR_F("   Z error: ", normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6);
1590
 
1559
 
1591
           t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
1560
           t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
1592
           d = t + normal.z * 0;
1561
           d = t + normal.z * 0;
1593
-          SERIAL_ECHOPGM("D from home location with Z=0 : ");
1594
-          SERIAL_ECHO_F(d, 6);
1595
-          SERIAL_EOL();
1562
+          SERIAL_ECHOLNPAIR_F("D from home location with Z=0 : ", d, 6);
1596
 
1563
 
1597
           t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
1564
           t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT);
1598
           d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0;
1565
           d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0;
1599
-          SERIAL_ECHOPGM("D from home location using mesh value for Z: ");
1600
-          SERIAL_ECHO_F(d, 6);
1566
+          SERIAL_ECHOPAIR_F("D from home location using mesh value for Z: ", d, 6);
1601
 
1567
 
1602
           SERIAL_ECHOPAIR("   Z error: (", Z_SAFE_HOMING_X_POINT);
1568
           SERIAL_ECHOPAIR("   Z error: (", Z_SAFE_HOMING_X_POINT);
1603
-          SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT );
1604
-          SERIAL_ECHOPGM(") = ");
1605
-          SERIAL_ECHO_F(get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6);
1606
-          SERIAL_EOL();
1569
+          SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT);
1570
+          SERIAL_ECHOLNPAIR_F(") = ", get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6);
1607
           #endif
1571
           #endif
1608
         } // DEBUGGING(LEVELING)
1572
         } // DEBUGGING(LEVELING)
1609
       #endif
1573
       #endif
1675
       report_state();
1639
       report_state();
1676
 
1640
 
1677
       if (storage_slot == -1)
1641
       if (storage_slot == -1)
1678
-        SERIAL_PROTOCOLPGM("No Mesh Loaded.");
1642
+        SERIAL_ECHOPGM("No Mesh Loaded.");
1679
       else {
1643
       else {
1680
-        SERIAL_PROTOCOLPAIR("Mesh ", storage_slot);
1681
-        SERIAL_PROTOCOLPGM(" Loaded.");
1644
+        SERIAL_ECHOPAIR("Mesh ", storage_slot);
1645
+        SERIAL_ECHOPGM(" Loaded.");
1682
       }
1646
       }
1683
       SERIAL_EOL();
1647
       SERIAL_EOL();
1684
       serial_delay(50);
1648
       serial_delay(50);
1685
 
1649
 
1686
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1650
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1687
-        SERIAL_PROTOCOLPGM("planner.z_fade_height : ");
1688
-        SERIAL_PROTOCOL_F(planner.z_fade_height, 4);
1689
-        SERIAL_EOL();
1651
+        SERIAL_ECHOLNPAIR_F("planner.z_fade_height : ", planner.z_fade_height, 4);
1690
       #endif
1652
       #endif
1691
 
1653
 
1692
       adjust_mesh_to_mean(g29_c_flag, g29_constant);
1654
       adjust_mesh_to_mean(g29_c_flag, g29_constant);
1693
 
1655
 
1694
       #if HAS_BED_PROBE
1656
       #if HAS_BED_PROBE
1695
-        SERIAL_PROTOCOLPGM("zprobe_zoffset: ");
1696
-        SERIAL_PROTOCOL_F(zprobe_zoffset, 7);
1697
-        SERIAL_EOL();
1657
+        SERIAL_ECHOLNPAIR_F("zprobe_zoffset: ", zprobe_zoffset, 7);
1698
       #endif
1658
       #endif
1699
 
1659
 
1700
       SERIAL_ECHOLNPAIR("MESH_MIN_X  " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); serial_delay(50);
1660
       SERIAL_ECHOLNPAIR("MESH_MIN_X  " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); serial_delay(50);
1706
       SERIAL_ECHOLNPAIR("MESH_X_DIST  ", MESH_X_DIST);
1666
       SERIAL_ECHOLNPAIR("MESH_X_DIST  ", MESH_X_DIST);
1707
       SERIAL_ECHOLNPAIR("MESH_Y_DIST  ", MESH_Y_DIST);                         serial_delay(50);
1667
       SERIAL_ECHOLNPAIR("MESH_Y_DIST  ", MESH_Y_DIST);                         serial_delay(50);
1708
 
1668
 
1709
-      SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: ");
1669
+      SERIAL_ECHOPGM("X-Axis Mesh Points at: ");
1710
       for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
1670
       for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
1711
-        SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3);
1712
-        SERIAL_PROTOCOLPGM("  ");
1671
+        SERIAL_ECHO_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3);
1672
+        SERIAL_ECHOPGM("  ");
1713
         serial_delay(25);
1673
         serial_delay(25);
1714
       }
1674
       }
1715
       SERIAL_EOL();
1675
       SERIAL_EOL();
1716
 
1676
 
1717
-      SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: ");
1677
+      SERIAL_ECHOPGM("Y-Axis Mesh Points at: ");
1718
       for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) {
1678
       for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) {
1719
-        SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3);
1720
-        SERIAL_PROTOCOLPGM("  ");
1679
+        SERIAL_ECHO_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3);
1680
+        SERIAL_ECHOPGM("  ");
1721
         serial_delay(25);
1681
         serial_delay(25);
1722
       }
1682
       }
1723
       SERIAL_EOL();
1683
       SERIAL_EOL();
1724
 
1684
 
1725
       #if HAS_KILL
1685
       #if HAS_KILL
1726
-        SERIAL_PROTOCOLPAIR("Kill pin on :", KILL_PIN);
1727
-        SERIAL_PROTOCOLLNPAIR("  state:", READ(KILL_PIN));
1686
+        SERIAL_ECHOPAIR("Kill pin on :", KILL_PIN);
1687
+        SERIAL_ECHOLNPAIR("  state:", READ(KILL_PIN));
1728
       #endif
1688
       #endif
1729
       SERIAL_EOL();
1689
       SERIAL_EOL();
1730
       serial_delay(50);
1690
       serial_delay(50);
1731
 
1691
 
1732
       #if ENABLED(UBL_DEVEL_DEBUGGING)
1692
       #if ENABLED(UBL_DEVEL_DEBUGGING)
1733
-        SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL();
1734
-        SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); SERIAL_EOL();
1693
+        SERIAL_ECHOLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL();
1694
+        SERIAL_ECHOLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); SERIAL_EOL();
1735
         serial_delay(50);
1695
         serial_delay(50);
1736
 
1696
 
1737
-        SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()));
1738
-        SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.meshes_end_index()));
1697
+        SERIAL_ECHOPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()));
1698
+        SERIAL_ECHOLNPAIR(" to ", hex_address((void*)settings.meshes_end_index()));
1739
         serial_delay(50);
1699
         serial_delay(50);
1740
 
1700
 
1741
-        SERIAL_PROTOCOLLNPAIR("sizeof(ubl) :  ", (int)sizeof(ubl));         SERIAL_EOL();
1742
-        SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL();
1701
+        SERIAL_ECHOLNPAIR("sizeof(ubl) :  ", (int)sizeof(ubl));         SERIAL_EOL();
1702
+        SERIAL_ECHOLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL();
1743
         serial_delay(25);
1703
         serial_delay(25);
1744
 
1704
 
1745
-        SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
1705
+        SERIAL_ECHOLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
1746
         serial_delay(50);
1706
         serial_delay(50);
1747
 
1707
 
1748
-        SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());
1749
-        SERIAL_PROTOCOLLNPGM(" meshes.\n");
1708
+        SERIAL_ECHOPAIR("EEPROM can hold ", settings.calc_num_meshes());
1709
+        SERIAL_ECHOLNPGM(" meshes.\n");
1750
         serial_delay(25);
1710
         serial_delay(25);
1751
       #endif // UBL_DEVEL_DEBUGGING
1711
       #endif // UBL_DEVEL_DEBUGGING
1752
 
1712
 
1753
       if (!sanity_check()) {
1713
       if (!sanity_check()) {
1754
         echo_name();
1714
         echo_name();
1755
-        SERIAL_PROTOCOLLNPGM(" sanity checks passed.");
1715
+        SERIAL_ECHOLNPGM(" sanity checks passed.");
1756
       }
1716
       }
1757
     }
1717
     }
1758
 
1718
 
1763
     void unified_bed_leveling::g29_eeprom_dump() {
1723
     void unified_bed_leveling::g29_eeprom_dump() {
1764
       uint8_t cccc;
1724
       uint8_t cccc;
1765
 
1725
 
1766
-      SERIAL_ECHO_START();
1767
-      SERIAL_ECHOLNPGM("EEPROM Dump:");
1726
+      SERIAL_ECHO_MSG("EEPROM Dump:");
1768
       persistentStore.access_start();
1727
       persistentStore.access_start();
1769
       for (uint16_t i = 0; i < persistentStore.capacity(); i += 16) {
1728
       for (uint16_t i = 0; i < persistentStore.capacity(); i += 16) {
1770
         if (!(i & 0x3)) idle();
1729
         if (!(i & 0x3)) idle();
1773
         for (uint16_t j = 0; j < 16; j++) {
1732
         for (uint16_t j = 0; j < 16; j++) {
1774
           persistentStore.read_data(i + j, &cccc, sizeof(uint8_t));
1733
           persistentStore.read_data(i + j, &cccc, sizeof(uint8_t));
1775
           print_hex_byte(cccc);
1734
           print_hex_byte(cccc);
1776
-          SERIAL_ECHO(' ');
1735
+          SERIAL_CHAR(' ');
1777
         }
1736
         }
1778
         SERIAL_EOL();
1737
         SERIAL_EOL();
1779
       }
1738
       }
1789
       int16_t a = settings.calc_num_meshes();
1748
       int16_t a = settings.calc_num_meshes();
1790
 
1749
 
1791
       if (!a) {
1750
       if (!a) {
1792
-        SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
1751
+        SERIAL_ECHOLNPGM("?EEPROM storage not available.");
1793
         return;
1752
         return;
1794
       }
1753
       }
1795
 
1754
 
1796
       if (!parser.has_value()) {
1755
       if (!parser.has_value()) {
1797
-        SERIAL_PROTOCOLLNPGM("?Storage slot # required.");
1798
-        SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
1756
+        SERIAL_ECHOLNPGM("?Storage slot # required.");
1757
+        SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
1799
         return;
1758
         return;
1800
       }
1759
       }
1801
 
1760
 
1802
       g29_storage_slot = parser.value_int();
1761
       g29_storage_slot = parser.value_int();
1803
 
1762
 
1804
       if (!WITHIN(g29_storage_slot, 0, a - 1)) {
1763
       if (!WITHIN(g29_storage_slot, 0, a - 1)) {
1805
-        SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
1806
-        SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
1764
+        SERIAL_ECHOLNPGM("?Invalid storage slot.");
1765
+        SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
1807
         return;
1766
         return;
1808
       }
1767
       }
1809
 
1768
 
1810
       float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
1769
       float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
1811
       settings.load_mesh(g29_storage_slot, &tmp_z_values);
1770
       settings.load_mesh(g29_storage_slot, &tmp_z_values);
1812
 
1771
 
1813
-      SERIAL_PROTOCOLPAIR("Subtracting mesh in slot ", g29_storage_slot);
1814
-      SERIAL_PROTOCOLLNPGM(" from current mesh.");
1772
+      SERIAL_ECHOPAIR("Subtracting mesh in slot ", g29_storage_slot);
1773
+      SERIAL_ECHOLNPGM(" from current mesh.");
1815
 
1774
 
1816
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
1775
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
1817
         for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
1776
         for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)

+ 1
- 2
Marlin/src/feature/dac/stepper_dac.cpp 查看文件

103
 void dac_print_values() {
103
 void dac_print_values() {
104
   if (!dac_present) return;
104
   if (!dac_present) return;
105
 
105
 
106
-  SERIAL_ECHO_START();
107
-  SERIAL_ECHOLNPGM("Stepper current values in % (Amps):");
106
+  SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
108
   SERIAL_ECHO_START();
107
   SERIAL_ECHO_START();
109
   SERIAL_ECHOPAIR(" X:",  dac_perc(X_AXIS));
108
   SERIAL_ECHOPAIR(" X:",  dac_perc(X_AXIS));
110
   SERIAL_ECHOPAIR(" (",   dac_amps(X_AXIS));
109
   SERIAL_ECHOPAIR(" (",   dac_amps(X_AXIS));

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

93
 
93
 
94
   #if ENABLED(PREVENT_COLD_EXTRUSION)
94
   #if ENABLED(PREVENT_COLD_EXTRUSION)
95
     if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
95
     if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
96
-      SERIAL_ERROR_START();
97
-      SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD);
96
+      SERIAL_ERROR_MSG(MSG_ERR_HOTEND_TOO_COLD);
98
       return false;
97
       return false;
99
     }
98
     }
100
   #endif
99
   #endif
142
     #if HAS_LCD_MENU
141
     #if HAS_LCD_MENU
143
       if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
142
       if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
144
     #endif
143
     #endif
145
-    SERIAL_ECHO_START();
146
-    SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT);
144
+    SERIAL_ECHO_MSG(MSG_FILAMENT_CHANGE_INSERT);
147
 
145
 
148
     #if HAS_BUZZER
146
     #if HAS_BUZZER
149
       filament_change_beep(max_beep_count, true);
147
       filament_change_beep(max_beep_count, true);
336
   #endif
334
   #endif
337
 
335
 
338
   if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
336
   if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
339
-    SERIAL_ERROR_START();
340
-    SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD);
337
+    SERIAL_ERROR_MSG(MSG_ERR_HOTEND_TOO_COLD);
341
 
338
 
342
     #if HAS_LCD_MENU
339
     #if HAS_LCD_MENU
343
       if (show_lcd) { // Show status screen
340
       if (show_lcd) { // Show status screen
464
       #if HAS_LCD_MENU
461
       #if HAS_LCD_MENU
465
         lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEAT);
462
         lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEAT);
466
       #endif
463
       #endif
467
-      SERIAL_ECHO_START();
468
-      SERIAL_ECHOLNPGM(_PMSG(MSG_FILAMENT_CHANGE_HEAT));
464
+      SERIAL_ECHO_MSG(_PMSG(MSG_FILAMENT_CHANGE_HEAT));
469
 
465
 
470
       // Wait for LCD click or M108
466
       // Wait for LCD click or M108
471
       while (wait_for_user) idle(true);
467
       while (wait_for_user) idle(true);

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

192
 
192
 
193
         #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
193
         #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG
194
           if (change) {
194
           if (change) {
195
-            SERIAL_PROTOCOLPGM("Motion detected:");
195
+            SERIAL_ECHOPGM("Motion detected:");
196
             for (uint8_t e = 0; e < NUM_RUNOUT_SENSORS; e++)
196
             for (uint8_t e = 0; e < NUM_RUNOUT_SENSORS; e++)
197
               if (TEST(change, e)) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + e); }
197
               if (TEST(change, e)) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + e); }
198
             SERIAL_EOL();
198
             SERIAL_EOL();
253
           static bool was_out = false;
253
           static bool was_out = false;
254
           if (out != was_out) {
254
           if (out != was_out) {
255
             was_out = out;
255
             was_out = out;
256
-            SERIAL_PROTOCOL("Filament ");
256
+            SERIAL_ECHOPGM("Filament ");
257
             serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n"));
257
             serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n"));
258
           }
258
           }
259
         #endif
259
         #endif
289
             t = millis() + 1000UL;
289
             t = millis() + 1000UL;
290
             LOOP_L_N(i, EXTRUDERS) {
290
             LOOP_L_N(i, EXTRUDERS) {
291
               serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: "));
291
               serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: "));
292
-              SERIAL_PROTOCOL(runout_mm_countdown[i]);
292
+              SERIAL_ECHO(runout_mm_countdown[i]);
293
             }
293
             }
294
             SERIAL_EOL();
294
             SERIAL_EOL();
295
           }
295
           }

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

59
           break;
59
           break;
60
       #endif
60
       #endif
61
     default:
61
     default:
62
-      SERIAL_ECHO_START();
63
-      SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
62
+      SERIAL_ECHO_MSG(MSG_INVALID_SOLENOID);
64
       break;
63
       break;
65
   }
64
   }
66
 }
65
 }

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

358
 
358
 
359
   template <typename TMC>
359
   template <typename TMC>
360
   static void tmc_status(TMC &st, const TMC_debug_enum i, const float spmm) {
360
   static void tmc_status(TMC &st, const TMC_debug_enum i, const float spmm) {
361
-    SERIAL_ECHO('\t');
361
+    SERIAL_CHAR('\t');
362
     switch (i) {
362
     switch (i) {
363
       case TMC_CODES: st.printLabel(); break;
363
       case TMC_CODES: st.printLabel(); break;
364
       case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
364
       case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
365
       case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
365
       case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
366
-      case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break;
366
+      case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
367
       case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
367
       case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
368
       case TMC_IRUN:
368
       case TMC_IRUN:
369
         SERIAL_PRINT(st.irun(), DEC);
369
         SERIAL_PRINT(st.irun(), DEC);
408
   #if HAS_DRIVER(TMC2660)
408
   #if HAS_DRIVER(TMC2660)
409
     template<char AXIS_LETTER, char DRIVER_ID>
409
     template<char AXIS_LETTER, char DRIVER_ID>
410
     void tmc_status(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const TMC_debug_enum i, const float) {
410
     void tmc_status(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const TMC_debug_enum i, const float) {
411
-      SERIAL_ECHO('\t');
411
+      SERIAL_CHAR('\t');
412
       switch (i) {
412
       switch (i) {
413
         case TMC_CODES: st.printLabel(); break;
413
         case TMC_CODES: st.printLabel(); break;
414
         case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
414
         case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
415
         case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
415
         case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
416
-        case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break;
416
+        case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
417
         case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
417
         case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
418
         case TMC_IRUN:
418
         case TMC_IRUN:
419
           SERIAL_PRINT(st.cs(), DEC);
419
           SERIAL_PRINT(st.cs(), DEC);

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

44
 
44
 
45
 void TWIBus::address(const uint8_t adr) {
45
 void TWIBus::address(const uint8_t adr) {
46
   if (!WITHIN(adr, 8, 127)) {
46
   if (!WITHIN(adr, 8, 127)) {
47
-    SERIAL_ECHO_START();
48
-    SERIAL_ECHOLNPGM("Bad I2C address (8-127)");
47
+    SERIAL_ECHO_MSG("Bad I2C address (8-127)");
49
   }
48
   }
50
 
49
 
51
   this->addr = adr;
50
   this->addr = adr;

+ 12
- 12
Marlin/src/gcode/bedlevel/G26.cpp 查看文件

573
   if (parser.seenval('B')) {
573
   if (parser.seenval('B')) {
574
     g26_bed_temp = parser.value_celsius();
574
     g26_bed_temp = parser.value_celsius();
575
     if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) {
575
     if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) {
576
-      SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible (40-140C).");
576
+      SERIAL_ECHOLNPGM("?Specified bed temperature not plausible (40-140C).");
577
       return;
577
       return;
578
     }
578
     }
579
   }
579
   }
581
   if (parser.seenval('L')) {
581
   if (parser.seenval('L')) {
582
     g26_layer_height = parser.value_linear_units();
582
     g26_layer_height = parser.value_linear_units();
583
     if (!WITHIN(g26_layer_height, 0.0, 2.0)) {
583
     if (!WITHIN(g26_layer_height, 0.0, 2.0)) {
584
-      SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
584
+      SERIAL_ECHOLNPGM("?Specified layer height not plausible.");
585
       return;
585
       return;
586
     }
586
     }
587
   }
587
   }
590
     if (parser.has_value()) {
590
     if (parser.has_value()) {
591
       g26_retraction_multiplier = parser.value_float();
591
       g26_retraction_multiplier = parser.value_float();
592
       if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
592
       if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
593
-        SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
593
+        SERIAL_ECHOLNPGM("?Specified Retraction Multiplier not plausible.");
594
         return;
594
         return;
595
       }
595
       }
596
     }
596
     }
597
     else {
597
     else {
598
-      SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified.");
598
+      SERIAL_ECHOLNPGM("?Retraction Multiplier must be specified.");
599
       return;
599
       return;
600
     }
600
     }
601
   }
601
   }
603
   if (parser.seenval('S')) {
603
   if (parser.seenval('S')) {
604
     g26_nozzle = parser.value_float();
604
     g26_nozzle = parser.value_float();
605
     if (!WITHIN(g26_nozzle, 0.1, 1.0)) {
605
     if (!WITHIN(g26_nozzle, 0.1, 1.0)) {
606
-      SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
606
+      SERIAL_ECHOLNPGM("?Specified nozzle size not plausible.");
607
       return;
607
       return;
608
     }
608
     }
609
   }
609
   }
613
       #if HAS_LCD_MENU
613
       #if HAS_LCD_MENU
614
         g26_prime_flag = -1;
614
         g26_prime_flag = -1;
615
       #else
615
       #else
616
-        SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD.");
616
+        SERIAL_ECHOLNPGM("?Prime length must be specified when not using an LCD.");
617
         return;
617
         return;
618
       #endif
618
       #endif
619
     }
619
     }
621
       g26_prime_flag++;
621
       g26_prime_flag++;
622
       g26_prime_length = parser.value_linear_units();
622
       g26_prime_length = parser.value_linear_units();
623
       if (!WITHIN(g26_prime_length, 0.0, 25.0)) {
623
       if (!WITHIN(g26_prime_length, 0.0, 25.0)) {
624
-        SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
624
+        SERIAL_ECHOLNPGM("?Specified prime length not plausible.");
625
         return;
625
         return;
626
       }
626
       }
627
     }
627
     }
630
   if (parser.seenval('F')) {
630
   if (parser.seenval('F')) {
631
     g26_filament_diameter = parser.value_linear_units();
631
     g26_filament_diameter = parser.value_linear_units();
632
     if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) {
632
     if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) {
633
-      SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
633
+      SERIAL_ECHOLNPGM("?Specified filament size not plausible.");
634
       return;
634
       return;
635
     }
635
     }
636
   }
636
   }
643
   if (parser.seenval('H')) {
643
   if (parser.seenval('H')) {
644
     g26_hotend_temp = parser.value_celsius();
644
     g26_hotend_temp = parser.value_celsius();
645
     if (!WITHIN(g26_hotend_temp, 165, 280)) {
645
     if (!WITHIN(g26_hotend_temp, 165, 280)) {
646
-      SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
646
+      SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible.");
647
       return;
647
       return;
648
     }
648
     }
649
   }
649
   }
659
     g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1);
659
     g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1);
660
   #else
660
   #else
661
     if (!parser.seen('R')) {
661
     if (!parser.seen('R')) {
662
-      SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD.");
662
+      SERIAL_ECHOLNPGM("?(R)epeat must be specified when not using an LCD.");
663
       return;
663
       return;
664
     }
664
     }
665
     else
665
     else
666
       g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1;
666
       g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1;
667
   #endif
667
   #endif
668
   if (g26_repeats < 1) {
668
   if (g26_repeats < 1) {
669
-    SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1.");
669
+    SERIAL_ECHOLNPGM("?(R)epeat value not plausible; must be at least 1.");
670
     return;
670
     return;
671
   }
671
   }
672
 
672
 
673
   g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
673
   g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
674
   g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
674
   g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
675
   if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
675
   if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
676
-    SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
676
+    SERIAL_ECHOLNPGM("?Specified X,Y coordinate out of bounds.");
677
     return;
677
     return;
678
   }
678
   }
679
 
679
 

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

95
         const int16_t a = settings.calc_num_meshes();
95
         const int16_t a = settings.calc_num_meshes();
96
 
96
 
97
         if (!a) {
97
         if (!a) {
98
-          SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
98
+          SERIAL_ECHOLNPGM("?EEPROM storage not available.");
99
           return;
99
           return;
100
         }
100
         }
101
 
101
 
102
         if (!WITHIN(storage_slot, 0, a - 1)) {
102
         if (!WITHIN(storage_slot, 0, a - 1)) {
103
-          SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
104
-          SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
103
+          SERIAL_ECHOLNPGM("?Invalid storage slot.");
104
+          SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1);
105
           return;
105
           return;
106
         }
106
         }
107
 
107
 
110
 
110
 
111
       #else
111
       #else
112
 
112
 
113
-        SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
113
+        SERIAL_ECHOLNPGM("?EEPROM storage not available.");
114
         return;
114
         return;
115
 
115
 
116
       #endif
116
       #endif
206
   set_bed_leveling_enabled(to_enable);
206
   set_bed_leveling_enabled(to_enable);
207
 
207
 
208
   // Error if leveling failed to enable or reenable
208
   // Error if leveling failed to enable or reenable
209
-  if (to_enable && !planner.leveling_active) {
210
-    SERIAL_ERROR_START();
211
-    SERIAL_ERRORLNPGM(MSG_ERR_M420_FAILED);
212
-  }
209
+  if (to_enable && !planner.leveling_active)
210
+    SERIAL_ERROR_MSG(MSG_ERR_M420_FAILED);
213
 
211
 
214
   SERIAL_ECHO_START();
212
   SERIAL_ECHO_START();
215
   SERIAL_ECHOPGM("Bed Leveling ");
213
   SERIAL_ECHOPGM("Bed Leveling ");

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

293
       const bool seen_w = parser.seen('W');
293
       const bool seen_w = parser.seen('W');
294
       if (seen_w) {
294
       if (seen_w) {
295
         if (!leveling_is_valid()) {
295
         if (!leveling_is_valid()) {
296
-          SERIAL_ERROR_START();
297
-          SERIAL_ERRORLNPGM("No bilinear grid");
296
+          SERIAL_ERROR_MSG("No bilinear grid");
298
           G29_RETURN(false);
297
           G29_RETURN(false);
299
         }
298
         }
300
 
299
 
301
         const float rz = parser.seenval('Z') ? RAW_Z_POSITION(parser.value_linear_units()) : current_position[Z_AXIS];
300
         const float rz = parser.seenval('Z') ? RAW_Z_POSITION(parser.value_linear_units()) : current_position[Z_AXIS];
302
         if (!WITHIN(rz, -10, 10)) {
301
         if (!WITHIN(rz, -10, 10)) {
303
-          SERIAL_ERROR_START();
304
-          SERIAL_ERRORLNPGM("Bad Z value");
302
+          SERIAL_ERROR_MSG("Bad Z value");
305
           G29_RETURN(false);
303
           G29_RETURN(false);
306
         }
304
         }
307
 
305
 
343
 
341
 
344
     verbose_level = parser.intval('V');
342
     verbose_level = parser.intval('V');
345
     if (!WITHIN(verbose_level, 0, 4)) {
343
     if (!WITHIN(verbose_level, 0, 4)) {
346
-      SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).");
344
+      SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).");
347
       G29_RETURN(false);
345
       G29_RETURN(false);
348
     }
346
     }
349
 
347
 
364
       if (parser.seenval('P')) abl_grid_points_x = abl_grid_points_y = parser.value_int();
362
       if (parser.seenval('P')) abl_grid_points_x = abl_grid_points_y = parser.value_int();
365
 
363
 
366
       if (!WITHIN(abl_grid_points_x, 2, GRID_MAX_POINTS_X)) {
364
       if (!WITHIN(abl_grid_points_x, 2, GRID_MAX_POINTS_X)) {
367
-        SERIAL_PROTOCOLLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
365
+        SERIAL_ECHOLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
368
         G29_RETURN(false);
366
         G29_RETURN(false);
369
       }
367
       }
370
       if (!WITHIN(abl_grid_points_y, 2, GRID_MAX_POINTS_Y)) {
368
       if (!WITHIN(abl_grid_points_y, 2, GRID_MAX_POINTS_Y)) {
371
-        SERIAL_PROTOCOLLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
369
+        SERIAL_ECHOLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
372
         G29_RETURN(false);
370
         G29_RETURN(false);
373
       }
371
       }
374
 
372
 
410
           || !position_is_reachable_by_probe(right_probe_bed_position, back_probe_bed_position)
408
           || !position_is_reachable_by_probe(right_probe_bed_position, back_probe_bed_position)
411
         #endif
409
         #endif
412
       ) {
410
       ) {
413
-        SERIAL_PROTOCOLLNPGM("? (L,R,F,B) out of bounds.");
411
+        SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
414
         G29_RETURN(false);
412
         G29_RETURN(false);
415
       }
413
       }
416
 
414
 
421
     #endif // ABL_GRID
419
     #endif // ABL_GRID
422
 
420
 
423
     if (verbose_level > 0) {
421
     if (verbose_level > 0) {
424
-      SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling");
425
-      if (dryrun) SERIAL_PROTOCOLPGM(" (DRYRUN)");
422
+      SERIAL_ECHOPGM("G29 Auto Bed Leveling");
423
+      if (dryrun) SERIAL_ECHOPGM(" (DRYRUN)");
426
       SERIAL_EOL();
424
       SERIAL_EOL();
427
     }
425
     }
428
 
426
 
491
 
489
 
492
     // Abort current G29 procedure, go back to idle state
490
     // Abort current G29 procedure, go back to idle state
493
     if (seenA && g29_in_progress) {
491
     if (seenA && g29_in_progress) {
494
-      SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
492
+      SERIAL_ECHOLNPGM("Manual G29 aborted");
495
       #if HAS_SOFTWARE_ENDSTOPS
493
       #if HAS_SOFTWARE_ENDSTOPS
496
         soft_endstops_enabled = enable_soft_endstops;
494
         soft_endstops_enabled = enable_soft_endstops;
497
       #endif
495
       #endif
504
 
502
 
505
     // Query G29 status
503
     // Query G29 status
506
     if (verbose_level || seenQ) {
504
     if (verbose_level || seenQ) {
507
-      SERIAL_PROTOCOLPGM("Manual G29 ");
505
+      SERIAL_ECHOPGM("Manual G29 ");
508
       if (g29_in_progress) {
506
       if (g29_in_progress) {
509
-        SERIAL_PROTOCOLPAIR("point ", MIN(abl_probe_index + 1, abl_points));
510
-        SERIAL_PROTOCOLLNPAIR(" of ", abl_points);
507
+        SERIAL_ECHOPAIR("point ", MIN(abl_probe_index + 1, abl_points));
508
+        SERIAL_ECHOLNPAIR(" of ", abl_points);
511
       }
509
       }
512
       else
510
       else
513
-        SERIAL_PROTOCOLLNPGM("idle");
511
+        SERIAL_ECHOLNPGM("idle");
514
     }
512
     }
515
 
513
 
516
     if (no_action) G29_RETURN(false);
514
     if (no_action) G29_RETURN(false);
553
 
551
 
554
         #if ENABLED(DEBUG_LEVELING_FEATURE)
552
         #if ENABLED(DEBUG_LEVELING_FEATURE)
555
           if (DEBUGGING(LEVELING)) {
553
           if (DEBUGGING(LEVELING)) {
556
-            SERIAL_PROTOCOLPAIR("Save X", xCount);
557
-            SERIAL_PROTOCOLPAIR(" Y", yCount);
558
-            SERIAL_PROTOCOLLNPAIR(" Z", measured_z + zoffset);
554
+            SERIAL_ECHOPAIR("Save X", xCount);
555
+            SERIAL_ECHOPAIR(" Y", yCount);
556
+            SERIAL_ECHOLNPAIR(" Z", measured_z + zoffset);
559
           }
557
           }
560
         #endif
558
         #endif
561
 
559
 
609
 
607
 
610
         // Leveling done! Fall through to G29 finishing code below
608
         // Leveling done! Fall through to G29 finishing code below
611
 
609
 
612
-        SERIAL_PROTOCOLLNPGM("Grid probing done.");
610
+        SERIAL_ECHOLNPGM("Grid probing done.");
613
 
611
 
614
         // Re-enable software endstops, if needed
612
         // Re-enable software endstops, if needed
615
         #if HAS_SOFTWARE_ENDSTOPS
613
         #if HAS_SOFTWARE_ENDSTOPS
633
       }
631
       }
634
       else {
632
       else {
635
 
633
 
636
-        SERIAL_PROTOCOLLNPGM("3-point probing done.");
634
+        SERIAL_ECHOLNPGM("3-point probing done.");
637
 
635
 
638
         // Re-enable software endstops, if needed
636
         // Re-enable software endstops, if needed
639
         #if HAS_SOFTWARE_ENDSTOPS
637
         #if HAS_SOFTWARE_ENDSTOPS
829
       mean /= abl_points;
827
       mean /= abl_points;
830
 
828
 
831
       if (verbose_level) {
829
       if (verbose_level) {
832
-        SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
833
-        SERIAL_PROTOCOL_F(plane_equation_coefficients[0], 8);
834
-        SERIAL_PROTOCOLPGM(" b: ");
835
-        SERIAL_PROTOCOL_F(plane_equation_coefficients[1], 8);
836
-        SERIAL_PROTOCOLPGM(" d: ");
837
-        SERIAL_PROTOCOL_F(plane_equation_coefficients[2], 8);
830
+        SERIAL_ECHOPAIR_F("Eqn coefficients: a: ", plane_equation_coefficients[0], 8);
831
+        SERIAL_ECHOPAIR_F(" b: ", plane_equation_coefficients[1], 8);
832
+        SERIAL_ECHOPAIR_F(" d: ", plane_equation_coefficients[2], 8);
833
+        if (verbose_level > 2)
834
+          SERIAL_ECHOPAIR_F("\nMean of sampled points: ", mean, 8);
838
         SERIAL_EOL();
835
         SERIAL_EOL();
839
-        if (verbose_level > 2) {
840
-          SERIAL_PROTOCOLPGM("Mean of sampled points: ");
841
-          SERIAL_PROTOCOL_F(mean, 8);
842
-          SERIAL_EOL();
843
-        }
844
       }
836
       }
845
 
837
 
846
       // Create the matrix but don't correct the position yet
838
       // Create the matrix but don't correct the position yet
852
       // Show the Topography map if enabled
844
       // Show the Topography map if enabled
853
       if (do_topography_map) {
845
       if (do_topography_map) {
854
 
846
 
855
-        SERIAL_PROTOCOLLNPGM("\nBed Height Topography:\n"
847
+        SERIAL_ECHOLNPGM("\nBed Height Topography:\n"
856
                                "   +--- BACK --+\n"
848
                                "   +--- BACK --+\n"
857
                                "   |           |\n"
849
                                "   |           |\n"
858
                                " L |    (+)    | R\n"
850
                                " L |    (+)    | R\n"
879
             NOMORE(min_diff, eqnBVector[ind] - z_tmp);
871
             NOMORE(min_diff, eqnBVector[ind] - z_tmp);
880
 
872
 
881
             if (diff >= 0.0)
873
             if (diff >= 0.0)
882
-              SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
874
+              SERIAL_ECHOPGM(" +");   // Include + for column alignment
883
             else
875
             else
884
-              SERIAL_PROTOCOLCHAR(' ');
885
-            SERIAL_PROTOCOL_F(diff, 5);
876
+              SERIAL_CHAR(' ');
877
+            SERIAL_ECHO_F(diff, 5);
886
           } // xx
878
           } // xx
887
           SERIAL_EOL();
879
           SERIAL_EOL();
888
         } // yy
880
         } // yy
889
         SERIAL_EOL();
881
         SERIAL_EOL();
890
 
882
 
891
         if (verbose_level > 3) {
883
         if (verbose_level > 3) {
892
-          SERIAL_PROTOCOLLNPGM("\nCorrected Bed Height vs. Bed Topology:");
884
+          SERIAL_ECHOLNPGM("\nCorrected Bed Height vs. Bed Topology:");
893
 
885
 
894
           for (int8_t yy = abl_grid_points_y - 1; yy >= 0; yy--) {
886
           for (int8_t yy = abl_grid_points_y - 1; yy >= 0; yy--) {
895
             for (uint8_t xx = 0; xx < abl_grid_points_x; xx++) {
887
             for (uint8_t xx = 0; xx < abl_grid_points_x; xx++) {
902
 
894
 
903
               float diff = eqnBVector[ind] - z_tmp - min_diff;
895
               float diff = eqnBVector[ind] - z_tmp - min_diff;
904
               if (diff >= 0.0)
896
               if (diff >= 0.0)
905
-                SERIAL_PROTOCOLPGM(" +");
897
+                SERIAL_ECHOPGM(" +");
906
               // Include + for column alignment
898
               // Include + for column alignment
907
               else
899
               else
908
-                SERIAL_PROTOCOLCHAR(' ');
909
-              SERIAL_PROTOCOL_F(diff, 5);
900
+                SERIAL_CHAR(' ');
901
+              SERIAL_ECHO_F(diff, 5);
910
             } // xx
902
             } // xx
911
             SERIAL_EOL();
903
             SERIAL_EOL();
912
           } // yy
904
           } // yy

+ 4
- 8
Marlin/src/gcode/bedlevel/abl/M421.cpp 查看文件

45
              hasZ = parser.seen('Z'),
45
              hasZ = parser.seen('Z'),
46
              hasQ = !hasZ && parser.seen('Q');
46
              hasQ = !hasZ && parser.seen('Q');
47
 
47
 
48
-  if (!hasI || !hasJ || !(hasZ || hasQ)) {
49
-    SERIAL_ERROR_START();
50
-    SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
51
-  }
52
-  else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
53
-    SERIAL_ERROR_START();
54
-    SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
55
-  }
48
+  if (!hasI || !hasJ || !(hasZ || hasQ))
49
+    SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
50
+  else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))
51
+    SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
56
   else {
52
   else {
57
     z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
53
     z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
58
     #if ENABLED(ABL_BILINEAR_SUBDIVISION)
54
     #if ENABLED(ABL_BILINEAR_SUBDIVISION)

+ 12
- 12
Marlin/src/gcode/bedlevel/mbl/G29.cpp 查看文件

39
 #include "../../../module/stepper.h"
39
 #include "../../../module/stepper.h"
40
 
40
 
41
 // Save 130 bytes with non-duplication of PSTR
41
 // Save 130 bytes with non-duplication of PSTR
42
-inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_PROTOCOLLNPGM(" not entered."); }
42
+inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
43
 
43
 
44
 /**
44
 /**
45
  * G29: Mesh-based Z probe, probes a grid and produces a
45
  * G29: Mesh-based Z probe, probes a grid and produces a
64
 
64
 
65
   MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
65
   MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
66
   if (!WITHIN(state, 0, 5)) {
66
   if (!WITHIN(state, 0, 5)) {
67
-    SERIAL_PROTOCOLLNPGM("S out of range (0-5).");
67
+    SERIAL_ECHOLNPGM("S out of range (0-5).");
68
     return;
68
     return;
69
   }
69
   }
70
 
70
 
72
 
72
 
73
   switch (state) {
73
   switch (state) {
74
     case MeshReport:
74
     case MeshReport:
75
-      SERIAL_PROTOCOLPGM("Mesh Bed Leveling ");
75
+      SERIAL_ECHOPGM("Mesh Bed Leveling ");
76
       if (leveling_is_valid()) {
76
       if (leveling_is_valid()) {
77
         serialprintln_onoff(planner.leveling_active);
77
         serialprintln_onoff(planner.leveling_active);
78
         mbl.report_mesh();
78
         mbl.report_mesh();
79
       }
79
       }
80
       else
80
       else
81
-        SERIAL_PROTOCOLLNPGM("has no data.");
81
+        SERIAL_ECHOLNPGM("has no data.");
82
       break;
82
       break;
83
 
83
 
84
     case MeshStart:
84
     case MeshStart:
92
 
92
 
93
     case MeshNext:
93
     case MeshNext:
94
       if (mbl_probe_index < 0) {
94
       if (mbl_probe_index < 0) {
95
-        SERIAL_PROTOCOLLNPGM("Start mesh probing with \"G29 S1\" first.");
95
+        SERIAL_ECHOLNPGM("Start mesh probing with \"G29 S1\" first.");
96
         return;
96
         return;
97
       }
97
       }
98
       // For each G29 S2...
98
       // For each G29 S2...
130
 
130
 
131
         // After recording the last point, activate home and activate
131
         // After recording the last point, activate home and activate
132
         mbl_probe_index = -1;
132
         mbl_probe_index = -1;
133
-        SERIAL_PROTOCOLLNPGM("Mesh probing done.");
133
+        SERIAL_ECHOLNPGM("Mesh probing done.");
134
         BUZZ(100, 659);
134
         BUZZ(100, 659);
135
         BUZZ(100, 698);
135
         BUZZ(100, 698);
136
 
136
 
154
       if (parser.seenval('I')) {
154
       if (parser.seenval('I')) {
155
         ix = parser.value_int();
155
         ix = parser.value_int();
156
         if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) {
156
         if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) {
157
-          SERIAL_PROTOCOLPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1));
158
-          SERIAL_PROTOCOLLNPGM(")");
157
+          SERIAL_ECHOPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1));
158
+          SERIAL_ECHOLNPGM(")");
159
           return;
159
           return;
160
         }
160
         }
161
       }
161
       }
165
       if (parser.seenval('J')) {
165
       if (parser.seenval('J')) {
166
         iy = parser.value_int();
166
         iy = parser.value_int();
167
         if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
167
         if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
168
-          SERIAL_PROTOCOLPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1));
169
-          SERIAL_PROTOCOLLNPGM(")");
168
+          SERIAL_ECHOPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1));
169
+          SERIAL_ECHOLNPGM(")");
170
           return;
170
           return;
171
         }
171
         }
172
       }
172
       }
193
   } // switch(state)
193
   } // switch(state)
194
 
194
 
195
   if (state == MeshNext) {
195
   if (state == MeshNext) {
196
-    SERIAL_PROTOCOLPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
197
-    SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
196
+    SERIAL_ECHOPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
197
+    SERIAL_ECHOLNPAIR(" of ", int(GRID_MAX_POINTS));
198
   }
198
   }
199
 
199
 
200
   report_current_position();
200
   report_current_position();

+ 4
- 8
Marlin/src/gcode/bedlevel/mbl/M421.cpp 查看文件

48
   const int8_t iy = hasJ ? parser.value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1;
48
   const int8_t iy = hasJ ? parser.value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1;
49
   const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q');
49
   const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q');
50
 
50
 
51
-  if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) {
52
-    SERIAL_ERROR_START();
53
-    SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
54
-  }
55
-  else if (ix < 0 || iy < 0) {
56
-    SERIAL_ERROR_START();
57
-    SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
58
-  }
51
+  if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ))
52
+    SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
53
+  else if (ix < 0 || iy < 0)
54
+    SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
59
   else
55
   else
60
     mbl.set_z(ix, iy, parser.value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0));
56
     mbl.set_z(ix, iy, parser.value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0));
61
 }
57
 }

+ 4
- 8
Marlin/src/gcode/bedlevel/ubl/M421.cpp 查看文件

56
     iy = location.y_index;
56
     iy = location.y_index;
57
   }
57
   }
58
 
58
 
59
-  if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) {
60
-    SERIAL_ERROR_START();
61
-    SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
62
-  }
63
-  else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
64
-    SERIAL_ERROR_START();
65
-    SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
66
-  }
59
+  if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
60
+    SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS);
61
+  else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1))
62
+    SERIAL_ERROR_MSG(MSG_ERR_MESH_XY);
67
   else
63
   else
68
     ubl.z_values[ix][iy] = hasN ? NAN : parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
64
     ubl.z_values[ix][iy] = hasN ? NAN : parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
69
 }
65
 }

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

33
 
33
 
34
 void GcodeSuite::M49() {
34
 void GcodeSuite::M49() {
35
   g26_debug_flag ^= true;
35
   g26_debug_flag ^= true;
36
-  SERIAL_PROTOCOLPGM("G26 Debug: ");
36
+  SERIAL_ECHOPGM("G26 Debug: ");
37
   serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
37
   serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
38
 }
38
 }
39
 
39
 

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

92
     // Disallow Z homing if X or Y are unknown
92
     // Disallow Z homing if X or Y are unknown
93
     if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
93
     if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
94
       LCD_MESSAGEPGM(MSG_ERR_Z_HOMING);
94
       LCD_MESSAGEPGM(MSG_ERR_Z_HOMING);
95
-      SERIAL_ECHO_START();
96
-      SERIAL_ECHOLNPGM(MSG_ERR_Z_HOMING);
95
+      SERIAL_ECHO_MSG(MSG_ERR_Z_HOMING);
97
       return;
96
       return;
98
     }
97
     }
99
 
98
 
135
     }
134
     }
136
     else {
135
     else {
137
       LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
136
       LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
138
-      SERIAL_ECHO_START();
139
-      SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
137
+      SERIAL_ECHO_MSG(MSG_ZPROBE_OUT);
140
     }
138
     }
141
 
139
 
142
     #if ENABLED(DEBUG_LEVELING_FEATURE)
140
     #if ENABLED(DEBUG_LEVELING_FEATURE)

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

109
 }
109
 }
110
 
110
 
111
 void print_signed_float(PGM_P const prefix, const float &f) {
111
 void print_signed_float(PGM_P const prefix, const float &f) {
112
-  SERIAL_PROTOCOLPGM("  ");
112
+  SERIAL_ECHOPGM("  ");
113
   serialprintPGM(prefix);
113
   serialprintPGM(prefix);
114
-  SERIAL_PROTOCOLCHAR(':');
114
+  SERIAL_CHAR(':');
115
   if (f >= 0) SERIAL_CHAR('+');
115
   if (f >= 0) SERIAL_CHAR('+');
116
-  SERIAL_PROTOCOL_F(f, 2);
116
+  SERIAL_ECHO_F(f, 2);
117
 }
117
 }
118
 
118
 
119
 /**
119
 /**
120
  *  - Print the delta settings
120
  *  - Print the delta settings
121
  */
121
  */
122
 static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
122
 static void print_calibration_settings(const bool end_stops, const bool tower_angles) {
123
-  SERIAL_PROTOCOLPAIR(".Height:", delta_height);
123
+  SERIAL_ECHOPAIR(".Height:", delta_height);
124
   if (end_stops) {
124
   if (end_stops) {
125
     print_signed_float(PSTR("Ex"), delta_endstop_adj[A_AXIS]);
125
     print_signed_float(PSTR("Ex"), delta_endstop_adj[A_AXIS]);
126
     print_signed_float(PSTR("Ey"), delta_endstop_adj[B_AXIS]);
126
     print_signed_float(PSTR("Ey"), delta_endstop_adj[B_AXIS]);
127
     print_signed_float(PSTR("Ez"), delta_endstop_adj[C_AXIS]);
127
     print_signed_float(PSTR("Ez"), delta_endstop_adj[C_AXIS]);
128
   }
128
   }
129
   if (end_stops && tower_angles) {
129
   if (end_stops && tower_angles) {
130
-    SERIAL_PROTOCOLPAIR("  Radius:", delta_radius);
130
+    SERIAL_ECHOPAIR("  Radius:", delta_radius);
131
     SERIAL_EOL();
131
     SERIAL_EOL();
132
     SERIAL_CHAR('.');
132
     SERIAL_CHAR('.');
133
-    SERIAL_PROTOCOL_SP(13);
133
+    SERIAL_ECHO_SP(13);
134
   }
134
   }
135
   if (tower_angles) {
135
   if (tower_angles) {
136
     print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
136
     print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
138
     print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]);
138
     print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]);
139
   }
139
   }
140
   if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
140
   if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
141
-    SERIAL_PROTOCOLPAIR("  Radius:", delta_radius);
141
+    SERIAL_ECHOPAIR("  Radius:", delta_radius);
142
   }
142
   }
143
   #if HAS_BED_PROBE
143
   #if HAS_BED_PROBE
144
     if (!end_stops && !tower_angles) {
144
     if (!end_stops && !tower_angles) {
145
-      SERIAL_PROTOCOL_SP(30);
145
+      SERIAL_ECHO_SP(30);
146
       print_signed_float(PSTR("Offset"), zprobe_zoffset);
146
       print_signed_float(PSTR("Offset"), zprobe_zoffset);
147
     }
147
     }
148
   #endif
148
   #endif
153
  *  - Print the probe results
153
  *  - Print the probe results
154
  */
154
  */
155
 static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
155
 static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
156
-  SERIAL_PROTOCOLPGM(".    ");
156
+  SERIAL_ECHOPGM(".    ");
157
   print_signed_float(PSTR("c"), z_pt[CEN]);
157
   print_signed_float(PSTR("c"), z_pt[CEN]);
158
   if (tower_points) {
158
   if (tower_points) {
159
     print_signed_float(PSTR(" x"), z_pt[__A]);
159
     print_signed_float(PSTR(" x"), z_pt[__A]);
163
   if (tower_points && opposite_points) {
163
   if (tower_points && opposite_points) {
164
     SERIAL_EOL();
164
     SERIAL_EOL();
165
     SERIAL_CHAR('.');
165
     SERIAL_CHAR('.');
166
-    SERIAL_PROTOCOL_SP(13);
166
+    SERIAL_ECHO_SP(13);
167
   }
167
   }
168
   if (opposite_points) {
168
   if (opposite_points) {
169
     print_signed_float(PSTR("yz"), z_pt[_BC]);
169
     print_signed_float(PSTR("yz"), z_pt[_BC]);
438
 
438
 
439
   const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
439
   const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
440
   if (!WITHIN(probe_points, -1, 10)) {
440
   if (!WITHIN(probe_points, -1, 10)) {
441
-    SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (-1 - 10).");
441
+    SERIAL_ECHOLNPGM("?(P)oints is implausible (-1 - 10).");
442
     return;
442
     return;
443
   }
443
   }
444
 
444
 
446
 
446
 
447
   const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0);
447
   const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0);
448
   if (calibration_precision < 0) {
448
   if (calibration_precision < 0) {
449
-    SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0).");
449
+    SERIAL_ECHOLNPGM("?(C)alibration precision is implausible (>=0).");
450
     return;
450
     return;
451
   }
451
   }
452
 
452
 
453
   const int8_t force_iterations = parser.intval('F', 0);
453
   const int8_t force_iterations = parser.intval('F', 0);
454
   if (!WITHIN(force_iterations, 0, 30)) {
454
   if (!WITHIN(force_iterations, 0, 30)) {
455
-    SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0 - 30).");
455
+    SERIAL_ECHOLNPGM("?(F)orce iteration is implausible (0 - 30).");
456
     return;
456
     return;
457
   }
457
   }
458
 
458
 
459
   const int8_t verbose_level = parser.byteval('V', 1);
459
   const int8_t verbose_level = parser.byteval('V', 1);
460
   if (!WITHIN(verbose_level, 0, 3)) {
460
   if (!WITHIN(verbose_level, 0, 3)) {
461
-    SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0 - 3).");
461
+    SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0 - 3).");
462
     return;
462
     return;
463
   }
463
   }
464
 
464
 
503
           delta_tower_angle_trim[C_AXIS]
503
           delta_tower_angle_trim[C_AXIS]
504
         };
504
         };
505
 
505
 
506
-  SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
506
+  SERIAL_ECHOLNPGM("G33 Auto Calibrate");
507
 
507
 
508
   if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable
508
   if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable
509
     LOOP_CAL_RAD(axis) {
509
     LOOP_CAL_RAD(axis) {
510
       const float a = RADIANS(210 + (360 / NPP) *  (axis - 1)),
510
       const float a = RADIANS(210 + (360 / NPP) *  (axis - 1)),
511
                   r = delta_calibration_radius;
511
                   r = delta_calibration_radius;
512
       if (!position_is_reachable(cos(a) * r, sin(a) * r)) {
512
       if (!position_is_reachable(cos(a) * r, sin(a) * r)) {
513
-        SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible.");
513
+        SERIAL_ECHOLNPGM("?(M665 B)ed radius is implausible.");
514
         return;
514
         return;
515
       }
515
       }
516
     }
516
     }
519
   // Report settings
519
   // Report settings
520
   PGM_P checkingac = PSTR("Checking... AC");
520
   PGM_P checkingac = PSTR("Checking... AC");
521
   serialprintPGM(checkingac);
521
   serialprintPGM(checkingac);
522
-  if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
523
-  if (set_up) SERIAL_PROTOCOLPGM("  (SET-UP)");
522
+  if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)");
523
+  if (set_up) SERIAL_ECHOPGM("  (SET-UP)");
524
   SERIAL_EOL();
524
   SERIAL_EOL();
525
   ui.set_status_P(checkingac);
525
   ui.set_status_P(checkingac);
526
 
526
 
540
     // Probe the points
540
     // Probe the points
541
     zero_std_dev_old = zero_std_dev;
541
     zero_std_dev_old = zero_std_dev;
542
     if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) {
542
     if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) {
543
-      SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666");
543
+      SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666");
544
       return AC_CLEANUP();
544
       return AC_CLEANUP();
545
     }
545
     }
546
     zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points);
546
     zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points);
665
 
665
 
666
     if (verbose_level != 0) { // !dry run
666
     if (verbose_level != 0) { // !dry run
667
       if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations
667
       if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations
668
-        SERIAL_PROTOCOLPGM("Calibration OK");
669
-        SERIAL_PROTOCOL_SP(32);
668
+        SERIAL_ECHOPGM("Calibration OK");
669
+        SERIAL_ECHO_SP(32);
670
         #if HAS_BED_PROBE
670
         #if HAS_BED_PROBE
671
           if (zero_std_dev >= test_precision && !_1p_calibration && !_0p_calibration)
671
           if (zero_std_dev >= test_precision && !_1p_calibration && !_0p_calibration)
672
-            SERIAL_PROTOCOLPGM("rolling back.");
672
+            SERIAL_ECHOPGM("rolling back.");
673
           else
673
           else
674
         #endif
674
         #endif
675
           {
675
           {
676
-            SERIAL_PROTOCOLPGM("std dev:");
677
-            SERIAL_PROTOCOL_F(zero_std_dev_min, 3);
676
+            SERIAL_ECHOPAIR_F("std dev:", zero_std_dev_min, 3);
678
           }
677
           }
679
         SERIAL_EOL();
678
         SERIAL_EOL();
680
         char mess[21];
679
         char mess[21];
694
           sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations);
693
           sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations);
695
         else
694
         else
696
           strcpy_P(mess, PSTR("No convergence"));
695
           strcpy_P(mess, PSTR("No convergence"));
697
-        SERIAL_PROTOCOL(mess);
698
-        SERIAL_PROTOCOL_SP(32);
699
-        SERIAL_PROTOCOLPGM("std dev:");
700
-        SERIAL_PROTOCOL_F(zero_std_dev, 3);
701
-        SERIAL_EOL();
696
+        SERIAL_ECHO(mess);
697
+        SERIAL_ECHO_SP(32);
698
+        SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
702
         ui.set_status(mess);
699
         ui.set_status(mess);
703
         if (verbose_level > 1)
700
         if (verbose_level > 1)
704
           print_calibration_settings(_endstop_results, _angle_results);
701
           print_calibration_settings(_endstop_results, _angle_results);
707
     else { // dry run
704
     else { // dry run
708
       PGM_P enddryrun = PSTR("End DRY-RUN");
705
       PGM_P enddryrun = PSTR("End DRY-RUN");
709
       serialprintPGM(enddryrun);
706
       serialprintPGM(enddryrun);
710
-      SERIAL_PROTOCOL_SP(35);
711
-      SERIAL_PROTOCOLPGM("std dev:");
712
-      SERIAL_PROTOCOL_F(zero_std_dev, 3);
713
-      SERIAL_EOL();
707
+      SERIAL_ECHO_SP(35);
708
+      SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);
714
 
709
 
715
       char mess[21];
710
       char mess[21];
716
       strcpy_P(mess, enddryrun);
711
       strcpy_P(mess, enddryrun);

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

263
 void GcodeSuite::M422() {
263
 void GcodeSuite::M422() {
264
   const int8_t zstepper = parser.intval('S') - 1;
264
   const int8_t zstepper = parser.intval('S') - 1;
265
   if (!WITHIN(zstepper, 0, Z_STEPPER_COUNT - 1)) {
265
   if (!WITHIN(zstepper, 0, Z_STEPPER_COUNT - 1)) {
266
-    SERIAL_PROTOCOLLNPGM("?(S) Z-Stepper index invalid.");
266
+    SERIAL_ECHOLNPGM("?(S) Z-Stepper index invalid.");
267
     return;
267
     return;
268
   }
268
   }
269
 
269
 
270
   const float x_pos = parser.floatval('X', z_auto_align_xpos[zstepper]);
270
   const float x_pos = parser.floatval('X', z_auto_align_xpos[zstepper]);
271
   if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
271
   if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
272
-    SERIAL_PROTOCOLLNPGM("?(X) out of bounds.");
272
+    SERIAL_ECHOLNPGM("?(X) out of bounds.");
273
     return;
273
     return;
274
   }
274
   }
275
 
275
 
276
   const float y_pos = parser.floatval('Y', z_auto_align_ypos[zstepper]);
276
   const float y_pos = parser.floatval('Y', z_auto_align_ypos[zstepper]);
277
   if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
277
   if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
278
-    SERIAL_PROTOCOLLNPGM("?(Y) out of bounds.");
278
+    SERIAL_ECHOLNPGM("?(Y) out of bounds.");
279
     return;
279
     return;
280
   }
280
   }
281
 
281
 

+ 21
- 35
Marlin/src/gcode/calibrate/M48.cpp 查看文件

55
 
55
 
56
   const int8_t verbose_level = parser.byteval('V', 1);
56
   const int8_t verbose_level = parser.byteval('V', 1);
57
   if (!WITHIN(verbose_level, 0, 4)) {
57
   if (!WITHIN(verbose_level, 0, 4)) {
58
-    SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).");
58
+    SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).");
59
     return;
59
     return;
60
   }
60
   }
61
 
61
 
62
   if (verbose_level > 0)
62
   if (verbose_level > 0)
63
-    SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability Test");
63
+    SERIAL_ECHOLNPGM("M48 Z-Probe Repeatability Test");
64
 
64
 
65
   const int8_t n_samples = parser.byteval('P', 10);
65
   const int8_t n_samples = parser.byteval('P', 10);
66
   if (!WITHIN(n_samples, 4, 50)) {
66
   if (!WITHIN(n_samples, 4, 50)) {
67
-    SERIAL_PROTOCOLLNPGM("?Sample size not plausible (4-50).");
67
+    SERIAL_ECHOLNPGM("?Sample size not plausible (4-50).");
68
     return;
68
     return;
69
   }
69
   }
70
 
70
 
77
               Y_probe_location = parser.linearval('Y', Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER);
77
               Y_probe_location = parser.linearval('Y', Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER);
78
 
78
 
79
   if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
79
   if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) {
80
-    SERIAL_PROTOCOLLNPGM("? (X,Y) out of bounds.");
80
+    SERIAL_ECHOLNPGM("? (X,Y) out of bounds.");
81
     return;
81
     return;
82
   }
82
   }
83
 
83
 
84
   bool seen_L = parser.seen('L');
84
   bool seen_L = parser.seen('L');
85
   uint8_t n_legs = seen_L ? parser.value_byte() : 0;
85
   uint8_t n_legs = seen_L ? parser.value_byte() : 0;
86
   if (n_legs > 15) {
86
   if (n_legs > 15) {
87
-    SERIAL_PROTOCOLLNPGM("?Number of legs in movement not plausible (0-15).");
87
+    SERIAL_ECHOLNPGM("?Number of legs in movement not plausible (0-15).");
88
     return;
88
     return;
89
   }
89
   }
90
   if (n_legs == 1) n_legs = 2;
90
   if (n_legs == 1) n_legs = 2;
98
    * we don't want to use that as a starting point for each probe.
98
    * we don't want to use that as a starting point for each probe.
99
    */
99
    */
100
   if (verbose_level > 2)
100
   if (verbose_level > 2)
101
-    SERIAL_PROTOCOLLNPGM("Positioning the probe...");
101
+    SERIAL_ECHOLNPGM("Positioning the probe...");
102
 
102
 
103
   // Disable bed level correction in M48 because we want the raw data when we probe
103
   // Disable bed level correction in M48 because we want the raw data when we probe
104
 
104
 
178
             }
178
             }
179
           #endif
179
           #endif
180
           if (verbose_level > 3) {
180
           if (verbose_level > 3) {
181
-            SERIAL_PROTOCOLPGM("Going to:");
181
+            SERIAL_ECHOPGM("Going to:");
182
             SERIAL_ECHOPAIR(" X", X_current);
182
             SERIAL_ECHOPAIR(" X", X_current);
183
             SERIAL_ECHOPAIR(" Y", Y_current);
183
             SERIAL_ECHOPAIR(" Y", Y_current);
184
             SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
184
             SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
215
       sigma = SQRT(sum / (n + 1));
215
       sigma = SQRT(sum / (n + 1));
216
       if (verbose_level > 0) {
216
       if (verbose_level > 0) {
217
         if (verbose_level > 1) {
217
         if (verbose_level > 1) {
218
-          SERIAL_PROTOCOL(n + 1);
219
-          SERIAL_PROTOCOLPGM(" of ");
220
-          SERIAL_PROTOCOL((int)n_samples);
221
-          SERIAL_PROTOCOLPGM(": z: ");
222
-          SERIAL_PROTOCOL_F(sample_set[n], 3);
218
+          SERIAL_ECHO(n + 1);
219
+          SERIAL_ECHOPAIR(" of ", (int)n_samples);
220
+          SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3);
223
           if (verbose_level > 2) {
221
           if (verbose_level > 2) {
224
-            SERIAL_PROTOCOLPGM(" mean: ");
225
-            SERIAL_PROTOCOL_F(mean, 4);
226
-            SERIAL_PROTOCOLPGM(" sigma: ");
227
-            SERIAL_PROTOCOL_F(sigma, 6);
228
-            SERIAL_PROTOCOLPGM(" min: ");
229
-            SERIAL_PROTOCOL_F(min, 3);
230
-            SERIAL_PROTOCOLPGM(" max: ");
231
-            SERIAL_PROTOCOL_F(max, 3);
232
-            SERIAL_PROTOCOLPGM(" range: ");
233
-            SERIAL_PROTOCOL_F(max-min, 3);
222
+            SERIAL_ECHOPAIR_F(" mean: ", mean, 4);
223
+            SERIAL_ECHOPAIR_F(" sigma: ", sigma, 6);
224
+            SERIAL_ECHOPAIR_F(" min: ", min, 3);
225
+            SERIAL_ECHOPAIR_F(" max: ", max, 3);
226
+            SERIAL_ECHOPAIR_F(" range: ", max-min, 3);
234
           }
227
           }
235
           SERIAL_EOL();
228
           SERIAL_EOL();
236
         }
229
         }
242
   STOW_PROBE();
235
   STOW_PROBE();
243
 
236
 
244
   if (probing_good) {
237
   if (probing_good) {
245
-    SERIAL_PROTOCOLLNPGM("Finished!");
238
+    SERIAL_ECHOLNPGM("Finished!");
246
 
239
 
247
     if (verbose_level > 0) {
240
     if (verbose_level > 0) {
248
-      SERIAL_PROTOCOLPGM("Mean: ");
249
-      SERIAL_PROTOCOL_F(mean, 6);
250
-      SERIAL_PROTOCOLPGM(" Min: ");
251
-      SERIAL_PROTOCOL_F(min, 3);
252
-      SERIAL_PROTOCOLPGM(" Max: ");
253
-      SERIAL_PROTOCOL_F(max, 3);
254
-      SERIAL_PROTOCOLPGM(" Range: ");
255
-      SERIAL_PROTOCOL_F(max-min, 3);
256
-      SERIAL_EOL();
241
+      SERIAL_ECHOPAIR_F("Mean: ", mean, 6);
242
+      SERIAL_ECHOPAIR_F(" Min: ", min, 3);
243
+      SERIAL_ECHOPAIR_F(" Max: ", max, 3);
244
+      SERIAL_ECHOLNPAIR_F(" Range: ", max-min, 3);
257
     }
245
     }
258
 
246
 
259
-    SERIAL_PROTOCOLPGM("Standard Deviation: ");
260
-    SERIAL_PROTOCOL_F(sigma, 6);
261
-    SERIAL_EOL();
247
+    SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6);
262
     SERIAL_EOL();
248
     SERIAL_EOL();
263
   }
249
   }
264
 
250
 

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

84
         if (sumAPX == 1)
84
         if (sumAPX == 1)
85
           scara_home_offset[A_AXIS] = parser.value_float();
85
           scara_home_offset[A_AXIS] = parser.value_float();
86
         else {
86
         else {
87
-          SERIAL_ERROR_START();
88
-          SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
87
+          SERIAL_ERROR_MSG("Only one of A, P, or X is allowed.");
89
           return;
88
           return;
90
         }
89
         }
91
       }
90
       }
96
         if (sumBTY == 1)
95
         if (sumBTY == 1)
97
           scara_home_offset[B_AXIS] = parser.value_float();
96
           scara_home_offset[B_AXIS] = parser.value_float();
98
         else {
97
         else {
99
-          SERIAL_ERROR_START();
100
-          SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
98
+          SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed.");
101
           return;
99
           return;
102
         }
100
         }
103
       }
101
       }

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

93
 
93
 
94
   if (!ijk) {
94
   if (!ijk) {
95
     SERIAL_ECHO_START();
95
     SERIAL_ECHO_START();
96
-    SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: ");
97
-    SERIAL_ECHO_F(planner.skew_factor.xy, 6);
98
-    SERIAL_EOL();
96
+    SERIAL_ECHOLNPAIR_F(MSG_SKEW_FACTOR " XY: ", planner.skew_factor.xy, 6);
99
     #if ENABLED(SKEW_CORRECTION_FOR_Z)
97
     #if ENABLED(SKEW_CORRECTION_FOR_Z)
100
       SERIAL_ECHOPAIR(" XZ: ", planner.skew_factor.xz);
98
       SERIAL_ECHOPAIR(" XZ: ", planner.skew_factor.xz);
101
       SERIAL_ECHOLNPAIR(" YZ: ", planner.skew_factor.yz);
99
       SERIAL_ECHOLNPAIR(" YZ: ", planner.skew_factor.yz);

+ 2
- 4
Marlin/src/gcode/config/M200-M205.cpp 查看文件

147
           planner.recalculate_max_e_jerk();
147
           planner.recalculate_max_e_jerk();
148
         #endif
148
         #endif
149
       }
149
       }
150
-      else {
151
-        SERIAL_ERROR_START();
152
-        SERIAL_ERRORLNPGM("?J out of range (0.01 to 0.3)");
153
-      }
150
+      else
151
+        SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)");
154
     }
152
     }
155
   #endif
153
   #endif
156
   #if HAS_CLASSIC_JERK
154
   #if HAS_CLASSIC_JERK

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

70
     #endif
70
     #endif
71
     SERIAL_EOL();
71
     SERIAL_EOL();
72
   }
72
   }
73
-  else {
74
-    SERIAL_ERROR_START();
75
-    SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER);
76
-  }
73
+  else
74
+    SERIAL_ERROR_MSG(MSG_INVALID_EXTRUDER);
77
 }
75
 }
78
 
76
 
79
 #endif // PIDTEMP
77
 #endif // PIDTEMP

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

89
 inline void servo_probe_test() {
89
 inline void servo_probe_test() {
90
   #if !(NUM_SERVOS > 0 && HAS_SERVO_0)
90
   #if !(NUM_SERVOS > 0 && HAS_SERVO_0)
91
 
91
 
92
-    SERIAL_ERROR_START();
93
-    SERIAL_ERRORLNPGM("SERVO not setup");
92
+    SERIAL_ERROR_MSG("SERVO not setup");
94
 
93
 
95
   #elif !HAS_Z_SERVO_PROBE
94
   #elif !HAS_Z_SERVO_PROBE
96
 
95
 
97
-    SERIAL_ERROR_START();
98
-    SERIAL_ERRORLNPGM("Z_PROBE_SERVO_NR not setup");
96
+    SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not setup");
99
 
97
 
100
   #else // HAS_Z_SERVO_PROBE
98
   #else // HAS_Z_SERVO_PROBE
101
 
99
 
102
     const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
100
     const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
103
 
101
 
104
-    SERIAL_PROTOCOLLNPGM("Servo probe test");
105
-    SERIAL_PROTOCOLLNPAIR(".  using index:  ", probe_index);
106
-    SERIAL_PROTOCOLLNPAIR(".  deploy angle: ", servo_angles[probe_index][0]);
107
-    SERIAL_PROTOCOLLNPAIR(".  stow angle:   ", servo_angles[probe_index][1]);
102
+    SERIAL_ECHOLNPGM("Servo probe test");
103
+    SERIAL_ECHOLNPAIR(".  using index:  ", probe_index);
104
+    SERIAL_ECHOLNPAIR(".  deploy angle: ", servo_angles[probe_index][0]);
105
+    SERIAL_ECHOLNPAIR(".  stow angle:   ", servo_angles[probe_index][1]);
108
 
106
 
109
     bool probe_inverting;
107
     bool probe_inverting;
110
 
108
 
112
 
110
 
113
       #define PROBE_TEST_PIN Z_MIN_PIN
111
       #define PROBE_TEST_PIN Z_MIN_PIN
114
 
112
 
115
-      SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
116
-      SERIAL_PROTOCOLLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
117
-      SERIAL_PROTOCOLPGM(". Z_MIN_ENDSTOP_INVERTING: ");
113
+      SERIAL_ECHOLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN);
114
+      SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)");
115
+      SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
118
 
116
 
119
       #if Z_MIN_ENDSTOP_INVERTING
117
       #if Z_MIN_ENDSTOP_INVERTING
120
-        SERIAL_PROTOCOLLNPGM("true");
118
+        SERIAL_ECHOLNPGM("true");
121
       #else
119
       #else
122
-        SERIAL_PROTOCOLLNPGM("false");
120
+        SERIAL_ECHOLNPGM("false");
123
       #endif
121
       #endif
124
 
122
 
125
       probe_inverting = Z_MIN_ENDSTOP_INVERTING;
123
       probe_inverting = Z_MIN_ENDSTOP_INVERTING;
127
     #elif ENABLED(Z_MIN_PROBE_ENDSTOP)
125
     #elif ENABLED(Z_MIN_PROBE_ENDSTOP)
128
 
126
 
129
       #define PROBE_TEST_PIN Z_MIN_PROBE_PIN
127
       #define PROBE_TEST_PIN Z_MIN_PROBE_PIN
130
-      SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
131
-      SERIAL_PROTOCOLLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
132
-      SERIAL_PROTOCOLPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
128
+      SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
129
+      SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)");
130
+      SERIAL_ECHOPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
133
 
131
 
134
       #if Z_MIN_PROBE_ENDSTOP_INVERTING
132
       #if Z_MIN_PROBE_ENDSTOP_INVERTING
135
-        SERIAL_PROTOCOLLNPGM("true");
133
+        SERIAL_ECHOLNPGM("true");
136
       #else
134
       #else
137
-        SERIAL_PROTOCOLLNPGM("false");
135
+        SERIAL_ECHOLNPGM("false");
138
       #endif
136
       #endif
139
 
137
 
140
       probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
138
       probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
141
 
139
 
142
     #endif
140
     #endif
143
 
141
 
144
-    SERIAL_PROTOCOLLNPGM(". deploy & stow 4 times");
142
+    SERIAL_ECHOLNPGM(". deploy & stow 4 times");
145
     SET_INPUT_PULLUP(PROBE_TEST_PIN);
143
     SET_INPUT_PULLUP(PROBE_TEST_PIN);
146
     uint8_t i = 0;
144
     uint8_t i = 0;
147
     bool deploy_state, stow_state;
145
     bool deploy_state, stow_state;
153
       safe_delay(500);
151
       safe_delay(500);
154
       stow_state = READ(PROBE_TEST_PIN);
152
       stow_state = READ(PROBE_TEST_PIN);
155
     } while (++i < 4);
153
     } while (++i < 4);
156
-    if (probe_inverting != deploy_state) SERIAL_PROTOCOLLNPGM("WARNING - INVERTING setting probably backwards");
154
+    if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards");
157
 
155
 
158
     if (deploy_state != stow_state) {
156
     if (deploy_state != stow_state) {
159
-      SERIAL_PROTOCOLLNPGM("BLTouch clone detected");
157
+      SERIAL_ECHOLNPGM("BLTouch clone detected");
160
       if (deploy_state) {
158
       if (deploy_state) {
161
-        SERIAL_PROTOCOLLNPGM(".  DEPLOYED state: HIGH (logic 1)");
162
-        SERIAL_PROTOCOLLNPGM(".  STOWED (triggered) state: LOW (logic 0)");
159
+        SERIAL_ECHOLNPGM(".  DEPLOYED state: HIGH (logic 1)");
160
+        SERIAL_ECHOLNPGM(".  STOWED (triggered) state: LOW (logic 0)");
163
       }
161
       }
164
       else {
162
       else {
165
-        SERIAL_PROTOCOLLNPGM(".  DEPLOYED state: LOW (logic 0)");
166
-        SERIAL_PROTOCOLLNPGM(".  STOWED (triggered) state: HIGH (logic 1)");
163
+        SERIAL_ECHOLNPGM(".  DEPLOYED state: LOW (logic 0)");
164
+        SERIAL_ECHOLNPGM(".  STOWED (triggered) state: HIGH (logic 1)");
167
       }
165
       }
168
       #if ENABLED(BLTOUCH)
166
       #if ENABLED(BLTOUCH)
169
-        SERIAL_PROTOCOLLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
167
+        SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
170
       #endif
168
       #endif
171
     }
169
     }
172
     else {                                           // measure active signal length
170
     else {                                           // measure active signal length
173
       MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
171
       MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy
174
       safe_delay(500);
172
       safe_delay(500);
175
-      SERIAL_PROTOCOLLNPGM("please trigger probe");
173
+      SERIAL_ECHOLNPGM("please trigger probe");
176
       uint16_t probe_counter = 0;
174
       uint16_t probe_counter = 0;
177
 
175
 
178
       // Allow 30 seconds max for operator to trigger probe
176
       // Allow 30 seconds max for operator to trigger probe
188
             safe_delay(2);
186
             safe_delay(2);
189
 
187
 
190
           if (probe_counter == 50)
188
           if (probe_counter == 50)
191
-            SERIAL_PROTOCOLLNPGM("Z Servo Probe detected"); // >= 100mS active time
189
+            SERIAL_ECHOLNPGM("Z Servo Probe detected"); // >= 100mS active time
192
           else if (probe_counter >= 2)
190
           else if (probe_counter >= 2)
193
-            SERIAL_PROTOCOLLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
191
+            SERIAL_ECHOLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse
194
           else
192
           else
195
-            SERIAL_PROTOCOLLNPGM("noise detected - please re-run test"); // less than 2mS pulse
193
+            SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse
196
 
194
 
197
           MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
195
           MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow
198
 
196
 
200
 
198
 
201
       } // for loop waiting for trigger
199
       } // for loop waiting for trigger
202
 
200
 
203
-      if (probe_counter == 0) SERIAL_PROTOCOLLNPGM("trigger not detected");
201
+      if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected");
204
 
202
 
205
     } // measure active signal length
203
     } // measure active signal length
206
 
204
 
245
   // Enable or disable endstop monitoring
243
   // Enable or disable endstop monitoring
246
   if (parser.seen('E')) {
244
   if (parser.seen('E')) {
247
     endstops.monitor_flag = parser.value_bool();
245
     endstops.monitor_flag = parser.value_bool();
248
-    SERIAL_PROTOCOLPGM("endstop monitor ");
246
+    SERIAL_ECHOPGM("endstop monitor ");
249
     serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
247
     serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
250
-    SERIAL_PROTOCOLLNPGM("abled");
248
+    SERIAL_ECHOLNPGM("abled");
251
     return;
249
     return;
252
   }
250
   }
253
 
251
 
266
 
264
 
267
   // Watch until click, M108, or reset
265
   // Watch until click, M108, or reset
268
   if (parser.boolval('W')) {
266
   if (parser.boolval('W')) {
269
-    SERIAL_PROTOCOLLNPGM("Watching pins");
267
+    SERIAL_ECHOLNPGM("Watching pins");
270
 
268
 
271
     #ifdef ARDUINO_ARCH_SAM
269
     #ifdef ARDUINO_ARCH_SAM
272
       NOLESS(first_pin, 2);  // don't hijack the UART pins
270
       NOLESS(first_pin, 2);  // don't hijack the UART pins

+ 2
- 4
Marlin/src/gcode/eeprom/M500-M504.cpp 查看文件

94
    * M504: Validate EEPROM Contents
94
    * M504: Validate EEPROM Contents
95
    */
95
    */
96
   void GcodeSuite::M504() {
96
   void GcodeSuite::M504() {
97
-    if (settings.validate(CHAT_PORT)) {
98
-      SERIAL_ECHO_START_P(command_queue_port[cmd_queue_index_r]);
99
-      SERIAL_ECHOLNPGM_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
100
-    }
97
+    if (settings.validate(CHAT_PORT))
98
+      SERIAL_ECHO_MSG_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
101
   }
99
   }
102
 #endif
100
 #endif

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

40
   #else
40
   #else
41
     const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder;
41
     const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder;
42
     if (tmp_extruder >= EXTRUDERS) {
42
     if (tmp_extruder >= EXTRUDERS) {
43
-      SERIAL_PROTOCOLLNPGM("?T value out of range.");
43
+      SERIAL_ECHOLNPGM("?T value out of range.");
44
       return;
44
       return;
45
     }
45
     }
46
   #endif
46
   #endif
52
       planner.extruder_advance_K[tmp_extruder] = newK;
52
       planner.extruder_advance_K[tmp_extruder] = newK;
53
     }
53
     }
54
     else
54
     else
55
-      SERIAL_PROTOCOLLNPGM("?K value out of range (0-10).");
55
+      SERIAL_ECHOLNPGM("?K value out of range (0-10).");
56
   }
56
   }
57
   else {
57
   else {
58
     SERIAL_ECHO_START();
58
     SERIAL_ECHO_START();

+ 1
- 2
Marlin/src/gcode/feature/caselight/M355.cpp 查看文件

63
       else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
63
       else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
64
     }
64
     }
65
   #else
65
   #else
66
-    SERIAL_ERROR_START();
67
-    SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE);
66
+    SERIAL_ERROR_MSG(MSG_ERR_M355_NONE);
68
   #endif
67
   #endif
69
 }
68
 }

+ 3
- 6
Marlin/src/gcode/feature/filwidth/M404-M407.cpp 查看文件

38
     filament_width_nominal = parser.value_linear_units();
38
     filament_width_nominal = parser.value_linear_units();
39
     planner.volumetric_area_nominal = CIRCLE_AREA(filament_width_nominal * 0.5);
39
     planner.volumetric_area_nominal = CIRCLE_AREA(filament_width_nominal * 0.5);
40
   }
40
   }
41
-  else {
42
-    SERIAL_PROTOCOLPGM("Filament dia (nominal mm):");
43
-    SERIAL_PROTOCOLLN(filament_width_nominal);
44
-  }
41
+  else
42
+    SERIAL_ECHOLNPAIR("Filament dia (nominal mm):", filament_width_nominal);
45
 }
43
 }
46
 
44
 
47
 /**
45
 /**
79
  * M407: Get measured filament diameter on serial output
77
  * M407: Get measured filament diameter on serial output
80
  */
78
  */
81
 void GcodeSuite::M407() {
79
 void GcodeSuite::M407() {
82
-  SERIAL_PROTOCOLPGM("Filament dia (measured mm):");
83
-  SERIAL_PROTOCOLLN(filament_width_meas);
80
+  SERIAL_ECHOLNPAIR("Filament dia (measured mm):", filament_width_meas);
84
 }
81
 }
85
 
82
 
86
 #endif // FILAMENT_WIDTH_SENSOR
83
 #endif // FILAMENT_WIDTH_SENSOR

+ 3
- 6
Marlin/src/gcode/feature/i2c/M260_M261.cpp 查看文件

68
 
68
 
69
   uint8_t bytes = parser.byteval('B', 1);
69
   uint8_t bytes = parser.byteval('B', 1);
70
 
70
 
71
-  if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) {
71
+  if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE)
72
     i2c.relay(bytes);
72
     i2c.relay(bytes);
73
-  }
74
-  else {
75
-    SERIAL_ERROR_START();
76
-    SERIAL_ERRORLNPGM("Bad i2c request");
77
-  }
73
+  else
74
+    SERIAL_ERROR_MSG("Bad i2c request");
78
 }
75
 }
79
 
76
 
80
 #endif
77
 #endif

+ 2
- 4
Marlin/src/gcode/feature/macro/M810-M819.cpp 查看文件

45
 
45
 
46
   if (len) {
46
   if (len) {
47
     // Set a macro
47
     // Set a macro
48
-    if (len > GCODE_MACROS_SLOT_SIZE) {
49
-      SERIAL_ERROR_START();
50
-      SERIAL_ERRORLNPGM("Macro too long.");
51
-    }
48
+    if (len > GCODE_MACROS_SLOT_SIZE)
49
+      SERIAL_ERROR_MSG("Macro too long.");
52
     else {
50
     else {
53
       char c, *s = parser.string_arg, *d = gcode_macros[index];
51
       char c, *s = parser.string_arg, *d = gcode_macros[index];
54
       do {
52
       do {

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

790
       switch (busy_state) {
790
       switch (busy_state) {
791
         case IN_HANDLER:
791
         case IN_HANDLER:
792
         case IN_PROCESS:
792
         case IN_PROCESS:
793
-          SERIAL_ECHO_START();
794
-          SERIAL_ECHOLNPGM(MSG_BUSY_PROCESSING);
793
+          SERIAL_ECHO_MSG(MSG_BUSY_PROCESSING);
795
           break;
794
           break;
796
         case PAUSED_FOR_USER:
795
         case PAUSED_FOR_USER:
797
-          SERIAL_ECHO_START();
798
-          SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_USER);
796
+          SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_USER);
799
           break;
797
           break;
800
         case PAUSED_FOR_INPUT:
798
         case PAUSED_FOR_INPUT:
801
-          SERIAL_ECHO_START();
802
-          SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_INPUT);
799
+          SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_INPUT);
803
           break;
800
           break;
804
         default:
801
         default:
805
           break;
802
           break;

+ 1
- 1
Marlin/src/gcode/geometry/G53-G59.cpp 查看文件

80
 void G54_59(uint8_t subcode=0) {
80
 void G54_59(uint8_t subcode=0) {
81
   const int8_t _space = parser.codenum - 54 + subcode;
81
   const int8_t _space = parser.codenum - 54 + subcode;
82
   if (gcode.select_coordinate_system(_space)) {
82
   if (gcode.select_coordinate_system(_space)) {
83
-    SERIAL_PROTOCOLLNPAIR("Select workspace ", _space);
83
+    SERIAL_ECHOLNPAIR("Select workspace ", _space);
84
     report_current_position();
84
     report_current_position();
85
   }
85
   }
86
 }
86
 }

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

69
     if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
69
     if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
70
       diff[i] = -current_position[i];
70
       diff[i] = -current_position[i];
71
     if (!WITHIN(diff[i], -20, 20)) {
71
     if (!WITHIN(diff[i], -20, 20)) {
72
-      SERIAL_ERROR_START();
73
-      SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
72
+      SERIAL_ERROR_MSG(MSG_ERR_M428_TOO_FAR);
74
       LCD_ALERTMESSAGEPGM("Err: Too far!");
73
       LCD_ALERTMESSAGEPGM("Err: Too far!");
75
       BUZZ(200, 40);
74
       BUZZ(200, 40);
76
       return;
75
       return;

+ 12
- 12
Marlin/src/gcode/host/M114.cpp 查看文件

34
       SERIAL_CHAR(' ');
34
       SERIAL_CHAR(' ');
35
       SERIAL_CHAR(axis_codes[i]);
35
       SERIAL_CHAR(axis_codes[i]);
36
       SERIAL_CHAR(':');
36
       SERIAL_CHAR(':');
37
-      SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
37
+      SERIAL_ECHO(dtostrf(pos[i], 8, precision, str));
38
     }
38
     }
39
     SERIAL_EOL();
39
     SERIAL_EOL();
40
   }
40
   }
43
 
43
 
44
   void report_current_position_detail() {
44
   void report_current_position_detail() {
45
 
45
 
46
-    SERIAL_PROTOCOLPGM("\nLogical:");
46
+    SERIAL_ECHOPGM("\nLogical:");
47
     const float logical[XYZ] = {
47
     const float logical[XYZ] = {
48
       LOGICAL_X_POSITION(current_position[X_AXIS]),
48
       LOGICAL_X_POSITION(current_position[X_AXIS]),
49
       LOGICAL_Y_POSITION(current_position[Y_AXIS]),
49
       LOGICAL_Y_POSITION(current_position[Y_AXIS]),
51
     };
51
     };
52
     report_xyz(logical);
52
     report_xyz(logical);
53
 
53
 
54
-    SERIAL_PROTOCOLPGM("Raw:    ");
54
+    SERIAL_ECHOPGM("Raw:    ");
55
     report_xyz(current_position);
55
     report_xyz(current_position);
56
 
56
 
57
     float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
57
     float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
58
 
58
 
59
     #if HAS_LEVELING
59
     #if HAS_LEVELING
60
-      SERIAL_PROTOCOLPGM("Leveled:");
60
+      SERIAL_ECHOPGM("Leveled:");
61
       planner.apply_leveling(leveled);
61
       planner.apply_leveling(leveled);
62
       report_xyz(leveled);
62
       report_xyz(leveled);
63
 
63
 
64
-      SERIAL_PROTOCOLPGM("UnLevel:");
64
+      SERIAL_ECHOPGM("UnLevel:");
65
       float unleveled[XYZ] = { leveled[X_AXIS], leveled[Y_AXIS], leveled[Z_AXIS] };
65
       float unleveled[XYZ] = { leveled[X_AXIS], leveled[Y_AXIS], leveled[Z_AXIS] };
66
       planner.unapply_leveling(unleveled);
66
       planner.unapply_leveling(unleveled);
67
       report_xyz(unleveled);
67
       report_xyz(unleveled);
69
 
69
 
70
     #if IS_KINEMATIC
70
     #if IS_KINEMATIC
71
       #if IS_SCARA
71
       #if IS_SCARA
72
-        SERIAL_PROTOCOLPGM("ScaraK: ");
72
+        SERIAL_ECHOPGM("ScaraK: ");
73
       #else
73
       #else
74
-        SERIAL_PROTOCOLPGM("DeltaK: ");
74
+        SERIAL_ECHOPGM("DeltaK: ");
75
       #endif
75
       #endif
76
       inverse_kinematics(leveled);  // writes delta[]
76
       inverse_kinematics(leveled);  // writes delta[]
77
       report_xyz(delta);
77
       report_xyz(delta);
79
 
79
 
80
     planner.synchronize();
80
     planner.synchronize();
81
 
81
 
82
-    SERIAL_PROTOCOLPGM("Stepper:");
82
+    SERIAL_ECHOPGM("Stepper:");
83
     LOOP_XYZE(i) {
83
     LOOP_XYZE(i) {
84
       SERIAL_CHAR(' ');
84
       SERIAL_CHAR(' ');
85
       SERIAL_CHAR(axis_codes[i]);
85
       SERIAL_CHAR(axis_codes[i]);
86
       SERIAL_CHAR(':');
86
       SERIAL_CHAR(':');
87
-      SERIAL_PROTOCOL(stepper.position((AxisEnum)i));
87
+      SERIAL_ECHO(stepper.position((AxisEnum)i));
88
     }
88
     }
89
     SERIAL_EOL();
89
     SERIAL_EOL();
90
 
90
 
93
         planner.get_axis_position_degrees(A_AXIS),
93
         planner.get_axis_position_degrees(A_AXIS),
94
         planner.get_axis_position_degrees(B_AXIS)
94
         planner.get_axis_position_degrees(B_AXIS)
95
       };
95
       };
96
-      SERIAL_PROTOCOLPGM("Degrees:");
96
+      SERIAL_ECHOPGM("Degrees:");
97
       report_xyze(deg, 2);
97
       report_xyze(deg, 2);
98
     #endif
98
     #endif
99
 
99
 
100
-    SERIAL_PROTOCOLPGM("FromStp:");
100
+    SERIAL_ECHOPGM("FromStp:");
101
     get_cartesian_from_steppers();  // writes cartes[XYZ] (with forward kinematics)
101
     get_cartesian_from_steppers();  // writes cartes[XYZ] (with forward kinematics)
102
     const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], planner.get_axis_position_mm(E_AXIS) };
102
     const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], planner.get_axis_position_mm(E_AXIS) };
103
     report_xyze(from_steppers);
103
     report_xyze(from_steppers);
108
       from_steppers[Z_AXIS] - leveled[Z_AXIS],
108
       from_steppers[Z_AXIS] - leveled[Z_AXIS],
109
       from_steppers[E_AXIS] - current_position[E_AXIS]
109
       from_steppers[E_AXIS] - current_position[E_AXIS]
110
     };
110
     };
111
-    SERIAL_PROTOCOLPGM("Differ: ");
111
+    SERIAL_ECHOPGM("Differ: ");
112
     report_xyze(diff);
112
     report_xyze(diff);
113
   }
113
   }
114
 
114
 

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

29
 
29
 
30
 #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
30
 #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
31
   static void cap_line(PGM_P const name, bool ena=false) {
31
   static void cap_line(PGM_P const name, bool ena=false) {
32
-    SERIAL_PROTOCOLPGM("Cap:");
32
+    SERIAL_ECHOPGM("Cap:");
33
     serialprintPGM(name);
33
     serialprintPGM(name);
34
     SERIAL_CHAR(':');
34
     SERIAL_CHAR(':');
35
-    SERIAL_PROTOCOLLN(int(ena ? 1 : 0));
35
+    SERIAL_ECHOLN(int(ena ? 1 : 0));
36
   }
36
   }
37
 #endif
37
 #endif
38
 
38
 
47
     #define CAPLINE(STR,...) cap_line(PSTR(STR), __VA_ARGS__)
47
     #define CAPLINE(STR,...) cap_line(PSTR(STR), __VA_ARGS__)
48
   #endif
48
   #endif
49
 
49
 
50
-  SERIAL_PROTOCOLLNPGM_P(port, MSG_M115_REPORT);
50
+  SERIAL_ECHOLNPGM_P(port, MSG_M115_REPORT);
51
 
51
 
52
   #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
52
   #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
53
 
53
 

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

37
  */
37
  */
38
 void GcodeSuite::M145() {
38
 void GcodeSuite::M145() {
39
   const uint8_t material = (uint8_t)parser.intval('S');
39
   const uint8_t material = (uint8_t)parser.intval('S');
40
-  if (material >= COUNT(ui.preheat_hotend_temp)) {
41
-    SERIAL_ERROR_START();
42
-    SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX);
43
-  }
40
+  if (material >= COUNT(ui.preheat_hotend_temp))
41
+    SERIAL_ERROR_MSG(MSG_ERR_MATERIAL_INDEX);
44
   else {
42
   else {
45
     int v;
43
     int v;
46
     if (parser.seenval('H')) {
44
     if (parser.seenval('H')) {

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

32
  */
32
  */
33
 void GcodeSuite::M250() {
33
 void GcodeSuite::M250() {
34
   if (parser.seen('C')) ui.set_contrast(parser.value_int());
34
   if (parser.seen('C')) ui.set_contrast(parser.value_int());
35
-  SERIAL_PROTOCOLLNPAIR("LCD Contrast: ", ui.contrast);
35
+  SERIAL_ECHOLNPAIR("LCD Contrast: ", ui.contrast);
36
 }
36
 }
37
 
37
 
38
 #endif // HAS_LCD_CONTRAST
38
 #endif // HAS_LCD_CONTRAST

+ 5
- 9
Marlin/src/gcode/motion/G2_G3.cpp 查看文件

293
       #if ENABLED(ARC_P_CIRCLES)
293
       #if ENABLED(ARC_P_CIRCLES)
294
         // P indicates number of circles to do
294
         // P indicates number of circles to do
295
         int8_t circles_to_do = parser.byteval('P');
295
         int8_t circles_to_do = parser.byteval('P');
296
-        if (!WITHIN(circles_to_do, 0, 100)) {
297
-          SERIAL_ERROR_START();
298
-          SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
299
-        }
296
+        if (!WITHIN(circles_to_do, 0, 100))
297
+          SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS);
298
+
300
         while (circles_to_do--)
299
         while (circles_to_do--)
301
           plan_arc(current_position, arc_offset, clockwise);
300
           plan_arc(current_position, arc_offset, clockwise);
302
       #endif
301
       #endif
305
       plan_arc(destination, arc_offset, clockwise);
304
       plan_arc(destination, arc_offset, clockwise);
306
       reset_stepper_timeout();
305
       reset_stepper_timeout();
307
     }
306
     }
308
-    else {
309
-      // Bad arguments
310
-      SERIAL_ERROR_START();
311
-      SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
312
-    }
307
+    else
308
+      SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS);
313
   }
309
   }
314
 }
310
 }
315
 
311
 

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

50
 
50
 
51
     #if ENABLED(CNC_WORKSPACE_PLANES)
51
     #if ENABLED(CNC_WORKSPACE_PLANES)
52
       if (workspace_plane != PLANE_XY) {
52
       if (workspace_plane != PLANE_XY) {
53
-        SERIAL_ERROR_START();
54
-        SERIAL_ERRORLNPGM(MSG_ERR_BAD_PLANE_MODE);
53
+        SERIAL_ERROR_MSG(MSG_ERR_BAD_PLANE_MODE);
55
         return;
54
         return;
56
       }
55
       }
57
     #endif
56
     #endif

+ 3
- 3
Marlin/src/gcode/probe/G30.cpp 查看文件

55
   const float measured_z = probe_pt(xpos, ypos, raise_after, 1);
55
   const float measured_z = probe_pt(xpos, ypos, raise_after, 1);
56
 
56
 
57
   if (!isnan(measured_z)) {
57
   if (!isnan(measured_z)) {
58
-    SERIAL_PROTOCOLPAIR_F("Bed X: ", xpos);
59
-    SERIAL_PROTOCOLPAIR_F(" Y: ", ypos);
60
-    SERIAL_PROTOCOLLNPAIR_F(" Z: ", measured_z);
58
+    SERIAL_ECHOPAIR("Bed X: ", FIXFLOAT(xpos));
59
+    SERIAL_ECHOPAIR(" Y: ", FIXFLOAT(ypos));
60
+    SERIAL_ECHOLNPAIR(" Z: ", FIXFLOAT(measured_z));
61
   }
61
   }
62
 
62
 
63
   clean_up_after_endstop_or_probe_move();
63
   clean_up_after_endstop_or_probe_move();

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

108
     if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
108
     if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
109
       if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
109
       if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
110
       // If G38.2 fails throw an error
110
       // If G38.2 fails throw an error
111
-      if (!G38_run_probe() && is_38_2) {
112
-        SERIAL_ERROR_START();
113
-        SERIAL_ERRORLNPGM("Failed to reach target");
114
-      }
111
+      if (!G38_run_probe() && is_38_2) SERIAL_ERROR_MSG("Failed to reach target");
115
       break;
112
       break;
116
     }
113
     }
117
 
114
 

+ 3
- 8
Marlin/src/gcode/probe/M851.cpp 查看文件

32
   if (parser.seenval('Z')) {
32
   if (parser.seenval('Z')) {
33
     const float value = parser.value_linear_units();
33
     const float value = parser.value_linear_units();
34
     if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
34
     if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
35
-    {
36
       zprobe_zoffset = value;
35
       zprobe_zoffset = value;
37
-    }
38
-    else {
39
-      SERIAL_ERROR_START();
40
-      SERIAL_ERRORLNPGM("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")");
41
-    }
36
+    else
37
+      SERIAL_ERROR_MSG("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")");
42
     return;
38
     return;
43
   }
39
   }
44
   SERIAL_ECHO_START();
40
   SERIAL_ECHO_START();
45
-  SERIAL_ECHOPGM(MSG_PROBE_Z_OFFSET);
46
-  SERIAL_ECHOLNPAIR(": ", zprobe_zoffset);
41
+  SERIAL_ECHOLNPAIR(MSG_PROBE_Z_OFFSET ": ", zprobe_zoffset);
47
 }
42
 }
48
 
43
 
49
 #endif // HAS_BED_PROBE
44
 #endif // HAS_BED_PROBE

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

221
     if (port < 0) return;
221
     if (port < 0) return;
222
   #endif
222
   #endif
223
   if (!send_ok[cmd_queue_index_r]) return;
223
   if (!send_ok[cmd_queue_index_r]) return;
224
-  SERIAL_PROTOCOLPGM_P(port, MSG_OK);
224
+  SERIAL_ECHOPGM_P(port, MSG_OK);
225
   #if ENABLED(ADVANCED_OK)
225
   #if ENABLED(ADVANCED_OK)
226
     char* p = command_queue[cmd_queue_index_r];
226
     char* p = command_queue[cmd_queue_index_r];
227
     if (*p == 'N') {
227
     if (*p == 'N') {
228
-      SERIAL_PROTOCOL_P(port, ' ');
228
+      SERIAL_ECHO_P(port, ' ');
229
       SERIAL_ECHO_P(port, *p++);
229
       SERIAL_ECHO_P(port, *p++);
230
       while (NUMERIC_SIGNED(*p))
230
       while (NUMERIC_SIGNED(*p))
231
         SERIAL_ECHO_P(port, *p++);
231
         SERIAL_ECHO_P(port, *p++);
232
     }
232
     }
233
-    SERIAL_PROTOCOLPGM_P(port, " P"); SERIAL_PROTOCOL_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
234
-    SERIAL_PROTOCOLPGM_P(port, " B"); SERIAL_PROTOCOL_P(port, BUFSIZE - commands_in_queue);
233
+    SERIAL_ECHOPGM_P(port, " P"); SERIAL_ECHO_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
234
+    SERIAL_ECHOPGM_P(port, " B"); SERIAL_ECHO_P(port, BUFSIZE - commands_in_queue);
235
   #endif
235
   #endif
236
   SERIAL_EOL_P(port);
236
   SERIAL_EOL_P(port);
237
 }
237
 }
246
     if (port < 0) return;
246
     if (port < 0) return;
247
   #endif
247
   #endif
248
   SERIAL_FLUSH_P(port);
248
   SERIAL_FLUSH_P(port);
249
-  SERIAL_PROTOCOLPGM_P(port, MSG_RESEND);
250
-  SERIAL_PROTOCOLLN_P(port, gcode_LastN + 1);
249
+  SERIAL_ECHOPGM_P(port, MSG_RESEND);
250
+  SERIAL_ECHOLN_P(port, gcode_LastN + 1);
251
   ok_to_send();
251
   ok_to_send();
252
 }
252
 }
253
 
253
 
254
 void gcode_line_error(PGM_P err, uint8_t port) {
254
 void gcode_line_error(PGM_P err, uint8_t port) {
255
   SERIAL_ERROR_START_P(port);
255
   SERIAL_ERROR_START_P(port);
256
   serialprintPGM_P(port, err);
256
   serialprintPGM_P(port, err);
257
-  SERIAL_ERRORLN_P(port, gcode_LastN);
257
+  SERIAL_ECHOLN_P(port, gcode_LastN);
258
   flush_and_request_resend();
258
   flush_and_request_resend();
259
   serial_count[port] = 0;
259
   serial_count[port] = 0;
260
 }
260
 }
648
               #if ENABLED(BEZIER_CURVE_SUPPORT)
648
               #if ENABLED(BEZIER_CURVE_SUPPORT)
649
                 case 5:
649
                 case 5:
650
               #endif
650
               #endif
651
-                SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
651
+                SERIAL_ECHOLNPGM(MSG_ERR_STOPPED);
652
                 LCD_MESSAGEPGM(MSG_STOPPED);
652
                 LCD_MESSAGEPGM(MSG_STOPPED);
653
                 break;
653
                 break;
654
             }
654
             }
754
           if (IS_SD_PRINTING())
754
           if (IS_SD_PRINTING())
755
             sd_count = 0; // If a sub-file was printing, continue from call point
755
             sd_count = 0; // If a sub-file was printing, continue from call point
756
           else {
756
           else {
757
-            SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
757
+            SERIAL_ECHOLNPGM(MSG_FILE_PRINTED);
758
             #if ENABLED(PRINTER_EVENT_LEDS)
758
             #if ENABLED(PRINTER_EVENT_LEDS)
759
               printerEventLEDs.onPrintCompleted();
759
               printerEventLEDs.onPrintCompleted();
760
               #if HAS_RESUME_CONTINUE
760
               #if HAS_RESUME_CONTINUE
769
             #endif // PRINTER_EVENT_LEDS
769
             #endif // PRINTER_EVENT_LEDS
770
           }
770
           }
771
         }
771
         }
772
-        else if (n == -1) {
773
-          SERIAL_ERROR_START();
774
-          SERIAL_ECHOLNPGM(MSG_SD_ERR_READ);
775
-        }
772
+        else if (n == -1)
773
+          SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
774
+
776
         if (sd_char == '#') stop_buffering = true;
775
         if (sd_char == '#') stop_buffering = true;
777
 
776
 
778
         sd_comment_mode = false; // for new command
777
         sd_comment_mode = false; // for new command
843
       if (strstr_P(command, PSTR("M29"))) {
842
       if (strstr_P(command, PSTR("M29"))) {
844
         // M29 closes the file
843
         // M29 closes the file
845
         card.closefile();
844
         card.closefile();
846
-        SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
845
+        SERIAL_ECHOLNPGM(MSG_FILE_SAVED);
847
 
846
 
848
         #if !defined(__AVR__) || !defined(USBCON)
847
         #if !defined(__AVR__) || !defined(USBCON)
849
           #if ENABLED(SERIAL_STATS_DROPPED_RX)
848
           #if ENABLED(SERIAL_STATS_DROPPED_RX)

+ 2
- 2
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp 查看文件

50
     const int16_t port = command_queue_port[cmd_queue_index_r];
50
     const int16_t port = command_queue_port[cmd_queue_index_r];
51
   #endif
51
   #endif
52
 
52
 
53
-  SERIAL_PROTOCOLLNPGM_P(port, MSG_BEGIN_FILE_LIST);
53
+  SERIAL_ECHOLNPGM_P(port, MSG_BEGIN_FILE_LIST);
54
   card.ls(
54
   card.ls(
55
     #if NUM_SERIAL > 1
55
     #if NUM_SERIAL > 1
56
       port
56
       port
57
     #endif
57
     #endif
58
   );
58
   );
59
-  SERIAL_PROTOCOLLNPGM_P(port, MSG_END_FILE_LIST);
59
+  SERIAL_ECHOLNPGM_P(port, MSG_END_FILE_LIST);
60
 }
60
 }
61
 
61
 
62
 /**
62
 /**

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

40
   #endif
40
   #endif
41
 
41
 
42
   #if HAS_TEMP_SENSOR
42
   #if HAS_TEMP_SENSOR
43
-    SERIAL_PROTOCOLPGM_P(port, MSG_OK);
43
+    SERIAL_ECHOPGM_P(port, MSG_OK);
44
     thermalManager.print_heater_states(target_extruder
44
     thermalManager.print_heater_states(target_extruder
45
       #if NUM_SERIAL > 1
45
       #if NUM_SERIAL > 1
46
         , port
46
         , port
47
       #endif
47
       #endif
48
     );
48
     );
49
   #else // !HAS_TEMP_SENSOR
49
   #else // !HAS_TEMP_SENSOR
50
-    SERIAL_ERROR_START_P(port);
51
-    SERIAL_ERRORLNPGM_P(port, MSG_ERR_NO_THERMISTORS);
50
+    SERIAL_ERROR_MSG_P(port, MSG_ERR_NO_THERMISTORS);
52
   #endif
51
   #endif
53
 
52
 
54
   SERIAL_EOL_P(port);
53
   SERIAL_EOL_P(port);

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

296
 
296
 
297
 void _lcd_ubl_invalidate() {
297
 void _lcd_ubl_invalidate() {
298
   ubl.invalidate();
298
   ubl.invalidate();
299
-  SERIAL_PROTOCOLLNPGM("Mesh invalidated.");
299
+  SERIAL_ECHOLNPGM("Mesh invalidated.");
300
 }
300
 }
301
 
301
 
302
 /**
302
 /**

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

84
 
84
 
85
 void vector_3::debug(PGM_P const title) {
85
 void vector_3::debug(PGM_P const title) {
86
   serialprintPGM(title);
86
   serialprintPGM(title);
87
-  SERIAL_PROTOCOLPGM(" x: ");
88
-  SERIAL_PROTOCOL_F(x, 6);
89
-  SERIAL_PROTOCOLPGM(" y: ");
90
-  SERIAL_PROTOCOL_F(y, 6);
91
-  SERIAL_PROTOCOLPGM(" z: ");
92
-  SERIAL_PROTOCOL_F(z, 6);
93
-  SERIAL_EOL();
87
+  SERIAL_ECHOPAIR_F(" x: ", x, 6);
88
+  SERIAL_ECHOPAIR_F(" y: ", y, 6);
89
+  SERIAL_ECHOLNPAIR_F(" z: ", z, 6);
94
 }
90
 }
95
 
91
 
96
 void apply_rotation_xyz(const matrix_3x3 &matrix, float &x, float &y, float &z) {
92
 void apply_rotation_xyz(const matrix_3x3 &matrix, float &x, float &y, float &z) {
151
   uint8_t count = 0;
147
   uint8_t count = 0;
152
   for (uint8_t i = 0; i < 3; i++) {
148
   for (uint8_t i = 0; i < 3; i++) {
153
     for (uint8_t j = 0; j < 3; j++) {
149
     for (uint8_t j = 0; j < 3; j++) {
154
-      if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+');
155
-      SERIAL_PROTOCOL_F(matrix[count], 6);
156
-      SERIAL_PROTOCOLCHAR(' ');
150
+      if (matrix[count] >= 0.0) SERIAL_CHAR('+');
151
+      SERIAL_ECHO_F(matrix[count], 6);
152
+      SERIAL_CHAR(' ');
157
       count++;
153
       count++;
158
     }
154
     }
159
     SERIAL_EOL();
155
     SERIAL_EOL();

+ 180
- 280
Marlin/src/module/configuration_store.cpp 查看文件

384
 
384
 
385
 #endif // SD_FIRMWARE_UPDATE
385
 #endif // SD_FIRMWARE_UPDATE
386
 
386
 
387
+#if ENABLED(EEPROM_CHITCHAT)
388
+  #define CHITCHAT_ECHO(V)                      SERIAL_ECHO(V)
389
+  #define CHITCHAT_ECHOLNPGM(STR)               SERIAL_ECHOLNPGM(STR)
390
+  #define CHITCHAT_ECHOPAIR(STR,V)              SERIAL_ECHOPAIR(STR,V)
391
+  #define CHITCHAT_ECHOLNPAIR(STR,V)            SERIAL_ECHOLNPAIR(STR,V)
392
+  #define CHITCHAT_ECHO_START_P(port)           SERIAL_ECHO_START_P(port)
393
+  #define CHITCHAT_ERROR_START_P(port)          SERIAL_ERROR_START_P(port)
394
+  #define CHITCHAT_ERROR_MSG_P(port, STR)       SERIAL_ERROR_MSG_P(port, STR)
395
+  #define CHITCHAT_ECHO_P(port, VAL)            SERIAL_ECHO_P(port, VAL)
396
+  #define CHITCHAT_ECHOPGM_P(port, STR)         SERIAL_ECHOPGM_P(port, STR)
397
+  #define CHITCHAT_ECHOLNPGM_P(port, STR)       SERIAL_ECHOLNPGM_P(port, STR)
398
+  #define CHITCHAT_ECHOPAIR_P(port, STR, VAL)   SERIAL_ECHOPAIR_P(port, STR, VAL)
399
+  #define CHITCHAT_ECHOLNPAIR_P(port, STR, VAL) SERIAL_ECHOLNPAIR_P(port, STR, VAL)
400
+  #define CHITCHAT_EOL()                        SERIAL_EOL()
401
+#else
402
+  #define CHITCHAT_ECHO(V)                      NOOP
403
+  #define CHITCHAT_ECHOLNPGM(STR)               NOOP
404
+  #define CHITCHAT_ECHOPAIR(STR,V)              NOOP
405
+  #define CHITCHAT_ECHOLNPAIR(STR,V)            NOOP
406
+  #define CHITCHAT_ECHO_START_P(port)           NOOP
407
+  #define CHITCHAT_ERROR_START_P(port)          NOOP
408
+  #define CHITCHAT_ERROR_MSG_P(port, STR)       NOOP
409
+  #define CHITCHAT_ECHO_P(port, VAL)            NOOP
410
+  #define CHITCHAT_ECHOPGM_P(port, STR)         NOOP
411
+  #define CHITCHAT_ECHOLNPGM_P(port, STR)       NOOP
412
+  #define CHITCHAT_ECHOPAIR_P(port, STR, VAL)   NOOP
413
+  #define CHITCHAT_ECHOLNPAIR_P(port, STR, VAL) NOOP
414
+  #define CHITCHAT_EOL()                        NOOP
415
+#endif
416
+
387
 #if ENABLED(EEPROM_SETTINGS)
417
 #if ENABLED(EEPROM_SETTINGS)
388
 
418
 
389
   #define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
419
   #define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
392
   #define EEPROM_WRITE(VAR) persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
422
   #define EEPROM_WRITE(VAR) persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
393
   #define EEPROM_READ(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating)
423
   #define EEPROM_READ(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating)
394
   #define EEPROM_READ_ALWAYS(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
424
   #define EEPROM_READ_ALWAYS(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
395
-  #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_START_P(port); SERIAL_ERRORLNPGM_P(port, ERR); eeprom_error = true; } }while(0)
425
+  #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG_P(port, ERR); eeprom_error = true; } }while(0)
396
 
426
 
397
   #if ENABLED(DEBUG_EEPROM_READWRITE)
427
   #if ENABLED(DEBUG_EEPROM_READWRITE)
398
     #define _FIELD_TEST(FIELD) \
428
     #define _FIELD_TEST(FIELD) \
410
 
440
 
411
   bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) {
441
   bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) {
412
     if (size != datasize()) {
442
     if (size != datasize()) {
413
-      #if ENABLED(EEPROM_CHITCHAT)
414
-        SERIAL_ERROR_START_P(port);
415
-        SERIAL_ERRORLNPGM_P(port, "EEPROM datasize error.");
416
-      #endif
443
+      CHITCHAT_ERROR_MSG_P(port, "EEPROM datasize error.");
417
       return true;
444
       return true;
418
     }
445
     }
419
     return false;
446
     return false;
1050
       EEPROM_WRITE(final_crc);
1077
       EEPROM_WRITE(final_crc);
1051
 
1078
 
1052
       // Report storage size
1079
       // Report storage size
1053
-      #if ENABLED(EEPROM_CHITCHAT)
1054
-        SERIAL_ECHO_START_P(port);
1055
-        SERIAL_ECHOPAIR_P(port, "Settings Stored (", eeprom_size);
1056
-        SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)final_crc);
1057
-        SERIAL_ECHOLNPGM_P(port, ")");
1058
-      #endif
1080
+      CHITCHAT_ECHO_START_P(port);
1081
+      CHITCHAT_ECHOPAIR_P(port, "Settings Stored (", eeprom_size);
1082
+      CHITCHAT_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)final_crc);
1083
+      CHITCHAT_ECHOLNPGM_P(port, ")");
1059
 
1084
 
1060
       eeprom_error |= size_error(eeprom_size);
1085
       eeprom_error |= size_error(eeprom_size);
1061
     }
1086
     }
1092
         stored_ver[0] = '?';
1117
         stored_ver[0] = '?';
1093
         stored_ver[1] = '\0';
1118
         stored_ver[1] = '\0';
1094
       }
1119
       }
1095
-      #if ENABLED(EEPROM_CHITCHAT)
1096
-        SERIAL_ECHO_START_P(port);
1097
-        SERIAL_ECHOPGM_P(port, "EEPROM version mismatch ");
1098
-        SERIAL_ECHOPAIR_P(port, "(EEPROM=", stored_ver);
1099
-        SERIAL_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")");
1100
-      #endif
1120
+      CHITCHAT_ECHO_START_P(port);
1121
+      CHITCHAT_ECHOPGM_P(port, "EEPROM version mismatch ");
1122
+      CHITCHAT_ECHOPAIR_P(port, "(EEPROM=", stored_ver);
1123
+      CHITCHAT_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")");
1101
       eeprom_error = true;
1124
       eeprom_error = true;
1102
     }
1125
     }
1103
     else {
1126
     else {
1704
 
1727
 
1705
       eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
1728
       eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
1706
       if (eeprom_error) {
1729
       if (eeprom_error) {
1707
-        #if ENABLED(EEPROM_CHITCHAT)
1708
-          SERIAL_ECHO_START_P(port);
1709
-          SERIAL_ECHOPAIR_P(port, "Index: ", int(eeprom_index - (EEPROM_OFFSET)));
1710
-          SERIAL_ECHOLNPAIR_P(port, " Size: ", datasize());
1711
-        #endif
1730
+        CHITCHAT_ECHO_START_P(port);
1731
+        CHITCHAT_ECHOPAIR_P(port, "Index: ", int(eeprom_index - (EEPROM_OFFSET)));
1732
+        CHITCHAT_ECHOLNPAIR_P(port, " Size: ", datasize());
1712
       }
1733
       }
1713
       else if (working_crc != stored_crc) {
1734
       else if (working_crc != stored_crc) {
1714
         eeprom_error = true;
1735
         eeprom_error = true;
1715
-        #if ENABLED(EEPROM_CHITCHAT)
1716
-          SERIAL_ERROR_START_P(port);
1717
-          SERIAL_ERRORPGM_P(port, "EEPROM CRC mismatch - (stored) ");
1718
-          SERIAL_ERROR_P(port, stored_crc);
1719
-          SERIAL_ERRORPGM_P(port, " != ");
1720
-          SERIAL_ERROR_P(port, working_crc);
1721
-          SERIAL_ERRORLNPGM_P(port, " (calculated)!");
1722
-        #endif
1736
+        CHITCHAT_ERROR_START_P(port);
1737
+        CHITCHAT_ECHOPGM_P(port, "EEPROM CRC mismatch - (stored) ");
1738
+        CHITCHAT_ECHO_P(port, stored_crc);
1739
+        CHITCHAT_ECHOPGM_P(port, " != ");
1740
+        CHITCHAT_ECHO_P(port, working_crc);
1741
+        CHITCHAT_ECHOLNPGM_P(port, " (calculated)!");
1723
       }
1742
       }
1724
       else if (!validating) {
1743
       else if (!validating) {
1725
-        #if ENABLED(EEPROM_CHITCHAT)
1726
-          SERIAL_ECHO_START_P(port);
1727
-          SERIAL_ECHO_P(port, version);
1728
-          SERIAL_ECHOPAIR_P(port, " stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
1729
-          SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)working_crc);
1730
-          SERIAL_ECHOLNPGM_P(port, ")");
1731
-        #endif
1744
+        CHITCHAT_ECHO_START_P(port);
1745
+        CHITCHAT_ECHO_P(port, version);
1746
+        CHITCHAT_ECHOPAIR_P(port, " stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
1747
+        CHITCHAT_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)working_crc);
1748
+        CHITCHAT_ECHOLNPGM_P(port, ")");
1732
       }
1749
       }
1733
 
1750
 
1734
       if (!validating && !eeprom_error) postprocess();
1751
       if (!validating && !eeprom_error) postprocess();
1741
             SERIAL_EOL_P(port);
1758
             SERIAL_EOL_P(port);
1742
             #if ENABLED(EEPROM_CHITCHAT)
1759
             #if ENABLED(EEPROM_CHITCHAT)
1743
               ubl.echo_name();
1760
               ubl.echo_name();
1744
-              SERIAL_ECHOLNPGM_P(port, " initialized.\n");
1761
+              CHITCHAT_ECHOLNPGM_P(port, " initialized.\n");
1745
             #endif
1762
             #endif
1746
           }
1763
           }
1747
           else {
1764
           else {
1748
             eeprom_error = true;
1765
             eeprom_error = true;
1749
             #if ENABLED(EEPROM_CHITCHAT)
1766
             #if ENABLED(EEPROM_CHITCHAT)
1750
-              SERIAL_PROTOCOLPGM_P(port, "?Can't enable ");
1767
+              CHITCHAT_ECHOPGM_P(port, "?Can't enable ");
1751
               ubl.echo_name();
1768
               ubl.echo_name();
1752
-              SERIAL_PROTOCOLLNPGM_P(port, ".");
1769
+              CHITCHAT_ECHOLNPGM_P(port, ".");
1753
             #endif
1770
             #endif
1754
             ubl.reset();
1771
             ubl.reset();
1755
           }
1772
           }
1756
 
1773
 
1757
           if (ubl.storage_slot >= 0) {
1774
           if (ubl.storage_slot >= 0) {
1758
             load_mesh(ubl.storage_slot);
1775
             load_mesh(ubl.storage_slot);
1759
-            #if ENABLED(EEPROM_CHITCHAT)
1760
-              SERIAL_ECHOPAIR_P(port, "Mesh ", ubl.storage_slot);
1761
-              SERIAL_ECHOLNPGM_P(port, " loaded from storage.");
1762
-            #endif
1776
+            CHITCHAT_ECHOPAIR_P(port, "Mesh ", ubl.storage_slot);
1777
+            CHITCHAT_ECHOLNPGM_P(port, " loaded from storage.");
1763
           }
1778
           }
1764
           else {
1779
           else {
1765
             ubl.reset();
1780
             ubl.reset();
1766
-            #if ENABLED(EEPROM_CHITCHAT)
1767
-              SERIAL_ECHOLNPGM_P(port, "UBL System reset()");
1768
-            #endif
1781
+            CHITCHAT_ECHOLNPGM_P(port, "UBL System reset()");
1769
           }
1782
           }
1770
         }
1783
         }
1771
       #endif
1784
       #endif
1794
 
1807
 
1795
   #if ENABLED(AUTO_BED_LEVELING_UBL)
1808
   #if ENABLED(AUTO_BED_LEVELING_UBL)
1796
 
1809
 
1797
-    #if ENABLED(EEPROM_CHITCHAT)
1798
-      void ubl_invalid_slot(const int s) {
1799
-        SERIAL_PROTOCOLLNPGM("?Invalid slot.");
1800
-        SERIAL_PROTOCOL(s);
1801
-        SERIAL_PROTOCOLLNPGM(" mesh slots available.");
1802
-      }
1803
-    #endif
1810
+    inline void ubl_invalid_slot(const int s) {
1811
+      #if ENABLED(EEPROM_CHITCHAT)
1812
+        CHITCHAT_ECHOLNPGM("?Invalid slot.");
1813
+        CHITCHAT_ECHO(s);
1814
+        CHITCHAT_ECHOLNPGM(" mesh slots available.");
1815
+      #else
1816
+        UNUSED(s);
1817
+      #endif
1818
+    }
1804
 
1819
 
1805
     const uint16_t MarlinSettings::meshes_end = persistentStore.capacity() - 129; // 128 (+1 because of the change to capacity rather than last valid address)
1820
     const uint16_t MarlinSettings::meshes_end = persistentStore.capacity() - 129; // 128 (+1 because of the change to capacity rather than last valid address)
1806
                                                                                   // is a placeholder for the size of the MAT; the MAT will always
1821
                                                                                   // is a placeholder for the size of the MAT; the MAT will always
1824
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1839
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1825
         const int16_t a = calc_num_meshes();
1840
         const int16_t a = calc_num_meshes();
1826
         if (!WITHIN(slot, 0, a - 1)) {
1841
         if (!WITHIN(slot, 0, a - 1)) {
1827
-          #if ENABLED(EEPROM_CHITCHAT)
1828
-            ubl_invalid_slot(a);
1829
-            SERIAL_PROTOCOLPAIR("E2END=", persistentStore.capacity() - 1);
1830
-            SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
1831
-            SERIAL_PROTOCOLLNPAIR(" slot=", slot);
1832
-            SERIAL_EOL();
1833
-          #endif
1842
+          ubl_invalid_slot(a);
1843
+          CHITCHAT_ECHOPAIR("E2END=", persistentStore.capacity() - 1);
1844
+          CHITCHAT_ECHOPAIR(" meshes_end=", meshes_end);
1845
+          CHITCHAT_ECHOLNPAIR(" slot=", slot);
1846
+          CHITCHAT_EOL();
1834
           return;
1847
           return;
1835
         }
1848
         }
1836
 
1849
 
1837
         int pos = mesh_slot_offset(slot);
1850
         int pos = mesh_slot_offset(slot);
1838
         uint16_t crc = 0;
1851
         uint16_t crc = 0;
1839
 
1852
 
1853
+        // Write crc to MAT along with other data, or just tack on to the beginning or end
1840
         persistentStore.access_start();
1854
         persistentStore.access_start();
1841
         const bool status = persistentStore.write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
1855
         const bool status = persistentStore.write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
1842
         persistentStore.access_finish();
1856
         persistentStore.access_finish();
1843
 
1857
 
1844
-        if (status)
1845
-          SERIAL_PROTOCOLPGM("?Unable to save mesh data.\n");
1846
-
1847
-        // Write crc to MAT along with other data, or just tack on to the beginning or end
1848
-
1849
-        #if ENABLED(EEPROM_CHITCHAT)
1850
-          if (!status)
1851
-            SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot);
1852
-        #endif
1858
+        if (status) SERIAL_ECHOPGM("?Unable to save mesh data.\n");
1859
+        else        CHITCHAT_ECHOLNPAIR("Mesh saved in slot ", slot);
1853
 
1860
 
1854
       #else
1861
       #else
1855
 
1862
 
1865
         const int16_t a = settings.calc_num_meshes();
1872
         const int16_t a = settings.calc_num_meshes();
1866
 
1873
 
1867
         if (!WITHIN(slot, 0, a - 1)) {
1874
         if (!WITHIN(slot, 0, a - 1)) {
1868
-          #if ENABLED(EEPROM_CHITCHAT)
1869
-            ubl_invalid_slot(a);
1870
-          #endif
1875
+          ubl_invalid_slot(a);
1871
           return;
1876
           return;
1872
         }
1877
         }
1873
 
1878
 
1879
         const uint16_t status = persistentStore.read_data(pos, dest, sizeof(ubl.z_values), &crc);
1884
         const uint16_t status = persistentStore.read_data(pos, dest, sizeof(ubl.z_values), &crc);
1880
         persistentStore.access_finish();
1885
         persistentStore.access_finish();
1881
 
1886
 
1882
-        if (status)
1883
-          SERIAL_PROTOCOLPGM("?Unable to load mesh data.\n");
1887
+        if (status) SERIAL_ECHOPGM("?Unable to load mesh data.\n");
1888
+        else        CHITCHAT_ECHOLNPAIR("Mesh loaded from slot ", slot);
1884
 
1889
 
1885
-        #if ENABLED(EEPROM_CHITCHAT)
1886
-          else
1887
-            SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot);
1888
-        #endif
1889
         EEPROM_FINISH();
1890
         EEPROM_FINISH();
1890
 
1891
 
1891
       #else
1892
       #else
1903
 #else // !EEPROM_SETTINGS
1904
 #else // !EEPROM_SETTINGS
1904
 
1905
 
1905
   bool MarlinSettings::save(PORTARG_SOLO) {
1906
   bool MarlinSettings::save(PORTARG_SOLO) {
1906
-    #if ENABLED(EEPROM_CHITCHAT)
1907
-      SERIAL_ERROR_START_P(port);
1908
-      SERIAL_ERRORLNPGM_P(port, "EEPROM disabled");
1909
-    #endif
1907
+    CHITCHAT_ERROR_MSG_P(port, "EEPROM disabled");
1910
     return false;
1908
     return false;
1911
   }
1909
   }
1912
 
1910
 
2177
 
2175
 
2178
   postprocess();
2176
   postprocess();
2179
 
2177
 
2180
-  #if ENABLED(EEPROM_CHITCHAT)
2181
-    SERIAL_ECHO_START_P(port);
2182
-    SERIAL_ECHOLNPGM_P(port, "Hardcoded Default Settings Loaded");
2183
-  #endif
2178
+  CHITCHAT_ECHO_START_P(port);
2179
+  CHITCHAT_ECHOLNPGM_P(port, "Hardcoded Default Settings Loaded");
2184
 }
2180
 }
2185
 
2181
 
2186
 #if DISABLED(DISABLE_M503)
2182
 #if DISABLED(DISABLE_M503)
2187
 
2183
 
2188
-  #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
2184
+  #define CONFIG_ECHO_START()       do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
2185
+  #define CONFIG_ECHO_MSG(STR)      do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM_P(port, STR); }while(0)
2186
+  #define CONFIG_ECHO_HEADING(STR)  do{ if (!forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOLNPGM_P(port, STR); } }while(0)
2189
 
2187
 
2190
   #if HAS_TRINAMIC
2188
   #if HAS_TRINAMIC
2191
     void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M906"); }
2189
     void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M906"); }
2234
     /**
2232
     /**
2235
      * Announce current units, in case inches are being displayed
2233
      * Announce current units, in case inches are being displayed
2236
      */
2234
      */
2237
-    CONFIG_ECHO_START;
2235
+    CONFIG_ECHO_START();
2238
     #if ENABLED(INCH_MODE_SUPPORT)
2236
     #if ENABLED(INCH_MODE_SUPPORT)
2239
       SERIAL_ECHOPGM_P(port, "  G2");
2237
       SERIAL_ECHOPGM_P(port, "  G2");
2240
       SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
2238
       SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
2250
 
2248
 
2251
       // Temperature units - for Ultipanel temperature options
2249
       // Temperature units - for Ultipanel temperature options
2252
 
2250
 
2253
-      CONFIG_ECHO_START;
2251
+      CONFIG_ECHO_START();
2254
       #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
2252
       #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
2255
         SERIAL_ECHOPGM_P(port, "  M149 ");
2253
         SERIAL_ECHOPGM_P(port, "  M149 ");
2256
         SERIAL_CHAR_P(port, parser.temp_units_code());
2254
         SERIAL_CHAR_P(port, parser.temp_units_code());
2270
        * Volumetric extrusion M200
2268
        * Volumetric extrusion M200
2271
        */
2269
        */
2272
       if (!forReplay) {
2270
       if (!forReplay) {
2273
-        CONFIG_ECHO_START;
2271
+        CONFIG_ECHO_START();
2274
         SERIAL_ECHOPGM_P(port, "Filament settings:");
2272
         SERIAL_ECHOPGM_P(port, "Filament settings:");
2275
         if (parser.volumetric_enabled)
2273
         if (parser.volumetric_enabled)
2276
           SERIAL_EOL_P(port);
2274
           SERIAL_EOL_P(port);
2278
           SERIAL_ECHOLNPGM_P(port, " Disabled");
2276
           SERIAL_ECHOLNPGM_P(port, " Disabled");
2279
       }
2277
       }
2280
 
2278
 
2281
-      CONFIG_ECHO_START;
2279
+      CONFIG_ECHO_START();
2282
       SERIAL_ECHOPAIR_P(port, "  M200 D", LINEAR_UNIT(planner.filament_size[0]));
2280
       SERIAL_ECHOPAIR_P(port, "  M200 D", LINEAR_UNIT(planner.filament_size[0]));
2283
       SERIAL_EOL_P(port);
2281
       SERIAL_EOL_P(port);
2284
       #if EXTRUDERS > 1
2282
       #if EXTRUDERS > 1
2285
-        CONFIG_ECHO_START;
2283
+        CONFIG_ECHO_START();
2286
         SERIAL_ECHOPAIR_P(port, "  M200 T1 D", LINEAR_UNIT(planner.filament_size[1]));
2284
         SERIAL_ECHOPAIR_P(port, "  M200 T1 D", LINEAR_UNIT(planner.filament_size[1]));
2287
         SERIAL_EOL_P(port);
2285
         SERIAL_EOL_P(port);
2288
         #if EXTRUDERS > 2
2286
         #if EXTRUDERS > 2
2289
-          CONFIG_ECHO_START;
2287
+          CONFIG_ECHO_START();
2290
           SERIAL_ECHOPAIR_P(port, "  M200 T2 D", LINEAR_UNIT(planner.filament_size[2]));
2288
           SERIAL_ECHOPAIR_P(port, "  M200 T2 D", LINEAR_UNIT(planner.filament_size[2]));
2291
           SERIAL_EOL_P(port);
2289
           SERIAL_EOL_P(port);
2292
           #if EXTRUDERS > 3
2290
           #if EXTRUDERS > 3
2293
-            CONFIG_ECHO_START;
2291
+            CONFIG_ECHO_START();
2294
             SERIAL_ECHOPAIR_P(port, "  M200 T3 D", LINEAR_UNIT(planner.filament_size[3]));
2292
             SERIAL_ECHOPAIR_P(port, "  M200 T3 D", LINEAR_UNIT(planner.filament_size[3]));
2295
             SERIAL_EOL_P(port);
2293
             SERIAL_EOL_P(port);
2296
             #if EXTRUDERS > 4
2294
             #if EXTRUDERS > 4
2297
-              CONFIG_ECHO_START;
2295
+              CONFIG_ECHO_START();
2298
               SERIAL_ECHOPAIR_P(port, "  M200 T4 D", LINEAR_UNIT(planner.filament_size[4]));
2296
               SERIAL_ECHOPAIR_P(port, "  M200 T4 D", LINEAR_UNIT(planner.filament_size[4]));
2299
               SERIAL_EOL_P(port);
2297
               SERIAL_EOL_P(port);
2300
               #if EXTRUDERS > 5
2298
               #if EXTRUDERS > 5
2301
-                CONFIG_ECHO_START;
2299
+                CONFIG_ECHO_START();
2302
                 SERIAL_ECHOPAIR_P(port, "  M200 T5 D", LINEAR_UNIT(planner.filament_size[5]));
2300
                 SERIAL_ECHOPAIR_P(port, "  M200 T5 D", LINEAR_UNIT(planner.filament_size[5]));
2303
                 SERIAL_EOL_P(port);
2301
                 SERIAL_EOL_P(port);
2304
               #endif // EXTRUDERS > 5
2302
               #endif // EXTRUDERS > 5
2307
         #endif // EXTRUDERS > 2
2305
         #endif // EXTRUDERS > 2
2308
       #endif // EXTRUDERS > 1
2306
       #endif // EXTRUDERS > 1
2309
 
2307
 
2310
-      if (!parser.volumetric_enabled) {
2311
-        CONFIG_ECHO_START;
2312
-        SERIAL_ECHOLNPGM_P(port, "  M200 D0");
2313
-      }
2308
+      if (!parser.volumetric_enabled)
2309
+        CONFIG_ECHO_MSG("  M200 D0");
2314
 
2310
 
2315
     #endif // !NO_VOLUMETRICS
2311
     #endif // !NO_VOLUMETRICS
2316
 
2312
 
2317
-    if (!forReplay) {
2318
-      CONFIG_ECHO_START;
2319
-      SERIAL_ECHOLNPGM_P(port, "Steps per unit:");
2320
-    }
2321
-    CONFIG_ECHO_START;
2313
+    CONFIG_ECHO_HEADING("Steps per unit:");
2314
+    CONFIG_ECHO_START();
2322
     SERIAL_ECHOPAIR_P(port, "  M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]));
2315
     SERIAL_ECHOPAIR_P(port, "  M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]));
2323
     SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]));
2316
     SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]));
2324
     SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]));
2317
     SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]));
2327
     #endif
2320
     #endif
2328
     SERIAL_EOL_P(port);
2321
     SERIAL_EOL_P(port);
2329
     #if ENABLED(DISTINCT_E_FACTORS)
2322
     #if ENABLED(DISTINCT_E_FACTORS)
2330
-      CONFIG_ECHO_START;
2323
+      CONFIG_ECHO_START();
2331
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
2324
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
2332
         SERIAL_ECHOPAIR_P(port, "  M92 T", (int)i);
2325
         SERIAL_ECHOPAIR_P(port, "  M92 T", (int)i);
2333
         SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS + i]));
2326
         SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS + i]));
2334
       }
2327
       }
2335
     #endif
2328
     #endif
2336
 
2329
 
2337
-    if (!forReplay) {
2338
-      CONFIG_ECHO_START;
2339
-      SERIAL_ECHOLNPGM_P(port, "Maximum feedrates (units/s):");
2340
-    }
2341
-    CONFIG_ECHO_START;
2330
+    CONFIG_ECHO_HEADING("Maximum feedrates (units/s):");
2331
+    CONFIG_ECHO_START();
2342
     SERIAL_ECHOPAIR_P(port, "  M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]));
2332
     SERIAL_ECHOPAIR_P(port, "  M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]));
2343
     SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]));
2333
     SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]));
2344
     SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]));
2334
     SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]));
2347
     #endif
2337
     #endif
2348
     SERIAL_EOL_P(port);
2338
     SERIAL_EOL_P(port);
2349
     #if ENABLED(DISTINCT_E_FACTORS)
2339
     #if ENABLED(DISTINCT_E_FACTORS)
2350
-      CONFIG_ECHO_START;
2340
+      CONFIG_ECHO_START();
2351
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
2341
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
2352
         SERIAL_ECHOPAIR_P(port, "  M203 T", (int)i);
2342
         SERIAL_ECHOPAIR_P(port, "  M203 T", (int)i);
2353
         SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS + i]));
2343
         SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS + i]));
2354
       }
2344
       }
2355
     #endif
2345
     #endif
2356
 
2346
 
2357
-    if (!forReplay) {
2358
-      CONFIG_ECHO_START;
2359
-      SERIAL_ECHOLNPGM_P(port, "Maximum Acceleration (units/s2):");
2360
-    }
2361
-    CONFIG_ECHO_START;
2347
+    CONFIG_ECHO_HEADING("Maximum Acceleration (units/s2):");
2348
+    CONFIG_ECHO_START();
2362
     SERIAL_ECHOPAIR_P(port, "  M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]));
2349
     SERIAL_ECHOPAIR_P(port, "  M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]));
2363
     SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]));
2350
     SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]));
2364
     SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]));
2351
     SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]));
2367
     #endif
2354
     #endif
2368
     SERIAL_EOL_P(port);
2355
     SERIAL_EOL_P(port);
2369
     #if ENABLED(DISTINCT_E_FACTORS)
2356
     #if ENABLED(DISTINCT_E_FACTORS)
2370
-      CONFIG_ECHO_START;
2357
+      CONFIG_ECHO_START();
2371
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
2358
       for (uint8_t i = 0; i < E_STEPPERS; i++) {
2372
         SERIAL_ECHOPAIR_P(port, "  M201 T", (int)i);
2359
         SERIAL_ECHOPAIR_P(port, "  M201 T", (int)i);
2373
         SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS + i]));
2360
         SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS + i]));
2374
       }
2361
       }
2375
     #endif
2362
     #endif
2376
 
2363
 
2377
-    if (!forReplay) {
2378
-      CONFIG_ECHO_START;
2379
-      SERIAL_ECHOLNPGM_P(port, "Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
2380
-    }
2381
-    CONFIG_ECHO_START;
2364
+    CONFIG_ECHO_HEADING("Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
2365
+    CONFIG_ECHO_START();
2382
     SERIAL_ECHOPAIR_P(port, "  M204 P", LINEAR_UNIT(planner.settings.acceleration));
2366
     SERIAL_ECHOPAIR_P(port, "  M204 P", LINEAR_UNIT(planner.settings.acceleration));
2383
     SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.settings.retract_acceleration));
2367
     SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.settings.retract_acceleration));
2384
     SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.settings.travel_acceleration));
2368
     SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.settings.travel_acceleration));
2385
 
2369
 
2386
     if (!forReplay) {
2370
     if (!forReplay) {
2387
-      CONFIG_ECHO_START;
2371
+      CONFIG_ECHO_START();
2388
       SERIAL_ECHOPGM_P(port, "Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>");
2372
       SERIAL_ECHOPGM_P(port, "Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>");
2389
       #if ENABLED(JUNCTION_DEVIATION)
2373
       #if ENABLED(JUNCTION_DEVIATION)
2390
         SERIAL_ECHOPGM_P(port, " J<junc_dev>");
2374
         SERIAL_ECHOPGM_P(port, " J<junc_dev>");
2397
       #endif
2381
       #endif
2398
       SERIAL_EOL_P(port);
2382
       SERIAL_EOL_P(port);
2399
     }
2383
     }
2400
-    CONFIG_ECHO_START;
2384
+    CONFIG_ECHO_START();
2401
     SERIAL_ECHOPAIR_P(port, "  M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us));
2385
     SERIAL_ECHOPAIR_P(port, "  M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us));
2402
     SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s));
2386
     SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s));
2403
     SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s));
2387
     SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s));
2417
     SERIAL_EOL_P(port);
2401
     SERIAL_EOL_P(port);
2418
 
2402
 
2419
     #if HAS_M206_COMMAND
2403
     #if HAS_M206_COMMAND
2420
-      if (!forReplay) {
2421
-        CONFIG_ECHO_START;
2422
-        SERIAL_ECHOLNPGM_P(port, "Home offset:");
2423
-      }
2424
-      CONFIG_ECHO_START;
2404
+      CONFIG_ECHO_HEADING("Home offset:");
2405
+      CONFIG_ECHO_START();
2425
       SERIAL_ECHOPAIR_P(port, "  M206 X", LINEAR_UNIT(home_offset[X_AXIS]));
2406
       SERIAL_ECHOPAIR_P(port, "  M206 X", LINEAR_UNIT(home_offset[X_AXIS]));
2426
       SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(home_offset[Y_AXIS]));
2407
       SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(home_offset[Y_AXIS]));
2427
       SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(home_offset[Z_AXIS]));
2408
       SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(home_offset[Z_AXIS]));
2428
     #endif
2409
     #endif
2429
 
2410
 
2430
     #if HAS_HOTEND_OFFSET
2411
     #if HAS_HOTEND_OFFSET
2431
-      if (!forReplay) {
2432
-        CONFIG_ECHO_START;
2433
-        SERIAL_ECHOLNPGM_P(port, "Hotend offsets:");
2434
-      }
2435
-      CONFIG_ECHO_START;
2412
+      CONFIG_ECHO_HEADING("Hotend offsets:");
2413
+      CONFIG_ECHO_START();
2436
       for (uint8_t e = 1; e < HOTENDS; e++) {
2414
       for (uint8_t e = 1; e < HOTENDS; e++) {
2437
         SERIAL_ECHOPAIR_P(port, "  M218 T", (int)e);
2415
         SERIAL_ECHOPAIR_P(port, "  M218 T", (int)e);
2438
         SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(hotend_offset[X_AXIS][e]));
2416
         SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(hotend_offset[X_AXIS][e]));
2439
         SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e]));
2417
         SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e]));
2440
-        SERIAL_ECHO_P(port, " Z");
2441
-        SERIAL_ECHO_F_P(port, LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3);
2442
-        SERIAL_EOL_P(port);
2418
+        SERIAL_ECHOLNPAIR_F_P(port, " Z", LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3);
2443
       }
2419
       }
2444
     #endif
2420
     #endif
2445
 
2421
 
2450
 
2426
 
2451
       #if ENABLED(MESH_BED_LEVELING)
2427
       #if ENABLED(MESH_BED_LEVELING)
2452
 
2428
 
2453
-        if (!forReplay) {
2454
-          CONFIG_ECHO_START;
2455
-          SERIAL_ECHOLNPGM_P(port, "Mesh Bed Leveling:");
2456
-        }
2429
+        CONFIG_ECHO_HEADING("Mesh Bed Leveling:");
2457
 
2430
 
2458
       #elif ENABLED(AUTO_BED_LEVELING_UBL)
2431
       #elif ENABLED(AUTO_BED_LEVELING_UBL)
2459
 
2432
 
2460
         if (!forReplay) {
2433
         if (!forReplay) {
2461
-          CONFIG_ECHO_START;
2434
+          CONFIG_ECHO_START();
2462
           ubl.echo_name();
2435
           ubl.echo_name();
2463
           SERIAL_ECHOLNPGM_P(port, ":");
2436
           SERIAL_ECHOLNPGM_P(port, ":");
2464
         }
2437
         }
2465
 
2438
 
2466
       #elif HAS_ABL
2439
       #elif HAS_ABL
2467
 
2440
 
2468
-        if (!forReplay) {
2469
-          CONFIG_ECHO_START;
2470
-          SERIAL_ECHOLNPGM_P(port, "Auto Bed Leveling:");
2471
-        }
2441
+        CONFIG_ECHO_HEADING("Auto Bed Leveling:");
2472
 
2442
 
2473
       #endif
2443
       #endif
2474
 
2444
 
2475
-      CONFIG_ECHO_START;
2445
+      CONFIG_ECHO_START();
2476
       SERIAL_ECHOPAIR_P(port, "  M420 S", planner.leveling_active ? 1 : 0);
2446
       SERIAL_ECHOPAIR_P(port, "  M420 S", planner.leveling_active ? 1 : 0);
2477
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2447
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2478
         SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.z_fade_height));
2448
         SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.z_fade_height));
2484
         if (leveling_is_valid()) {
2454
         if (leveling_is_valid()) {
2485
           for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2455
           for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2486
             for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2456
             for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2487
-              CONFIG_ECHO_START;
2457
+              CONFIG_ECHO_START();
2488
               SERIAL_ECHOPAIR_P(port, "  G29 S3 X", (int)px + 1);
2458
               SERIAL_ECHOPAIR_P(port, "  G29 S3 X", (int)px + 1);
2489
               SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
2459
               SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
2490
-              SERIAL_ECHOPGM_P(port, " Z");
2491
-              SERIAL_ECHO_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5);
2492
-              SERIAL_EOL_P(port);
2460
+              SERIAL_ECHOLNPAIR_F_P(port, " Z", LINEAR_UNIT(mbl.z_values[px][py]), 5);
2493
             }
2461
             }
2494
           }
2462
           }
2495
         }
2463
         }
2504
           SERIAL_ECHOLNPGM_P(port, " meshes.\n");
2472
           SERIAL_ECHOLNPGM_P(port, " meshes.\n");
2505
         }
2473
         }
2506
 
2474
 
2507
-//      ubl.report_current_mesh(PORTVAR_SOLO);   // This is too verbose for large mesh's.   A better (more terse)
2508
-                                                 // solution needs to be found.
2475
+       //ubl.report_current_mesh(PORTVAR_SOLO);   // This is too verbose for large meshes. A better (more terse)
2476
+                                                  // solution needs to be found.
2509
       #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
2477
       #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
2510
 
2478
 
2511
         if (leveling_is_valid()) {
2479
         if (leveling_is_valid()) {
2512
           for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2480
           for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2513
             for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2481
             for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2514
-              CONFIG_ECHO_START;
2482
+              CONFIG_ECHO_START();
2515
               SERIAL_ECHOPAIR_P(port, "  G29 W I", (int)px);
2483
               SERIAL_ECHOPAIR_P(port, "  G29 W I", (int)px);
2516
               SERIAL_ECHOPAIR_P(port, " J", (int)py);
2484
               SERIAL_ECHOPAIR_P(port, " J", (int)py);
2517
-              SERIAL_ECHOPGM_P(port, " Z");
2518
-              SERIAL_ECHO_F_P(port, LINEAR_UNIT(z_values[px][py]), 5);
2519
-              SERIAL_EOL_P(port);
2485
+              SERIAL_ECHOLNPAIR_F_P(port, " Z", LINEAR_UNIT(z_values[px][py]), 5);
2520
             }
2486
             }
2521
           }
2487
           }
2522
         }
2488
         }
2527
 
2493
 
2528
     #if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)
2494
     #if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)
2529
 
2495
 
2530
-      if (!forReplay) {
2531
-        CONFIG_ECHO_START;
2532
-        SERIAL_ECHOLNPGM_P(port, "Servo Angles:");
2533
-      }
2496
+      CONFIG_ECHO_HEADING("Servo Angles:");
2534
       for (uint8_t i = 0; i < NUM_SERVOS; i++) {
2497
       for (uint8_t i = 0; i < NUM_SERVOS; i++) {
2535
         switch (i) {
2498
         switch (i) {
2536
           #if ENABLED(SWITCHING_EXTRUDER)
2499
           #if ENABLED(SWITCHING_EXTRUDER)
2543
           #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)
2506
           #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)
2544
             case Z_PROBE_SERVO_NR:
2507
             case Z_PROBE_SERVO_NR:
2545
           #endif
2508
           #endif
2546
-            CONFIG_ECHO_START;
2509
+            CONFIG_ECHO_START();
2547
             SERIAL_ECHOPAIR_P(port, "  M281 P", int(i));
2510
             SERIAL_ECHOPAIR_P(port, "  M281 P", int(i));
2548
             SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]);
2511
             SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]);
2549
             SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]);
2512
             SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]);
2556
 
2519
 
2557
     #if HAS_SCARA_OFFSET
2520
     #if HAS_SCARA_OFFSET
2558
 
2521
 
2559
-      if (!forReplay) {
2560
-        CONFIG_ECHO_START;
2561
-        SERIAL_ECHOLNPGM_P(port, "SCARA settings: S<seg-per-sec> P<theta-psi-offset> T<theta-offset>");
2562
-      }
2563
-      CONFIG_ECHO_START;
2522
+      CONFIG_ECHO_HEADING("SCARA settings: S<seg-per-sec> P<theta-psi-offset> T<theta-offset>");
2523
+      CONFIG_ECHO_START();
2564
       SERIAL_ECHOPAIR_P(port, "  M665 S", delta_segments_per_second);
2524
       SERIAL_ECHOPAIR_P(port, "  M665 S", delta_segments_per_second);
2565
       SERIAL_ECHOPAIR_P(port, " P", scara_home_offset[A_AXIS]);
2525
       SERIAL_ECHOPAIR_P(port, " P", scara_home_offset[A_AXIS]);
2566
       SERIAL_ECHOPAIR_P(port, " T", scara_home_offset[B_AXIS]);
2526
       SERIAL_ECHOPAIR_P(port, " T", scara_home_offset[B_AXIS]);
2569
 
2529
 
2570
     #elif ENABLED(DELTA)
2530
     #elif ENABLED(DELTA)
2571
 
2531
 
2572
-      if (!forReplay) {
2573
-        CONFIG_ECHO_START;
2574
-        SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:");
2575
-      }
2576
-      CONFIG_ECHO_START;
2532
+      CONFIG_ECHO_HEADING("Endstop adjustment:");
2533
+      CONFIG_ECHO_START();
2577
       SERIAL_ECHOPAIR_P(port, "  M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS]));
2534
       SERIAL_ECHOPAIR_P(port, "  M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS]));
2578
       SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS]));
2535
       SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS]));
2579
       SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS]));
2536
       SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS]));
2580
-      if (!forReplay) {
2581
-        CONFIG_ECHO_START;
2582
-        SERIAL_ECHOLNPGM_P(port, "Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> B<calibration radius> XYZ<tower angle corrections>");
2583
-      }
2584
-      CONFIG_ECHO_START;
2537
+
2538
+      CONFIG_ECHO_HEADING("Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> B<calibration radius> XYZ<tower angle corrections>");
2539
+      CONFIG_ECHO_START();
2585
       SERIAL_ECHOPAIR_P(port, "  M665 L", LINEAR_UNIT(delta_diagonal_rod));
2540
       SERIAL_ECHOPAIR_P(port, "  M665 L", LINEAR_UNIT(delta_diagonal_rod));
2586
       SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(delta_radius));
2541
       SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(delta_radius));
2587
       SERIAL_ECHOPAIR_P(port, " H", LINEAR_UNIT(delta_height));
2542
       SERIAL_ECHOPAIR_P(port, " H", LINEAR_UNIT(delta_height));
2594
 
2549
 
2595
     #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
2550
     #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
2596
 
2551
 
2597
-      if (!forReplay) {
2598
-        CONFIG_ECHO_START;
2599
-        SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:");
2600
-      }
2601
-      CONFIG_ECHO_START;
2552
+      CONFIG_ECHO_HEADING("Endstop adjustment:");
2553
+      CONFIG_ECHO_START();
2602
       SERIAL_ECHOPGM_P(port, "  M666");
2554
       SERIAL_ECHOPGM_P(port, "  M666");
2603
       #if ENABLED(X_DUAL_ENDSTOPS)
2555
       #if ENABLED(X_DUAL_ENDSTOPS)
2604
         SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(endstops.x2_endstop_adj));
2556
         SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(endstops.x2_endstop_adj));
2608
       #endif
2560
       #endif
2609
       #if ENABLED(Z_TRIPLE_ENDSTOPS)
2561
       #if ENABLED(Z_TRIPLE_ENDSTOPS)
2610
         SERIAL_ECHOLNPAIR_P(port, "S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj));
2562
         SERIAL_ECHOLNPAIR_P(port, "S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj));
2611
-        CONFIG_ECHO_START;
2563
+        CONFIG_ECHO_START();
2612
         SERIAL_ECHOPAIR_P(port, "  M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
2564
         SERIAL_ECHOPAIR_P(port, "  M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
2613
       #elif ENABLED(Z_DUAL_ENDSTOPS)
2565
       #elif ENABLED(Z_DUAL_ENDSTOPS)
2614
         SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(endstops.z2_endstop_adj));
2566
         SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(endstops.z2_endstop_adj));
2619
 
2571
 
2620
     #if HAS_LCD_MENU
2572
     #if HAS_LCD_MENU
2621
 
2573
 
2622
-      if (!forReplay) {
2623
-        CONFIG_ECHO_START;
2624
-        SERIAL_ECHOLNPGM_P(port, "Material heatup parameters:");
2625
-      }
2574
+      CONFIG_ECHO_HEADING("Material heatup parameters:");
2626
       for (uint8_t i = 0; i < COUNT(ui.preheat_hotend_temp); i++) {
2575
       for (uint8_t i = 0; i < COUNT(ui.preheat_hotend_temp); i++) {
2627
-        CONFIG_ECHO_START;
2576
+        CONFIG_ECHO_START();
2628
         SERIAL_ECHOPAIR_P(port, "  M145 S", (int)i);
2577
         SERIAL_ECHOPAIR_P(port, "  M145 S", (int)i);
2629
         SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(ui.preheat_hotend_temp[i]));
2578
         SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(ui.preheat_hotend_temp[i]));
2630
         SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(ui.preheat_bed_temp[i]));
2579
         SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(ui.preheat_bed_temp[i]));
2635
 
2584
 
2636
     #if HAS_PID_HEATING
2585
     #if HAS_PID_HEATING
2637
 
2586
 
2638
-      if (!forReplay) {
2639
-        CONFIG_ECHO_START;
2640
-        SERIAL_ECHOLNPGM_P(port, "PID settings:");
2641
-      }
2587
+      CONFIG_ECHO_HEADING("PID settings:");
2642
       #if ENABLED(PIDTEMP)
2588
       #if ENABLED(PIDTEMP)
2643
         #if HOTENDS > 1
2589
         #if HOTENDS > 1
2644
           if (forReplay) {
2590
           if (forReplay) {
2645
             HOTEND_LOOP() {
2591
             HOTEND_LOOP() {
2646
-              CONFIG_ECHO_START;
2592
+              CONFIG_ECHO_START();
2647
               SERIAL_ECHOPAIR_P(port, "  M301 E", e);
2593
               SERIAL_ECHOPAIR_P(port, "  M301 E", e);
2648
               SERIAL_ECHOPAIR_P(port, " P", PID_PARAM(Kp, e));
2594
               SERIAL_ECHOPAIR_P(port, " P", PID_PARAM(Kp, e));
2649
               SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, e)));
2595
               SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, e)));
2659
         #endif // HOTENDS > 1
2605
         #endif // HOTENDS > 1
2660
         // !forReplay || HOTENDS == 1
2606
         // !forReplay || HOTENDS == 1
2661
         {
2607
         {
2662
-          CONFIG_ECHO_START;
2608
+          CONFIG_ECHO_START();
2663
           SERIAL_ECHOPAIR_P(port, "  M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
2609
           SERIAL_ECHOPAIR_P(port, "  M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
2664
           SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, 0)));
2610
           SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, 0)));
2665
           SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, 0)));
2611
           SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, 0)));
2672
       #endif // PIDTEMP
2618
       #endif // PIDTEMP
2673
 
2619
 
2674
       #if ENABLED(PIDTEMPBED)
2620
       #if ENABLED(PIDTEMPBED)
2675
-        CONFIG_ECHO_START;
2621
+        CONFIG_ECHO_START();
2676
         SERIAL_ECHOPAIR_P(port, "  M304 P", thermalManager.bed_pid.Kp);
2622
         SERIAL_ECHOPAIR_P(port, "  M304 P", thermalManager.bed_pid.Kp);
2677
         SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bed_pid.Ki));
2623
         SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bed_pid.Ki));
2678
         SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bed_pid.Kd));
2624
         SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bed_pid.Kd));
2682
     #endif // PIDTEMP || PIDTEMPBED
2628
     #endif // PIDTEMP || PIDTEMPBED
2683
 
2629
 
2684
     #if HAS_LCD_CONTRAST
2630
     #if HAS_LCD_CONTRAST
2685
-      if (!forReplay) {
2686
-        CONFIG_ECHO_START;
2687
-        SERIAL_ECHOLNPGM_P(port, "LCD Contrast:");
2688
-      }
2689
-      CONFIG_ECHO_START;
2631
+      CONFIG_ECHO_HEADING("LCD Contrast:");
2632
+      CONFIG_ECHO_START();
2690
       SERIAL_ECHOLNPAIR_P(port, "  M250 C", ui.contrast);
2633
       SERIAL_ECHOLNPAIR_P(port, "  M250 C", ui.contrast);
2691
     #endif
2634
     #endif
2692
 
2635
 
2693
     #if ENABLED(POWER_LOSS_RECOVERY)
2636
     #if ENABLED(POWER_LOSS_RECOVERY)
2694
-      if (!forReplay) {
2695
-        CONFIG_ECHO_START;
2696
-        SERIAL_ECHOLNPGM_P(port, "Power-Loss Recovery:");
2697
-      }
2698
-      CONFIG_ECHO_START;
2637
+      CONFIG_ECHO_HEADING("Power-Loss Recovery:");
2638
+      CONFIG_ECHO_START();
2699
       SERIAL_ECHOLNPAIR_P(port, "  M413 S", int(recovery.enabled));
2639
       SERIAL_ECHOLNPAIR_P(port, "  M413 S", int(recovery.enabled));
2700
     #endif
2640
     #endif
2701
 
2641
 
2702
     #if ENABLED(FWRETRACT)
2642
     #if ENABLED(FWRETRACT)
2703
 
2643
 
2704
-      if (!forReplay) {
2705
-        CONFIG_ECHO_START;
2706
-        SERIAL_ECHOLNPGM_P(port, "Retract: S<length> F<units/m> Z<lift>");
2707
-      }
2708
-      CONFIG_ECHO_START;
2644
+      CONFIG_ECHO_HEADING("Retract: S<length> F<units/m> Z<lift>");
2645
+      CONFIG_ECHO_START();
2709
       SERIAL_ECHOPAIR_P(port, "  M207 S", LINEAR_UNIT(fwretract.settings.retract_length));
2646
       SERIAL_ECHOPAIR_P(port, "  M207 S", LINEAR_UNIT(fwretract.settings.retract_length));
2710
       SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_length));
2647
       SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_length));
2711
       SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s)));
2648
       SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s)));
2712
       SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.settings.retract_zraise));
2649
       SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.settings.retract_zraise));
2713
 
2650
 
2714
-      if (!forReplay) {
2715
-        CONFIG_ECHO_START;
2716
-        SERIAL_ECHOLNPGM_P(port, "Recover: S<length> F<units/m>");
2717
-      }
2718
-      CONFIG_ECHO_START;
2651
+      CONFIG_ECHO_HEADING("Recover: S<length> F<units/m>");
2652
+      CONFIG_ECHO_START();
2719
       SERIAL_ECHOPAIR_P(port, "  M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_length));
2653
       SERIAL_ECHOPAIR_P(port, "  M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_length));
2720
       SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_length));
2654
       SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_length));
2721
       SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s)));
2655
       SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s)));
2722
 
2656
 
2723
       #if ENABLED(FWRETRACT_AUTORETRACT)
2657
       #if ENABLED(FWRETRACT_AUTORETRACT)
2724
 
2658
 
2725
-        if (!forReplay) {
2726
-          CONFIG_ECHO_START;
2727
-          SERIAL_ECHOLNPGM_P(port, "Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
2728
-        }
2729
-        CONFIG_ECHO_START;
2659
+        CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
2660
+        CONFIG_ECHO_START();
2730
         SERIAL_ECHOLNPAIR_P(port, "  M209 S", fwretract.autoretract_enabled ? 1 : 0);
2661
         SERIAL_ECHOLNPAIR_P(port, "  M209 S", fwretract.autoretract_enabled ? 1 : 0);
2731
 
2662
 
2732
       #endif // FWRETRACT_AUTORETRACT
2663
       #endif // FWRETRACT_AUTORETRACT
2738
      */
2669
      */
2739
     #if HAS_BED_PROBE
2670
     #if HAS_BED_PROBE
2740
       if (!forReplay) {
2671
       if (!forReplay) {
2741
-        CONFIG_ECHO_START;
2672
+        CONFIG_ECHO_START();
2742
         SERIAL_ECHOPGM_P(port, "Z-Probe Offset");
2673
         SERIAL_ECHOPGM_P(port, "Z-Probe Offset");
2743
         SAY_UNITS_P(port, true);
2674
         SAY_UNITS_P(port, true);
2744
       }
2675
       }
2745
-      CONFIG_ECHO_START;
2676
+      CONFIG_ECHO_START();
2746
       SERIAL_ECHOLNPAIR_P(port, "  M851 Z", LINEAR_UNIT(zprobe_zoffset));
2677
       SERIAL_ECHOLNPAIR_P(port, "  M851 Z", LINEAR_UNIT(zprobe_zoffset));
2747
     #endif
2678
     #endif
2748
 
2679
 
2750
      * Bed Skew Correction
2681
      * Bed Skew Correction
2751
      */
2682
      */
2752
     #if ENABLED(SKEW_CORRECTION_GCODE)
2683
     #if ENABLED(SKEW_CORRECTION_GCODE)
2753
-      if (!forReplay) {
2754
-        CONFIG_ECHO_START;
2755
-        SERIAL_ECHOLNPGM_P(port, "Skew Factor: ");
2756
-      }
2757
-      CONFIG_ECHO_START;
2684
+      CONFIG_ECHO_HEADING("Skew Factor: ");
2685
+      CONFIG_ECHO_START();
2758
       #if ENABLED(SKEW_CORRECTION_FOR_Z)
2686
       #if ENABLED(SKEW_CORRECTION_FOR_Z)
2759
-        SERIAL_ECHOPGM_P(port, "  M852 I");
2760
-        SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6);
2761
-        SERIAL_ECHOPGM_P(port, " J");
2762
-        SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xz), 6);
2763
-        SERIAL_ECHOPGM_P(port, " K");
2764
-        SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.yz), 6);
2765
-        SERIAL_EOL_P(port);
2687
+        SERIAL_ECHOPAIR_F_P(port, "  M852 I", LINEAR_UNIT(planner.skew_factor.xy), 6);
2688
+        SERIAL_ECHOPAIR_F_P(port, " J", LINEAR_UNIT(planner.skew_factor.xz), 6);
2689
+        SERIAL_ECHOLNPAIR_F_P(port, " K", LINEAR_UNIT(planner.skew_factor.yz), 6);
2766
       #else
2690
       #else
2767
-        SERIAL_ECHOPGM_P(port, "  M852 S");
2768
-        SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6);
2769
-        SERIAL_EOL_P(port);
2691
+        SERIAL_ECHOLNPAIR_F_P(port, "  M852 S", LINEAR_UNIT(planner.skew_factor.xy), 6);
2770
       #endif
2692
       #endif
2771
     #endif
2693
     #endif
2772
 
2694
 
2775
       /**
2697
       /**
2776
        * TMC stepper driver current
2698
        * TMC stepper driver current
2777
        */
2699
        */
2778
-      if (!forReplay) {
2779
-        CONFIG_ECHO_START;
2780
-        SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
2781
-      }
2782
-      CONFIG_ECHO_START;
2700
+      CONFIG_ECHO_HEADING("Stepper driver current:");
2701
+      CONFIG_ECHO_START();
2783
       #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
2702
       #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
2784
         say_M906(PORTVAR_SOLO);
2703
         say_M906(PORTVAR_SOLO);
2785
       #endif
2704
       #endif
2848
        * TMC Hybrid Threshold
2767
        * TMC Hybrid Threshold
2849
        */
2768
        */
2850
       #if ENABLED(HYBRID_THRESHOLD)
2769
       #if ENABLED(HYBRID_THRESHOLD)
2851
-        if (!forReplay) {
2852
-          CONFIG_ECHO_START;
2853
-          SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:");
2854
-        }
2855
-        CONFIG_ECHO_START;
2770
+        CONFIG_ECHO_HEADING("Hybrid Threshold:");
2771
+        CONFIG_ECHO_START();
2856
         #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z)
2772
         #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z)
2857
           say_M913(PORTVAR_SOLO);
2773
           say_M913(PORTVAR_SOLO);
2858
         #endif
2774
         #endif
2923
        * TMC Sensorless homing thresholds
2839
        * TMC Sensorless homing thresholds
2924
        */
2840
        */
2925
       #if USE_SENSORLESS
2841
       #if USE_SENSORLESS
2926
-        if (!forReplay) {
2927
-          CONFIG_ECHO_START;
2928
-          SERIAL_ECHOLNPGM_P(port, "TMC2130 StallGuard threshold:");
2929
-        }
2930
-        CONFIG_ECHO_START;
2842
+        CONFIG_ECHO_HEADING("TMC2130 StallGuard threshold:");
2843
+        CONFIG_ECHO_START();
2931
         #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
2844
         #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
2932
           say_M914(PORTVAR_SOLO);
2845
           say_M914(PORTVAR_SOLO);
2933
           #if X_SENSORLESS
2846
           #if X_SENSORLESS
2975
      * Linear Advance
2888
      * Linear Advance
2976
      */
2889
      */
2977
     #if ENABLED(LIN_ADVANCE)
2890
     #if ENABLED(LIN_ADVANCE)
2978
-      if (!forReplay) {
2979
-        CONFIG_ECHO_START;
2980
-        SERIAL_ECHOLNPGM_P(port, "Linear Advance:");
2981
-      }
2982
-
2983
-      CONFIG_ECHO_START;
2891
+      CONFIG_ECHO_HEADING("Linear Advance:");
2892
+      CONFIG_ECHO_START();
2984
       #if EXTRUDERS < 2
2893
       #if EXTRUDERS < 2
2985
         SERIAL_ECHOLNPAIR_P(port, "  M900 K", planner.extruder_advance_K[0]);
2894
         SERIAL_ECHOLNPAIR_P(port, "  M900 K", planner.extruder_advance_K[0]);
2986
       #else
2895
       #else
2992
     #endif
2901
     #endif
2993
 
2902
 
2994
     #if HAS_MOTOR_CURRENT_PWM
2903
     #if HAS_MOTOR_CURRENT_PWM
2995
-      CONFIG_ECHO_START;
2996
-      if (!forReplay) {
2997
-        SERIAL_ECHOLNPGM_P(port, "Stepper motor currents:");
2998
-        CONFIG_ECHO_START;
2999
-      }
2904
+      CONFIG_ECHO_HEADING("Stepper motor currents:");
2905
+      CONFIG_ECHO_START();
3000
       SERIAL_ECHOPAIR_P(port, "  M907 X", stepper.motor_current_setting[0]);
2906
       SERIAL_ECHOPAIR_P(port, "  M907 X", stepper.motor_current_setting[0]);
3001
       SERIAL_ECHOPAIR_P(port, " Z", stepper.motor_current_setting[1]);
2907
       SERIAL_ECHOPAIR_P(port, " Z", stepper.motor_current_setting[1]);
3002
       SERIAL_ECHOPAIR_P(port, " E", stepper.motor_current_setting[2]);
2908
       SERIAL_ECHOPAIR_P(port, " E", stepper.motor_current_setting[2]);
3007
      * Advanced Pause filament load & unload lengths
2913
      * Advanced Pause filament load & unload lengths
3008
      */
2914
      */
3009
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
2915
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
3010
-      if (!forReplay) {
3011
-        CONFIG_ECHO_START;
3012
-        SERIAL_ECHOLNPGM_P(port, "Filament load/unload lengths:");
3013
-      }
3014
-      CONFIG_ECHO_START;
2916
+      CONFIG_ECHO_HEADING("Filament load/unload lengths:");
2917
+      CONFIG_ECHO_START();
3015
       #if EXTRUDERS == 1
2918
       #if EXTRUDERS == 1
3016
         say_M603(PORTVAR_SOLO);
2919
         say_M603(PORTVAR_SOLO);
3017
         SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(fc_settings[0].load_length));
2920
         SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(fc_settings[0].load_length));
3020
         say_M603(PORTVAR_SOLO);
2923
         say_M603(PORTVAR_SOLO);
3021
         SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(fc_settings[0].load_length));
2924
         SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(fc_settings[0].load_length));
3022
         SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[0].unload_length));
2925
         SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[0].unload_length));
3023
-        CONFIG_ECHO_START;
2926
+        CONFIG_ECHO_START();
3024
         say_M603(PORTVAR_SOLO);
2927
         say_M603(PORTVAR_SOLO);
3025
         SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(fc_settings[1].load_length));
2928
         SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(fc_settings[1].load_length));
3026
         SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[1].unload_length));
2929
         SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[1].unload_length));
3027
         #if EXTRUDERS > 2
2930
         #if EXTRUDERS > 2
3028
-          CONFIG_ECHO_START;
2931
+          CONFIG_ECHO_START();
3029
           say_M603(PORTVAR_SOLO);
2932
           say_M603(PORTVAR_SOLO);
3030
           SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(fc_settings[2].load_length));
2933
           SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(fc_settings[2].load_length));
3031
           SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[2].unload_length));
2934
           SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[2].unload_length));
3032
           #if EXTRUDERS > 3
2935
           #if EXTRUDERS > 3
3033
-            CONFIG_ECHO_START;
2936
+            CONFIG_ECHO_START();
3034
             say_M603(PORTVAR_SOLO);
2937
             say_M603(PORTVAR_SOLO);
3035
             SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(fc_settings[3].load_length));
2938
             SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(fc_settings[3].load_length));
3036
             SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[3].unload_length));
2939
             SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[3].unload_length));
3037
             #if EXTRUDERS > 4
2940
             #if EXTRUDERS > 4
3038
-              CONFIG_ECHO_START;
2941
+              CONFIG_ECHO_START();
3039
               say_M603(PORTVAR_SOLO);
2942
               say_M603(PORTVAR_SOLO);
3040
               SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(fc_settings[4].load_length));
2943
               SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(fc_settings[4].load_length));
3041
               SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[4].unload_length));
2944
               SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[4].unload_length));
3042
               #if EXTRUDERS > 5
2945
               #if EXTRUDERS > 5
3043
-                CONFIG_ECHO_START;
2946
+                CONFIG_ECHO_START();
3044
                 say_M603(PORTVAR_SOLO);
2947
                 say_M603(PORTVAR_SOLO);
3045
                 SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(fc_settings[5].load_length));
2948
                 SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(fc_settings[5].load_length));
3046
                 SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[5].unload_length));
2949
                 SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[5].unload_length));
3052
     #endif // ADVANCED_PAUSE_FEATURE
2955
     #endif // ADVANCED_PAUSE_FEATURE
3053
 
2956
 
3054
     #if EXTRUDERS > 1
2957
     #if EXTRUDERS > 1
3055
-      CONFIG_ECHO_START;
3056
-      if (!forReplay) {
3057
-        SERIAL_ECHOLNPGM_P(port, "Tool-changing:");
3058
-        CONFIG_ECHO_START;
3059
-      }
2958
+      CONFIG_ECHO_HEADING("Tool-changing:");
2959
+      CONFIG_ECHO_START();
3060
       M217_report(true);
2960
       M217_report(true);
3061
     #endif
2961
     #endif
3062
   }
2962
   }

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

365
 
365
 
366
 static void print_es_state(const bool is_hit, PGM_P const label=NULL) {
366
 static void print_es_state(const bool is_hit, PGM_P const label=NULL) {
367
   if (label) serialprintPGM(label);
367
   if (label) serialprintPGM(label);
368
-  SERIAL_PROTOCOLPGM(": ");
368
+  SERIAL_ECHOPGM(": ");
369
   serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));
369
   serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));
370
   SERIAL_EOL();
370
   SERIAL_EOL();
371
 }
371
 }
372
 
372
 
373
 void _O2 Endstops::M119() {
373
 void _O2 Endstops::M119() {
374
-  SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT);
374
+  SERIAL_ECHOLNPGM(MSG_M119_REPORT);
375
   #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S))
375
   #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S))
376
   #if HAS_X_MIN
376
   #if HAS_X_MIN
377
     ES_REPORT(X_MIN);
377
     ES_REPORT(X_MIN);
441
             #endif
441
             #endif
442
           #endif
442
           #endif
443
         }
443
         }
444
-        SERIAL_PROTOCOLPGM(MSG_FILAMENT_RUNOUT_SENSOR);
444
+        SERIAL_ECHOPGM(MSG_FILAMENT_RUNOUT_SENSOR);
445
         if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); }
445
         if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); }
446
         print_es_state(digitalRead(pin) != FIL_RUNOUT_INVERTING);
446
         print_es_state(digitalRead(pin) != FIL_RUNOUT_INVERTING);
447
       }
447
       }
825
 
825
 
826
     if (endstop_change) {
826
     if (endstop_change) {
827
       #if HAS_X_MIN
827
       #if HAS_X_MIN
828
-        if (TEST(endstop_change, X_MIN)) SERIAL_PROTOCOLPAIR("  X_MIN:", TEST(live_state_local, X_MIN));
828
+        if (TEST(endstop_change, X_MIN)) SERIAL_ECHOPAIR("  X_MIN:", TEST(live_state_local, X_MIN));
829
       #endif
829
       #endif
830
       #if HAS_X_MAX
830
       #if HAS_X_MAX
831
-        if (TEST(endstop_change, X_MAX)) SERIAL_PROTOCOLPAIR("  X_MAX:", TEST(live_state_local, X_MAX));
831
+        if (TEST(endstop_change, X_MAX)) SERIAL_ECHOPAIR("  X_MAX:", TEST(live_state_local, X_MAX));
832
       #endif
832
       #endif
833
       #if HAS_Y_MIN
833
       #if HAS_Y_MIN
834
-        if (TEST(endstop_change, Y_MIN)) SERIAL_PROTOCOLPAIR("  Y_MIN:", TEST(live_state_local, Y_MIN));
834
+        if (TEST(endstop_change, Y_MIN)) SERIAL_ECHOPAIR("  Y_MIN:", TEST(live_state_local, Y_MIN));
835
       #endif
835
       #endif
836
       #if HAS_Y_MAX
836
       #if HAS_Y_MAX
837
-        if (TEST(endstop_change, Y_MAX)) SERIAL_PROTOCOLPAIR("  Y_MAX:", TEST(live_state_local, Y_MAX));
837
+        if (TEST(endstop_change, Y_MAX)) SERIAL_ECHOPAIR("  Y_MAX:", TEST(live_state_local, Y_MAX));
838
       #endif
838
       #endif
839
       #if HAS_Z_MIN
839
       #if HAS_Z_MIN
840
-        if (TEST(endstop_change, Z_MIN)) SERIAL_PROTOCOLPAIR("  Z_MIN:", TEST(live_state_local, Z_MIN));
840
+        if (TEST(endstop_change, Z_MIN)) SERIAL_ECHOPAIR("  Z_MIN:", TEST(live_state_local, Z_MIN));
841
       #endif
841
       #endif
842
       #if HAS_Z_MAX
842
       #if HAS_Z_MAX
843
-        if (TEST(endstop_change, Z_MAX)) SERIAL_PROTOCOLPAIR("  Z_MAX:", TEST(live_state_local, Z_MAX));
843
+        if (TEST(endstop_change, Z_MAX)) SERIAL_ECHOPAIR("  Z_MAX:", TEST(live_state_local, Z_MAX));
844
       #endif
844
       #endif
845
       #if HAS_Z_MIN_PROBE_PIN
845
       #if HAS_Z_MIN_PROBE_PIN
846
-        if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR("  PROBE:", TEST(live_state_local, Z_MIN_PROBE));
846
+        if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_ECHOPAIR("  PROBE:", TEST(live_state_local, Z_MIN_PROBE));
847
       #endif
847
       #endif
848
       #if HAS_X2_MIN
848
       #if HAS_X2_MIN
849
-        if (TEST(endstop_change, X2_MIN)) SERIAL_PROTOCOLPAIR("  X2_MIN:", TEST(live_state_local, X2_MIN));
849
+        if (TEST(endstop_change, X2_MIN)) SERIAL_ECHOPAIR("  X2_MIN:", TEST(live_state_local, X2_MIN));
850
       #endif
850
       #endif
851
       #if HAS_X2_MAX
851
       #if HAS_X2_MAX
852
-        if (TEST(endstop_change, X2_MAX)) SERIAL_PROTOCOLPAIR("  X2_MAX:", TEST(live_state_local, X2_MAX));
852
+        if (TEST(endstop_change, X2_MAX)) SERIAL_ECHOPAIR("  X2_MAX:", TEST(live_state_local, X2_MAX));
853
       #endif
853
       #endif
854
       #if HAS_Y2_MIN
854
       #if HAS_Y2_MIN
855
-        if (TEST(endstop_change, Y2_MIN)) SERIAL_PROTOCOLPAIR("  Y2_MIN:", TEST(live_state_local, Y2_MIN));
855
+        if (TEST(endstop_change, Y2_MIN)) SERIAL_ECHOPAIR("  Y2_MIN:", TEST(live_state_local, Y2_MIN));
856
       #endif
856
       #endif
857
       #if HAS_Y2_MAX
857
       #if HAS_Y2_MAX
858
-        if (TEST(endstop_change, Y2_MAX)) SERIAL_PROTOCOLPAIR("  Y2_MAX:", TEST(live_state_local, Y2_MAX));
858
+        if (TEST(endstop_change, Y2_MAX)) SERIAL_ECHOPAIR("  Y2_MAX:", TEST(live_state_local, Y2_MAX));
859
       #endif
859
       #endif
860
       #if HAS_Z2_MIN
860
       #if HAS_Z2_MIN
861
-        if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR("  Z2_MIN:", TEST(live_state_local, Z2_MIN));
861
+        if (TEST(endstop_change, Z2_MIN)) SERIAL_ECHOPAIR("  Z2_MIN:", TEST(live_state_local, Z2_MIN));
862
       #endif
862
       #endif
863
       #if HAS_Z2_MAX
863
       #if HAS_Z2_MAX
864
-        if (TEST(endstop_change, Z2_MAX)) SERIAL_PROTOCOLPAIR("  Z2_MAX:", TEST(live_state_local, Z2_MAX));
864
+        if (TEST(endstop_change, Z2_MAX)) SERIAL_ECHOPAIR("  Z2_MAX:", TEST(live_state_local, Z2_MAX));
865
       #endif
865
       #endif
866
       #if HAS_Z3_MIN
866
       #if HAS_Z3_MIN
867
-        if (TEST(endstop_change, Z3_MIN)) SERIAL_PROTOCOLPAIR("  Z3_MIN:", TEST(live_state_local, Z3_MIN));
867
+        if (TEST(endstop_change, Z3_MIN)) SERIAL_ECHOPAIR("  Z3_MIN:", TEST(live_state_local, Z3_MIN));
868
       #endif
868
       #endif
869
       #if HAS_Z3_MAX
869
       #if HAS_Z3_MAX
870
-        if (TEST(endstop_change, Z3_MAX)) SERIAL_PROTOCOLPAIR("  Z3_MAX:", TEST(live_state_local, Z3_MAX));
870
+        if (TEST(endstop_change, Z3_MAX)) SERIAL_ECHOPAIR("  Z3_MAX:", TEST(live_state_local, Z3_MAX));
871
       #endif
871
       #endif
872
-      SERIAL_PROTOCOLPGM("\n\n");
872
+      SERIAL_ECHOPGM("\n\n");
873
       analogWrite(LED_PIN, local_LED_status);
873
       analogWrite(LED_PIN, local_LED_status);
874
       local_LED_status ^= 255;
874
       local_LED_status ^= 255;
875
       old_live_state_local = live_state_local;
875
       old_live_state_local = live_state_local;

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

163
  * Output the current position to serial
163
  * Output the current position to serial
164
  */
164
  */
165
 void report_current_position() {
165
 void report_current_position() {
166
-  SERIAL_PROTOCOLPGM("X:");
167
-  SERIAL_PROTOCOL(LOGICAL_X_POSITION(current_position[X_AXIS]));
168
-  SERIAL_PROTOCOLPGM(" Y:");
169
-  SERIAL_PROTOCOL(LOGICAL_Y_POSITION(current_position[Y_AXIS]));
170
-  SERIAL_PROTOCOLPGM(" Z:");
171
-  SERIAL_PROTOCOL(LOGICAL_Z_POSITION(current_position[Z_AXIS]));
172
-  SERIAL_PROTOCOLPGM(" E:");
173
-  SERIAL_PROTOCOL(current_position[E_AXIS]);
166
+  SERIAL_ECHOPAIR("X:", LOGICAL_X_POSITION(current_position[X_AXIS]));
167
+  SERIAL_ECHOPAIR(" Y:", LOGICAL_Y_POSITION(current_position[Y_AXIS]));
168
+  SERIAL_ECHOPAIR(" Z:", LOGICAL_Z_POSITION(current_position[Z_AXIS]));
169
+  SERIAL_ECHOPAIR(" E:", current_position[E_AXIS]);
174
 
170
 
175
   stepper.report_positions();
171
   stepper.report_positions();
176
 
172
 
967
         #if ENABLED(PREVENT_COLD_EXTRUSION)
963
         #if ENABLED(PREVENT_COLD_EXTRUSION)
968
           if (thermalManager.tooColdToExtrude(active_extruder)) {
964
           if (thermalManager.tooColdToExtrude(active_extruder)) {
969
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
965
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
970
-            SERIAL_ECHO_START();
971
-            SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
966
+            SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
972
           }
967
           }
973
         #endif // PREVENT_COLD_EXTRUSION
968
         #endif // PREVENT_COLD_EXTRUSION
974
         #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
969
         #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
975
           if (ABS(destination[E_AXIS] - current_position[E_AXIS]) * planner.e_factor[active_extruder] > (EXTRUDE_MAXLENGTH)) {
970
           if (ABS(destination[E_AXIS] - current_position[E_AXIS]) * planner.e_factor[active_extruder] > (EXTRUDE_MAXLENGTH)) {
976
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
971
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
977
-            SERIAL_ECHO_START();
978
-            SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
972
+            SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
979
           }
973
           }
980
         #endif // PREVENT_LENGTHY_EXTRUDE
974
         #endif // PREVENT_LENGTHY_EXTRUDE
981
       }
975
       }
1046
   uint8_t hbd = pgm_read_byte(&homing_bump_divisor[axis]);
1040
   uint8_t hbd = pgm_read_byte(&homing_bump_divisor[axis]);
1047
   if (hbd < 1) {
1041
   if (hbd < 1) {
1048
     hbd = 10;
1042
     hbd = 10;
1049
-    SERIAL_ECHO_START();
1050
-    SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
1043
+    SERIAL_ECHO_MSG("Warning: Homing Bump Divisor < 1");
1051
   }
1044
   }
1052
   return homing_feedrate(axis) / hbd;
1045
   return homing_feedrate(axis) / hbd;
1053
 }
1046
 }

+ 2
- 4
Marlin/src/module/planner.cpp 查看文件

1661
             position_float[E_AXIS] = target_float[E_AXIS];
1661
             position_float[E_AXIS] = target_float[E_AXIS];
1662
           #endif
1662
           #endif
1663
           de = 0; // no difference
1663
           de = 0; // no difference
1664
-          SERIAL_ECHO_START();
1665
-          SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
1664
+          SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
1666
         }
1665
         }
1667
       #endif // PREVENT_COLD_EXTRUSION
1666
       #endif // PREVENT_COLD_EXTRUSION
1668
       #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
1667
       #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
1672
             position_float[E_AXIS] = target_float[E_AXIS];
1671
             position_float[E_AXIS] = target_float[E_AXIS];
1673
           #endif
1672
           #endif
1674
           de = 0; // no difference
1673
           de = 0; // no difference
1675
-          SERIAL_ECHO_START();
1676
-          SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
1674
+          SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
1677
         }
1675
         }
1678
       #endif // PREVENT_LENGTHY_EXTRUDE
1676
       #endif // PREVENT_LENGTHY_EXTRUDE
1679
     }
1677
     }

+ 3
- 3
Marlin/src/module/printcounter.cpp 查看文件

111
 void PrintCounter::showStats() {
111
 void PrintCounter::showStats() {
112
   char buffer[21];
112
   char buffer[21];
113
 
113
 
114
-  SERIAL_PROTOCOLPGM(MSG_STATS);
114
+  SERIAL_ECHOPGM(MSG_STATS);
115
 
115
 
116
   SERIAL_ECHOPGM("Prints: ");
116
   SERIAL_ECHOPGM("Prints: ");
117
   SERIAL_ECHO(data.totalPrints);
117
   SERIAL_ECHO(data.totalPrints);
124
     - ((isRunning() || isPaused()) ? 1 : 0));
124
     - ((isRunning() || isPaused()) ? 1 : 0));
125
 
125
 
126
   SERIAL_EOL();
126
   SERIAL_EOL();
127
-  SERIAL_PROTOCOLPGM(MSG_STATS);
127
+  SERIAL_ECHOPGM(MSG_STATS);
128
 
128
 
129
   duration_t elapsed = data.printTime;
129
   duration_t elapsed = data.printTime;
130
   elapsed.toString(buffer);
130
   elapsed.toString(buffer);
151
   #endif
151
   #endif
152
 
152
 
153
   SERIAL_EOL();
153
   SERIAL_EOL();
154
-  SERIAL_PROTOCOLPGM(MSG_STATS);
154
+  SERIAL_ECHOPGM(MSG_STATS);
155
 
155
 
156
   SERIAL_ECHOPGM("Filament used: ");
156
   SERIAL_ECHOPGM("Filament used: ");
157
   SERIAL_ECHO(data.filamentUsed / 1000);
157
   SERIAL_ECHO(data.filamentUsed / 1000);

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

320
                                          //  (Measured completion time was 0.65 seconds
320
                                          //  (Measured completion time was 0.65 seconds
321
                                          //   after reset, deploy, and stow sequence)
321
                                          //   after reset, deploy, and stow sequence)
322
       if (TEST_BLTOUCH()) {              // If it still claims to be triggered...
322
       if (TEST_BLTOUCH()) {              // If it still claims to be triggered...
323
-        SERIAL_ERROR_START();
324
-        SERIAL_ERRORLNPGM(MSG_STOP_BLTOUCH);
323
+        SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH);
325
         stop();                          // punt!
324
         stop();                          // punt!
326
         return true;
325
         return true;
327
       }
326
       }
450
       #define _AUE_ARGS
449
       #define _AUE_ARGS
451
     #endif
450
     #endif
452
     if (axis_unhomed_error(_AUE_ARGS)) {
451
     if (axis_unhomed_error(_AUE_ARGS)) {
453
-      SERIAL_ERROR_START();
454
-      SERIAL_ERRORLNPGM(MSG_STOP_UNHOMED);
452
+      SERIAL_ERROR_MSG(MSG_STOP_UNHOMED);
455
       stop();
453
       stop();
456
       return true;
454
       return true;
457
     }
455
     }
479
 
477
 
480
     if (PROBE_STOWED() == deploy) {                // Unchanged after deploy/stow action?
478
     if (PROBE_STOWED() == deploy) {                // Unchanged after deploy/stow action?
481
       if (IsRunning()) {
479
       if (IsRunning()) {
482
-        SERIAL_ERROR_START();
483
-        SERIAL_ERRORLNPGM("Z-Probe failed");
480
+        SERIAL_ERROR_MSG("Z-Probe failed");
484
         LCD_ALERTMESSAGEPGM("Err: ZPROBE");
481
         LCD_ALERTMESSAGEPGM("Err: ZPROBE");
485
       }
482
       }
486
       stop();
483
       stop();
771
   }
768
   }
772
 
769
 
773
   if (verbose_level > 2) {
770
   if (verbose_level > 2) {
774
-    SERIAL_PROTOCOLPGM("Bed X: ");
775
-    SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 3);
776
-    SERIAL_PROTOCOLPGM(" Y: ");
777
-    SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(ry), 3);
778
-    SERIAL_PROTOCOLPGM(" Z: ");
779
-    SERIAL_PROTOCOL_F(measured_z, 3);
780
-    SERIAL_EOL();
771
+    SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3);
772
+    SERIAL_ECHOPAIR_F(" Y: ", LOGICAL_Y_POSITION(ry), 3);
773
+    SERIAL_ECHOLNPAIR_F(" Z: ", measured_z, 3);
781
   }
774
   }
782
 
775
 
783
   feedrate_mm_s = old_feedrate_mm_s;
776
   feedrate_mm_s = old_feedrate_mm_s;
785
   if (isnan(measured_z)) {
778
   if (isnan(measured_z)) {
786
     STOW_PROBE();
779
     STOW_PROBE();
787
     LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED);
780
     LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED);
788
-    SERIAL_ERROR_START();
789
-    SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
781
+    SERIAL_ERROR_MSG(MSG_ERR_PROBING_FAILED);
790
   }
782
   }
791
 
783
 
792
   #if ENABLED(DEBUG_LEVELING_FEATURE)
784
   #if ENABLED(DEBUG_LEVELING_FEATURE)

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

142
 }
142
 }
143
 
143
 
144
 void scara_report_positions() {
144
 void scara_report_positions() {
145
-  SERIAL_PROTOCOLPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS));
146
-  SERIAL_PROTOCOLLNPAIR("   Psi+Theta:", planner.get_axis_position_degrees(B_AXIS));
145
+  SERIAL_ECHOPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS));
146
+  SERIAL_ECHOLNPAIR("   Psi+Theta:", planner.get_axis_position_degrees(B_AXIS));
147
   SERIAL_EOL();
147
   SERIAL_EOL();
148
 }
148
 }
149
 
149
 

+ 46
- 47
Marlin/src/module/stepper.cpp 查看文件

2218
   if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
2218
   if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
2219
 
2219
 
2220
   #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
2220
   #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
2221
-    SERIAL_PROTOCOLPGM(MSG_COUNT_A);
2221
+    SERIAL_ECHOPGM(MSG_COUNT_A);
2222
   #else
2222
   #else
2223
-    SERIAL_PROTOCOLPGM(MSG_COUNT_X);
2223
+    SERIAL_ECHOPGM(MSG_COUNT_X);
2224
   #endif
2224
   #endif
2225
-  SERIAL_PROTOCOL(xpos);
2225
+  SERIAL_ECHO(xpos);
2226
 
2226
 
2227
   #if CORE_IS_XY || CORE_IS_YZ || ENABLED(DELTA) || IS_SCARA
2227
   #if CORE_IS_XY || CORE_IS_YZ || ENABLED(DELTA) || IS_SCARA
2228
-    SERIAL_PROTOCOLPGM(" B:");
2228
+    SERIAL_ECHOPGM(" B:");
2229
   #else
2229
   #else
2230
-    SERIAL_PROTOCOLPGM(" Y:");
2230
+    SERIAL_ECHOPGM(" Y:");
2231
   #endif
2231
   #endif
2232
-  SERIAL_PROTOCOL(ypos);
2232
+  SERIAL_ECHO(ypos);
2233
 
2233
 
2234
   #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
2234
   #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
2235
-    SERIAL_PROTOCOLPGM(" C:");
2235
+    SERIAL_ECHOPGM(" C:");
2236
   #else
2236
   #else
2237
-    SERIAL_PROTOCOLPGM(" Z:");
2237
+    SERIAL_ECHOPGM(" Z:");
2238
   #endif
2238
   #endif
2239
-  SERIAL_PROTOCOL(zpos);
2239
+  SERIAL_ECHO(zpos);
2240
 
2240
 
2241
   SERIAL_EOL();
2241
   SERIAL_EOL();
2242
 }
2242
 }
2813
         case 128: microstep_ms(driver, MICROSTEP128); break;
2813
         case 128: microstep_ms(driver, MICROSTEP128); break;
2814
       #endif
2814
       #endif
2815
 
2815
 
2816
-      default: SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Microsteps unavailable"); break;
2816
+      default: SERIAL_ERROR_MSG("Microsteps unavailable"); break;
2817
     }
2817
     }
2818
   }
2818
   }
2819
 
2819
 
2820
   void Stepper::microstep_readings() {
2820
   void Stepper::microstep_readings() {
2821
-    SERIAL_PROTOCOLLNPGM("MS1,MS2,MS3 Pins");
2822
-    SERIAL_PROTOCOLPGM("X: ");
2821
+    SERIAL_ECHOPGM("MS1,MS2,MS3 Pins\nX: ");
2823
     #if HAS_X_MICROSTEPS
2822
     #if HAS_X_MICROSTEPS
2824
-      SERIAL_PROTOCOL(READ(X_MS1_PIN));
2825
-      SERIAL_PROTOCOL(READ(X_MS2_PIN));
2823
+      SERIAL_ECHO(READ(X_MS1_PIN));
2824
+      SERIAL_ECHO(READ(X_MS2_PIN));
2826
       #if PIN_EXISTS(X_MS3)
2825
       #if PIN_EXISTS(X_MS3)
2827
-        SERIAL_PROTOCOLLN(READ(X_MS3_PIN));
2826
+        SERIAL_ECHOLN(READ(X_MS3_PIN));
2828
       #endif
2827
       #endif
2829
     #endif
2828
     #endif
2830
     #if HAS_Y_MICROSTEPS
2829
     #if HAS_Y_MICROSTEPS
2831
-      SERIAL_PROTOCOLPGM("Y: ");
2832
-      SERIAL_PROTOCOL(READ(Y_MS1_PIN));
2833
-      SERIAL_PROTOCOL(READ(Y_MS2_PIN));
2830
+      SERIAL_ECHOPGM("Y: ");
2831
+      SERIAL_ECHO(READ(Y_MS1_PIN));
2832
+      SERIAL_ECHO(READ(Y_MS2_PIN));
2834
       #if PIN_EXISTS(Y_MS3)
2833
       #if PIN_EXISTS(Y_MS3)
2835
-        SERIAL_PROTOCOLLN(READ(Y_MS3_PIN));
2834
+        SERIAL_ECHOLN(READ(Y_MS3_PIN));
2836
       #endif
2835
       #endif
2837
     #endif
2836
     #endif
2838
     #if HAS_Z_MICROSTEPS
2837
     #if HAS_Z_MICROSTEPS
2839
-      SERIAL_PROTOCOLPGM("Z: ");
2840
-      SERIAL_PROTOCOL(READ(Z_MS1_PIN));
2841
-      SERIAL_PROTOCOL(READ(Z_MS2_PIN));
2838
+      SERIAL_ECHOPGM("Z: ");
2839
+      SERIAL_ECHO(READ(Z_MS1_PIN));
2840
+      SERIAL_ECHO(READ(Z_MS2_PIN));
2842
       #if PIN_EXISTS(Z_MS3)
2841
       #if PIN_EXISTS(Z_MS3)
2843
-        SERIAL_PROTOCOLLN(READ(Z_MS3_PIN));
2842
+        SERIAL_ECHOLN(READ(Z_MS3_PIN));
2844
       #endif
2843
       #endif
2845
     #endif
2844
     #endif
2846
     #if HAS_E0_MICROSTEPS
2845
     #if HAS_E0_MICROSTEPS
2847
-      SERIAL_PROTOCOLPGM("E0: ");
2848
-      SERIAL_PROTOCOL(READ(E0_MS1_PIN));
2849
-      SERIAL_PROTOCOL(READ(E0_MS2_PIN));
2846
+      SERIAL_ECHOPGM("E0: ");
2847
+      SERIAL_ECHO(READ(E0_MS1_PIN));
2848
+      SERIAL_ECHO(READ(E0_MS2_PIN));
2850
       #if PIN_EXISTS(E0_MS3)
2849
       #if PIN_EXISTS(E0_MS3)
2851
-        SERIAL_PROTOCOLLN(READ(E0_MS3_PIN));
2850
+        SERIAL_ECHOLN(READ(E0_MS3_PIN));
2852
       #endif
2851
       #endif
2853
     #endif
2852
     #endif
2854
     #if HAS_E1_MICROSTEPS
2853
     #if HAS_E1_MICROSTEPS
2855
-      SERIAL_PROTOCOLPGM("E1: ");
2856
-      SERIAL_PROTOCOL(READ(E1_MS1_PIN));
2857
-      SERIAL_PROTOCOL(READ(E1_MS2_PIN));
2854
+      SERIAL_ECHOPGM("E1: ");
2855
+      SERIAL_ECHO(READ(E1_MS1_PIN));
2856
+      SERIAL_ECHO(READ(E1_MS2_PIN));
2858
       #if PIN_EXISTS(E1_MS3)
2857
       #if PIN_EXISTS(E1_MS3)
2859
-        SERIAL_PROTOCOLLN(READ(E1_MS3_PIN));
2858
+        SERIAL_ECHOLN(READ(E1_MS3_PIN));
2860
       #endif
2859
       #endif
2861
     #endif
2860
     #endif
2862
     #if HAS_E2_MICROSTEPS
2861
     #if HAS_E2_MICROSTEPS
2863
-      SERIAL_PROTOCOLPGM("E2: ");
2864
-      SERIAL_PROTOCOL(READ(E2_MS1_PIN));
2865
-      SERIAL_PROTOCOL(READ(E2_MS2_PIN));
2862
+      SERIAL_ECHOPGM("E2: ");
2863
+      SERIAL_ECHO(READ(E2_MS1_PIN));
2864
+      SERIAL_ECHO(READ(E2_MS2_PIN));
2866
       #if PIN_EXISTS(E2_MS3)
2865
       #if PIN_EXISTS(E2_MS3)
2867
-        SERIAL_PROTOCOLLN(READ(E2_MS3_PIN));
2866
+        SERIAL_ECHOLN(READ(E2_MS3_PIN));
2868
       #endif
2867
       #endif
2869
     #endif
2868
     #endif
2870
     #if HAS_E3_MICROSTEPS
2869
     #if HAS_E3_MICROSTEPS
2871
-      SERIAL_PROTOCOLPGM("E3: ");
2872
-      SERIAL_PROTOCOL(READ(E3_MS1_PIN));
2873
-      SERIAL_PROTOCOL(READ(E3_MS2_PIN));
2870
+      SERIAL_ECHOPGM("E3: ");
2871
+      SERIAL_ECHO(READ(E3_MS1_PIN));
2872
+      SERIAL_ECHO(READ(E3_MS2_PIN));
2874
       #if PIN_EXISTS(E3_MS3)
2873
       #if PIN_EXISTS(E3_MS3)
2875
-        SERIAL_PROTOCOLLN(READ(E3_MS3_PIN));
2874
+        SERIAL_ECHOLN(READ(E3_MS3_PIN));
2876
       #endif
2875
       #endif
2877
     #endif
2876
     #endif
2878
     #if HAS_E4_MICROSTEPS
2877
     #if HAS_E4_MICROSTEPS
2879
-      SERIAL_PROTOCOLPGM("E4: ");
2880
-      SERIAL_PROTOCOL(READ(E4_MS1_PIN));
2881
-      SERIAL_PROTOCOL(READ(E4_MS2_PIN));
2878
+      SERIAL_ECHOPGM("E4: ");
2879
+      SERIAL_ECHO(READ(E4_MS1_PIN));
2880
+      SERIAL_ECHO(READ(E4_MS2_PIN));
2882
       #if PIN_EXISTS(E4_MS3)
2881
       #if PIN_EXISTS(E4_MS3)
2883
-        SERIAL_PROTOCOLLN(READ(E4_MS3_PIN));
2882
+        SERIAL_ECHOLN(READ(E4_MS3_PIN));
2884
       #endif
2883
       #endif
2885
     #endif
2884
     #endif
2886
     #if HAS_E5_MICROSTEPS
2885
     #if HAS_E5_MICROSTEPS
2887
-      SERIAL_PROTOCOLPGM("E5: ");
2888
-      SERIAL_PROTOCOL(READ(E5_MS1_PIN));
2889
-      SERIAL_PROTOCOLLN(READ(E5_MS2_PIN));
2886
+      SERIAL_ECHOPGM("E5: ");
2887
+      SERIAL_ECHO(READ(E5_MS1_PIN));
2888
+      SERIAL_ECHOLN(READ(E5_MS2_PIN));
2890
       #if PIN_EXISTS(E5_MS3)
2889
       #if PIN_EXISTS(E5_MS3)
2891
-        SERIAL_PROTOCOLLN(READ(E5_MS3_PIN));
2890
+        SERIAL_ECHOLN(READ(E5_MS3_PIN));
2892
       #endif
2891
       #endif
2893
     #endif
2892
     #endif
2894
   }
2893
   }

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

228
 
228
 
229
 #if HAS_PID_HEATING
229
 #if HAS_PID_HEATING
230
 
230
 
231
-  inline void say_default_() { SERIAL_PROTOCOLPGM("#define DEFAULT_"); }
231
+  inline void say_default_() { SERIAL_ECHOPGM("#define DEFAULT_"); }
232
 
232
 
233
   /**
233
   /**
234
    * PID Autotuning (M303)
234
    * PID Autotuning (M303)
343
               bias = constrain(bias, 20, max_pow - 20);
343
               bias = constrain(bias, 20, max_pow - 20);
344
               d = (bias > max_pow >> 1) ? max_pow - 1 - bias : bias;
344
               d = (bias > max_pow >> 1) ? max_pow - 1 - bias : bias;
345
 
345
 
346
-              SERIAL_PROTOCOLPAIR(MSG_BIAS, bias);
347
-              SERIAL_PROTOCOLPAIR(MSG_D, d);
348
-              SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
349
-              SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
346
+              SERIAL_ECHOPAIR(MSG_BIAS, bias);
347
+              SERIAL_ECHOPAIR(MSG_D, d);
348
+              SERIAL_ECHOPAIR(MSG_T_MIN, min);
349
+              SERIAL_ECHOPAIR(MSG_T_MAX, max);
350
               if (cycles > 2) {
350
               if (cycles > 2) {
351
                 float Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f),
351
                 float Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f),
352
                       Tu = ((float)(t_low + t_high) * 0.001f);
352
                       Tu = ((float)(t_low + t_high) * 0.001f);
353
-                SERIAL_PROTOCOLPAIR(MSG_KU, Ku);
354
-                SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
353
+                SERIAL_ECHOPAIR(MSG_KU, Ku);
354
+                SERIAL_ECHOPAIR(MSG_TU, Tu);
355
                 tune_pid.Kp = 0.6f * Ku;
355
                 tune_pid.Kp = 0.6f * Ku;
356
                 tune_pid.Ki = 2 * tune_pid.Kp / Tu;
356
                 tune_pid.Ki = 2 * tune_pid.Kp / Tu;
357
                 tune_pid.Kd = tune_pid.Kp * Tu * 0.125f;
357
                 tune_pid.Kd = tune_pid.Kp * Tu * 0.125f;
358
-                SERIAL_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID);
359
-                SERIAL_PROTOCOLPAIR(MSG_KP, tune_pid.Kp);
360
-                SERIAL_PROTOCOLPAIR(MSG_KI, tune_pid.Ki);
361
-                SERIAL_PROTOCOLLNPAIR(MSG_KD, tune_pid.Kd);
358
+                SERIAL_ECHOLNPGM("\n" MSG_CLASSIC_PID);
359
+                SERIAL_ECHOPAIR(MSG_KP, tune_pid.Kp);
360
+                SERIAL_ECHOPAIR(MSG_KI, tune_pid.Ki);
361
+                SERIAL_ECHOLNPAIR(MSG_KD, tune_pid.Kd);
362
                 /**
362
                 /**
363
                 tune_pid.Kp = 0.33*Ku;
363
                 tune_pid.Kp = 0.33*Ku;
364
                 tune_pid.Ki = tune_pid.Kp/Tu;
364
                 tune_pid.Ki = tune_pid.Kp/Tu;
365
                 tune_pid.Kd = tune_pid.Kp*Tu/3;
365
                 tune_pid.Kd = tune_pid.Kp*Tu/3;
366
-                SERIAL_PROTOCOLLNPGM(" Some overshoot");
367
-                SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp);
368
-                SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki);
369
-                SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd);
366
+                SERIAL_ECHOLNPGM(" Some overshoot");
367
+                SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
368
+                SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
369
+                SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
370
                 tune_pid.Kp = 0.2*Ku;
370
                 tune_pid.Kp = 0.2*Ku;
371
                 tune_pid.Ki = 2*tune_pid.Kp/Tu;
371
                 tune_pid.Ki = 2*tune_pid.Kp/Tu;
372
                 tune_pid.Kd = tune_pid.Kp*Tu/3;
372
                 tune_pid.Kd = tune_pid.Kp*Tu/3;
373
-                SERIAL_PROTOCOLLNPGM(" No overshoot");
374
-                SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp);
375
-                SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki);
376
-                SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd);
373
+                SERIAL_ECHOLNPGM(" No overshoot");
374
+                SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
375
+                SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
376
+                SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
377
                 */
377
                 */
378
               }
378
               }
379
             }
379
             }
389
         #define MAX_OVERSHOOT_PID_AUTOTUNE 20
389
         #define MAX_OVERSHOOT_PID_AUTOTUNE 20
390
       #endif
390
       #endif
391
       if (current > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
391
       if (current > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
392
-        SERIAL_PROTOCOLLNPGM(MSG_PID_TEMP_TOO_HIGH);
392
+        SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH);
393
         break;
393
         break;
394
       }
394
       }
395
 
395
 
432
         #define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
432
         #define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
433
       #endif
433
       #endif
434
       if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
434
       if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
435
-        SERIAL_PROTOCOLLNPGM(MSG_PID_TIMEOUT);
435
+        SERIAL_ECHOLNPGM(MSG_PID_TIMEOUT);
436
         break;
436
         break;
437
       }
437
       }
438
 
438
 
439
       if (cycles > ncycles) {
439
       if (cycles > ncycles) {
440
-        SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
440
+        SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED);
441
 
441
 
442
         #if HAS_PID_FOR_BOTH
442
         #if HAS_PID_FOR_BOTH
443
           const char * const estring = GHV(PSTR("bed"), PSTR(""));
443
           const char * const estring = GHV(PSTR("bed"), PSTR(""));
444
-          say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp);
445
-          say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki);
446
-          say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd);
444
+          say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp);
445
+          say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki);
446
+          say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd);
447
         #elif ENABLED(PIDTEMP)
447
         #elif ENABLED(PIDTEMP)
448
-          say_default_(); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp);
449
-          say_default_(); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki);
450
-          say_default_(); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd);
448
+          say_default_(); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp);
449
+          say_default_(); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki);
450
+          say_default_(); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd);
451
         #else
451
         #else
452
-          say_default_(); SERIAL_PROTOCOLLNPAIR("bedKp ", tune_pid.Kp);
453
-          say_default_(); SERIAL_PROTOCOLLNPAIR("bedKi ", tune_pid.Ki);
454
-          say_default_(); SERIAL_PROTOCOLLNPAIR("bedKd ", tune_pid.Kd);
452
+          say_default_(); SERIAL_ECHOLNPAIR("bedKp ", tune_pid.Kp);
453
+          say_default_(); SERIAL_ECHOLNPAIR("bedKi ", tune_pid.Ki);
454
+          say_default_(); SERIAL_ECHOLNPAIR("bedKd ", tune_pid.Kd);
455
         #endif
455
         #endif
456
 
456
 
457
         #define _SET_BED_PID() do { \
457
         #define _SET_BED_PID() do { \
564
   if (IsRunning()) {
564
   if (IsRunning()) {
565
     SERIAL_ERROR_START();
565
     SERIAL_ERROR_START();
566
     serialprintPGM(serial_msg);
566
     serialprintPGM(serial_msg);
567
-    SERIAL_ERRORPGM(MSG_STOPPED_HEATER);
568
-    if (heater >= 0) SERIAL_ERRORLN((int)heater); else SERIAL_ERRORLNPGM(MSG_HEATER_BED);
567
+    SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
568
+    if (heater >= 0) SERIAL_ECHOLN((int)heater); else SERIAL_ECHOLNPGM(MSG_HEATER_BED);
569
   }
569
   }
570
   #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
570
   #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
571
     if (!killed) {
571
     if (!killed) {
940
   #endif
940
   #endif
941
     {
941
     {
942
       SERIAL_ERROR_START();
942
       SERIAL_ERROR_START();
943
-      SERIAL_ERROR((int)e);
944
-      SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM);
943
+      SERIAL_ECHO((int)e);
944
+      SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER_NUM);
945
       kill();
945
       kill();
946
       return 0.0;
946
       return 0.0;
947
     }
947
     }
1684
 
1684
 
1685
     if (max6675_temp & MAX6675_ERROR_MASK) {
1685
     if (max6675_temp & MAX6675_ERROR_MASK) {
1686
       SERIAL_ERROR_START();
1686
       SERIAL_ERROR_START();
1687
-      SERIAL_ERRORPGM("Temp measurement error! ");
1687
+      SERIAL_ECHOPGM("Temp measurement error! ");
1688
       #if MAX6675_ERROR_MASK == 7
1688
       #if MAX6675_ERROR_MASK == 7
1689
-        SERIAL_ERRORPGM("MAX31855 ");
1689
+        SERIAL_ECHOPGM("MAX31855 ");
1690
         if (max6675_temp & 1)
1690
         if (max6675_temp & 1)
1691
-          SERIAL_ERRORLNPGM("Open Circuit");
1691
+          SERIAL_ECHOLNPGM("Open Circuit");
1692
         else if (max6675_temp & 2)
1692
         else if (max6675_temp & 2)
1693
-          SERIAL_ERRORLNPGM("Short to GND");
1693
+          SERIAL_ECHOLNPGM("Short to GND");
1694
         else if (max6675_temp & 4)
1694
         else if (max6675_temp & 4)
1695
-          SERIAL_ERRORLNPGM("Short to VCC");
1695
+          SERIAL_ECHOLNPGM("Short to VCC");
1696
       #else
1696
       #else
1697
-        SERIAL_ERRORLNPGM("MAX6675");
1697
+        SERIAL_ECHOLNPGM("MAX6675");
1698
       #endif
1698
       #endif
1699
 
1699
 
1700
       // Thermocouple open
1700
       // Thermocouple open
2365
       UNUSED(e);
2365
       UNUSED(e);
2366
     #endif
2366
     #endif
2367
 
2367
 
2368
-    SERIAL_PROTOCOLCHAR_P(port, ' ');
2369
-    SERIAL_PROTOCOLCHAR_P(port,
2368
+    SERIAL_CHAR_P(port, ' ');
2369
+    SERIAL_CHAR_P(port,
2370
       #if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
2370
       #if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
2371
         e == -2 ? 'C' : e == -1 ? 'B' : 'T'
2371
         e == -2 ? 'C' : e == -1 ? 'B' : 'T'
2372
       #elif HAS_HEATED_BED && HAS_TEMP_HOTEND
2372
       #elif HAS_HEATED_BED && HAS_TEMP_HOTEND
2378
       #endif
2378
       #endif
2379
     );
2379
     );
2380
     #if HOTENDS > 1
2380
     #if HOTENDS > 1
2381
-      if (e >= 0) SERIAL_PROTOCOLCHAR_P(port, '0' + e);
2381
+      if (e >= 0) SERIAL_CHAR_P(port, '0' + e);
2382
     #endif
2382
     #endif
2383
-    SERIAL_PROTOCOLCHAR_P(port, ':');
2384
-    SERIAL_PROTOCOL_P(port, c);
2385
-    SERIAL_PROTOCOLPAIR_P(port, " /" , t);
2383
+    SERIAL_CHAR_P(port, ':');
2384
+    SERIAL_ECHO_P(port, c);
2385
+    SERIAL_ECHOPAIR_P(port, " /" , t);
2386
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2386
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2387
-      SERIAL_PROTOCOLPAIR_P(port, " (", r / OVERSAMPLENR);
2388
-      SERIAL_PROTOCOLCHAR_P(port, ')');
2387
+      SERIAL_ECHOPAIR_P(port, " (", r / OVERSAMPLENR);
2388
+      SERIAL_CHAR_P(port, ')');
2389
     #endif
2389
     #endif
2390
     delay(2);
2390
     delay(2);
2391
   }
2391
   }
2435
         , e
2435
         , e
2436
       );
2436
       );
2437
     #endif
2437
     #endif
2438
-    SERIAL_PROTOCOLPGM_P(port, " @:");
2439
-    SERIAL_PROTOCOL_P(port, getHeaterPower(target_extruder));
2438
+    SERIAL_ECHOPGM_P(port, " @:");
2439
+    SERIAL_ECHO_P(port, getHeaterPower(target_extruder));
2440
     #if HAS_HEATED_BED
2440
     #if HAS_HEATED_BED
2441
-      SERIAL_PROTOCOLPGM_P(port, " B@:");
2442
-      SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
2441
+      SERIAL_ECHOPGM_P(port, " B@:");
2442
+      SERIAL_ECHO_P(port, getHeaterPower(-1));
2443
     #endif
2443
     #endif
2444
     #if HOTENDS > 1
2444
     #if HOTENDS > 1
2445
       HOTEND_LOOP() {
2445
       HOTEND_LOOP() {
2446
-        SERIAL_PROTOCOLPAIR_P(port, " @", e);
2447
-        SERIAL_PROTOCOLCHAR_P(port, ':');
2448
-        SERIAL_PROTOCOL_P(port, getHeaterPower(e));
2446
+        SERIAL_ECHOPAIR_P(port, " @", e);
2447
+        SERIAL_CHAR_P(port, ':');
2448
+        SERIAL_ECHO_P(port, getHeaterPower(e));
2449
       }
2449
       }
2450
     #endif
2450
     #endif
2451
   }
2451
   }
2528
           next_temp_ms = now + 1000UL;
2528
           next_temp_ms = now + 1000UL;
2529
           print_heater_states(target_extruder);
2529
           print_heater_states(target_extruder);
2530
           #if TEMP_RESIDENCY_TIME > 0
2530
           #if TEMP_RESIDENCY_TIME > 0
2531
-            SERIAL_PROTOCOLPGM(" W:");
2531
+            SERIAL_ECHOPGM(" W:");
2532
             if (residency_start_ms)
2532
             if (residency_start_ms)
2533
-              SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
2533
+              SERIAL_ECHO(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
2534
             else
2534
             else
2535
-              SERIAL_PROTOCOLCHAR('?');
2535
+              SERIAL_CHAR('?');
2536
           #endif
2536
           #endif
2537
           SERIAL_EOL();
2537
           SERIAL_EOL();
2538
         }
2538
         }
2651
           next_temp_ms = now + 1000UL;
2651
           next_temp_ms = now + 1000UL;
2652
           print_heater_states(active_extruder);
2652
           print_heater_states(active_extruder);
2653
           #if TEMP_BED_RESIDENCY_TIME > 0
2653
           #if TEMP_BED_RESIDENCY_TIME > 0
2654
-            SERIAL_PROTOCOLPGM(" W:");
2654
+            SERIAL_ECHOPGM(" W:");
2655
             if (residency_start_ms)
2655
             if (residency_start_ms)
2656
-              SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
2656
+              SERIAL_ECHO(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
2657
             else
2657
             else
2658
-              SERIAL_PROTOCOLCHAR('?');
2658
+              SERIAL_CHAR('?');
2659
           #endif
2659
           #endif
2660
           SERIAL_EOL();
2660
           SERIAL_EOL();
2661
         }
2661
         }

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

553
       #endif
553
       #endif
554
       if (should_swap) {
554
       if (should_swap) {
555
         if (too_cold) {
555
         if (too_cold) {
556
-          SERIAL_ERROR_START();
557
-          SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD);
556
+          SERIAL_ERROR_MSG(MSG_ERR_HOTEND_TOO_COLD);
558
           #if ENABLED(SINGLENOZZLE)
557
           #if ENABLED(SINGLENOZZLE)
559
             active_extruder = tmp_extruder;
558
             active_extruder = tmp_extruder;
560
             return;
559
             return;

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

140
             if (pin == 46 || pin == 47) {
140
             if (pin == 46 || pin == 47) {
141
               if (pin == 46) {
141
               if (pin == 46) {
142
                 print_input_or_output(GET_OUTPUT(46));
142
                 print_input_or_output(GET_OUTPUT(46));
143
-                SERIAL_PROTOCOL(READ(46));
143
+                SERIAL_ECHO(READ(46));
144
               }
144
               }
145
               else if (pin == 47) {
145
               else if (pin == 47) {
146
                 print_input_or_output(GET_OUTPUT(47));
146
                 print_input_or_output(GET_OUTPUT(47));
147
-                SERIAL_PROTOCOL(READ(47));
147
+                SERIAL_ECHO(READ(47));
148
               }
148
               }
149
             }
149
             }
150
             else
150
             else
160
                                                // because this could interfere with inductive/capacitive
160
                                                // because this could interfere with inductive/capacitive
161
                                                // sensors (high impedance voltage divider) and with PT100 amplifier
161
                                                // sensors (high impedance voltage divider) and with PT100 amplifier
162
                 print_input_or_output(false);
162
                 print_input_or_output(false);
163
-                SERIAL_PROTOCOL(digitalRead_mod(pin));
163
+                SERIAL_ECHO(digitalRead_mod(pin));
164
               }
164
               }
165
               else if (pwm_status(pin)) {
165
               else if (pwm_status(pin)) {
166
                 // do nothing
166
                 // do nothing
167
               }
167
               }
168
               else {
168
               else {
169
                 print_input_or_output(true);
169
                 print_input_or_output(true);
170
-                SERIAL_PROTOCOL(digitalRead_mod(pin));
170
+                SERIAL_ECHO(digitalRead_mod(pin));
171
               }
171
               }
172
             }
172
             }
173
             if (!multi_name_pin && extended) pwm_details(pin);  // report PWM capabilities only on the first pass & only if doing an extended report
173
             if (!multi_name_pin && extended) pwm_details(pin);  // report PWM capabilities only on the first pass & only if doing an extended report
193
     if (extended) {
193
     if (extended) {
194
       #if AVR_AT90USB1286_FAMILY  //Teensy IDEs don't know about these pins so must use FASTIO
194
       #if AVR_AT90USB1286_FAMILY  //Teensy IDEs don't know about these pins so must use FASTIO
195
         if (pin == 46 || pin == 47) {
195
         if (pin == 46 || pin == 47) {
196
-          SERIAL_PROTOCOL_SP(12);
196
+          SERIAL_ECHO_SP(12);
197
           if (pin == 46) {
197
           if (pin == 46) {
198
             print_input_or_output(GET_OUTPUT(46));
198
             print_input_or_output(GET_OUTPUT(46));
199
-            SERIAL_PROTOCOL(READ(46));
199
+            SERIAL_ECHO(READ(46));
200
           }
200
           }
201
           else {
201
           else {
202
             print_input_or_output(GET_OUTPUT(47));
202
             print_input_or_output(GET_OUTPUT(47));
203
-            SERIAL_PROTOCOL(READ(47));
203
+            SERIAL_ECHO(READ(47));
204
           }
204
           }
205
         }
205
         }
206
         else
206
         else
207
       #endif
207
       #endif
208
       {
208
       {
209
         if (GET_PINMODE(pin)) {
209
         if (GET_PINMODE(pin)) {
210
-          SERIAL_PROTOCOL_SP(MAX_NAME_LENGTH - 16);
210
+          SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16);
211
           print_input_or_output(true);
211
           print_input_or_output(true);
212
-          SERIAL_PROTOCOL(digitalRead_mod(pin));
212
+          SERIAL_ECHO(digitalRead_mod(pin));
213
         }
213
         }
214
         else {
214
         else {
215
           if (IS_ANALOG(pin)) {
215
           if (IS_ANALOG(pin)) {
221
           SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16);   // add padding if not an analog pin
221
           SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16);   // add padding if not an analog pin
222
 
222
 
223
           print_input_or_output(false);
223
           print_input_or_output(false);
224
-          SERIAL_PROTOCOL(digitalRead_mod(pin));
224
+          SERIAL_ECHO(digitalRead_mod(pin));
225
         }
225
         }
226
         //if (!pwm_status(pin)) SERIAL_CHAR(' ');    // add padding if it's not a PWM pin
226
         //if (!pwm_status(pin)) SERIAL_CHAR(' ');    // add padding if it's not a PWM pin
227
         if (extended) pwm_details(pin);  // report PWM capabilities only if doing an extended report
227
         if (extended) pwm_details(pin);  // report PWM capabilities only if doing an extended report

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

905
 // print uint8_t with width 2
905
 // print uint8_t with width 2
906
 static void print2u(const uint8_t v) {
906
 static void print2u(const uint8_t v) {
907
   if (v < 10) SERIAL_CHAR('0');
907
   if (v < 10) SERIAL_CHAR('0');
908
-  SERIAL_ECHO_F(v, DEC);
908
+  SERIAL_ECHO(int(v));
909
 }
909
 }
910
 
910
 
911
 /**
911
 /**

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

108
  *
108
  *
109
  * \return Extracted month [1,12]
109
  * \return Extracted month [1,12]
110
  */
110
  */
111
-static inline uint8_t FAT_MONTH(uint16_t fatDate) { return (fatDate >> 5) & 0XF; }
111
+static inline uint8_t FAT_MONTH(uint16_t fatDate) { return (fatDate >> 5) & 0xF; }
112
 
112
 
113
 /**
113
 /**
114
  * day part of FAT directory date field
114
  * day part of FAT directory date field

+ 41
- 56
Marlin/src/sd/cardreader.cpp 查看文件

228
 
228
 
229
         case LS_SerialPrint:
229
         case LS_SerialPrint:
230
           createFilename(filename, p);
230
           createFilename(filename, p);
231
-          if (prepend) SERIAL_PROTOCOL_P(port, prepend);
232
-          SERIAL_PROTOCOL_P(port, filename);
233
-          SERIAL_PROTOCOLCHAR_P(port, ' ');
234
-          SERIAL_PROTOCOLLN_P(port, p.fileSize);
231
+          if (prepend) SERIAL_ECHO_P(port, prepend);
232
+          SERIAL_ECHO_P(port, filename);
233
+          SERIAL_CHAR_P(port, ' ');
234
+          SERIAL_ECHOLN_P(port, p.fileSize);
235
           break;
235
           break;
236
 
236
 
237
         case LS_GetFilename:
237
         case LS_GetFilename:
305
       );
305
       );
306
 
306
 
307
       // Print /LongNamePart to serial output
307
       // Print /LongNamePart to serial output
308
-      SERIAL_PROTOCOLCHAR_P(port, '/');
309
-      SERIAL_PROTOCOL_P(port, longFilename[0] ? longFilename : "???");
308
+      SERIAL_CHAR_P(port, '/');
309
+      SERIAL_ECHO_P(port, longFilename[0] ? longFilename : "???");
310
 
310
 
311
       // If the filename was printed then that's it
311
       // If the filename was printed then that's it
312
       if (!flag.filenameIsDir) break;
312
       if (!flag.filenameIsDir) break;
373
     #endif
373
     #endif
374
   ) {
374
   ) {
375
     //if (!sd2card.init(SPI_HALF_SPEED,SDSS))
375
     //if (!sd2card.init(SPI_HALF_SPEED,SDSS))
376
-    SERIAL_ECHO_START();
377
-    SERIAL_ECHOLNPGM(MSG_SD_INIT_FAIL);
378
-  }
379
-  else if (!volume.init(&sd2card)) {
380
-    SERIAL_ERROR_START();
381
-    SERIAL_ERRORLNPGM(MSG_SD_VOL_INIT_FAIL);
382
-  }
383
-  else if (!root.openRoot(&volume)) {
384
-    SERIAL_ERROR_START();
385
-    SERIAL_ERRORLNPGM(MSG_SD_OPENROOT_FAIL);
376
+    SERIAL_ECHO_MSG(MSG_SD_INIT_FAIL);
386
   }
377
   }
378
+  else if (!volume.init(&sd2card))
379
+    SERIAL_ERROR_MSG(MSG_SD_VOL_INIT_FAIL);
380
+  else if (!root.openRoot(&volume))
381
+    SERIAL_ERROR_MSG(MSG_SD_OPENROOT_FAIL);
387
   else {
382
   else {
388
     flag.cardOK = true;
383
     flag.cardOK = true;
389
-    SERIAL_ECHO_START();
390
-    SERIAL_ECHOLNPGM(MSG_SD_CARD_OK);
384
+    SERIAL_ECHO_MSG(MSG_SD_CARD_OK);
391
   }
385
   }
392
   setroot();
386
   setroot();
393
 }
387
 }
462
   if (isFileOpen()) {                     // Replacing current file or doing a subroutine
456
   if (isFileOpen()) {                     // Replacing current file or doing a subroutine
463
     if (subcall) {
457
     if (subcall) {
464
       if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
458
       if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
465
-        SERIAL_ERROR_START();
466
-        SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");
467
-        SERIAL_ERRORLN((int)SD_PROCEDURE_DEPTH);
459
+        SERIAL_ERROR_MSG("trying to call sub-gcode files with too many levels. MAX level is:" STRINGIFY(SD_PROCEDURE_DEPTH));
468
         kill();
460
         kill();
469
         return;
461
         return;
470
       }
462
       }
482
     else
474
     else
483
       doing = 1;
475
       doing = 1;
484
   }
476
   }
485
-  else if (subcall) {     // Returning from a subcall?
486
-    SERIAL_ECHO_START();
487
-    SERIAL_ECHOLNPGM("END SUBROUTINE");
488
-  }
477
+  else if (subcall)       // Returning from a subcall?
478
+    SERIAL_ECHO_MSG("END SUBROUTINE");
489
   else {                  // Opening fresh file
479
   else {                  // Opening fresh file
490
     doing = 2;
480
     doing = 2;
491
     file_subcall_ctr = 0; // Reset procedure depth in case user cancels print while in procedure
481
     file_subcall_ctr = 0; // Reset procedure depth in case user cancels print while in procedure
508
     if (file.open(curDir, fname, O_READ)) {
498
     if (file.open(curDir, fname, O_READ)) {
509
       filesize = file.fileSize();
499
       filesize = file.fileSize();
510
       sdpos = 0;
500
       sdpos = 0;
511
-      SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
512
-      SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
513
-      SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
501
+      SERIAL_ECHOPAIR(MSG_SD_FILE_OPENED, fname);
502
+      SERIAL_ECHOLNPAIR(MSG_SD_SIZE, filesize);
503
+      SERIAL_ECHOLNPGM(MSG_SD_FILE_SELECTED);
514
 
504
 
515
       getfilename(0, fname);
505
       getfilename(0, fname);
516
       ui.set_status(longFilename[0] ? longFilename : fname);
506
       ui.set_status(longFilename[0] ? longFilename : fname);
517
       //if (longFilename[0]) {
507
       //if (longFilename[0]) {
518
-      //  SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
508
+      //  SERIAL_ECHOPAIR(MSG_SD_FILE_LONG_NAME, longFilename);
519
       //}
509
       //}
520
     }
510
     }
521
     else {
511
     else {
522
-      SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
523
-      SERIAL_PROTOCOLCHAR('.');
512
+      SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
513
+      SERIAL_CHAR('.');
524
       SERIAL_EOL();
514
       SERIAL_EOL();
525
     }
515
     }
526
   }
516
   }
527
   else { //write
517
   else { //write
528
     if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
518
     if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
529
-      SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
530
-      SERIAL_PROTOCOLCHAR('.');
519
+      SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
520
+      SERIAL_CHAR('.');
531
       SERIAL_EOL();
521
       SERIAL_EOL();
532
     }
522
     }
533
     else {
523
     else {
536
       #if ENABLED(EMERGENCY_PARSER)
526
       #if ENABLED(EMERGENCY_PARSER)
537
         emergency_parser.disable();
527
         emergency_parser.disable();
538
       #endif
528
       #endif
539
-      SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
529
+      SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, fname);
540
       ui.set_status(fname);
530
       ui.set_status(fname);
541
     }
531
     }
542
   }
532
   }
552
   if (!fname) return;
542
   if (!fname) return;
553
 
543
 
554
   if (file.remove(curDir, fname)) {
544
   if (file.remove(curDir, fname)) {
555
-    SERIAL_PROTOCOLPGM("File deleted:");
556
-    SERIAL_PROTOCOLLN(fname);
545
+    SERIAL_ECHOLNPAIR("File deleted:", fname);
557
     sdpos = 0;
546
     sdpos = 0;
558
     #if ENABLED(SDCARD_SORT_ALPHA)
547
     #if ENABLED(SDCARD_SORT_ALPHA)
559
       presort();
548
       presort();
560
     #endif
549
     #endif
561
   }
550
   }
562
   else {
551
   else {
563
-    SERIAL_PROTOCOLPGM("Deletion failed, File: ");
564
-    SERIAL_PROTOCOL(fname);
565
-    SERIAL_PROTOCOLCHAR('.');
552
+    SERIAL_ECHOPAIR("Deletion failed, File: ", fname);
553
+    SERIAL_CHAR('.');
566
   }
554
   }
567
 }
555
 }
568
 
556
 
572
   #endif
560
   #endif
573
 ) {
561
 ) {
574
   if (flag.cardOK && flag.sdprinting) {
562
   if (flag.cardOK && flag.sdprinting) {
575
-    SERIAL_PROTOCOLPGM_P(port, MSG_SD_PRINTING_BYTE);
576
-    SERIAL_PROTOCOL_P(port, sdpos);
577
-    SERIAL_PROTOCOLCHAR_P(port, '/');
578
-    SERIAL_PROTOCOLLN_P(port, filesize);
563
+    SERIAL_ECHOPGM_P(port, MSG_SD_PRINTING_BYTE);
564
+    SERIAL_ECHO_P(port, sdpos);
565
+    SERIAL_CHAR_P(port, '/');
566
+    SERIAL_ECHOLN_P(port, filesize);
579
   }
567
   }
580
   else
568
   else
581
-    SERIAL_PROTOCOLLNPGM_P(port, MSG_SD_NOT_PRINTING);
569
+    SERIAL_ECHOLNPGM_P(port, MSG_SD_NOT_PRINTING);
582
 }
570
 }
583
 
571
 
584
 void CardReader::write_command(char *buf) {
572
 void CardReader::write_command(char *buf) {
595
   end[2] = '\n';
583
   end[2] = '\n';
596
   end[3] = '\0';
584
   end[3] = '\0';
597
   file.write(begin);
585
   file.write(begin);
598
-  if (file.writeError) {
599
-    SERIAL_ERROR_START();
600
-    SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
601
-  }
586
+
587
+  if (file.writeError) SERIAL_ERROR_MSG(MSG_SD_ERR_WRITE_TO_FILE);
602
 }
588
 }
603
 
589
 
604
 //
590
 //
715
     if (echo) SERIAL_ECHOLN(dosSubdirname);
701
     if (echo) SERIAL_ECHOLN(dosSubdirname);
716
 
702
 
717
     if (!myDir.open(curDir, dosSubdirname, O_READ)) {
703
     if (!myDir.open(curDir, dosSubdirname, O_READ)) {
718
-      SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname);
719
-      SERIAL_PROTOCOLCHAR('.');
704
+      SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname);
705
+      SERIAL_CHAR('.');
720
       SERIAL_EOL();
706
       SERIAL_EOL();
721
       return NULL;
707
       return NULL;
722
     }
708
     }
740
   }
726
   }
741
   else {
727
   else {
742
     SERIAL_ECHO_START();
728
     SERIAL_ECHO_START();
743
-    SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR);
744
-    SERIAL_ECHOLN(relpath);
729
+    SERIAL_ECHOLNPAIR(MSG_SD_CANT_ENTER_SUBDIR, relpath);
745
   }
730
   }
746
 }
731
 }
747
 
732
 
1081
     if (!flag.cardOK) return;
1066
     if (!flag.cardOK) return;
1082
     if (recovery.file.isOpen()) return;
1067
     if (recovery.file.isOpen()) return;
1083
     if (!recovery.file.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC)) {
1068
     if (!recovery.file.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC)) {
1084
-      SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name);
1085
-      SERIAL_PROTOCOLCHAR('.');
1069
+      SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name);
1070
+      SERIAL_CHAR('.');
1086
       SERIAL_EOL();
1071
       SERIAL_EOL();
1087
     }
1072
     }
1088
     else if (!read)
1073
     else if (!read)
1089
-      SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name);
1074
+      SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name);
1090
   }
1075
   }
1091
 
1076
 
1092
   // Removing the job recovery file currently requires closing
1077
   // Removing the job recovery file currently requires closing
1097
       //closefile();
1082
       //closefile();
1098
       removeFile(job_recovery_file_name);
1083
       removeFile(job_recovery_file_name);
1099
       #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
1084
       #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
1100
-        SERIAL_PROTOCOLPGM("Power-loss file delete");
1085
+        SERIAL_ECHOPGM("Power-loss file delete");
1101
         serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n"));
1086
         serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n"));
1102
       #endif
1087
       #endif
1103
     }
1088
     }

Loading…
取消
儲存