瀏覽代碼

Serial refactor. Default 8-bit ECHO to int, not char (#20985)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
X-Ryl669 3 年之前
父節點
當前提交
e7c711996b
No account linked to committer's email address
共有 72 個文件被更改,包括 382 次插入340 次删除
  1. 1
    1
      Marlin/src/HAL/AVR/MarlinSerial.cpp
  2. 1
    1
      Marlin/src/HAL/AVR/MarlinSerial.h
  3. 7
    15
      Marlin/src/HAL/AVR/pinsDebug.h
  4. 2
    7
      Marlin/src/HAL/DUE/MarlinSerialUSB.cpp
  5. 9
    10
      Marlin/src/HAL/DUE/MarlinSerialUSB.h
  6. 3
    3
      Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp
  7. 0
    26
      Marlin/src/HAL/STM32F1/MarlinSerial.h
  8. 2
    2
      Marlin/src/HAL/shared/backtrace/backtrace.cpp
  9. 1
    1
      Marlin/src/MarlinCore.cpp
  10. 6
    0
      Marlin/src/core/macros.h
  11. 3
    1
      Marlin/src/core/serial.cpp
  12. 79
    59
      Marlin/src/core/serial.h
  13. 77
    43
      Marlin/src/core/serial_base.h
  14. 6
    1
      Marlin/src/core/serial_hook.h
  15. 2
    2
      Marlin/src/feature/bedlevel/abl/abl.cpp
  16. 2
    2
      Marlin/src/feature/bedlevel/bedlevel.cpp
  17. 2
    2
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  18. 4
    4
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  19. 1
    1
      Marlin/src/feature/binary_stream.h
  20. 3
    3
      Marlin/src/feature/bltouch.cpp
  21. 2
    3
      Marlin/src/feature/cancel_object.cpp
  22. 4
    4
      Marlin/src/feature/encoder_i2c.cpp
  23. 5
    5
      Marlin/src/feature/encoder_i2c.h
  24. 2
    2
      Marlin/src/feature/mixing.cpp
  25. 7
    7
      Marlin/src/feature/mixing.h
  26. 3
    3
      Marlin/src/feature/mmu/mmu2.cpp
  27. 7
    7
      Marlin/src/feature/pause.cpp
  28. 6
    6
      Marlin/src/feature/powerloss.cpp
  29. 3
    3
      Marlin/src/feature/repeat.cpp
  30. 1
    1
      Marlin/src/gcode/bedlevel/G26.cpp
  31. 2
    2
      Marlin/src/gcode/bedlevel/G35.cpp
  32. 2
    2
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  33. 3
    3
      Marlin/src/gcode/bedlevel/mbl/G29.cpp
  34. 9
    9
      Marlin/src/gcode/calibrate/G34_M422.cpp
  35. 2
    2
      Marlin/src/gcode/calibrate/G425.cpp
  36. 2
    2
      Marlin/src/gcode/calibrate/M48.cpp
  37. 1
    1
      Marlin/src/gcode/config/M217.cpp
  38. 1
    1
      Marlin/src/gcode/config/M305.cpp
  39. 3
    3
      Marlin/src/gcode/config/M43.cpp
  40. 1
    1
      Marlin/src/gcode/config/M92.cpp
  41. 8
    8
      Marlin/src/gcode/control/M605.cpp
  42. 2
    2
      Marlin/src/gcode/eeprom/M500-M504.cpp
  43. 3
    3
      Marlin/src/gcode/feature/advance/M900.cpp
  44. 1
    1
      Marlin/src/gcode/feature/leds/M7219.cpp
  45. 2
    2
      Marlin/src/gcode/feature/mixing/M166.cpp
  46. 1
    1
      Marlin/src/gcode/feature/network/M552-M554.cpp
  47. 1
    1
      Marlin/src/gcode/feature/pause/G61.cpp
  48. 2
    2
      Marlin/src/gcode/gcode.cpp
  49. 1
    1
      Marlin/src/gcode/host/M113.cpp
  50. 1
    1
      Marlin/src/gcode/host/M360.cpp
  51. 1
    1
      Marlin/src/gcode/motion/M290.cpp
  52. 3
    3
      Marlin/src/gcode/parser.cpp
  53. 2
    2
      Marlin/src/gcode/parser.h
  54. 3
    3
      Marlin/src/gcode/probe/M851.cpp
  55. 2
    2
      Marlin/src/gcode/queue.cpp
  56. 1
    1
      Marlin/src/lcd/dwin/e3v2/dwin.cpp
  57. 1
    1
      Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp
  58. 2
    2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp
  59. 2
    2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp
  60. 1
    1
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp
  61. 1
    3
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp
  62. 2
    2
      Marlin/src/lcd/marlinui.cpp
  63. 1
    1
      Marlin/src/lcd/menu/menu_configuration.cpp
  64. 1
    1
      Marlin/src/libs/bresenham.h
  65. 3
    3
      Marlin/src/module/motion.cpp
  66. 1
    1
      Marlin/src/module/probe.cpp
  67. 18
    20
      Marlin/src/module/settings.cpp
  68. 3
    3
      Marlin/src/module/temperature.cpp
  69. 13
    13
      Marlin/src/module/tool_change.cpp
  70. 1
    1
      Marlin/src/sd/SdBaseFile.cpp
  71. 1
    1
      Marlin/src/sd/cardreader.cpp
  72. 20
    0
      docs/Serial.md

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

@@ -595,7 +595,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
595 595
     MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>>::_tx_udr_empty_irq();
596 596
   }
597 597
 
598
-  template class MarlinSerial< MarlinSerialCfg<MMU2_SERIAL_PORT> >;
598
+  template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
599 599
   MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser);
600 600
 #endif
601 601
 

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

@@ -263,7 +263,7 @@
263 263
   };
264 264
 
265 265
   typedef Serial0Type< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
266
-  extern MSerial3 mmuSerial;
266
+  extern MSerialT3 mmuSerial;
267 267
 #endif
268 268
 
269 269
 #ifdef LCD_SERIAL_PORT

+ 7
- 15
Marlin/src/HAL/AVR/pinsDebug.h 查看文件

@@ -235,8 +235,8 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin");
235 235
 
236 236
 inline void com_print(const uint8_t N, const uint8_t Z) {
237 237
   const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
238
-  SERIAL_ECHOPGM("    COM");
239
-  SERIAL_CHAR('0' + N, Z);
238
+  SERIAL_ECHOPAIR("    COM", AS_CHAR('0' + N));
239
+  SERIAL_CHAR(Z);
240 240
   SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
241 241
 }
242 242
 
@@ -247,8 +247,8 @@ void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  N -
247 247
   uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1))));
248 248
   if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
249 249
 
250
-  SERIAL_ECHOPGM("    TIMER");
251
-  SERIAL_CHAR(T + '0', L);
250
+  SERIAL_ECHOPAIR("    TIMER", AS_CHAR(T + '0'));
251
+  SERIAL_CHAR(L);
252 252
   SERIAL_ECHO_SP(3);
253 253
 
254 254
   if (N == 3) {
@@ -262,19 +262,11 @@ void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  N -
262 262
   SERIAL_ECHOPAIR("    WGM: ", WGM);
263 263
   com_print(T,L);
264 264
   SERIAL_ECHOPAIR("    CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
265
-
266
-  SERIAL_ECHOPGM("    TCCR");
267
-  SERIAL_CHAR(T + '0');
268
-  SERIAL_ECHOPAIR("A: ", *TCCRA);
269
-
270
-  SERIAL_ECHOPGM("    TCCR");
271
-  SERIAL_CHAR(T + '0');
272
-  SERIAL_ECHOPAIR("B: ", *TCCRB);
265
+  SERIAL_ECHOPAIR("    TCCR", AS_CHAR(T + '0'), "A: ", *TCCRA);
266
+  SERIAL_ECHOPAIR("    TCCR", AS_CHAR(T + '0'), "B: ", *TCCRB);
273 267
 
274 268
   const uint8_t *TMSK = (uint8_t*)TIMSK(T);
275
-  SERIAL_ECHOPGM("    TIMSK");
276
-  SERIAL_CHAR(T + '0');
277
-  SERIAL_ECHOPAIR(": ", *TMSK);
269
+  SERIAL_ECHOPAIR("    TIMSK", AS_CHAR(T + '0'), ": ", *TMSK);
278 270
 
279 271
   const uint8_t OCIE = L - 'A' + 1;
280 272
   if (N == 3) { if (WGM == 0 || WGM == 2 || WGM ==  4 || WGM ==  6) err_is_counter(); }

+ 2
- 7
Marlin/src/HAL/DUE/MarlinSerialUSB.cpp 查看文件

@@ -33,10 +33,6 @@
33 33
 
34 34
 #include "MarlinSerialUSB.h"
35 35
 
36
-#if ENABLED(EMERGENCY_PARSER)
37
-  #include "../../feature/e_parser.h"
38
-#endif
39
-
40 36
 // Imports from Atmel USB Stack/CDC implementation
41 37
 extern "C" {
42 38
   bool usb_task_cdc_isenabled();
@@ -69,7 +65,7 @@ int MarlinSerialUSB::peek() {
69 65
 
70 66
   pending_char = udi_cdc_getc();
71 67
 
72
-  TERN_(EMERGENCY_PARSER, emergency_parser.update(emergency_state, (char)pending_char));
68
+  TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)pending_char));
73 69
 
74 70
   return pending_char;
75 71
 }
@@ -91,7 +87,7 @@ int MarlinSerialUSB::read() {
91 87
 
92 88
   int c = udi_cdc_getc();
93 89
 
94
-  TERN_(EMERGENCY_PARSER, emergency_parser.update(emergency_state, (char)c));
90
+  TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)c));
95 91
 
96 92
   return c;
97 93
 }
@@ -105,7 +101,6 @@ bool MarlinSerialUSB::available() {
105 101
 }
106 102
 
107 103
 void MarlinSerialUSB::flush() { }
108
-void MarlinSerialUSB::flushTX() { }
109 104
 
110 105
 size_t MarlinSerialUSB::write(const uint8_t c) {
111 106
 

+ 9
- 10
Marlin/src/HAL/DUE/MarlinSerialUSB.h 查看文件

@@ -34,21 +34,20 @@
34 34
 
35 35
 
36 36
 struct MarlinSerialUSB {
37
-  static void begin(const long);
38
-  static void end();
39
-  static int peek();
40
-  static int read();
41
-  static void flush();
42
-  static void flushTX();
43
-  static bool available();
44
-  static size_t write(const uint8_t c);
37
+  void begin(const long);
38
+  void end();
39
+  int peek();
40
+  int read();
41
+  void flush();
42
+  bool available();
43
+  size_t write(const uint8_t c);
45 44
 
46 45
   #if ENABLED(SERIAL_STATS_DROPPED_RX)
47
-    FORCE_INLINE static uint32_t dropped() { return 0; }
46
+    FORCE_INLINE uint32_t dropped() { return 0; }
48 47
   #endif
49 48
 
50 49
   #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
51
-    FORCE_INLINE static int rxMaxEnqueued() { return 0; }
50
+    FORCE_INLINE int rxMaxEnqueued() { return 0; }
52 51
   #endif
53 52
 };
54 53
 typedef Serial0Type<MarlinSerialUSB> MSerialT;

+ 3
- 3
Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp 查看文件

@@ -84,16 +84,16 @@ static void debug_rw(const bool write, int &pos, const uint8_t *value, const siz
84 84
   PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
85 85
   SERIAL_CHAR(' ');
86 86
   serialprintPGM(rw_str);
87
-  SERIAL_ECHOLNPAIR("_data(", pos, ",", int(value), ",", int(size), ", ...)");
87
+  SERIAL_ECHOLNPAIR("_data(", pos, ",", value, ",", size, ", ...)");
88 88
   if (total) {
89 89
     SERIAL_ECHOPGM(" f_");
90 90
     serialprintPGM(rw_str);
91
-    SERIAL_ECHOPAIR("()=", int(s), "\n size=", int(size), "\n bytes_");
91
+    SERIAL_ECHOPAIR("()=", s, "\n size=", size, "\n bytes_");
92 92
     serialprintPGM(write ? PSTR("written=") : PSTR("read="));
93 93
     SERIAL_ECHOLN(total);
94 94
   }
95 95
   else
96
-    SERIAL_ECHOLNPAIR(" f_lseek()=", int(s));
96
+    SERIAL_ECHOLNPAIR(" f_lseek()=", s);
97 97
 }
98 98
 
99 99
 // File function return codes for type FRESULT. This goes away soon, but

+ 0
- 26
Marlin/src/HAL/STM32F1/MarlinSerial.h 查看文件

@@ -28,10 +28,6 @@
28 28
 #include "../../inc/MarlinConfigPre.h"
29 29
 #include "../../core/serial_hook.h"
30 30
 
31
-#if HAS_TFT_LVGL_UI
32
-  extern "C" { extern char public_buf_m[100]; }
33
-#endif
34
-
35 31
 // Increase priority of serial interrupts, to reduce overflow errors
36 32
 #define UART_IRQ_PRIO 1
37 33
 
@@ -49,28 +45,6 @@ struct MarlinSerial : public HardwareSerial {
49 45
       nvic_irq_set_priority(c_dev()->irq_num, UART_IRQ_PRIO);
50 46
     }
51 47
   #endif
52
-
53
-  #if HAS_TFT_LVGL_UI
54
-    // Hook the serial write method to capture the output of GCode command sent via LCD
55
-    uint32_t current_wpos;
56
-    void (*line_callback)(void *, const char * msg);
57
-    void *user_pointer;
58
-
59
-    void set_hook(void (*hook)(void *, const char *), void * that) { line_callback = hook; user_pointer = that; current_wpos = 0; }
60
-
61
-    size_t write(uint8_t c) {
62
-      if (line_callback) {
63
-        if (c == '\n' || current_wpos == sizeof(public_buf_m) - 1) { // End of line, probably end of command anyway
64
-          public_buf_m[current_wpos] = 0;
65
-          line_callback(user_pointer, public_buf_m);
66
-          current_wpos = 0;
67
-        }
68
-        else
69
-          public_buf_m[current_wpos++] = c;
70
-      }
71
-      return HardwareSerial::write(c);
72
-    }
73
-  #endif
74 48
 };
75 49
 
76 50
 typedef Serial0Type<MarlinSerial> MSerialT;

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

@@ -35,9 +35,9 @@ static bool UnwReportOut(void* ctx, const UnwReport* bte) {
35 35
   (*p)++;
36 36
 
37 37
   SERIAL_CHAR('#'); SERIAL_ECHO(*p); SERIAL_ECHOPGM(" : ");
38
-  SERIAL_ECHOPGM(bte->name ? bte->name : "unknown"); SERIAL_ECHOPGM("@0x"); SERIAL_PRINT(bte->function, HEX);
38
+  SERIAL_ECHOPGM(bte->name ? bte->name : "unknown"); SERIAL_ECHOPGM("@0x"); SERIAL_PRINT(bte->function, PrintBase::Hex);
39 39
   SERIAL_CHAR('+'); SERIAL_ECHO(bte->address - bte->function);
40
-  SERIAL_ECHOPGM(" PC:"); SERIAL_PRINT(bte->address,HEX); SERIAL_CHAR('\n');
40
+  SERIAL_ECHOPGM(" PC:"); SERIAL_PRINT(bte->address, PrintBase::Hex); SERIAL_CHAR('\n');
41 41
   return true;
42 42
 }
43 43
 

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

@@ -1003,7 +1003,7 @@ void setup() {
1003 1003
     );
1004 1004
   #endif
1005 1005
   SERIAL_ECHO_MSG("Compiled: " __DATE__);
1006
-  SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE));
1006
+  SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, sizeof(block_t) * (BLOCK_BUFFER_SIZE));
1007 1007
 
1008 1008
   // Some HAL need precise delay adjustment
1009 1009
   calibrate_delay_loop();

+ 6
- 0
Marlin/src/core/macros.h 查看文件

@@ -321,6 +321,12 @@
321 321
   namespace Private {
322 322
     template<bool, typename _Tp = void> struct enable_if { };
323 323
     template<typename _Tp>              struct enable_if<true, _Tp> { typedef _Tp type; };
324
+
325
+    template<typename T, typename U> struct is_same { enum { value = false }; };
326
+    template<typename T> struct is_same<T, T> { enum { value = true }; };
327
+
328
+    template <typename T, typename ... Args> struct first_type_of { typedef T type; };
329
+    template <typename T> struct first_type_of<T> { typedef T type; };
324 330
   }
325 331
   // C++11 solution using SFINAE to detect the existance of a member in a class at compile time.
326 332
   // It creates a HasMember<Type> structure containing 'value' set to true if the member exists

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

@@ -59,12 +59,14 @@ void serialprintPGM(PGM_P str) {
59 59
 void serial_echo_start()  { static PGMSTR(echomagic, "echo:"); serialprintPGM(echomagic); }
60 60
 void serial_error_start() { static PGMSTR(errormagic, "Error:"); serialprintPGM(errormagic); }
61 61
 
62
+void serial_echopair_PGM(PGM_P const s_P, serial_char_t v) { serialprintPGM(s_P); SERIAL_CHAR(v.c); }
62 63
 void serial_echopair_PGM(PGM_P const s_P, const char *v)   { serialprintPGM(s_P); SERIAL_ECHO(v); }
63
-void serial_echopair_PGM(PGM_P const s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
64
+void serial_echopair_PGM(PGM_P const s_P, char v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
64 65
 void serial_echopair_PGM(PGM_P const s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
65 66
 void serial_echopair_PGM(PGM_P const s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
66 67
 void serial_echopair_PGM(PGM_P const s_P, float v)         { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
67 68
 void serial_echopair_PGM(PGM_P const s_P, double v)        { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
69
+void serial_echopair_PGM(PGM_P const s_P, unsigned char v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
68 70
 void serial_echopair_PGM(PGM_P const s_P, unsigned int v)  { serialprintPGM(s_P); SERIAL_ECHO(v); }
69 71
 void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
70 72
 

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

@@ -81,37 +81,49 @@ typedef int8_t serial_index_t;
81 81
 #define PORT_REDIRECT(p)        _PORT_REDIRECT(1,p)
82 82
 #define SERIAL_PORTMASK(P)      _BV(P)
83 83
 
84
-#define SERIAL_ECHO(x)          SERIAL_OUT(print, x)
85
-#define SERIAL_ECHO_F(V...)     SERIAL_OUT(print, V)
86
-#define SERIAL_ECHOLN(x)        SERIAL_OUT(println, x)
87
-#define SERIAL_PRINT(x,b)       SERIAL_OUT(print, x, b)
88
-#define SERIAL_PRINTLN(x,b)     SERIAL_OUT(println, x, b)
89
-#define SERIAL_FLUSH()          SERIAL_OUT(flush)
90
-
91
-#ifdef ARDUINO_ARCH_STM32
92
-  #define SERIAL_FLUSHTX()      SERIAL_OUT(flush)
93
-#elif TX_BUFFER_SIZE > 0
94
-  #define SERIAL_FLUSHTX()      SERIAL_OUT(flushTX)
95
-#else
96
-  #define SERIAL_FLUSHTX()
97
-#endif
84
+//
85
+// SERIAL_CHAR - Print one or more individual chars
86
+//
87
+inline void SERIAL_CHAR(char a) { SERIAL_IMPL.write(a); }
88
+template <typename ... Args>
89
+void SERIAL_CHAR(char a, Args ... args) { SERIAL_IMPL.write(a); SERIAL_CHAR(args ...); }
90
+
91
+/**
92
+ * SERIAL_ECHO - Print a single string or value.
93
+ *   Any numeric parameter (including char) is printed as a base-10 number.
94
+ *   A string pointer or literal will be output as a string.
95
+ *
96
+ * NOTE: Use SERIAL_CHAR to print char as a single character.
97
+ */
98
+template <typename T>
99
+void SERIAL_ECHO(T x) { SERIAL_IMPL.print(x); }
100
+
101
+// Wrapper for ECHO commands to interpret a char
102
+typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t;
103
+inline void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); }
104
+#define AS_CHAR(C) serial_char_t(C)
105
+
106
+// SERIAL_ECHO_F prints a floating point value with optional precision
107
+inline void SERIAL_ECHO_F(EnsureDouble x, int digit = 2) { SERIAL_IMPL.print(x, digit); }
108
+
109
+template <typename T>
110
+void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); }
98 111
 
99
-// Print up to 10 chars from a list
100
-#define __CHAR_N(N,V...)  _CHAR_##N(V)
101
-#define _CHAR_N(N,V...)   __CHAR_N(N,V)
102
-#define _CHAR_1(c)        SERIAL_OUT(write, c)
103
-#define _CHAR_2(a,b)      do{ _CHAR_1(a); _CHAR_1(b); }while(0)
104
-#define _CHAR_3(a,V...)   do{ _CHAR_1(a); _CHAR_2(V); }while(0)
105
-#define _CHAR_4(a,V...)   do{ _CHAR_1(a); _CHAR_3(V); }while(0)
106
-#define _CHAR_5(a,V...)   do{ _CHAR_1(a); _CHAR_4(V); }while(0)
107
-#define _CHAR_6(a,V...)   do{ _CHAR_1(a); _CHAR_5(V); }while(0)
108
-#define _CHAR_7(a,V...)   do{ _CHAR_1(a); _CHAR_6(V); }while(0)
109
-#define _CHAR_8(a,V...)   do{ _CHAR_1(a); _CHAR_7(V); }while(0)
110
-#define _CHAR_9(a,V...)   do{ _CHAR_1(a); _CHAR_8(V); }while(0)
111
-#define _CHAR_10(a,V...)  do{ _CHAR_1(a); _CHAR_9(V); }while(0)
112
-
113
-#define SERIAL_CHAR(V...) _CHAR_N(NUM_ARGS(V),V)
112
+// SERIAL_PRINT works like SERIAL_ECHO but allow to specify the encoding base of the number printed
113
+template <typename T, typename U>
114
+void SERIAL_PRINT(T x, U y) { SERIAL_IMPL.print(x, y); }
114 115
 
116
+template <typename T, typename U>
117
+void SERIAL_PRINTLN(T x, U y) { SERIAL_IMPL.println(x, y); }
118
+
119
+// Flush the serial port
120
+inline void SERIAL_FLUSH()    { SERIAL_IMPL.flush(); }
121
+inline void SERIAL_FLUSHTX()  { SERIAL_IMPL.flushTX(); }
122
+
123
+// Print a single PROGMEM string to serial
124
+void serialprintPGM(PGM_P str);
125
+
126
+// SERIAL_ECHOPAIR / SERIAL_ECHOPAIR_P is used to output a key value pair. The key must be a string and the value can be anything
115 127
 // Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR().
116 128
 #define __SEP_N(N,V...)   _SEP_##N(V)
117 129
 #define _SEP_N(N,V...)    __SEP_N(N,V)
@@ -170,6 +182,7 @@ typedef int8_t serial_index_t;
170 182
 #define _SEP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_21_P(V); }while(0)
171 183
 #define _SEP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_22_P(V); }while(0)
172 184
 
185
+// SERIAL_ECHOPAIR_P is used to output a key value pair. Unlike SERIAL_ECHOPAIR, the key must be a PGM string already and the value can be anything
173 186
 #define SERIAL_ECHOPAIR_P(V...) _SEP_N_P(NUM_ARGS(V),V)
174 187
 
175 188
 // Print up to 12 pairs of values followed by newline
@@ -244,32 +257,39 @@ typedef int8_t serial_index_t;
244 257
 
245 258
 #define SERIAL_ECHOLNPAIR_P(V...) _SELP_N_P(NUM_ARGS(V),V)
246 259
 
247
-// Print up to 20 comma-separated pairs of values
248
-#define __SLST_N(N,V...)   _SLST_##N(V)
249
-#define _SLST_N(N,V...)    __SLST_N(N,V)
250
-#define _SLST_1(a)         SERIAL_ECHO(a)
251
-#define _SLST_2(a,b)       do{ SERIAL_ECHO(a); SERIAL_ECHOPAIR(", ",b);     }while(0)
252
-#define _SLST_3(a,b,c)     do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_1(c);  }while(0)
253
-#define _SLST_4(a,b,V...)  do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_2(V);  }while(0)
254
-#define _SLST_5(a,b,V...)  do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_3(V);  }while(0)
255
-#define _SLST_6(a,b,V...)  do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_4(V);  }while(0)
256
-#define _SLST_7(a,b,V...)  do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_5(V);  }while(0)
257
-#define _SLST_8(a,b,V...)  do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_6(V);  }while(0)
258
-#define _SLST_9(a,b,V...)  do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_7(V);  }while(0)
259
-#define _SLST_10(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_8(V);  }while(0)
260
-#define _SLST_11(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_9(V);  }while(0)
261
-#define _SLST_12(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_10(V); }while(0)
262
-#define _SLST_13(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_11(V); }while(0)
263
-#define _SLST_14(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_12(V); }while(0)
264
-#define _SLST_15(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_13(V); }while(0)
265
-#define _SLST_16(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_14(V); }while(0)
266
-#define _SLST_17(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_15(V); }while(0)
267
-#define _SLST_18(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_16(V); }while(0)
268
-#define _SLST_19(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_17(V); }while(0)
269
-#define _SLST_20(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_18(V); }while(0) // Eat two args, pass the rest up
270
-
271
-#define SERIAL_ECHOLIST(pre,V...)   do{ SERIAL_ECHOPGM(pre); _SLST_N(NUM_ARGS(V),V); }while(0)
272
-#define SERIAL_ECHOLIST_N(N,V...)   _SLST_N(N,LIST_N(N,V))
260
+#ifdef AllowDifferentTypeInList
261
+
262
+  inline void SERIAL_ECHOLIST_IMPL() {}
263
+  template <typename T>
264
+  void SERIAL_ECHOLIST_IMPL(T && t) { SERIAL_IMPL.print(t); }
265
+
266
+  template <typename T, typename ... Args>
267
+  void SERIAL_ECHOLIST_IMPL(T && t, Args && ... args) {
268
+    SERIAL_IMPL.print(t);
269
+    serialprintPGM(PSTR(", "));
270
+    SERIAL_ECHOLIST_IMPL(args...);
271
+  }
272
+
273
+  template <typename ... Args>
274
+  void SERIAL_ECHOLIST(PGM_P const str, Args && ... args) {
275
+    SERIAL_IMPL.print(str);
276
+    SERIAL_ECHOLIST_IMPL(args...);
277
+  }
278
+
279
+#else // Optimization if the listed type are all the same (seems to be the case in the codebase so use that instead)
280
+
281
+  template <typename ... Args>
282
+  void SERIAL_ECHOLIST(PGM_P const str, Args && ... args) {
283
+    serialprintPGM(str);
284
+    typename Private::first_type_of<Args...>::type values[] = { args... };
285
+    constexpr size_t argsSize = sizeof...(args);
286
+    for (size_t i = 0; i < argsSize; i++) {
287
+      if (i) serialprintPGM(PSTR(", "));
288
+      SERIAL_IMPL.print(values[i]);
289
+    }
290
+  }
291
+
292
+#endif
273 293
 
274 294
 #define SERIAL_ECHOPGM_P(P)         (serialprintPGM(P))
275 295
 #define SERIAL_ECHOLNPGM_P(P)       (serialprintPGM(P "\n"))
@@ -303,19 +323,19 @@ typedef int8_t serial_index_t;
303 323
 //
304 324
 // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
305 325
 //
326
+void serial_echopair_PGM(PGM_P const s_P, serial_char_t v);
306 327
 void serial_echopair_PGM(PGM_P const s_P, const char *v);
307 328
 void serial_echopair_PGM(PGM_P const s_P, char v);
308 329
 void serial_echopair_PGM(PGM_P const s_P, int v);
309
-void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
310 330
 void serial_echopair_PGM(PGM_P const s_P, long v);
311
-void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
312 331
 void serial_echopair_PGM(PGM_P const s_P, float v);
313 332
 void serial_echopair_PGM(PGM_P const s_P, double v);
314
-inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); }
333
+void serial_echopair_PGM(PGM_P const s_P, unsigned char v);
334
+void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
335
+void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
315 336
 inline void serial_echopair_PGM(PGM_P const s_P, bool v)    { serial_echopair_PGM(s_P, (int)v); }
316 337
 inline void serial_echopair_PGM(PGM_P const s_P, void *v)   { serial_echopair_PGM(s_P, (uintptr_t)v); }
317 338
 
318
-void serialprintPGM(PGM_P str);
319 339
 void serial_echo_start();
320 340
 void serial_error_start();
321 341
 void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=nullptr);

+ 77
- 43
Marlin/src/core/serial_base.h 查看文件

@@ -22,25 +22,41 @@
22 22
 #pragma once
23 23
 
24 24
 #include "../inc/MarlinConfigPre.h"
25
+#include "macros.h"
25 26
 
26 27
 #if ENABLED(EMERGENCY_PARSER)
27 28
   #include "../feature/e_parser.h"
28 29
 #endif
29 30
 
30
-#ifndef DEC
31
-  #define DEC 10
32
-  #define HEX 16
33
-  #define OCT 8
34
-  #define BIN 2
35
-#endif
36
-
37 31
 // flushTX is not implemented in all HAL, so use SFINAE to call the method where it is.
38 32
 CALL_IF_EXISTS_IMPL(void, flushTX );
39 33
 CALL_IF_EXISTS_IMPL(bool, connected, true);
40 34
 
35
+// In order to catch usage errors in code, we make the base to encode number explicit
36
+// If given a number (and not this enum), the compiler will reject the overload, falling back to the (double, digit) version
37
+// We don't want hidden conversion of the first parameter to double, so it has to be as hard to do for the compiler as creating this enum
38
+enum class PrintBase {
39
+  Dec = 10,
40
+  Hex = 16,
41
+  Oct = 8,
42
+  Bin = 2
43
+};
44
+
45
+// A simple forward struct that prevent the compiler to select print(double, int) as a default overload for any type different than 
46
+// double or float. For double or float, a conversion exists so the call will be transparent
47
+struct EnsureDouble {
48
+  double a;
49
+  FORCE_INLINE operator double() { return a; }
50
+  // If the compiler breaks on ambiguity here, it's likely because you're calling print(X, base) with X not a double or a float, and a
51
+  // base that's not one of PrintBase's value. This exact code is made to detect such error, you NEED to set a base explicitely like this:
52
+  // SERIAL_PRINT(v, PrintBase::Hex) 
53
+  FORCE_INLINE EnsureDouble(double a) : a(a) {}
54
+  FORCE_INLINE EnsureDouble(float a) : a(a) {}
55
+};
56
+
41 57
 // Using Curiously Recurring Template Pattern here to avoid virtual table cost when compiling.
42
-// Since the real serial class is known at compile time, this results in compiler writing a completely
43
-// efficient code
58
+// Since the real serial class is known at compile time, this results in the compiler writing
59
+// a completely efficient code.
44 60
 template <class Child>
45 61
 struct SerialBase {
46 62
   #if ENABLED(EMERGENCY_PARSER)
@@ -78,39 +94,47 @@ struct SerialBase {
78 94
   FORCE_INLINE void write(const char* str)                    { while (*str) write(*str++); }
79 95
   FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
80 96
   FORCE_INLINE void print(const char* str)                    { write(str); }
81
-  NO_INLINE void print(char c, int base = 0)              { print((long)c, base); }
82
-  NO_INLINE void print(unsigned char c, int base = 0)     { print((unsigned long)c, base); }
83
-  NO_INLINE void print(int c, int base = DEC)             { print((long)c, base); }
84
-  NO_INLINE void print(unsigned int c, int base = DEC)    { print((unsigned long)c, base); }
85
-  void print(unsigned long c, int base = DEC)             { printNumber(c, base); }
86
-  void print(double c, int digits = 2)                    { printFloat(c, digits); }
87
-  void print(long c, int base = DEC)                      {
88
-    if (!base) {
89
-      write(c);
90
-      return;
91
-    }
92
-    if (base == DEC && c < 0) {
93
-      write((uint8_t)'-'); c = -c;
94
-    }
95
-    printNumber(c, base);
96
-  }
97
+  // No default argument to avoid ambiguity
98
+  NO_INLINE void print(char c, PrintBase base)                { printNumber((signed long)c, (uint8_t)base); }
99
+  NO_INLINE void print(unsigned char c, PrintBase base)       { printNumber((unsigned long)c, (uint8_t)base); }
100
+  NO_INLINE void print(int c, PrintBase base)                 { printNumber((signed long)c, (uint8_t)base); }
101
+  NO_INLINE void print(unsigned int c, PrintBase base)        { printNumber((unsigned long)c, (uint8_t)base); }
102
+  void print(unsigned long c, PrintBase base)                 { printNumber((unsigned long)c, (uint8_t)base); }
103
+  void print(long c, PrintBase base)                          { printNumber((signed long)c, (uint8_t)base); }
104
+  void print(EnsureDouble c, int digits)                      { printFloat(c, digits); }
105
+
106
+  // Forward the call to the former's method
107
+  FORCE_INLINE void print(char c)                { print(c, PrintBase::Dec); }
108
+  FORCE_INLINE void print(unsigned char c)       { print(c, PrintBase::Dec); }
109
+  FORCE_INLINE void print(int c)                 { print(c, PrintBase::Dec); }
110
+  FORCE_INLINE void print(unsigned int c)        { print(c, PrintBase::Dec); }
111
+  FORCE_INLINE void print(unsigned long c)       { print(c, PrintBase::Dec); }
112
+  FORCE_INLINE void print(long c)                { print(c, PrintBase::Dec); }
113
+  FORCE_INLINE void print(double c)              { print(c, 2); }
114
+
115
+  FORCE_INLINE void println(const char s[])                  { print(s); println(); }
116
+  FORCE_INLINE void println(char c, PrintBase base)          { print(c, base); println(); }
117
+  FORCE_INLINE void println(unsigned char c, PrintBase base) { print(c, base); println(); }
118
+  FORCE_INLINE void println(int c, PrintBase base)           { print(c, base); println(); }
119
+  FORCE_INLINE void println(unsigned int c, PrintBase base)  { print(c, base); println(); }
120
+  FORCE_INLINE void println(long c, PrintBase base)          { print(c, base); println(); }
121
+  FORCE_INLINE void println(unsigned long c, PrintBase base) { print(c, base); println(); }
122
+  FORCE_INLINE void println(double c, int digits)            { print(c, digits); println(); }
123
+  FORCE_INLINE void println()                                { write('\r'); write('\n'); }
97 124
 
98
-  NO_INLINE void println(const char s[])                  { print(s); println(); }
99
-  NO_INLINE void println(char c, int base = 0)            { print(c, base); println(); }
100
-  NO_INLINE void println(unsigned char c, int base = 0)   { print(c, base); println(); }
101
-  NO_INLINE void println(int c, int base = DEC)           { print(c, base); println(); }
102
-  NO_INLINE void println(unsigned int c, int base = DEC)  { print(c, base); println(); }
103
-  NO_INLINE void println(long c, int base = DEC)          { print(c, base); println(); }
104
-  NO_INLINE void println(unsigned long c, int base = DEC) { print(c, base); println(); }
105
-  NO_INLINE void println(double c, int digits = 2)        { print(c, digits); println(); }
106
-  NO_INLINE void println()                                { write('\r'); write('\n'); }
125
+  // Forward the call to the former's method
126
+  FORCE_INLINE void println(char c)                { println(c, PrintBase::Dec); }
127
+  FORCE_INLINE void println(unsigned char c)       { println(c, PrintBase::Dec); }
128
+  FORCE_INLINE void println(int c)                 { println(c, PrintBase::Dec); }
129
+  FORCE_INLINE void println(unsigned int c)        { println(c, PrintBase::Dec); }
130
+  FORCE_INLINE void println(unsigned long c)       { println(c, PrintBase::Dec); }
131
+  FORCE_INLINE void println(long c)                { println(c, PrintBase::Dec); }
132
+  FORCE_INLINE void println(double c)              { println(c, 2); }
107 133
 
108 134
   // Print a number with the given base
109
-  void printNumber(unsigned long n, const uint8_t base) {
110
-    if (!base) {
111
-      write((uint8_t)n);
112
-      return;
113
-    }
135
+  NO_INLINE void printNumber(unsigned long n, const uint8_t base) {
136
+    if (!base) return; // Hopefully, this should raise visible bug immediately
137
+
114 138
     if (n) {
115 139
       unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
116 140
       int8_t i = 0;
@@ -122,9 +146,19 @@ struct SerialBase {
122 146
     }
123 147
     else write('0');
124 148
   }
149
+  void printNumber(signed long n, const uint8_t base) {
150
+    if (base == 10 && n < 0) { 
151
+      n = -n; // This works because all platforms Marlin's builds on are using 2-complement encoding for negative number
152
+              // On such CPU, changing the sign of a number is done by inverting the bits and adding one, so if n = 0x80000000 = -2147483648 then
153
+              // -n = 0x7FFFFFFF + 1 => 0x80000000 = 2147483648 (if interpreted as unsigned) or -2147483648 if interpreted as signed.
154
+              // On non 2-complement CPU, there would be no possible representation for 2147483648.
155
+      write('-'); 
156
+    } 
157
+    printNumber((unsigned long)n , base);
158
+  }
125 159
 
126 160
   // Print a decimal number
127
-  void printFloat(double number, uint8_t digits) {
161
+  NO_INLINE void printFloat(double number, uint8_t digits) {
128 162
     // Handle negative numbers
129 163
     if (number < 0.0) {
130 164
       write('-');
@@ -147,7 +181,7 @@ struct SerialBase {
147 181
       // Extract digits from the remainder one at a time
148 182
       while (digits--) {
149 183
         remainder *= 10.0;
150
-        int toPrint = int(remainder);
184
+        unsigned long toPrint = (unsigned long)remainder;
151 185
         printNumber(toPrint, 10);
152 186
         remainder -= toPrint;
153 187
       }
@@ -155,5 +189,5 @@ struct SerialBase {
155 189
   }
156 190
 };
157 191
 
158
-// All serial instances will be built by chaining the features required for the function in a form of a template
159
-// type definition
192
+// All serial instances will be built by chaining the features required
193
+// for the function in the form of a template type definition.

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

@@ -21,6 +21,7 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
+#include "macros.h"
24 25
 #include "serial_base.h"
25 26
 
26 27
 // The most basic serial class: it dispatch to the base serial class with no hook whatsoever. This will compile to nothing but the base serial class
@@ -37,6 +38,8 @@ struct BaseSerial : public SerialBase< BaseSerial<SerialT> >, public SerialT {
37 38
   bool available(uint8_t index) { return index == 0 && SerialT::available(); }
38 39
   int read(uint8_t index)       { return index == 0 ? SerialT::read() : -1; }
39 40
   bool connected()              { return CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected);; }
41
+  void flushTX()                { CALL_IF_EXISTS(void, static_cast<SerialT*>(this), flushTX); }
42
+
40 43
   // We have 2 implementation of the same method in both base class, let's say which one we want
41 44
   using SerialT::available;
42 45
   using SerialT::read;
@@ -68,6 +71,7 @@ struct ConditionalSerial : public SerialBase< ConditionalSerial<SerialT> > {
68 71
 
69 72
   void msgDone() {}
70 73
   bool connected()              { return CALL_IF_EXISTS(bool, &out, connected); }
74
+  void flushTX()                { CALL_IF_EXISTS(void, &out, flushTX); }
71 75
 
72 76
   bool available(uint8_t index) { return index == 0 && out.available(); }
73 77
   int read(uint8_t index)       { return index == 0 ? out.read() : -1; }
@@ -91,6 +95,7 @@ struct ForwardSerial : public SerialBase< ForwardSerial<SerialT> > {
91 95
   void msgDone() {}
92 96
   // Existing instances implement Arduino's operator bool, so use that if it's available
93 97
   bool connected()              { return Private::HasMember_connected<SerialT>::value ? CALL_IF_EXISTS(bool, &out, connected) : (bool)out; }
98
+  void flushTX()                { CALL_IF_EXISTS(void, &out, flushTX); }
94 99
 
95 100
   bool available(uint8_t index) { return index == 0 && out.available(); }
96 101
   int read(uint8_t index)       { return index == 0 ? out.read() : -1; }
@@ -131,11 +136,11 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
131 136
   using BaseClassT::print;
132 137
   using BaseClassT::println;
133 138
 
134
-
135 139
   // Underlying implementation might use Arduino's bool operator
136 140
   bool connected() {
137 141
     return Private::HasMember_connected<SerialT>::value ? CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected) : static_cast<SerialT*>(this)->operator bool();
138 142
   }
143
+  void flushTX()                { CALL_IF_EXISTS(void, static_cast<SerialT*>(this), flushTX); }
139 144
 
140 145
   void setHook(WriteHook writeHook = 0, EndOfMessageHook eofHook = 0, void * userPointer = 0) {
141 146
     // Order is important here as serial code can be called inside interrupts

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

@@ -47,11 +47,11 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t
47 47
   if (DEBUGGING(LEVELING)) {
48 48
     DEBUG_ECHOPGM("Extrapolate [");
49 49
     if (x < 10) DEBUG_CHAR(' ');
50
-    DEBUG_ECHO((int)x);
50
+    DEBUG_ECHO(x);
51 51
     DEBUG_CHAR(xdir ? (xdir > 0 ? '+' : '-') : ' ');
52 52
     DEBUG_CHAR(' ');
53 53
     if (y < 10) DEBUG_CHAR(' ');
54
-    DEBUG_ECHO((int)y);
54
+    DEBUG_ECHO(y);
55 55
     DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' ');
56 56
     DEBUG_ECHOLNPGM("]");
57 57
   }

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

@@ -160,7 +160,7 @@ void reset_bed_level() {
160 160
     #ifndef SCAD_MESH_OUTPUT
161 161
       LOOP_L_N(x, sx) {
162 162
         serial_spaces(precision + (x < 10 ? 3 : 2));
163
-        SERIAL_ECHO(int(x));
163
+        SERIAL_ECHO(x);
164 164
       }
165 165
       SERIAL_EOL();
166 166
     #endif
@@ -172,7 +172,7 @@ void reset_bed_level() {
172 172
         SERIAL_ECHOPGM(" [");             // open sub-array
173 173
       #else
174 174
         if (y < 10) SERIAL_CHAR(' ');
175
-        SERIAL_ECHO(int(y));
175
+        SERIAL_ECHO(y);
176 176
       #endif
177 177
       LOOP_L_N(x, sx) {
178 178
         SERIAL_CHAR(' ');

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

@@ -50,7 +50,7 @@
50 50
     GRID_LOOP(x, y)
51 51
       if (!isnan(z_values[x][y])) {
52 52
         SERIAL_ECHO_START();
53
-        SERIAL_ECHOPAIR("  M421 I", int(x), " J", int(y));
53
+        SERIAL_ECHOPAIR("  M421 I", x, " J", y);
54 54
         SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4);
55 55
         serial_delay(75); // Prevent Printrun from exploding
56 56
       }
@@ -150,7 +150,7 @@
150 150
     SERIAL_ECHO_SP(7);
151 151
     LOOP_L_N(i, GRID_MAX_POINTS_X) {
152 152
       if (i < 10) SERIAL_CHAR(' ');
153
-      SERIAL_ECHO((int)i);
153
+      SERIAL_ECHO(i);
154 154
       SERIAL_ECHO_SP(sp);
155 155
     }
156 156
     serial_delay(10);

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

@@ -742,7 +742,7 @@
742 742
         if (do_ubl_mesh_map) display_map(g29_map_type);
743 743
 
744 744
         const int point_num = (GRID_MAX_POINTS) - count + 1;
745
-        SERIAL_ECHOLNPAIR("Probing mesh point ", point_num, "/", int(GRID_MAX_POINTS), ".");
745
+        SERIAL_ECHOLNPAIR("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
746 746
         TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS)));
747 747
 
748 748
         #if HAS_LCD_MENU
@@ -1694,7 +1694,7 @@
1694 1694
       SERIAL_EOL();
1695 1695
 
1696 1696
       #if HAS_KILL
1697
-        SERIAL_ECHOLNPAIR("Kill pin on :", int(KILL_PIN), "  state:", int(kill_state()));
1697
+        SERIAL_ECHOLNPAIR("Kill pin on :", KILL_PIN, "  state:", kill_state());
1698 1698
       #endif
1699 1699
 
1700 1700
       SERIAL_EOL();
@@ -1707,8 +1707,8 @@
1707 1707
         SERIAL_ECHOLNPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()), " to ", hex_address((void*)settings.meshes_end_index()));
1708 1708
         serial_delay(50);
1709 1709
 
1710
-        SERIAL_ECHOLNPAIR("sizeof(ubl) :  ", (int)sizeof(ubl));         SERIAL_EOL();
1711
-        SERIAL_ECHOLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL();
1710
+        SERIAL_ECHOLNPAIR("sizeof(ubl) :  ", sizeof(ubl));         SERIAL_EOL();
1711
+        SERIAL_ECHOLNPAIR("z_value[][] size: ", sizeof(z_values)); SERIAL_EOL();
1712 1712
         serial_delay(25);
1713 1713
 
1714 1714
         SERIAL_ECHOLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));

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

@@ -404,7 +404,7 @@ public:
404 404
           if (packet_retries < MAX_RETRIES || MAX_RETRIES == 0) {
405 405
             packet_retries++;
406 406
             stream_state = StreamState::PACKET_RESET;
407
-            SERIAL_ECHO_MSG("Resend request ", int(packet_retries));
407
+            SERIAL_ECHO_MSG("Resend request ", packet_retries);
408 408
             SERIAL_ECHOLNPAIR("rs", sync);
409 409
           }
410 410
           else

+ 3
- 3
Marlin/src/feature/bltouch.cpp 查看文件

@@ -64,7 +64,7 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
64 64
   #else
65 65
 
66 66
     if (DEBUGGING(LEVELING)) {
67
-      DEBUG_ECHOLNPAIR("last_written_mode - ", (int)last_written_mode);
67
+      DEBUG_ECHOLNPAIR("last_written_mode - ", last_written_mode);
68 68
       DEBUG_ECHOLNPGM("config mode - "
69 69
         #if ENABLED(BLTOUCH_SET_5V_MODE)
70 70
           "BLTOUCH_SET_5V_MODE"
@@ -175,7 +175,7 @@ bool BLTouch::status_proc() {
175 175
   _set_SW_mode();              // Incidentally, _set_SW_mode() will also RESET any active alarm
176 176
   const bool tr = triggered(); // If triggered in SW mode, the pin is up, it is STOWED
177 177
 
178
-  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", (int)tr);
178
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch is ", tr);
179 179
 
180 180
   if (tr) _stow(); else _deploy();  // Turn off SW mode, reset any trigger, honor pin state
181 181
   return !tr;
@@ -187,7 +187,7 @@ void BLTouch::mode_conv_proc(const bool M5V) {
187 187
    * BLTOUCH V3.0: This will set the mode (twice) and sadly, a STOW is needed at the end, because of the deploy
188 188
    * BLTOUCH V3.1: This will set the mode and store it in the eeprom. The STOW is not needed but does not hurt
189 189
    */
190
-  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch Set Mode - ", (int)M5V);
190
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("BLTouch Set Mode - ", M5V);
191 191
   _deploy();
192 192
   if (M5V) _set_5V_mode(); else _set_OD_mode();
193 193
   _mode_store();

+ 2
- 3
Marlin/src/feature/cancel_object.cpp 查看文件

@@ -66,9 +66,8 @@ void CancelObject::uncancel_object(const int8_t obj) {
66 66
 }
67 67
 
68 68
 void CancelObject::report() {
69
-  if (active_object >= 0) {
70
-    SERIAL_ECHO_MSG("Active Object: ", int(active_object));
71
-  }
69
+  if (active_object >= 0)
70
+    SERIAL_ECHO_MSG("Active Object: ", active_object);
72 71
 
73 72
   if (canceled) {
74 73
     SERIAL_ECHO_START();

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

@@ -49,7 +49,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
49 49
 
50 50
   initialized++;
51 51
 
52
-  SERIAL_ECHOLNPAIR("Setting up encoder on ", axis_codes[encoderAxis], " axis, addr = ", address);
52
+  SERIAL_ECHOLNPAIR("Setting up encoder on ", AS_CHAR(axis_codes[encoderAxis]), " axis, addr = ", address);
53 53
 
54 54
   position = get_position();
55 55
 }
@@ -67,7 +67,7 @@ void I2CPositionEncoder::update() {
67 67
     /*
68 68
     if (trusted) { //commented out as part of the note below
69 69
       trusted = false;
70
-      SERIAL_ECHOLMPAIR("Fault detected on ", axis_codes[encoderAxis], " axis encoder. Disengaging error correction until module is trusted again.");
70
+      SERIAL_ECHOLNPAIR("Fault detected on ", AS_CHAR(axis_codes[encoderAxis]), " axis encoder. Disengaging error correction until module is trusted again.");
71 71
     }
72 72
     */
73 73
     return;
@@ -92,7 +92,7 @@ void I2CPositionEncoder::update() {
92 92
       if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
93 93
         trusted = true;
94 94
 
95
-        SERIAL_ECHOLNPAIR("Untrusted encoder module on ", axis_codes[encoderAxis], " axis has been fault-free for set duration, reinstating error correction.");
95
+        SERIAL_ECHOLNPAIR("Untrusted encoder module on ", AS_CHAR(axis_codes[encoderAxis]), " axis has been fault-free for set duration, reinstating error correction.");
96 96
 
97 97
         //the encoder likely lost its place when the error occured, so we'll reset and use the printer's
98 98
         //idea of where it the axis is to re-initialize
@@ -193,7 +193,7 @@ void I2CPositionEncoder::update() {
193 193
       const millis_t ms = millis();
194 194
       if (ELAPSED(ms, nextErrorCountTime)) {
195 195
         SERIAL_CHAR(axis_codes[encoderAxis]);
196
-        SERIAL_ECHOLNPAIR(" : LARGE ERR ", int(error), "; diffSum=", diffSum);
196
+        SERIAL_ECHOLNPAIR(" : LARGE ERR ", error, "; diffSum=", diffSum);
197 197
         errorCount++;
198 198
         nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS;
199 199
       }

+ 5
- 5
Marlin/src/feature/encoder_i2c.h 查看文件

@@ -261,32 +261,32 @@ class I2CPositionEncodersMgr {
261 261
 
262 262
     static void report_error_count(const int8_t idx, const AxisEnum axis) {
263 263
       CHECK_IDX();
264
-      SERIAL_ECHOLNPAIR("Error count on ", axis_codes[axis], " axis is ", encoders[idx].get_error_count());
264
+      SERIAL_ECHOLNPAIR("Error count on ", AS_CHAR(axis_codes[axis]), " axis is ", encoders[idx].get_error_count());
265 265
     }
266 266
 
267 267
     static void reset_error_count(const int8_t idx, const AxisEnum axis) {
268 268
       CHECK_IDX();
269 269
       encoders[idx].set_error_count(0);
270
-      SERIAL_ECHOLNPAIR("Error count on ", axis_codes[axis], " axis has been reset.");
270
+      SERIAL_ECHOLNPAIR("Error count on ", AS_CHAR(axis_codes[axis]), " axis has been reset.");
271 271
     }
272 272
 
273 273
     static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
274 274
       CHECK_IDX();
275 275
       encoders[idx].set_ec_enabled(enabled);
276
-      SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]);
276
+      SERIAL_ECHOPAIR("Error correction on ", AS_CHAR(axis_codes[axis]));
277 277
       SERIAL_ECHO_TERNARY(encoders[idx].get_ec_enabled(), " axis is ", "en", "dis", "abled.\n");
278 278
     }
279 279
 
280 280
     static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
281 281
       CHECK_IDX();
282 282
       encoders[idx].set_ec_threshold(newThreshold);
283
-      SERIAL_ECHOLNPAIR("Error correct threshold for ", axis_codes[axis], " axis set to ", newThreshold, "mm.");
283
+      SERIAL_ECHOLNPAIR("Error correct threshold for ", AS_CHAR(axis_codes[axis]), " axis set to ", newThreshold, "mm.");
284 284
     }
285 285
 
286 286
     static void get_ec_threshold(const int8_t idx, const AxisEnum axis) {
287 287
       CHECK_IDX();
288 288
       const float threshold = encoders[idx].get_ec_threshold();
289
-      SERIAL_ECHOLNPAIR("Error correct threshold for ", axis_codes[axis], " axis is ", threshold, "mm.");
289
+      SERIAL_ECHOLNPAIR("Error correct threshold for ", AS_CHAR(axis_codes[axis]), " axis is ", threshold, "mm.");
290 290
     }
291 291
 
292 292
     static int8_t idx_from_axis(const AxisEnum axis) {

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

@@ -135,11 +135,11 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=
135 135
     cmax = _MAX(cmax, v);
136 136
     csum += v;
137 137
   }
138
-  //SERIAL_ECHOPAIR("Mixer::refresh_collector(", proportion, ", ", int(t), ") cmax=", cmax, "  csum=", csum, "  color");
138
+  //SERIAL_ECHOPAIR("Mixer::refresh_collector(", proportion, ", ", t, ") cmax=", cmax, "  csum=", csum, "  color");
139 139
   const float inv_prop = proportion / csum;
140 140
   MIXER_STEPPER_LOOP(i) {
141 141
     c[i] = color[t][i] * inv_prop;
142
-    //SERIAL_ECHOPAIR(" [", int(t), "][", int(i), "] = ", int(color[t][i]), " (", c[i], ")  ");
142
+    //SERIAL_ECHOPAIR(" [", t, "][", i, "] = ", color[t][i], " (", c[i], ")  ");
143 143
   }
144 144
   //SERIAL_EOL();
145 145
 }

+ 7
- 7
Marlin/src/feature/mixing.h 查看文件

@@ -139,9 +139,9 @@ class Mixer {
139 139
 
140 140
       #ifdef MIXER_NORMALIZER_DEBUG
141 141
         SERIAL_ECHOPGM("Mix [ ");
142
-        SERIAL_ECHOLIST_N(MIXING_STEPPERS, int(mix[0]), int(mix[1]), int(mix[2]), int(mix[3]), int(mix[4]), int(mix[5]));
142
+        SERIAL_ECHOLIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]);
143 143
         SERIAL_ECHOPGM(" ] to Color [ ");
144
-        SERIAL_ECHOLIST_N(MIXING_STEPPERS, int(tcolor[0]), int(tcolor[1]), int(tcolor[2]), int(tcolor[3]), int(tcolor[4]), int(tcolor[5]));
144
+        SERIAL_ECHOLIST_N(MIXING_STEPPERS, tcolor[0], tcolor[1], tcolor[2], tcolor[3], tcolor[4], tcolor[5]);
145 145
         SERIAL_ECHOLNPGM(" ]");
146 146
       #endif
147 147
     }
@@ -153,10 +153,10 @@ class Mixer {
153 153
       MIXER_STEPPER_LOOP(i) mix[i] = mixer_perc_t(100.0f * color[j][i] / ctot);
154 154
 
155 155
       #ifdef MIXER_NORMALIZER_DEBUG
156
-        SERIAL_ECHOPAIR("V-tool ", int(j), " [ ");
157
-        SERIAL_ECHOLIST_N(MIXING_STEPPERS, int(color[j][0]), int(color[j][1]), int(color[j][2]), int(color[j][3]), int(color[j][4]), int(color[j][5]));
156
+        SERIAL_ECHOPAIR("V-tool ", j, " [ ");
157
+        SERIAL_ECHOLIST_N(MIXING_STEPPERS, color[j][0], color[j][1], color[j][2], color[j][3], color[j][4], color[j][5]);
158 158
         SERIAL_ECHOPGM(" ] to Mix [ ");
159
-        SERIAL_ECHOLIST_N(MIXING_STEPPERS, int(mix[0]), int(mix[1]), int(mix[2]), int(mix[3]), int(mix[4]), int(mix[5]));
159
+        SERIAL_ECHOLIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]);
160 160
         SERIAL_ECHOLNPGM(" ]");
161 161
       #endif
162 162
     }
@@ -199,9 +199,9 @@ class Mixer {
199 199
 
200 200
       #ifdef MIXER_NORMALIZER_DEBUG
201 201
         SERIAL_ECHOPGM("Gradient [ ");
202
-        SERIAL_ECHOLIST_N(MIXING_STEPPERS, int(gradient.color[0]), int(gradient.color[1]), int(gradient.color[2]), int(gradient.color[3]), int(gradient.color[4]), int(gradient.color[5]));
202
+        SERIAL_ECHOLIST_N(MIXING_STEPPERS, gradient.color[0], gradient.color[1], gradient.color[2], gradient.color[3], gradient.color[4], gradient.color[5]);
203 203
         SERIAL_ECHOPGM(" ] to Mix [ ");
204
-        SERIAL_ECHOLIST_N(MIXING_STEPPERS, int(mix[0]), int(mix[1]), int(mix[2]), int(mix[3]), int(mix[4]), int(mix[5]));
204
+        SERIAL_ECHOLIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]);
205 205
         SERIAL_ECHOLNPGM(" ]");
206 206
       #endif
207 207
     }

+ 3
- 3
Marlin/src/feature/mmu/mmu2.cpp 查看文件

@@ -514,7 +514,7 @@ static void mmu2_not_responding() {
514 514
         extruder = index; // filament change is finished
515 515
         active_extruder = 0;
516 516
         ENABLE_AXIS_E0();
517
-        SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(extruder));
517
+        SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
518 518
       }
519 519
       ui.reset_status();
520 520
     }
@@ -601,7 +601,7 @@ static void mmu2_not_responding() {
601 601
       active_extruder = 0;
602 602
 
603 603
       ENABLE_AXIS_E0();
604
-      SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(extruder));
604
+      SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
605 605
 
606 606
       ui.reset_status();
607 607
     }
@@ -696,7 +696,7 @@ static void mmu2_not_responding() {
696 696
       extruder = index; //filament change is finished
697 697
       active_extruder = 0;
698 698
       ENABLE_AXIS_E0();
699
-      SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(extruder));
699
+      SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
700 700
       ui.reset_status();
701 701
     }
702 702
 

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

@@ -130,7 +130,7 @@ fil_change_settings_t fc_settings[EXTRUDERS];
130 130
  */
131 131
 static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=PAUSE_MODE_SAME) {
132 132
   DEBUG_SECTION(est, "ensure_safe_temperature", true);
133
-  DEBUG_ECHOLNPAIR("... wait:", int(wait), " mode:", int(mode));
133
+  DEBUG_ECHOLNPAIR("... wait:", wait, " mode:", mode);
134 134
 
135 135
   #if ENABLED(PREVENT_COLD_EXTRUSION)
136 136
     if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder))
@@ -176,7 +176,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
176 176
                    DXC_ARGS
177 177
 ) {
178 178
   DEBUG_SECTION(lf, "load_filament", true);
179
-  DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " showlcd:", int(show_lcd), " pauseforuser:", int(pause_for_user), " pausemode:", int(mode) DXC_SAY);
179
+  DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", max_beep_count, " showlcd:", show_lcd, " pauseforuser:", pause_for_user, " pausemode:", mode DXC_SAY);
180 180
 
181 181
   if (!ensure_safe_temperature(false, mode)) {
182 182
     if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_STATUS, mode);
@@ -309,7 +309,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
309 309
                      #endif
310 310
 ) {
311 311
   DEBUG_SECTION(uf, "unload_filament", true);
312
-  DEBUG_ECHOLNPAIR("... unloadlen:", unload_length, " showlcd:", int(show_lcd), " mode:", int(mode)
312
+  DEBUG_ECHOLNPAIR("... unloadlen:", unload_length, " showlcd:", show_lcd, " mode:", mode
313 313
     #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
314 314
       , " mixmult:", mix_multiplier
315 315
     #endif
@@ -373,7 +373,7 @@ uint8_t did_pause_print = 0;
373 373
 
374 374
 bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
375 375
   DEBUG_SECTION(pp, "pause_print", true);
376
-  DEBUG_ECHOLNPAIR("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", int(show_lcd) DXC_SAY);
376
+  DEBUG_ECHOLNPAIR("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", show_lcd DXC_SAY);
377 377
 
378 378
   UNUSED(show_lcd);
379 379
 
@@ -456,7 +456,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
456 456
 
457 457
 void show_continue_prompt(const bool is_reload) {
458 458
   DEBUG_SECTION(scp, "pause_print", true);
459
-  DEBUG_ECHOLNPAIR("... is_reload:", int(is_reload));
459
+  DEBUG_ECHOLNPAIR("... is_reload:", is_reload);
460 460
 
461 461
   ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
462 462
   SERIAL_ECHO_START();
@@ -465,7 +465,7 @@ void show_continue_prompt(const bool is_reload) {
465 465
 
466 466
 void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
467 467
   DEBUG_SECTION(wfc, "wait_for_confirmation", true);
468
-  DEBUG_ECHOLNPAIR("... is_reload:", is_reload, " maxbeep:", int(max_beep_count) DXC_SAY);
468
+  DEBUG_ECHOLNPAIR("... is_reload:", is_reload, " maxbeep:", max_beep_count DXC_SAY);
469 469
 
470 470
   bool nozzle_timed_out = false;
471 471
 
@@ -561,7 +561,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
561 561
  */
562 562
 void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, int16_t targetTemp/*=0*/ DXC_ARGS) {
563 563
   DEBUG_SECTION(rp, "resume_print", true);
564
-  DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " targetTemp:", targetTemp DXC_SAY);
564
+  DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", max_beep_count, " targetTemp:", targetTemp DXC_SAY);
565 565
 
566 566
   /*
567 567
   SERIAL_ECHOLNPAIR(

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

@@ -532,7 +532,7 @@ void PrintJobRecovery::resume() {
532 532
 
533 533
   void PrintJobRecovery::debug(PGM_P const prefix) {
534 534
     DEBUG_PRINT_P(prefix);
535
-    DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
535
+    DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot);
536 536
     if (info.valid_head) {
537 537
       if (info.valid_head == info.valid_foot) {
538 538
         DEBUG_ECHOPGM("current_position: ");
@@ -565,7 +565,7 @@ void PrintJobRecovery::resume() {
565 565
         DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate);
566 566
 
567 567
         #if HAS_MULTI_EXTRUDER
568
-          DEBUG_ECHOLNPAIR("active_extruder: ", int(info.active_extruder));
568
+          DEBUG_ECHOLNPAIR("active_extruder: ", info.active_extruder);
569 569
         #endif
570 570
 
571 571
         #if HAS_HOTEND
@@ -584,14 +584,14 @@ void PrintJobRecovery::resume() {
584 584
         #if HAS_FAN
585 585
           DEBUG_ECHOPGM("fan_speed: ");
586 586
           FANS_LOOP(i) {
587
-            DEBUG_ECHO(int(info.fan_speed[i]));
587
+            DEBUG_ECHO(info.fan_speed[i]);
588 588
             if (i < FAN_COUNT - 1) DEBUG_CHAR(',');
589 589
           }
590 590
           DEBUG_EOL();
591 591
         #endif
592 592
 
593 593
         #if HAS_LEVELING
594
-          DEBUG_ECHOLNPAIR("leveling: ", int(info.flag.leveling), " fade: ", info.fade);
594
+          DEBUG_ECHOLNPAIR("leveling: ", info.flag.leveling, " fade: ", info.fade);
595 595
         #endif
596 596
         #if ENABLED(FWRETRACT)
597 597
           DEBUG_ECHOPGM("retract: ");
@@ -605,8 +605,8 @@ void PrintJobRecovery::resume() {
605 605
         DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename);
606 606
         DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos);
607 607
         DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
608
-        DEBUG_ECHOLNPAIR("dryrun: ", int(info.flag.dryrun));
609
-        DEBUG_ECHOLNPAIR("allow_cold_extrusion: ", int(info.flag.allow_cold_extrusion));
608
+        DEBUG_ECHOLNPAIR("dryrun: ", info.flag.dryrun);
609
+        DEBUG_ECHOLNPAIR("allow_cold_extrusion: ", info.flag.allow_cold_extrusion);
610 610
       }
611 611
       else
612 612
         DEBUG_ECHOLNPGM("INVALID DATA");

+ 3
- 3
Marlin/src/feature/repeat.cpp 查看文件

@@ -43,7 +43,7 @@ void Repeat::add_marker(const uint32_t sdpos, const uint16_t count) {
43 43
     marker[index].sdpos = sdpos;
44 44
     marker[index].counter = count ?: -1;
45 45
     index++;
46
-    DEBUG_ECHOLNPAIR("Add Marker ", int(index), " at ", sdpos, " (", count, ")");
46
+    DEBUG_ECHOLNPAIR("Add Marker ", index, " at ", sdpos, " (", count, ")");
47 47
   }
48 48
 }
49 49
 
@@ -53,14 +53,14 @@ void Repeat::loop() {
53 53
   else {
54 54
     const uint8_t ind = index - 1;      // Active marker's index
55 55
     if (!marker[ind].counter) {         // Did its counter run out?
56
-      DEBUG_ECHOLNPAIR("Pass Marker ", int(index));
56
+      DEBUG_ECHOLNPAIR("Pass Marker ", index);
57 57
       index--;                          //  Carry on. Previous marker on the next 'M808'.
58 58
     }
59 59
     else {
60 60
       card.setIndex(marker[ind].sdpos); // Loop back to the marker.
61 61
       if (marker[ind].counter > 0)      // Ignore a negative (or zero) counter.
62 62
         --marker[ind].counter;          // Decrement the counter. If zero this 'M808' will be skipped next time.
63
-      DEBUG_ECHOLNPAIR("Goto Marker ", int(index), " at ", marker[ind].sdpos, " (", marker[ind].counter, ")");
63
+      DEBUG_ECHOLNPAIR("Goto Marker ", index, " at ", marker[ind].sdpos, " (", marker[ind].counter, ")");
64 64
     }
65 65
   }
66 66
 }

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

@@ -537,7 +537,7 @@ void GcodeSuite::G26() {
537 537
 
538 538
     if (bedtemp) {
539 539
       if (!WITHIN(bedtemp, 40, BED_MAX_TARGET)) {
540
-        SERIAL_ECHOLNPAIR("?Specified bed temperature not plausible (40-", int(BED_MAX_TARGET), "C).");
540
+        SERIAL_ECHOLNPAIR("?Specified bed temperature not plausible (40-", BED_MAX_TARGET, "C).");
541 541
         return;
542 542
       }
543 543
       g26_bed_temp = bedtemp;

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

@@ -104,7 +104,7 @@ void GcodeSuite::G35() {
104 104
     const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[i], PROBE_PT_RAISE, 0, true);
105 105
 
106 106
     if (isnan(z_probed_height)) {
107
-      SERIAL_ECHOPAIR("G35 failed at point ", int(i), " (");
107
+      SERIAL_ECHOPAIR("G35 failed at point ", i, " (");
108 108
       SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
109 109
       SERIAL_CHAR(')');
110 110
       SERIAL_ECHOLNPAIR_P(SP_X_STR, screws_tilt_adjust_pos[i].x, SP_Y_STR, screws_tilt_adjust_pos[i].y);
@@ -113,7 +113,7 @@ void GcodeSuite::G35() {
113 113
     }
114 114
 
115 115
     if (DEBUGGING(LEVELING)) {
116
-      DEBUG_ECHOPAIR("Probing point ", int(i), " (");
116
+      DEBUG_ECHOPAIR("Probing point ", i, " (");
117 117
       DEBUG_PRINT_P((char *)pgm_read_ptr(&tramming_point_name[i]));
118 118
       DEBUG_CHAR(')');
119 119
       DEBUG_ECHOLNPAIR_P(SP_X_STR, screws_tilt_adjust_pos[i].x, SP_Y_STR, screws_tilt_adjust_pos[i].y, SP_Z_STR, z_probed_height);

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

@@ -637,7 +637,7 @@ G29_TYPE GcodeSuite::G29() {
637 637
           // Avoid probing outside the round or hexagonal area
638 638
           if (TERN0(IS_KINEMATIC, !probe.can_reach(probePos))) continue;
639 639
 
640
-          if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", abl_points, ".");
640
+          if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", pt_index, "/", abl_points, ".");
641 641
           TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(abl_points)));
642 642
 
643 643
           measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(probePos, raise_after, verbose_level);
@@ -682,7 +682,7 @@ G29_TYPE GcodeSuite::G29() {
682 682
       // Probe at 3 arbitrary points
683 683
 
684 684
       LOOP_L_N(i, 3) {
685
-        if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", int(i + 1), "/3.");
685
+        if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", i + 1, "/3.");
686 686
         TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i + 1)));
687 687
 
688 688
         // Retain the last probe position

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

@@ -142,7 +142,7 @@ void GcodeSuite::G29() {
142 142
       if (parser.seenval('I')) {
143 143
         ix = parser.value_int();
144 144
         if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) {
145
-          SERIAL_ECHOLNPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1), ")");
145
+          SERIAL_ECHOLNPAIR("I out of range (0-", GRID_MAX_POINTS_X - 1, ")");
146 146
           return;
147 147
         }
148 148
       }
@@ -152,7 +152,7 @@ void GcodeSuite::G29() {
152 152
       if (parser.seenval('J')) {
153 153
         iy = parser.value_int();
154 154
         if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
155
-          SERIAL_ECHOLNPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1), ")");
155
+          SERIAL_ECHOLNPAIR("J out of range (0-", GRID_MAX_POINTS_Y - 1, ")");
156 156
           return;
157 157
         }
158 158
       }
@@ -181,7 +181,7 @@ void GcodeSuite::G29() {
181 181
   } // switch(state)
182 182
 
183 183
   if (state == MeshNext)
184
-    SERIAL_ECHOLNPAIR("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS), " of ", int(GRID_MAX_POINTS));
184
+    SERIAL_ECHOLNPAIR("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS), " of ", GRID_MAX_POINTS);
185 185
 
186 186
   report_current_position();
187 187
 }

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

@@ -238,7 +238,7 @@ void GcodeSuite::G34() {
238 238
           // the next iteration of probing. This allows adjustments to be made away from the bed.
239 239
           z_measured[iprobe] = z_probed_height + Z_CLEARANCE_BETWEEN_PROBES;
240 240
 
241
-          if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(iprobe + 1), " measured position is ", z_measured[iprobe]);
241
+          if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", iprobe + 1, " measured position is ", z_measured[iprobe]);
242 242
 
243 243
           // Remember the minimum measurement to calculate the correction later on
244 244
           z_measured_min = _MIN(z_measured_min, z_measured[iprobe]);
@@ -267,7 +267,7 @@ void GcodeSuite::G34() {
267 267
           linear_fit_data lfd;
268 268
           incremental_LSF_reset(&lfd);
269 269
           LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
270
-            SERIAL_ECHOLNPAIR("PROBEPT_", int(i), ": ", z_measured[i]);
270
+            SERIAL_ECHOLNPAIR("PROBEPT_", i, ": ", z_measured[i]);
271 271
             incremental_LSF(&lfd, z_stepper_align.xy[i], z_measured[i]);
272 272
           }
273 273
           finish_incremental_LSF(&lfd);
@@ -357,8 +357,8 @@ void GcodeSuite::G34() {
357 357
 
358 358
             // Check for less accuracy compared to last move
359 359
             if (decreasing_accuracy(last_z_align_move[zstepper], z_align_abs)) {
360
-              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " last_z_align_move = ", last_z_align_move[zstepper]);
361
-              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " z_align_abs = ", z_align_abs);
360
+              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", zstepper + 1, " last_z_align_move = ", last_z_align_move[zstepper]);
361
+              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", zstepper + 1, " z_align_abs = ", z_align_abs);
362 362
               adjustment_reverse = !adjustment_reverse;
363 363
             }
364 364
 
@@ -370,7 +370,7 @@ void GcodeSuite::G34() {
370 370
           // Stop early if all measured points achieve accuracy target
371 371
           if (z_align_abs > z_auto_align_accuracy) success_break = false;
372 372
 
373
-          if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " corrected by ", z_align_move);
373
+          if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", zstepper + 1, " corrected by ", z_align_move);
374 374
 
375 375
           // Lock all steppers except one
376 376
           stepper.set_all_z_lock(true, zstepper);
@@ -380,7 +380,7 @@ void GcodeSuite::G34() {
380 380
             // Will match reversed Z steppers on dual steppers. Triple will need more work to map.
381 381
             if (adjustment_reverse) {
382 382
               z_align_move = -z_align_move;
383
-              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " correction reversed to ", z_align_move);
383
+              if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", zstepper + 1, " correction reversed to ", z_align_move);
384 384
             }
385 385
           #endif
386 386
 
@@ -406,7 +406,7 @@ void GcodeSuite::G34() {
406 406
       if (err_break)
407 407
         SERIAL_ECHOLNPGM("G34 aborted.");
408 408
       else {
409
-        SERIAL_ECHOLNPAIR("Did ", int(iteration + (iteration != z_auto_align_iterations)), " of ", int(z_auto_align_iterations));
409
+        SERIAL_ECHOLNPAIR("Did ", iteration + (iteration != z_auto_align_iterations), " of ", z_auto_align_iterations);
410 410
         SERIAL_ECHOLNPAIR_F("Accuracy: ", z_maxdiff);
411 411
       }
412 412
 
@@ -467,10 +467,10 @@ void GcodeSuite::M422() {
467 467
 
468 468
   if (!parser.seen_any()) {
469 469
     LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS)
470
-      SERIAL_ECHOLNPAIR_P(PSTR("M422 S"), int(i + 1), SP_X_STR, z_stepper_align.xy[i].x, SP_Y_STR, z_stepper_align.xy[i].y);
470
+      SERIAL_ECHOLNPAIR_P(PSTR("M422 S"), i + 1, SP_X_STR, z_stepper_align.xy[i].x, SP_Y_STR, z_stepper_align.xy[i].y);
471 471
     #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
472 472
       LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS)
473
-        SERIAL_ECHOLNPAIR_P(PSTR("M422 W"), int(i + 1), SP_X_STR, z_stepper_align.stepper_xy[i].x, SP_Y_STR, z_stepper_align.stepper_xy[i].y);
473
+        SERIAL_ECHOLNPAIR_P(PSTR("M422 W"), i + 1, SP_X_STR, z_stepper_align.stepper_xy[i].x, SP_Y_STR, z_stepper_align.stepper_xy[i].y);
474 474
     #endif
475 475
     return;
476 476
   }

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

@@ -375,7 +375,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
375 375
 
376 376
   inline void report_measured_positional_error(const measurements_t &m) {
377 377
     SERIAL_CHAR('T');
378
-    SERIAL_ECHO(int(active_extruder));
378
+    SERIAL_ECHO(active_extruder);
379 379
     SERIAL_ECHOLNPGM(" Positional Error:");
380 380
     #if HAS_X_CENTER
381 381
       SERIAL_ECHOLNPAIR_P(SP_X_STR, m.pos_error.x);
@@ -408,7 +408,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
408 408
     //
409 409
     inline void report_hotend_offsets() {
410 410
       LOOP_S_L_N(e, 1, HOTENDS)
411
-        SERIAL_ECHOLNPAIR_P(PSTR("T"), int(e), PSTR(" Hotend Offset X"), hotend_offset[e].x, SP_Y_STR, hotend_offset[e].y, SP_Z_STR, hotend_offset[e].z);
411
+        SERIAL_ECHOLNPAIR_P(PSTR("T"), e, PSTR(" Hotend Offset X"), hotend_offset[e].x, SP_Y_STR, hotend_offset[e].y, SP_Z_STR, hotend_offset[e].z);
412 412
     }
413 413
   #endif
414 414
 

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

@@ -240,8 +240,8 @@ void GcodeSuite::M48() {
240 240
       sigma = SQRT(dev_sum / (n + 1));
241 241
 
242 242
       if (verbose_level > 1) {
243
-        SERIAL_ECHO((int)(n + 1));
244
-        SERIAL_ECHOPAIR(" of ", (int)n_samples);
243
+        SERIAL_ECHO(n + 1);
244
+        SERIAL_ECHOPAIR(" of ", n_samples);
245 245
         SERIAL_ECHOPAIR_F(": z: ", pz, 3);
246 246
         SERIAL_CHAR(' ');
247 247
         dev_report(verbose_level > 2, mean, sigma, min, max);

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

@@ -47,7 +47,7 @@ void M217_report(const bool eeprom=false) {
47 47
                     " G", toolchange_settings.fan_time);
48 48
 
49 49
     #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
50
-      SERIAL_ECHOPAIR(" A", int(migration.automode));
50
+      SERIAL_ECHOPAIR(" A", migration.automode);
51 51
       SERIAL_ECHOPAIR(" L", LINEAR_UNIT(migration.last));
52 52
     #endif
53 53
 

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

@@ -50,7 +50,7 @@ void GcodeSuite::M305() {
50 50
 
51 51
   // A valid P index is required
52 52
   if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0))
53
-    SERIAL_ECHO_MSG("!Invalid index. (0 <= P <= ", int(USER_THERMISTORS - 1), ")");
53
+    SERIAL_ECHO_MSG("!Invalid index. (0 <= P <= ", USER_THERMISTORS - 1, ")");
54 54
   else if (do_set) {
55 55
     if (parser.seen('R')) // Pullup resistor value
56 56
       if (!thermalManager.set_pull_up_res(t_index, parser.value_float()))

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

@@ -131,7 +131,7 @@ inline void servo_probe_test() {
131 131
     const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR);
132 132
 
133 133
     SERIAL_ECHOLNPAIR("Servo probe test\n"
134
-                      ". using index:  ", int(probe_index),
134
+                      ". using index:  ", probe_index,
135 135
                       ", deploy angle: ", servo_angles[probe_index][0],
136 136
                       ", stow angle:   ", servo_angles[probe_index][1]
137 137
     );
@@ -143,7 +143,7 @@ inline void servo_probe_test() {
143 143
       #define PROBE_TEST_PIN Z_MIN_PIN
144 144
       constexpr bool probe_inverting = Z_MIN_ENDSTOP_INVERTING;
145 145
 
146
-      SERIAL_ECHOLNPAIR(". Probe Z_MIN_PIN: ", int(PROBE_TEST_PIN));
146
+      SERIAL_ECHOLNPAIR(". Probe Z_MIN_PIN: ", PROBE_TEST_PIN);
147 147
       SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: ");
148 148
 
149 149
     #else
@@ -151,7 +151,7 @@ inline void servo_probe_test() {
151 151
       #define PROBE_TEST_PIN Z_MIN_PROBE_PIN
152 152
       constexpr bool probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING;
153 153
 
154
-      SERIAL_ECHOLNPAIR(". Probe Z_MIN_PROBE_PIN: ", int(PROBE_TEST_PIN));
154
+      SERIAL_ECHOLNPAIR(". Probe Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN);
155 155
       SERIAL_ECHOPGM(   ". Z_MIN_PROBE_ENDSTOP_INVERTING: ");
156 156
 
157 157
     #endif

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

@@ -37,7 +37,7 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
37 37
     LOOP_L_N(i, E_STEPPERS) {
38 38
       if (e >= 0 && i != e) continue;
39 39
       if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' ');
40
-      SERIAL_ECHOLNPAIR_P(PSTR(" M92 T"), (int)i,
40
+      SERIAL_ECHOLNPAIR_P(PSTR(" M92 T"), i,
41 41
                         SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
42 42
     }
43 43
   #endif

+ 8
- 8
Marlin/src/gcode/control/M605.cpp 查看文件

@@ -122,26 +122,26 @@
122 122
           case DXC_DUPLICATION_MODE:  DEBUG_ECHOPGM("DUPLICATION");  break;
123 123
           case DXC_MIRRORED_MODE:     DEBUG_ECHOPGM("MIRRORED");     break;
124 124
         }
125
-        DEBUG_ECHOPAIR("\nActive Ext: ", int(active_extruder));
125
+        DEBUG_ECHOPAIR("\nActive Ext: ", active_extruder);
126 126
         if (!active_extruder_parked) DEBUG_ECHOPGM(" NOT ");
127 127
         DEBUG_ECHOPGM(" parked.");
128 128
         DEBUG_ECHOPAIR("\nactive_extruder_x_pos: ", current_position.x);
129 129
         DEBUG_ECHOPAIR("\ninactive_extruder_x: ", inactive_extruder_x);
130
-        DEBUG_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
130
+        DEBUG_ECHOPAIR("\nextruder_duplication_enabled: ", extruder_duplication_enabled);
131 131
         DEBUG_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
132 132
         DEBUG_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
133 133
         DEBUG_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time);
134
-        DEBUG_ECHOPAIR("\nX1 Home X: ", x_home_pos(0), "\nX1_MIN_POS=", int(X1_MIN_POS), "\nX1_MAX_POS=", int(X1_MAX_POS));
135
-        DEBUG_ECHOPAIR("\nX2 Home X: ", x_home_pos(1), "\nX2_MIN_POS=", int(X2_MIN_POS), "\nX2_MAX_POS=", int(X2_MAX_POS));
136
-        DEBUG_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR), "\nX2_HOME_POS=", int(X2_HOME_POS));
134
+        DEBUG_ECHOPAIR("\nX1 Home X: ", x_home_pos(0), "\nX1_MIN_POS=", X1_MIN_POS, "\nX1_MAX_POS=", X1_MAX_POS);
135
+        DEBUG_ECHOPAIR("\nX2 Home X: ", x_home_pos(1), "\nX2_MIN_POS=", X2_MIN_POS, "\nX2_MAX_POS=", X2_MAX_POS);
136
+        DEBUG_ECHOPAIR("\nX2_HOME_DIR=", X2_HOME_DIR, "\nX2_HOME_POS=", X2_HOME_POS);
137 137
         DEBUG_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE));
138 138
         DEBUG_ECHOPAIR("\toolchange_settings.z_raise=", toolchange_settings.z_raise);
139
-        DEBUG_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET));
139
+        DEBUG_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", DEFAULT_DUPLICATION_X_OFFSET);
140 140
         DEBUG_EOL();
141 141
 
142 142
         HOTEND_LOOP() {
143
-          DEBUG_ECHOPAIR_P(SP_T_STR, int(e));
144
-          LOOP_XYZ(a) DEBUG_ECHOPAIR("  hotend_offset[", int(e), "].", XYZ_CHAR(a) | 0x20, "=", hotend_offset[e][a]);
143
+          DEBUG_ECHOPAIR_P(SP_T_STR, e);
144
+          LOOP_XYZ(a) DEBUG_ECHOPAIR("  hotend_offset[", e, "].", XYZ_CHAR(a) | 0x20, "=", hotend_offset[e][a]);
145 145
           DEBUG_EOL();
146 146
         }
147 147
         DEBUG_EOL();

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

@@ -75,7 +75,7 @@ void GcodeSuite::M502() {
75 75
         if (dowrite) {
76 76
           val = parser.byteval('V');
77 77
           persistentStore.write_data(addr, &val);
78
-          SERIAL_ECHOLNPAIR("Wrote address ", addr, " with ", int(val));
78
+          SERIAL_ECHOLNPAIR("Wrote address ", addr, " with ", val);
79 79
         }
80 80
         else {
81 81
           if (parser.seenval('T')) {
@@ -90,7 +90,7 @@ void GcodeSuite::M502() {
90 90
           }
91 91
           else {
92 92
             persistentStore.read_data(addr, &val);
93
-            SERIAL_ECHOLNPAIR("Read address ", addr, " and got ", int(val));
93
+            SERIAL_ECHOLNPAIR("Read address ", addr, " and got ", val);
94 94
           }
95 95
         }
96 96
         return;

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

@@ -115,12 +115,12 @@ void GcodeSuite::M900() {
115 115
     #if ENABLED(EXTRA_LIN_ADVANCE_K)
116 116
 
117 117
       #if EXTRUDERS < 2
118
-        SERIAL_ECHOLNPAIR("Advance S", int(new_slot), " K", kref, "(S", int(!new_slot), " K", lref, ")");
118
+        SERIAL_ECHOLNPAIR("Advance S", new_slot, " K", kref, "(S", !new_slot, " K", lref, ")");
119 119
       #else
120 120
         LOOP_L_N(i, EXTRUDERS) {
121 121
           const bool slot = TEST(lin_adv_slot, i);
122
-          SERIAL_ECHOLNPAIR("Advance T", int(i), " S", int(slot), " K", planner.extruder_advance_K[i],
123
-                            "(S", int(!slot), " K", other_extruder_advance_K[i], ")");
122
+          SERIAL_ECHOLNPAIR("Advance T", i, " S", slot, " K", planner.extruder_advance_K[i],
123
+                            "(S", !slot, " K", other_extruder_advance_K[i], ")");
124 124
           SERIAL_EOL();
125 125
         }
126 126
       #endif

+ 1
- 1
Marlin/src/gcode/feature/leds/M7219.cpp 查看文件

@@ -82,7 +82,7 @@ void GcodeSuite::M7219() {
82 82
     LOOP_L_N(r, MAX7219_LINES) {
83 83
       SERIAL_ECHOPGM("led_line[");
84 84
       if (r < 10) SERIAL_CHAR(' ');
85
-      SERIAL_ECHO(int(r));
85
+      SERIAL_ECHO(r);
86 86
       SERIAL_ECHOPGM("]=");
87 87
       for (uint8_t b = 8; b--;) SERIAL_CHAR('0' + TEST(max7219.led_line[r], b));
88 88
       SERIAL_EOL();

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

@@ -30,7 +30,7 @@
30 30
 #include "../../../feature/mixing.h"
31 31
 
32 32
 inline void echo_mix() {
33
-  SERIAL_ECHOPAIR(" (", int(mixer.mix[0]), "%|", int(mixer.mix[1]), "%)");
33
+  SERIAL_ECHOPAIR(" (", mixer.mix[0], "%|", mixer.mix[1], "%)");
34 34
 }
35 35
 
36 36
 inline void echo_zt(const int t, const float &z) {
@@ -74,7 +74,7 @@ void GcodeSuite::M166() {
74 74
 
75 75
     #if ENABLED(GRADIENT_VTOOL)
76 76
       if (mixer.gradient.vtool_index >= 0) {
77
-        SERIAL_ECHOPAIR(" (T", int(mixer.gradient.vtool_index));
77
+        SERIAL_ECHOPAIR(" (T", mixer.gradient.vtool_index);
78 78
         SERIAL_CHAR(')');
79 79
       }
80 80
     #endif

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

@@ -48,7 +48,7 @@ void MAC_report() {
48 48
     SERIAL_ECHOPGM("  MAC: ");
49 49
     LOOP_L_N(i, 6) {
50 50
       if (mac[i] < 16) SERIAL_CHAR('0');
51
-      SERIAL_PRINT(mac[i], HEX);
51
+      SERIAL_PRINT(mac[i], PrintBase::Hex);
52 52
       if (i < 5) SERIAL_CHAR(':');
53 53
     }
54 54
   }

+ 1
- 1
Marlin/src/gcode/feature/pause/G61.cpp 查看文件

@@ -49,7 +49,7 @@ void GcodeSuite::G61(void) {
49 49
   // No saved position? No axes being restored?
50 50
   if (!TEST(saved_slots[slot >> 3], slot & 0x07) || !parser.seen("XYZ")) return;
51 51
 
52
-  SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
52
+  SERIAL_ECHOPAIR(STR_RESTORING_POS " S", slot);
53 53
   LOOP_XYZ(i) {
54 54
     destination[i] = parser.seen(XYZ_CHAR(i))
55 55
       ? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)

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

@@ -105,7 +105,7 @@ int8_t GcodeSuite::get_target_extruder_from_command() {
105 105
     if (e < EXTRUDERS) return e;
106 106
     SERIAL_ECHO_START();
107 107
     SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
108
-    SERIAL_ECHOLNPAIR(" " STR_INVALID_EXTRUDER " ", int(e));
108
+    SERIAL_ECHOLNPAIR(" " STR_INVALID_EXTRUDER " ", e);
109 109
     return -1;
110 110
   }
111 111
   return active_extruder;
@@ -124,7 +124,7 @@ int8_t GcodeSuite::get_target_e_stepper_from_command() {
124 124
   if (e == -1)
125 125
     SERIAL_ECHOLNPGM(" " STR_E_STEPPER_NOT_SPECIFIED);
126 126
   else
127
-    SERIAL_ECHOLNPAIR(" " STR_INVALID_E_STEPPER " ", int(e));
127
+    SERIAL_ECHOLNPAIR(" " STR_INVALID_E_STEPPER " ", e);
128 128
   return -1;
129 129
 }
130 130
 

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

@@ -38,7 +38,7 @@ void GcodeSuite::M113() {
38 38
     NOMORE(host_keepalive_interval, 60);
39 39
   }
40 40
   else
41
-    SERIAL_ECHO_MSG("M113 S", (uint16_t)host_keepalive_interval);
41
+    SERIAL_ECHO_MSG("M113 S", host_keepalive_interval);
42 42
 
43 43
 }
44 44
 

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

@@ -35,7 +35,7 @@
35 35
 static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8_t ind=-1) {
36 36
   SERIAL_ECHOPGM("Config:");
37 37
   if (pref) serialprintPGM(pref);
38
-  if (ind >= 0) { SERIAL_ECHO(int(ind)); SERIAL_CHAR(':'); }
38
+  if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); }
39 39
   serialprintPGM(name);
40 40
   SERIAL_CHAR(':');
41 41
 }

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

@@ -97,7 +97,7 @@ void GcodeSuite::M290() {
97 97
     #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
98 98
     {
99 99
       SERIAL_ECHOLNPAIR_P(
100
-        PSTR("Hotend "), int(active_extruder)
100
+        PSTR("Hotend "), active_extruder
101 101
         #if ENABLED(BABYSTEP_XY)
102 102
           , PSTR("Offset X"), hotend_offset[active_extruder].x
103 103
           , SP_Y_STR, hotend_offset[active_extruder].y

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

@@ -307,7 +307,7 @@ void GCodeParser::parse(char *p) {
307 307
 
308 308
       #if ENABLED(DEBUG_GCODE_PARSER)
309 309
         if (debug) {
310
-          SERIAL_ECHOPAIR("Got param ", param, " at index ", (int)(p - command_ptr - 1));
310
+          SERIAL_ECHOPAIR("Got param ", param, " at index ", p - command_ptr - 1);
311 311
           if (has_val) SERIAL_ECHOPGM(" (has_val)");
312 312
         }
313 313
       #endif
@@ -391,8 +391,8 @@ void GCodeParser::unknown_command_warning() {
391 391
             "\n   sec-ms: ", value_millis_from_seconds(),
392 392
             "\n      int: ", value_int(),
393 393
             "\n   ushort: ", value_ushort(),
394
-            "\n     byte: ", (int)value_byte(),
395
-            "\n     bool: ", (int)value_bool(),
394
+            "\n     byte: ", value_byte(),
395
+            "\n     bool: ", value_bool(),
396 396
             "\n   linear: ", value_linear_units(),
397 397
             "\n  celsius: ", value_celsius()
398 398
           );

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

@@ -133,9 +133,9 @@ public:
133 133
       param[ind] = ptr ? ptr - command_ptr : 0;  // parameter offset or 0
134 134
       #if ENABLED(DEBUG_GCODE_PARSER)
135 135
         if (codenum == 800) {
136
-          SERIAL_ECHOPAIR("Set bit ", (int)ind, " of codebits (", hex_address((void*)(codebits >> 16)));
136
+          SERIAL_ECHOPAIR("Set bit ", ind, " of codebits (", hex_address((void*)(codebits >> 16)));
137 137
           print_hex_word((uint16_t)(codebits & 0xFFFF));
138
-          SERIAL_ECHOLNPAIR(") | param = ", (int)param[ind]);
138
+          SERIAL_ECHOLNPAIR(") | param = ", param[ind]);
139 139
         }
140 140
       #endif
141 141
     }

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

@@ -58,7 +58,7 @@ void GcodeSuite::M851() {
58 58
       if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
59 59
         offs.x = x;
60 60
       else {
61
-        SERIAL_ECHOLNPAIR("?X out of range (-", int(X_BED_SIZE), " to ", int(X_BED_SIZE), ")");
61
+        SERIAL_ECHOLNPAIR("?X out of range (-", X_BED_SIZE, " to ", X_BED_SIZE, ")");
62 62
         ok = false;
63 63
       }
64 64
     #else
@@ -72,7 +72,7 @@ void GcodeSuite::M851() {
72 72
       if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
73 73
         offs.y = y;
74 74
       else {
75
-        SERIAL_ECHOLNPAIR("?Y out of range (-", int(Y_BED_SIZE), " to ", int(Y_BED_SIZE), ")");
75
+        SERIAL_ECHOLNPAIR("?Y out of range (-", Y_BED_SIZE, " to ", Y_BED_SIZE, ")");
76 76
         ok = false;
77 77
       }
78 78
     #else
@@ -85,7 +85,7 @@ void GcodeSuite::M851() {
85 85
     if (WITHIN(z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
86 86
       offs.z = z;
87 87
     else {
88
-      SERIAL_ECHOLNPAIR("?Z out of range (", int(Z_PROBE_OFFSET_RANGE_MIN), " to ", int(Z_PROBE_OFFSET_RANGE_MAX), ")");
88
+      SERIAL_ECHOLNPAIR("?Z out of range (", Z_PROBE_OFFSET_RANGE_MIN, " to ", Z_PROBE_OFFSET_RANGE_MAX, ")");
89 89
       ok = false;
90 90
     }
91 91
   }

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

@@ -302,8 +302,8 @@ void GCodeQueue::ok_to_send() {
302 302
       while (NUMERIC_SIGNED(*p))
303 303
         SERIAL_CHAR(*p++);
304 304
     }
305
-    SERIAL_ECHOPAIR_P(SP_P_STR, int(planner.moves_free()),
306
-                      SP_B_STR, int(BUFSIZE - length));
305
+    SERIAL_ECHOPAIR_P(SP_P_STR, planner.moves_free(),
306
+                      SP_B_STR, BUFSIZE - length);
307 307
   #endif
308 308
   SERIAL_EOL();
309 309
 }

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

@@ -1772,7 +1772,7 @@ void HMI_SDCardUpdate() {
1772 1772
   if (HMI_flag.home_flag) return;
1773 1773
   if (DWIN_lcd_sd_status != card.isMounted()) {
1774 1774
     DWIN_lcd_sd_status = card.isMounted();
1775
-    // SERIAL_ECHOLNPAIR("HMI_SDCardUpdate: ", int(DWIN_lcd_sd_status));
1775
+    // SERIAL_ECHOLNPAIR("HMI_SDCardUpdate: ", DWIN_lcd_sd_status);
1776 1776
     if (DWIN_lcd_sd_status) {
1777 1777
       if (checkkey == SelectFile)
1778 1778
         Redraw_SD_List();

+ 1
- 1
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp 查看文件

@@ -141,7 +141,7 @@ void AnycubicTFTClass::OnKillTFT() {
141 141
 
142 142
 void AnycubicTFTClass::OnSDCardStateChange(bool isInserted) {
143 143
   #if ENABLED(ANYCUBIC_LCD_DEBUG)
144
-    SERIAL_ECHOLNPAIR("TFT Serial Debug: OnSDCardStateChange event triggered...", (int)isInserted);
144
+    SERIAL_ECHOLNPAIR("TFT Serial Debug: OnSDCardStateChange event triggered...", isInserted);
145 145
   #endif
146 146
   DoSDCardStateCheck();
147 147
 }

+ 2
- 2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp 查看文件

@@ -1083,7 +1083,7 @@ void CLCD::init() {
1083 1083
 
1084 1084
    if (counter == 249) {
1085 1085
       #if ENABLED(TOUCH_UI_DEBUG)
1086
-        SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", int(device_id));
1086
+        SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", device_id);
1087 1087
       #endif
1088 1088
     }
1089 1089
   }
@@ -1101,7 +1101,7 @@ void CLCD::init() {
1101 1101
       delay(1);
1102 1102
 
1103 1103
     if (ENABLED(TOUCH_UI_DEBUG) && counter == 99)
1104
-      SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", int(reset_status));
1104
+      SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", reset_status);
1105 1105
   }
1106 1106
 
1107 1107
   mem_write_8(REG::PWM_DUTY, 0);   // turn off Backlight, Frequency already is set to 250Hz default

+ 2
- 2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp 查看文件

@@ -124,7 +124,7 @@ namespace FTDI {
124 124
       case UNPRESSED:
125 125
         if (tag != 0) {
126 126
           #if ENABLED(TOUCH_UI_DEBUG)
127
-            SERIAL_ECHO_MSG("Touch start: ", int(tag));
127
+            SERIAL_ECHO_MSG("Touch start: ", tag);
128 128
           #endif
129 129
 
130 130
           pressed_tag = tag;
@@ -185,7 +185,7 @@ namespace FTDI {
185 185
             if (UIData::flags.bits.touch_end_sound) sound.play(unpress_sound);
186 186
 
187 187
             #if ENABLED(TOUCH_UI_DEBUG)
188
-              SERIAL_ECHO_MSG("Touch end: ", int(pressed_tag));
188
+              SERIAL_ECHO_MSG("Touch end: ", pressed_tag);
189 189
             #endif
190 190
 
191 191
             const uint8_t saved_pressed_tag = pressed_tag;

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp 查看文件

@@ -43,7 +43,7 @@ void ScreenRef::setScreen(onRedraw_func_t onRedraw_ptr) {
43 43
   if (type != 0xFF) {
44 44
     setType(type);
45 45
     #if ENABLED(TOUCH_UI_DEBUG)
46
-      SERIAL_ECHO_MSG("New screen: ", int(type));
46
+      SERIAL_ECHO_MSG("New screen: ", type);
47 47
     #endif
48 48
   }
49 49
 }

+ 1
- 3
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp 查看文件

@@ -37,9 +37,7 @@ namespace FTDI {
37 37
   void SoundPlayer::play(effect_t effect, note_t note) {
38 38
 
39 39
     #if ENABLED(TOUCH_UI_DEBUG)
40
-      SERIAL_ECHO_START();
41
-      SERIAL_ECHOPAIR  ("Playing note ", int(note));
42
-      SERIAL_ECHOLNPAIR(", instrument ", int(effect));
40
+      SERIAL_ECHO_MSG("Playing note ", note, ", instrument ", effect);
43 41
     #endif
44 42
 
45 43
     // Play the note

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

@@ -751,7 +751,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
751 751
         // For Cartesian / Core motion simply move to the current_position
752 752
         planner.buffer_line(current_position, fr_mm_s, axis == E_AXIS ? e_index : active_extruder);
753 753
 
754
-        //SERIAL_ECHOLNPAIR("Add planner.move with Axis ", int(axis), " at FR ", fr_mm_s);
754
+        //SERIAL_ECHOLNPAIR("Add planner.move with Axis ", axis, " at FR ", fr_mm_s);
755 755
 
756 756
         axis = NO_AXIS;
757 757
 
@@ -772,7 +772,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
772 772
     #endif
773 773
     start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
774 774
     axis = move_axis;
775
-    //SERIAL_ECHOLNPAIR("Post Move with Axis ", int(axis), " soon.");
775
+    //SERIAL_ECHOLNPAIR("Post Move with Axis ", axis, " soon.");
776 776
   }
777 777
 
778 778
   #if ENABLED(AUTO_BED_LEVELING_UBL)

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

@@ -216,7 +216,7 @@ void menu_advanced_settings();
216 216
 
217 217
   #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
218 218
     void bltouch_report() {
219
-      SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", (int)bltouch.last_written_mode);
219
+      SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", bltouch.last_written_mode);
220 220
       SERIAL_ECHOLNPGM("Configuration BLTouch Mode - " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD"));
221 221
       char mess[21];
222 222
       strcpy_P(mess, PSTR("BLTouch Mode - "));

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

@@ -120,7 +120,7 @@ public:
120 120
 
121 121
   static void report(const uint8_t index) {
122 122
     if (index < Cfg::SIZE) {
123
-      SERIAL_ECHOPAIR("bresenham ", int(index), " : (", dividend[index], "/", divisor, ") ");
123
+      SERIAL_ECHOPAIR("bresenham ", index, " : (", dividend[index], "/", divisor, ") ");
124 124
       if (counter[index] >= 0) SERIAL_CHAR(' ');
125 125
       if (labs(counter[index]) < 100) { SERIAL_CHAR(' '); if (labs(counter[index]) < 10) SERIAL_CHAR(' '); }
126 126
       SERIAL_ECHO(counter[index]);

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

@@ -1305,7 +1305,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
1305 1305
   const feedRate_t home_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
1306 1306
 
1307 1307
   if (DEBUGGING(LEVELING)) {
1308
-    DEBUG_ECHOPAIR("...(", axis_codes[axis], ", ", distance, ", ");
1308
+    DEBUG_ECHOPAIR("...(", AS_CHAR(axis_codes[axis]), ", ", distance, ", ");
1309 1309
     if (fr_mm_s)
1310 1310
       DEBUG_ECHO(fr_mm_s);
1311 1311
     else
@@ -1398,7 +1398,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
1398 1398
  * Callers must sync the planner position after calling this!
1399 1399
  */
1400 1400
 void set_axis_is_at_home(const AxisEnum axis) {
1401
-  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_is_at_home(", axis_codes[axis], ")");
1401
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_is_at_home(", AS_CHAR(axis_codes[axis]), ")");
1402 1402
 
1403 1403
   set_axis_trusted(axis);
1404 1404
   set_axis_homed(axis);
@@ -1448,7 +1448,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
1448 1448
 
1449 1449
   if (DEBUGGING(LEVELING)) {
1450 1450
     #if HAS_HOME_OFFSET
1451
-      DEBUG_ECHOLNPAIR("> home_offset[", axis_codes[axis], "] = ", home_offset[axis]);
1451
+      DEBUG_ECHOLNPAIR("> home_offset[", AS_CHAR(axis_codes[axis]), "] = ", home_offset[axis]);
1452 1452
     #endif
1453 1453
     DEBUG_POS("", current_position);
1454 1454
     DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")");

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

@@ -719,7 +719,7 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
719 719
     DEBUG_ECHOLNPAIR(
720 720
       "...(", LOGICAL_X_POSITION(rx), ", ", LOGICAL_Y_POSITION(ry),
721 721
       ", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none",
722
-      ", ", int(verbose_level),
722
+      ", ", verbose_level,
723 723
       ", ", probe_relative ? "probe" : "nozzle", "_relative)"
724 724
     );
725 725
     DEBUG_POS("", current_position);

+ 18
- 20
Marlin/src/module/settings.cpp 查看文件

@@ -2289,7 +2289,7 @@ void MarlinSettings::postprocess() {
2289 2289
       eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
2290 2290
       if (eeprom_error) {
2291 2291
         DEBUG_ECHO_START();
2292
-        DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
2292
+        DEBUG_ECHOLNPAIR("Index: ", eeprom_index - (EEPROM_OFFSET), " Size: ", datasize());
2293 2293
         IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_index());
2294 2294
       }
2295 2295
       else if (working_crc != stored_crc) {
@@ -3039,7 +3039,7 @@ void MarlinSettings::reset() {
3039 3039
       }
3040 3040
 
3041 3041
       #if EXTRUDERS == 1
3042
-        CONFIG_ECHO_MSG("  M200 S", int(parser.volumetric_enabled)
3042
+        CONFIG_ECHO_MSG("  M200 S", parser.volumetric_enabled
3043 3043
                             , " D", LINEAR_UNIT(planner.filament_size[0])
3044 3044
                             #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
3045 3045
                               , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[0])
@@ -3047,14 +3047,14 @@ void MarlinSettings::reset() {
3047 3047
                        );
3048 3048
       #else
3049 3049
         LOOP_L_N(i, EXTRUDERS) {
3050
-          CONFIG_ECHO_MSG("  M200 T", int(i)
3050
+          CONFIG_ECHO_MSG("  M200 T", i
3051 3051
                               , " D", LINEAR_UNIT(planner.filament_size[i])
3052 3052
                               #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
3053 3053
                                 , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[i])
3054 3054
                               #endif
3055 3055
                          );
3056 3056
         }
3057
-        CONFIG_ECHO_MSG("  M200 S", int(parser.volumetric_enabled));
3057
+        CONFIG_ECHO_MSG("  M200 S", parser.volumetric_enabled);
3058 3058
       #endif
3059 3059
 
3060 3060
     #endif // EXTRUDERS && !NO_VOLUMETRICS
@@ -3076,7 +3076,7 @@ void MarlinSettings::reset() {
3076 3076
       LOOP_L_N(i, E_STEPPERS) {
3077 3077
         CONFIG_ECHO_START();
3078 3078
         SERIAL_ECHOLNPAIR_P(
3079
-            PSTR("  M203 T"), (int)i
3079
+            PSTR("  M203 T"), i
3080 3080
           , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)])
3081 3081
         );
3082 3082
       }
@@ -3096,7 +3096,7 @@ void MarlinSettings::reset() {
3096 3096
       LOOP_L_N(i, E_STEPPERS) {
3097 3097
         CONFIG_ECHO_START();
3098 3098
         SERIAL_ECHOLNPAIR_P(
3099
-            PSTR("  M201 T"), (int)i
3099
+            PSTR("  M201 T"), i
3100 3100
           , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)])
3101 3101
         );
3102 3102
       }
@@ -3158,7 +3158,7 @@ void MarlinSettings::reset() {
3158 3158
       CONFIG_ECHO_START();
3159 3159
       LOOP_S_L_N(e, 1, HOTENDS) {
3160 3160
         SERIAL_ECHOPAIR_P(
3161
-          PSTR("  M218 T"), (int)e,
3161
+          PSTR("  M218 T"), e,
3162 3162
           SP_X_STR, LINEAR_UNIT(hotend_offset[e].x),
3163 3163
           SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y)
3164 3164
         );
@@ -3192,7 +3192,7 @@ void MarlinSettings::reset() {
3192 3192
 
3193 3193
       CONFIG_ECHO_START();
3194 3194
       SERIAL_ECHOLNPAIR_P(
3195
-        PSTR("  M420 S"), int(planner.leveling_active)
3195
+        PSTR("  M420 S"), planner.leveling_active
3196 3196
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
3197 3197
           , SP_Z_STR, LINEAR_UNIT(planner.z_fade_height)
3198 3198
         #endif
@@ -3204,7 +3204,7 @@ void MarlinSettings::reset() {
3204 3204
           LOOP_L_N(py, GRID_MAX_POINTS_Y) {
3205 3205
             LOOP_L_N(px, GRID_MAX_POINTS_X) {
3206 3206
               CONFIG_ECHO_START();
3207
-              SERIAL_ECHOPAIR_P(PSTR("  G29 S3 I"), (int)px, PSTR(" J"), (int)py);
3207
+              SERIAL_ECHOPAIR_P(PSTR("  G29 S3 I"), px, PSTR(" J"), py);
3208 3208
               SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(mbl.z_values[px][py]), 5);
3209 3209
             }
3210 3210
           }
@@ -3233,7 +3233,7 @@ void MarlinSettings::reset() {
3233 3233
           LOOP_L_N(py, GRID_MAX_POINTS_Y) {
3234 3234
             LOOP_L_N(px, GRID_MAX_POINTS_X) {
3235 3235
               CONFIG_ECHO_START();
3236
-              SERIAL_ECHOPAIR("  G29 W I", (int)px, " J", (int)py);
3236
+              SERIAL_ECHOPAIR("  G29 W I", px, " J", py);
3237 3237
               SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(z_values[px][py]), 5);
3238 3238
             }
3239 3239
           }
@@ -3258,7 +3258,7 @@ void MarlinSettings::reset() {
3258 3258
           #elif ENABLED(BLTOUCH) || (HAS_Z_SERVO_PROBE && defined(Z_SERVO_ANGLES))
3259 3259
             case Z_PROBE_SERVO_NR:
3260 3260
           #endif
3261
-            CONFIG_ECHO_MSG("  M281 P", int(i), " L", servo_angles[i][0], " U", servo_angles[i][1]);
3261
+            CONFIG_ECHO_MSG("  M281 P", i, " L", servo_angles[i][0], " U", servo_angles[i][1]);
3262 3262
           default: break;
3263 3263
         }
3264 3264
       }
@@ -3334,7 +3334,7 @@ void MarlinSettings::reset() {
3334 3334
       LOOP_L_N(i, PREHEAT_COUNT) {
3335 3335
         CONFIG_ECHO_START();
3336 3336
         SERIAL_ECHOLNPAIR_P(
3337
-          PSTR("  M145 S"), (int)i
3337
+          PSTR("  M145 S"), i
3338 3338
           #if HAS_HOTEND
3339 3339
             , PSTR(" H"), TEMP_UNIT(ui.material_preset[i].hotend_temp)
3340 3340
           #endif
@@ -3403,7 +3403,7 @@ void MarlinSettings::reset() {
3403 3403
 
3404 3404
     #if ENABLED(POWER_LOSS_RECOVERY)
3405 3405
       CONFIG_ECHO_HEADING("Power-Loss Recovery:");
3406
-      CONFIG_ECHO_MSG("  M413 S", int(recovery.enabled));
3406
+      CONFIG_ECHO_MSG("  M413 S", recovery.enabled);
3407 3407
     #endif
3408 3408
 
3409 3409
     #if ENABLED(FWRETRACT)
@@ -3425,11 +3425,9 @@ void MarlinSettings::reset() {
3425 3425
       );
3426 3426
 
3427 3427
       #if ENABLED(FWRETRACT_AUTORETRACT)
3428
-
3429 3428
         CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
3430
-        CONFIG_ECHO_MSG("  M209 S", int(fwretract.autoretract_enabled));
3431
-
3432
-      #endif // FWRETRACT_AUTORETRACT
3429
+        CONFIG_ECHO_MSG("  M209 S", fwretract.autoretract_enabled);
3430
+      #endif
3433 3431
 
3434 3432
     #endif // FWRETRACT
3435 3433
 
@@ -3775,7 +3773,7 @@ void MarlinSettings::reset() {
3775 3773
         CONFIG_ECHO_MSG("  M900 K", planner.extruder_advance_K[0]);
3776 3774
       #else
3777 3775
         LOOP_L_N(i, EXTRUDERS)
3778
-          CONFIG_ECHO_MSG("  M900 T", int(i), " K", planner.extruder_advance_K[i]);
3776
+          CONFIG_ECHO_MSG("  M900 T", i, " K", planner.extruder_advance_K[i]);
3779 3777
       #endif
3780 3778
     #endif
3781 3779
 
@@ -3841,7 +3839,7 @@ void MarlinSettings::reset() {
3841 3839
     #if HAS_FILAMENT_SENSOR
3842 3840
       CONFIG_ECHO_HEADING("Filament runout sensor:");
3843 3841
       CONFIG_ECHO_MSG(
3844
-        "  M412 S", int(runout.enabled)
3842
+        "  M412 S", runout.enabled
3845 3843
         #if HAS_FILAMENT_RUNOUT_DISTANCE
3846 3844
           , " D", LINEAR_UNIT(runout.runout_distance())
3847 3845
         #endif
@@ -3859,7 +3857,7 @@ void MarlinSettings::reset() {
3859 3857
 
3860 3858
     #if HAS_MULTI_LANGUAGE
3861 3859
       CONFIG_ECHO_HEADING("UI Language:");
3862
-      SERIAL_ECHO_MSG("  M414 S", int(ui.language));
3860
+      SERIAL_ECHO_MSG("  M414 S", ui.language);
3863 3861
     #endif
3864 3862
   }
3865 3863
 

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

@@ -828,7 +828,7 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms
828 828
     serialprintPGM(serial_msg);
829 829
     SERIAL_ECHOPGM(STR_STOPPED_HEATER);
830 830
     if (heater_id >= 0)
831
-      SERIAL_ECHO((int)heater_id);
831
+      SERIAL_ECHO(heater_id);
832 832
     else if (TERN0(HAS_HEATED_CHAMBER, heater_id == H_CHAMBER))
833 833
       SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
834 834
     else
@@ -1494,7 +1494,7 @@ void Temperature::manage_heater() {
1494 1494
   float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
1495 1495
       if (e > HOTENDS - DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)) {
1496 1496
         SERIAL_ERROR_START();
1497
-        SERIAL_ECHO((int)e);
1497
+        SERIAL_ECHO(e);
1498 1498
         SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
1499 1499
         kill();
1500 1500
         return 0;
@@ -2065,7 +2065,7 @@ void Temperature::init() {
2065 2065
       switch (heater_id) {
2066 2066
         case H_BED:     SERIAL_ECHOPGM("bed"); break;
2067 2067
         case H_CHAMBER: SERIAL_ECHOPGM("chamber"); break;
2068
-        default:        SERIAL_ECHO((int)heater_id);
2068
+        default:        SERIAL_ECHO(heater_id);
2069 2069
       }
2070 2070
       SERIAL_ECHOLNPAIR(
2071 2071
         " ; sizeof(running_temp):", sizeof(running_temp),

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

@@ -186,7 +186,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
186 186
 
187 187
     current_position.x = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
188 188
 
189
-    DEBUG_ECHOPAIR("(1) Move extruder ", int(new_tool));
189
+    DEBUG_ECHOPAIR("(1) Move extruder ", new_tool);
190 190
     DEBUG_POS(" to new extruder ParkPos", current_position);
191 191
 
192 192
     planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
@@ -196,7 +196,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
196 196
 
197 197
     current_position.x = grabpos + offsetcompensation;
198 198
 
199
-    DEBUG_ECHOPAIR("(2) Couple extruder ", int(new_tool));
199
+    DEBUG_ECHOPAIR("(2) Couple extruder ", new_tool);
200 200
     DEBUG_POS(" to new extruder GrabPos", current_position);
201 201
 
202 202
     planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
@@ -209,7 +209,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
209 209
 
210 210
     current_position.x = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
211 211
 
212
-    DEBUG_ECHOPAIR("(3) Move extruder ", int(new_tool));
212
+    DEBUG_ECHOPAIR("(3) Move extruder ", new_tool);
213 213
     DEBUG_POS(" back to new extruder ParkPos", current_position);
214 214
 
215 215
     planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
@@ -219,7 +219,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
219 219
 
220 220
     current_position.x = mpe_settings.parking_xpos[active_extruder] + (active_extruder == 0 ? MPE_TRAVEL_DISTANCE : -MPE_TRAVEL_DISTANCE) + offsetcompensation;
221 221
 
222
-    DEBUG_ECHOPAIR("(4) Move extruder ", int(new_tool));
222
+    DEBUG_ECHOPAIR("(4) Move extruder ", new_tool);
223 223
     DEBUG_POS(" close to old extruder ParkPos", current_position);
224 224
 
225 225
     planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
@@ -229,7 +229,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
229 229
 
230 230
     current_position.x = mpe_settings.parking_xpos[active_extruder] + offsetcompensation;
231 231
 
232
-    DEBUG_ECHOPAIR("(5) Park extruder ", int(new_tool));
232
+    DEBUG_ECHOPAIR("(5) Park extruder ", new_tool);
233 233
     DEBUG_POS(" at old extruder ParkPos", current_position);
234 234
 
235 235
     planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
@@ -239,7 +239,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
239 239
 
240 240
     current_position.x = oldx;
241 241
 
242
-    DEBUG_ECHOPAIR("(6) Move extruder ", int(new_tool));
242
+    DEBUG_ECHOPAIR("(6) Move extruder ", new_tool);
243 243
     DEBUG_POS(" to starting position", current_position);
244 244
 
245 245
     planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
@@ -274,9 +274,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
274 274
 
275 275
     if (homed_towards_final_tool) {
276 276
       pe_solenoid_magnet_off(1 - final_tool);
277
-      DEBUG_ECHOLNPAIR("Disengage magnet", (int)(1 - final_tool));
277
+      DEBUG_ECHOLNPAIR("Disengage magnet", 1 - final_tool);
278 278
       pe_solenoid_magnet_on(final_tool);
279
-      DEBUG_ECHOLNPAIR("Engage magnet", (int)final_tool);
279
+      DEBUG_ECHOLNPAIR("Engage magnet", final_tool);
280 280
       parking_extruder_set_parked(false);
281 281
       return false;
282 282
     }
@@ -315,7 +315,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
315 315
       if (!extruder_parked) {
316 316
         current_position.x = parkingposx[active_extruder] + x_offset;
317 317
 
318
-        DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
318
+        DEBUG_ECHOLNPAIR("(1) Park extruder ", active_extruder);
319 319
         DEBUG_POS("Moving ParkPos", current_position);
320 320
 
321 321
         fast_line_to_current(X_AXIS);
@@ -411,7 +411,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
411 411
 
412 412
     current_position.x = placexpos;
413 413
 
414
-    DEBUG_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
414
+    DEBUG_ECHOLNPAIR("(1) Place old tool ", active_extruder);
415 415
     DEBUG_POS("Move X SwitchPos", current_position);
416 416
 
417 417
     fast_line_to_current(X_AXIS);
@@ -509,7 +509,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
509 509
 
510 510
     current_position.y = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR;
511 511
 
512
-    SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
512
+    SERIAL_ECHOLNPAIR("(1) Place old tool ", active_extruder);
513 513
     DEBUG_POS("Move Y SwitchPos + Security", current_position);
514 514
 
515 515
     fast_line_to_current(Y_AXIS);
@@ -709,7 +709,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
709 709
 #if EXTRUDERS
710 710
   inline void invalid_extruder_error(const uint8_t e) {
711 711
     SERIAL_ECHO_START();
712
-    SERIAL_CHAR('T'); SERIAL_ECHO((int)e);
712
+    SERIAL_CHAR('T'); SERIAL_ECHO(e);
713 713
     SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER);
714 714
   }
715 715
 #endif
@@ -1196,7 +1196,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1196 1196
         gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_AFTER_TOOLCHANGE));
1197 1197
     #endif
1198 1198
 
1199
-    SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(active_extruder));
1199
+    SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, active_extruder);
1200 1200
 
1201 1201
   #endif // HAS_MULTI_EXTRUDER
1202 1202
 }

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

@@ -926,7 +926,7 @@ int SdBaseFile::peek() {
926 926
 // print uint8_t with width 2
927 927
 static void print2u(const uint8_t v) {
928 928
   if (v < 10) SERIAL_CHAR('0');
929
-  SERIAL_ECHO((int)v);
929
+  SERIAL_ECHO(v);
930 930
 }
931 931
 
932 932
 /**

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

@@ -583,7 +583,7 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0*
583 583
 
584 584
         // Too deep? The firmware has to bail.
585 585
         if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
586
-          SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:", int(SD_PROCEDURE_DEPTH));
586
+          SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:", SD_PROCEDURE_DEPTH);
587 587
           kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW));
588 588
           return;
589 589
         }

+ 20
- 0
docs/Serial.md 查看文件

@@ -40,5 +40,25 @@ typedef MultiSerial< RuntimeSerial<Serial>, ConditionalSerial<TelnetClient> > Se
40 40
 By default, the serial base interface provide an emergency parser that's only enable for serial classes that support it.
41 41
 Because of this condition, all underlying type takes a first `bool emergencyParserEnabled` argument to their constructor. You must take into account this parameter when defining the actual type used.
42 42
 
43
+## SERIAL macros
44
+The following macros are defined (in `serial.h`) to output data to the serial ports:
45
+
46
+| MACRO | Parameters | Usage | Example | Expected output |
47
+|-------|------------|-------|---------|-----------------|
48
+| `SERIAL_ECHO` | Any basic type is supported (`char`, `uint8_t`, `int16_t`, `int32_t`, `float`, `long`, `const char*`, ...). | For a numeric type it prints the number in decimal. A string is output as a string. | `uint8_t a = 123; SERIAL_ECHO(a); SERIAL_CHAR(' '); SERIAL_ECHO(' '); ` | `123 32` |
49
+| `SERIAL_ECHOLN` | Same as `SERIAL_ECHO` | Do `SERIAL_ECHO`, adding a newline | `int a = 456; SERIAL_ECHOLN(a);` | `456\n` |
50
+| `SERIAL_ECHO_F` | `float` or `double` | Print a decimal value with a given precision (default 2) | `float a = 3.1415; SERIAL_ECHO_F(a); SERIAL_CHAR(' '); SERIAL_ECHO_F(a, 4);` | `3.14 3.1415`|
51
+| `SERIAL_ECHOPAIR` | String / Value pairs | Print a series of string literals and values alternately | `SERIAL_ECHOPAIR("Bob", 34);` | `Bob34` |
52
+| `SERIAL_ECHOLNPAIR` | Same as `SERIAL_ECHOPAIR` | Do `SERIAL_ECHOPAIR`, adding a newline | `SERIAL_ECHOPAIR("Alice", 56);` | `alice56` |
53
+| `SERIAL_ECHOPAIR_P` | Like `SERIAL_ECHOPAIR` but takes PGM strings | Print a series of PGM strings and values alternately | `SERIAL_ECHOPAIR_P(GET_TEXT(MSG_HELLO), 123);` | `Hello123` |
54
+| `SERIAL_ECHOLNPAIR_P` | Same as `SERIAL_ECHOPAIR_P` | Do `SERIAL_ECHOPAIR_P`, adding a newline | `SERIAL_ECHOLNPAIR_P(PSTR("Alice"), 78);` | `alice78\n` |
55
+| `SERIAL_ECHOLIST` | String literal, values | Print a string literal and a list of values | `SERIAL_ECHOLIST("Key ", 1, 2, 3);` | `Key 1, 2, 3` |
56
+| `SERIAL_ECHO_START` | None | Prefix an echo line | `SERIAL_ECHO_START();` | `echo:` |
57
+| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLN_PAIR` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` |
58
+| `SERIAL_ERROR_START`| None | Prefix an error line | `SERIAL_ERROR_START();` | `Error:` |
59
+| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLN_PAIR` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` |
60
+| `SERIAL_ECHO_SP` | Number of spaces | Print one or more spaces | `SERIAL_ECHO_SP(3)` | `   ` |
61
+| `SERIAL_EOL` | None | Print an end of line | `SERIAL_EOL();` | `\n` |
62
+| `SERIAL_OUT` | `SERIAL_OUT(myMethod)` | Call a custom serial method | `SERIAL_OUT(msgDone);` | ... |
43 63
 
44 64
 *This document was written by [X-Ryl669](https://blog.cyril.by) and is under [CC-SA license](https://creativecommons.org/licenses/by-sa)*

Loading…
取消
儲存