Переглянути джерело

✨ Independent baud rates (#21949)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
charlespick 3 роки тому
джерело
коміт
29ad42e54e
Аккаунт користувача з таким Email не знайдено

+ 16
- 11
Marlin/Configuration.h Переглянути файл

@@ -105,11 +105,26 @@
105 105
 #define SERIAL_PORT 0
106 106
 
107 107
 /**
108
+ * Serial Port Baud Rate
109
+ * This is the default communication speed for all serial ports.
110
+ * Set the baud rate defaults for additional serial ports below.
111
+ *
112
+ * 250000 works in most cases, but you might try a lower speed if
113
+ * you commonly experience drop-outs during host printing.
114
+ * You may try up to 1000000 to speed up SD file transfer.
115
+ *
116
+ * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
117
+ */
118
+#define BAUDRATE 250000
119
+//#define BAUD_RATE_GCODE     // Enable G-code M575 to set the baud rate
120
+
121
+/**
108 122
  * Select a secondary serial port on the board to use for communication with the host.
109 123
  * Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
110 124
  * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
111 125
  */
112 126
 //#define SERIAL_PORT_2 -1
127
+//#define BAUDRATE_2 250000   // Enable to override BAUDRATE
113 128
 
114 129
 /**
115 130
  * Select a third serial port on the board to use for communication with the host.
@@ -117,17 +132,7 @@
117 132
  * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
118 133
  */
119 134
 //#define SERIAL_PORT_3 1
120
-
121
-/**
122
- * This setting determines the communication speed of the printer.
123
- *
124
- * 250000 works in most cases, but you might try a lower speed if
125
- * you commonly experience drop-outs during host printing.
126
- * You may try up to 1000000 to speed up SD file transfer.
127
- *
128
- * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
129
- */
130
-#define BAUDRATE 250000
135
+//#define BAUDRATE_3 250000   // Enable to override BAUDRATE
131 136
 
132 137
 // Enable the Bluetooth serial interface on AT90USB devices
133 138
 //#define BLUETOOTH

+ 0
- 3
Marlin/Configuration_adv.h Переглянути файл

@@ -2114,9 +2114,6 @@
2114 2114
   //#define SERIAL_XON_XOFF
2115 2115
 #endif
2116 2116
 
2117
-// Add M575 G-code to change the baud rate
2118
-//#define BAUD_RATE_GCODE
2119
-
2120 2117
 #if ENABLED(SDSUPPORT)
2121 2118
   // Enable this option to collect and display the maximum
2122 2119
   // RX queue usage after transferring a file to SD.

+ 8
- 2
Marlin/src/MarlinCore.cpp Переглянути файл

@@ -1073,11 +1073,17 @@ void setup() {
1073 1073
   while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1074 1074
 
1075 1075
   #if HAS_MULTI_SERIAL && !HAS_ETHERNET
1076
-    MYSERIAL2.begin(BAUDRATE);
1076
+    #ifndef BAUDRATE_2
1077
+      #define BAUDRATE_2 BAUDRATE
1078
+    #endif
1079
+    MYSERIAL2.begin(BAUDRATE_2);
1077 1080
     serial_connect_timeout = millis() + 1000UL;
1078 1081
     while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1079 1082
     #ifdef SERIAL_PORT_3
1080
-      MYSERIAL3.begin(BAUDRATE);
1083
+      #ifndef BAUDRATE_3
1084
+        #define BAUDRATE_3 BAUDRATE
1085
+      #endif
1086
+      MYSERIAL3.begin(BAUDRATE_3);
1081 1087
       serial_connect_timeout = millis() + 1000UL;
1082 1088
       while (!MYSERIAL3.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1083 1089
     #endif

+ 1
- 1
buildroot/tests/STM32F103RC_btt_USB Переглянути файл

@@ -10,7 +10,7 @@ set -e
10 10
 # Build with the default configurations
11 11
 #
12 12
 restore_configs
13
-opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_V1_1 SERIAL_PORT 1 SERIAL_PORT_2 -1
13
+opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_V1_1 SERIAL_PORT 1 SERIAL_PORT_2 -1 BAUDRATE_2 115200
14 14
 exec_test $1 $2 "BigTreeTech SKR Mini v1.1 - Basic Configuration" "$3"
15 15
 
16 16
 # clean up

Завантаження…
Відмінити
Зберегти