Independent baud rates (#21949)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
charlespick 2021-05-20 04:06:26 -07:00 committed by Scott Lahteine
parent 7898307d78
commit 1b45b3802a
4 changed files with 29 additions and 21 deletions

View file

@ -105,21 +105,9 @@
#define SERIAL_PORT 0 #define SERIAL_PORT 0
/** /**
* Select a secondary serial port on the board to use for communication with the host. * Serial Port Baud Rate
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards. * This is the default communication speed for all serial ports.
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7] * Set the baud rate defaults for additional serial ports below.
*/
//#define SERIAL_PORT_2 -1
/**
* Select a third serial port on the board to use for communication with the host.
* Currently only supported for AVR, DUE, LPC1768/9 and STM32/STM32F1
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_3 1
/**
* This setting determines the communication speed of the printer.
* *
* 250000 works in most cases, but you might try a lower speed if * 250000 works in most cases, but you might try a lower speed if
* you commonly experience drop-outs during host printing. * you commonly experience drop-outs during host printing.
@ -128,6 +116,23 @@
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
*/ */
#define BAUDRATE 250000 #define BAUDRATE 250000
//#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate
/**
* Select a secondary serial port on the board to use for communication with the host.
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_2 -1
//#define BAUDRATE_2 250000 // Enable to override BAUDRATE
/**
* Select a third serial port on the board to use for communication with the host.
* Currently only supported for AVR, DUE, LPC1768/9 and STM32/STM32F1
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_3 1
//#define BAUDRATE_3 250000 // Enable to override BAUDRATE
// Enable the Bluetooth serial interface on AT90USB devices // Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH //#define BLUETOOTH

View file

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

View file

@ -1073,11 +1073,17 @@ void setup() {
while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#if HAS_MULTI_SERIAL && !HAS_ETHERNET #if HAS_MULTI_SERIAL && !HAS_ETHERNET
MYSERIAL2.begin(BAUDRATE); #ifndef BAUDRATE_2
#define BAUDRATE_2 BAUDRATE
#endif
MYSERIAL2.begin(BAUDRATE_2);
serial_connect_timeout = millis() + 1000UL; serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#ifdef SERIAL_PORT_3 #ifdef SERIAL_PORT_3
MYSERIAL3.begin(BAUDRATE); #ifndef BAUDRATE_3
#define BAUDRATE_3 BAUDRATE
#endif
MYSERIAL3.begin(BAUDRATE_3);
serial_connect_timeout = millis() + 1000UL; serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL3.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!MYSERIAL3.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif #endif

View file

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