Browse Source

✨ Independent baud rates (#21949)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
charlespick 3 years ago
parent
commit
29ad42e54e
No account linked to committer's email address

+ 16
- 11
Marlin/Configuration.h View File

105
 #define SERIAL_PORT 0
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
  * Select a secondary serial port on the board to use for communication with the host.
122
  * Select a secondary serial port on the board to use for communication with the host.
109
  * Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
123
  * Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
110
  * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
124
  * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
111
  */
125
  */
112
 //#define SERIAL_PORT_2 -1
126
 //#define SERIAL_PORT_2 -1
127
+//#define BAUDRATE_2 250000   // Enable to override BAUDRATE
113
 
128
 
114
 /**
129
 /**
115
  * Select a third serial port on the board to use for communication with the host.
130
  * Select a third serial port on the board to use for communication with the host.
117
  * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
132
  * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
118
  */
133
  */
119
 //#define SERIAL_PORT_3 1
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
 // Enable the Bluetooth serial interface on AT90USB devices
137
 // Enable the Bluetooth serial interface on AT90USB devices
133
 //#define BLUETOOTH
138
 //#define BLUETOOTH

+ 0
- 3
Marlin/Configuration_adv.h View File

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

+ 8
- 2
Marlin/src/MarlinCore.cpp View File

1073
   while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1073
   while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1074
 
1074
 
1075
   #if HAS_MULTI_SERIAL && !HAS_ETHERNET
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
     serial_connect_timeout = millis() + 1000UL;
1080
     serial_connect_timeout = millis() + 1000UL;
1078
     while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1081
     while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1079
     #ifdef SERIAL_PORT_3
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
       serial_connect_timeout = millis() + 1000UL;
1087
       serial_connect_timeout = millis() + 1000UL;
1082
       while (!MYSERIAL3.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1088
       while (!MYSERIAL3.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
1083
     #endif
1089
     #endif

+ 1
- 1
buildroot/tests/STM32F103RC_btt_USB View File

10
 # Build with the default configurations
10
 # Build with the default configurations
11
 #
11
 #
12
 restore_configs
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
 exec_test $1 $2 "BigTreeTech SKR Mini v1.1 - Basic Configuration" "$3"
14
 exec_test $1 $2 "BigTreeTech SKR Mini v1.1 - Basic Configuration" "$3"
15
 
15
 
16
 # clean up
16
 # clean up

Loading…
Cancel
Save