Support a third serial port (#21784)

This commit is contained in:
ellensp
2021-05-07 17:31:45 +12:00
committed by Scott Lahteine
parent 4518506559
commit 9fa9eebe51
20 changed files with 212 additions and 47 deletions

View File

@ -955,15 +955,19 @@
// Serial Port Info
//
#ifdef SERIAL_PORT_2
#define NUM_SERIAL 2
#define HAS_MULTI_SERIAL 1
#ifdef SERIAL_PORT_3
#define NUM_SERIAL 3
#else
#define NUM_SERIAL 2
#endif
#elif defined(SERIAL_PORT)
#define NUM_SERIAL 1
#else
#define NUM_SERIAL 0
#undef BAUD_RATE_GCODE
#endif
#if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1
#if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1 || SERIAL_PORT_3 == -1
#define HAS_USB_SERIAL 1
#endif
#if SERIAL_PORT_2 == -2

View File

@ -1859,6 +1859,7 @@
// Flag the indexed hardware serial ports in use
#define CONF_SERIAL_IS(N) ( (defined(SERIAL_PORT) && SERIAL_PORT == N) \
|| (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == N) \
|| (defined(SERIAL_PORT_3) && SERIAL_PORT_3 == N) \
|| (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == N) \
|| (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == N) )

View File

@ -607,6 +607,14 @@
#error "SERIAL_PORT must be defined."
#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT."
#elif defined(SERIAL_PORT_3)
#ifndef SERIAL_PORT_2
#error "Use SERIAL_PORT_2 before using SERIAL_PORT_3"
#elif SERIAL_PORT_3 == SERIAL_PORT
#error "SERIAL_PORT_3 cannot be the same as SERIAL_PORT."
#elif SERIAL_PORT_3 == SERIAL_PORT_2
#error "SERIAL_PORT_3 cannot be the same as SERIAL_PORT_2."
#endif
#endif
#if !(defined(__AVR__) && defined(USBCON))
#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024