浏览代码

🐛 Fix M575 port index output (#22553)

Tanguy Pruvot 3 年前
父节点
当前提交
c657fe2112
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 13 次插入7 次删除
  1. 13
    7
      Marlin/src/gcode/config/M575.cpp

+ 13
- 7
Marlin/src/gcode/config/M575.cpp 查看文件

@@ -52,19 +52,25 @@ void GcodeSuite::M575() {
52 52
     case 2400: case 9600: case 19200: case 38400: case 57600:
53 53
     case 115200: case 250000: case 500000: case 1000000: {
54 54
       const int8_t port = parser.intval('P', -99);
55
-      const bool set0 = (port == -99 || port == 0);
56
-      if (set0) SERIAL_ECHO_MSG(" Serial ", '0', " baud rate set to ", baud);
55
+      const bool set1 = (port == -99 || port == 0);
56
+      if (set1) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('0'), " baud rate set to ", baud);
57 57
       #if HAS_MULTI_SERIAL
58
-        const bool set1 = (port == -99 || port == 1);
59
-        if (set1) SERIAL_ECHO_MSG(" Serial ", '1', " baud rate set to ", baud);
58
+        const bool set2 = (port == -99 || port == 1);
59
+        if (set2) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('1'), " baud rate set to ", baud);
60
+        #ifdef SERIAL_PORT_3
61
+          const bool set3 = (port == -99 || port == 2);
62
+          if (set3) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('2'), " baud rate set to ", baud);
63
+        #endif
60 64
       #endif
61 65
 
62 66
       SERIAL_FLUSH();
63 67
 
64
-      if (set0) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
65
-
68
+      if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
66 69
       #if HAS_MULTI_SERIAL
67
-        if (set1) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
70
+        if (set2) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
71
+        #ifdef SERIAL_PORT_3
72
+          if (set3) { MYSERIAL3.end(); MYSERIAL3.begin(baud); }
73
+        #endif
68 74
       #endif
69 75
 
70 76
     } break;

正在加载...
取消
保存