HAL and serial cleanup

Co-Authored-By: Jason Smith <20053467+sjasonsmith@users.noreply.github.com>
This commit is contained in:
Scott Lahteine 2020-09-23 19:45:33 -05:00
parent 27c067612c
commit f588d50d57
33 changed files with 220 additions and 420 deletions

View File

@ -81,12 +81,7 @@ typedef int8_t pin_t;
// Serial ports
#ifdef USBCON
#if ENABLED(BLUETOOTH)
#define MYSERIAL0 bluetoothSerial
#else
#define MYSERIAL0 Serial
#endif
#define NUM_SERIAL 1
#define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
#else
#if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
@ -97,36 +92,22 @@ typedef int8_t pin_t;
#ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#elif SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#endif
#define MYSERIAL1 customizedSerial2
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#endif
#ifdef DGUS_SERIAL_PORT
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#elif DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#endif
#define DGUS_SERIAL internalDgusSerial
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
#endif
#ifdef ANYCUBIC_LCD_SERIAL_PORT
#if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
#error "ANYCUBIC_LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#elif ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT
#error "ANYCUBIC_LCD_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT_2
#error "ANYCUBIC_LCD_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#endif
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
#endif

View File

@ -712,11 +712,11 @@
}
// Hookup ISR handlers
ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)) {
ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _RX_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect)) {
ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::_tx_udr_empty_irq();
}
@ -729,11 +729,11 @@
#ifdef SERIAL_PORT_2
// Hookup ISR handlers
ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_RX_vect)) {
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_2, _RX_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_UDRE_vect)) {
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_2, _UDRE_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::_tx_udr_empty_irq();
}
@ -749,11 +749,11 @@
#ifdef INTERNAL_SERIAL_PORT
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) {
ISR(SERIAL_REGNAME(USART, INTERNAL_SERIAL_PORT, _RX_vect)) {
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) {
ISR(SERIAL_REGNAME(USART, INTERNAL_SERIAL_PORT, _UDRE_vect)) {
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
}
@ -776,11 +776,11 @@
return ret;
}
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_RX_vect)) {
ISR(SERIAL_REGNAME(USART, DGUS_SERIAL_PORT, _RX_vect)) {
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_UDRE_vect)) {
ISR(SERIAL_REGNAME(USART, DGUS_SERIAL_PORT, _UDRE_vect)) {
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
}
@ -794,11 +794,11 @@
#ifdef ANYCUBIC_LCD_SERIAL_PORT
ISR(SERIAL_REGNAME(USART,ANYCUBIC_LCD_SERIAL_PORT,_RX_vect)) {
ISR(SERIAL_REGNAME(USART, ANYCUBIC_LCD_SERIAL_PORT, _RX_vect)) {
MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,ANYCUBIC_LCD_SERIAL_PORT,_UDRE_vect)) {
ISR(SERIAL_REGNAME(USART, ANYCUBIC_LCD_SERIAL_PORT, _UDRE_vect)) {
MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::_tx_udr_empty_irq();
}

View File

@ -48,11 +48,11 @@
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
// requires two levels of indirection to expand macro values properly)
#define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
#define SERIAL_REGNAME(registerbase,number,suffix) _SERIAL_REGNAME(registerbase,number,suffix)
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
#define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##suffix
#else
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
#define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##number##suffix
#endif
// Registers used by MarlinSerial class (expanded depending on selected serial port)

View File

@ -38,57 +38,34 @@
#include <stdint.h>
#define _MSERIAL(X) Serial##X
#define MSERIAL(X) _MSERIAL(X)
#define Serial0 Serial
// Define MYSERIAL0/1 before MarlinSerial includes!
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL0 customizedSerial1
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial
#elif SERIAL_PORT == 1
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 Serial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 Serial3
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
#if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial2
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 Serial2
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 Serial3
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#ifdef DGUS_SERIAL_PORT
#if DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1
#if DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL internalDgusSerial
#elif DGUS_SERIAL_PORT == 0
#define DGUS_SERIAL Serial
#elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL Serial1
#elif DGUS_SERIAL_PORT == 2
#define DGUS_SERIAL Serial2
#elif DGUS_SERIAL_PORT == 3
#define DGUS_SERIAL Serial3
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
#else
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif

View File

@ -58,9 +58,6 @@ extern portMUX_TYPE spinlock;
#else
#define MYSERIAL1 webSocketSerial
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)

View File

@ -25,6 +25,12 @@
#include HAL_PATH(.,HAL.h)
#ifdef SERIAL_PORT_2
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
#ifndef I2C_ADDRESS

View File

@ -62,7 +62,6 @@ uint8_t _getc();
extern HalSerial usb_serial;
#define MYSERIAL0 usb_serial
#define NUM_SERIAL 1
#define ST7920_DELAY_1 DELAY_NS(600)
#define ST7920_DELAY_2 DELAY_NS(750)

View File

@ -107,7 +107,7 @@ int main() {
std::thread write_serial (write_serial_thread);
std::thread read_serial (read_serial_thread);
#if NUM_SERIAL > 0
#ifdef MYSERIAL0
MYSERIAL0.begin(BAUDRATE);
SERIAL_ECHOLNPGM("x86_64 Initialized");
SERIAL_FLUSHTX();

View File

@ -63,56 +63,33 @@ extern "C" volatile uint32_t _millis;
#define ST7920_DELAY_3 DELAY_NS(750)
#endif
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#define MSerial0 MSerial
#if SERIAL_PORT == -1
#define MYSERIAL0 UsbSerial
#elif SERIAL_PORT == 0
#define MYSERIAL0 MSerial
#elif SERIAL_PORT == 1
#define MYSERIAL0 MSerial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 MSerial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 MSerial3
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 UsbSerial
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 MSerial
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 MSerial1
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 MSerial2
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 MSerial3
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#ifdef DGUS_SERIAL_PORT
#if DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1
#if DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL UsbSerial
#elif DGUS_SERIAL_PORT == 0
#define DGUS_SERIAL MSerial
#elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL MSerial1
#elif DGUS_SERIAL_PORT == 2
#define DGUS_SERIAL MSerial2
#elif DGUS_SERIAL_PORT == 3
#define DGUS_SERIAL MSerial3
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
#else
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif

View File

@ -89,6 +89,9 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
* Serial2 | P0_10 | P0_11 |
* Serial3 | P0_00 | P0_01 |
*/
#define ANY_TX(N,V...) DO(IS_TX##N,||,V)
#define ANY_RX(N,V...) DO(IS_RX##N,||,V)
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
#define IS_TX0(P) (P == P0_02)
#define IS_RX0(P) (P == P0_03)
@ -106,48 +109,56 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
#define IS_TX1(P) (P == P0_15)
#define IS_RX1(P) (P == P0_16)
#define _IS_TX1_1 IS_TX1
#define _IS_RX1_1 IS_RX1
#if IS_TX1(TMC_SW_SCK)
#error "Serial port pins (1) conflict with other pins!"
#elif HAS_SPI_LCD
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
#error "Serial port pins (1) conflict with Encoder Buttons!"
#elif IS_TX1(SCK_PIN) || IS_TX1(LCD_PINS_D4) || IS_TX1(DOGLCD_SCK) || IS_TX1(LCD_RESET_PIN) || IS_TX1(LCD_PINS_RS) || IS_TX1(SHIFT_CLK) \
|| IS_RX1(LCD_SDSS) || IS_RX1(LCD_PINS_RS) || IS_RX1(MISO_PIN) || IS_RX1(DOGLCD_A0) || IS_RX1(SS_PIN) || IS_RX1(LCD_SDSS) || IS_RX1(DOGLCD_CS) || IS_RX1(LCD_RESET_PIN) || IS_RX1(LCD_BACKLIGHT_PIN)
#elif ANY_TX(1, SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \
|| ANY_RX(1, LCD_SDSS, LCD_PINS_RS, MISO_PIN, DOGLCD_A0, SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN)
#error "Serial port pins (1) conflict with LCD pins!"
#endif
#endif
#undef IS_TX1
#undef IS_RX1
#undef _IS_TX1_1
#undef _IS_RX1_1
#endif
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
#define IS_TX2(P) (P == P0_10)
#define IS_RX2(P) (P == P0_11)
#if IS_TX2(X2_ENABLE_PIN) || IS_RX2(X2_DIR_PIN) || IS_RX2(X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
#define _IS_TX2_1 IS_TX2
#define _IS_RX2_1 IS_RX2
#if IS_TX2(X2_ENABLE_PIN) || ANY_RX(2, X2_DIR_PIN, X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
#error "Serial port pins (2) conflict with X2 pins!"
#elif IS_TX2(Y2_ENABLE_PIN) || IS_RX2(Y2_DIR_PIN) || IS_RX2(Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
#elif IS_TX2(Y2_ENABLE_PIN) || ANY_RX(2, Y2_DIR_PIN, Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
#error "Serial port pins (2) conflict with Y2 pins!"
#elif IS_TX2(Z2_ENABLE_PIN) || IS_RX2(Z2_DIR_PIN) || IS_RX2(Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
#elif IS_TX2(Z2_ENABLE_PIN) || ANY_RX(2, Z2_DIR_PIN, Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
#error "Serial port pins (2) conflict with Z2 pins!"
#elif IS_TX2(Z3_ENABLE_PIN) || IS_RX2(Z3_DIR_PIN) || IS_RX2(Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
#elif IS_TX2(Z3_ENABLE_PIN) || ANY_RX(2, Z3_DIR_PIN, Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
#error "Serial port pins (2) conflict with Z3 pins!"
#elif IS_TX2(Z4_ENABLE_PIN) || IS_RX2(Z4_DIR_PIN) || IS_RX2(Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
#elif IS_TX2(Z4_ENABLE_PIN) || ANY_RX(2, Z4_DIR_PIN, Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
#error "Serial port pins (2) conflict with Z4 pins!"
#elif IS_RX2(X_DIR_PIN) || IS_RX2(Y_DIR_PIN)
#elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#error "Serial port pins (2) conflict with other pins!"
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
#error "Serial port pins (2) conflict with Y endstop pin!"
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
#error "Serial port pins (2) conflict with probe pin!"
#elif IS_TX2(X_ENABLE_PIN) || IS_RX2(X_DIR_PIN) || IS_TX2(Y_ENABLE_PIN) || IS_RX2(Y_DIR_PIN)
#elif ANY_TX(2, X_ENABLE_PIN, Y_ENABLE_PIN) || ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#error "Serial port pins (2) conflict with X/Y stepper pins!"
#elif HAS_MULTI_EXTRUDER && (IS_TX2(E1_ENABLE_PIN) || (AXIS_HAS_SPI(E1) && IS_TX2(E1_CS_PIN)))
#error "Serial port pins (2) conflict with E1 stepper pins!"
#elif EXTRUDERS && (IS_RX2(E0_DIR_PIN) || IS_RX2(E0_STEP_PIN))
#elif EXTRUDERS && ANY_RX(2, E0_DIR_PIN, E0_STEP_PIN)
#error "Serial port pins (2) conflict with E stepper pins!"
#endif
#undef IS_TX2
#undef IS_RX2
#undef _IS_TX2_1
#undef _IS_RX2_1
#endif
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
@ -155,8 +166,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define PIN_IS_RX3(P) (P##_PIN == P0_01)
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
#error "Serial port pins (3) conflict with X endstop pins!"
#elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) \
|| PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
#elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) || PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
#error "Serial port pins (3) conflict with X/Y axis UART pins!"
#elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
#error "Serial port pins (3) conflict with X2 pins!"
@ -175,6 +185,9 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef PIN_IS_RX3
#endif
#undef ANY_TX
#undef ANY_RX
//
// Flag any i2c pin conflicts
//

View File

@ -35,56 +35,32 @@
// MYSERIAL0 required before MarlinSerial includes!
#define _MSERIAL(X) Serial##X
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
#if SERIAL_PORT == -1
#define MYSERIAL0 Serial
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 1
#define MYSERIAL0 Serial2
#elif SERIAL_PORT == 2
#define MYSERIAL0 Serial3
#elif SERIAL_PORT == 3
#define MYSERIAL0 Serial4
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 Serial
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 Serial2
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 Serial3
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 Serial4
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#ifdef DGUS_SERIAL_PORT
#if DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1
#if DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL Serial
#elif DGUS_SERIAL_PORT == 0
#define DGUS_SERIAL Serial1
#elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL Serial2
#elif DGUS_SERIAL_PORT == 2
#define DGUS_SERIAL Serial3
#elif DGUS_SERIAL_PORT == 2
#define DGUS_SERIAL Serial4
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(DGUS_SERIAL_PORT)
#else
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif

View File

@ -43,82 +43,47 @@
// ------------------------
// Defines
// ------------------------
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#if SERIAL_PORT == 0
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif SERIAL_PORT == -1
#if SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 1
#define MYSERIAL0 MSerial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 MSerial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 MSerial3
#elif SERIAL_PORT == 4
#define MYSERIAL0 MSerial4
#elif SERIAL_PORT == 5
#define MYSERIAL0 MSerial5
#elif SERIAL_PORT == 6
#define MYSERIAL0 MSerial6
#elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
#error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
#endif
#ifdef SERIAL_PORT_2
#define NUM_SERIAL 2
#if SERIAL_PORT_2 == 0
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 SerialUSB
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 MSerial1
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 MSerial2
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 MSerial3
#elif SERIAL_PORT_2 == 4
#define MYSERIAL1 MSerial4
#elif SERIAL_PORT_2 == 5
#define MYSERIAL1 MSerial5
#elif SERIAL_PORT_2 == 6
#define MYSERIAL1 MSerial6
#elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
#error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration."
#endif
#else
#define NUM_SERIAL 1
#endif
#if HAS_DGUS_LCD
#if DGUS_SERIAL_PORT == 0
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1
#if DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL SerialUSB
#elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL MSerial1
#elif DGUS_SERIAL_PORT == 2
#define DGUS_SERIAL MSerial2
#elif DGUS_SERIAL_PORT == 3
#define DGUS_SERIAL MSerial3
#elif DGUS_SERIAL_PORT == 4
#define DGUS_SERIAL MSerial4
#elif DGUS_SERIAL_PORT == 5
#define DGUS_SERIAL MSerial5
#elif DGUS_SERIAL_PORT == 6
#define DGUS_SERIAL MSerial6
#elif WITHIN(DGUS_SERIAL_PORT, 1, 6)
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
#else
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
#error "DGUS_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
#endif
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
#endif
#if ENABLED(MALYAN_LCD)
#if LCD_SERIAL_PORT == -1
#define LCD_SERIAL SerialUSB
#elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
#endif
#endif
/**
* TODO: review this to return 1 for pins that are not analog input

View File

@ -98,7 +98,7 @@ static inline void pwm_details(const pin_t pin) {
timer_dev * const tdev = PIN_MAP[pin].timer_device;
const uint8_t channel = PIN_MAP[pin].timer_channel;
const char num = (
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
tdev == &timer8 ? '8' :
tdev == &timer5 ? '5' :
#endif

View File

@ -53,7 +53,7 @@
// ------------------------
#ifndef STM32_FLASH_SIZE
#if defined(MCU_STM32F103RE) || defined(MCU_STM32F103VE)
#if EITHER(MCU_STM32F103RE, MCU_STM32F103VE)
#define STM32_FLASH_SIZE 512
#else
#define STM32_FLASH_SIZE 256
@ -106,9 +106,6 @@
#else
#error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#ifdef DGUS_SERIAL

View File

@ -30,6 +30,7 @@
#include "../../feature/e_parser.h"
#endif
// Increase priority of serial interrupts, to reduce overflow errors
#define UART_IRQ_PRIO 1
class MarlinSerial : public HardwareSerial {

View File

@ -26,7 +26,7 @@
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
#include "sdio.h"

View File

@ -46,24 +46,16 @@
// Serial override
//extern HalSerial usb_serial;
#define _MSERIAL(X) SerialUART##X
#define MSERIAL(X) _MSERIAL(X)
#define SerialUART0 Serial1
#if defined(STM32F4) && SERIAL_PORT == 0
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 1
#define MYSERIAL0 SerialUART1
#elif SERIAL_PORT == 2
#define MYSERIAL0 SerialUART2
#elif SERIAL_PORT == 3
#define MYSERIAL0 SerialUART3
#elif SERIAL_PORT == 4
#define MYSERIAL0 SerialUART4
#elif SERIAL_PORT == 5
#define MYSERIAL0 SerialUART5
#elif SERIAL_PORT == 6
#define MYSERIAL0 SerialUART6
#elif WITHIN(SERIAL_PORT, 0, 6)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
#endif
@ -71,55 +63,22 @@
#ifdef SERIAL_PORT_2
#if defined(STM32F4) && SERIAL_PORT_2 == 0
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#define MYSERIAL1 SerialUSB
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 SerialUART1
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 SerialUART2
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 SerialUART3
#elif SERIAL_PORT_2 == 4
#define MYSERIAL1 SerialUART4
#elif SERIAL_PORT_2 == 5
#define MYSERIAL1 SerialUART5
#elif SERIAL_PORT_2 == 6
#define MYSERIAL1 SerialUART6
#elif WITHIN(SERIAL_PORT_2, 0, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#ifdef DGUS_SERIAL_PORT
#if defined(STM32F4) && DGUS_SERIAL_PORT == 0
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
#elif DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
#elif DGUS_SERIAL_PORT == -1
#define DGUS_SERIAL SerialUSB
#elif DGUS_SERIAL_PORT == 0
#define DGUS_SERIAL Serial1
#elif DGUS_SERIAL_PORT == 1
#define DGUS_SERIAL SerialUART1
#elif DGUS_SERIAL_PORT == 2
#define DGUS_SERIAL SerialUART2
#elif DGUS_SERIAL_PORT == 3
#define DGUS_SERIAL SerialUART3
#elif DGUS_SERIAL_PORT == 4
#define DGUS_SERIAL SerialUART4
#elif DGUS_SERIAL_PORT == 5
#define DGUS_SERIAL SerialUART5
#elif DGUS_SERIAL_PORT == 6
#define DGUS_SERIAL SerialUART6
#elif WITHIN(DGUS_SERIAL_PORT, 0, 6)
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
#else
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
#endif

View File

@ -49,18 +49,14 @@
#define IS_TEENSY32 1
#endif
#define NUM_SERIAL 1
#define _MSERIAL(X) Serial##X
#define MSERIAL(X) _MSERIAL(X)
#define Serial0 Serial
#if SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial
#elif SERIAL_PORT == 1
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 Serial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 Serial3
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#endif
#define HAL_SERVO_LIB libServo

View File

@ -54,18 +54,14 @@
#define IS_TEENSY36 1
#endif
#define NUM_SERIAL 1
#define _MSERIAL(X) Serial##X
#define MSERIAL(X) _MSERIAL(X)
#define Serial0 Serial
#if SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial
#elif SERIAL_PORT == 1
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 Serial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 Serial3
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#endif
#define HAL_SERVO_LIB libServo

View File

@ -50,59 +50,26 @@
#define IS_TEENSY41 1
#endif
#define _MSERIAL(X) Serial##X
#define MSERIAL(X) _MSERIAL(X)
#define Serial0 Serial
#if SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial
#elif SERIAL_PORT == 1
#define MYSERIAL0 Serial1
#elif SERIAL_PORT == 2
#define MYSERIAL0 Serial2
#elif SERIAL_PORT == 3
#define MYSERIAL0 Serial3
#elif SERIAL_PORT == 4
#define MYSERIAL0 Serial4
#elif SERIAL_PORT == 5
#define MYSERIAL0 Serial5
#elif SERIAL_PORT == 6
#define MYSERIAL0 Serial6
#elif SERIAL_PORT == 7
#define MYSERIAL0 Serial7
#elif SERIAL_PORT == 8
#define MYSERIAL0 Serial8
#elif WITHIN(SERIAL_PORT, 0, 8)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 usbSerial
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial
#elif SERIAL_PORT_2 == 1
#define MYSERIAL1 Serial1
#elif SERIAL_PORT_2 == 2
#define MYSERIAL1 Serial2
#elif SERIAL_PORT_2 == 3
#define MYSERIAL1 Serial3
#elif SERIAL_PORT_2 == 4
#define MYSERIAL1 Serial4
#elif SERIAL_PORT_2 == 5
#define MYSERIAL1 Serial5
#elif SERIAL_PORT_2 == 6
#define MYSERIAL1 Serial6
#elif SERIAL_PORT_2 == 7
#define MYSERIAL1 Serial7
#elif SERIAL_PORT_2 == 8
#define MYSERIAL1 Serial8
#elif WITHIN(SERIAL_PORT_2, 0, 8)
#define MYSERIAL0 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
#endif
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#define HAL_SERVO_LIB libServo

View File

@ -912,17 +912,15 @@ void setup() {
#endif
#endif
#if NUM_SERIAL > 0
MYSERIAL0.begin(BAUDRATE);
uint32_t serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#if HAS_MULTI_SERIAL
MYSERIAL1.begin(BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif
SERIAL_ECHO_MSG("start");
MYSERIAL0.begin(BAUDRATE);
uint32_t serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#if HAS_MULTI_SERIAL
MYSERIAL1.begin(BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif
SERIAL_ECHO_MSG("start");
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
mks_esp_wifi_init();

View File

@ -53,23 +53,10 @@ void GcodeSuite::M575() {
case 115200: case 250000: case 500000: case 1000000: {
const int8_t port = parser.intval('P', -99);
const bool set0 = (port == -99 || port == 0);
if (set0) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(" Serial "
#if HAS_MULTI_SERIAL
, '0',
#else
"0"
#endif
" baud rate set to ", baud
);
}
if (set0) SERIAL_ECHO_MSG(" Serial ", '0', " baud rate set to ", baud);
#if HAS_MULTI_SERIAL
const bool set1 = (port == -99 || port == 1);
if (set1) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(" Serial ", '1', " baud rate set to ", baud);
}
if (set1) SERIAL_ECHO_MSG(" Serial ", '1', " baud rate set to ", baud);
#endif
SERIAL_FLUSH();
@ -85,4 +72,4 @@ void GcodeSuite::M575() {
}
}
#endif // NUM_SERIAL > 0 && BAUD_RATE_GCODE
#endif // BAUD_RATE_GCODE

View File

@ -582,12 +582,10 @@
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
#endif
#if SERIAL_PORT > 7
#error "Set SERIAL_PORT to the port on your board. Usually this is 0."
#endif
#if defined(SERIAL_PORT_2) && NUM_SERIAL < 2
#error "SERIAL_PORT_2 is not supported for your MOTHERBOARD. Disable it to continue."
#ifndef SERIAL_PORT
#error "SERIAL_PORT must be defined in Configuration.h"
#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
#endif
/**
@ -2280,6 +2278,36 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "Please enable only one LCD_SCREEN_ROT_* option: 0, 90, 180, or 270."
#endif
/**
* Serial displays require a dedicated serial port
*/
#if HAS_DGUS_LCD
#ifndef DGUS_SERIAL_PORT
#error "The DGUS LCD requires DGUS_SERIAL_PORT to be defined in Configuration.h"
#elif DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
#endif
#elif ENABLED(MALYAN_LCD)
#ifndef LCD_SERIAL_PORT
#error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined in Configuration.h"
#elif LCD_SERIAL_PORT == SERIAL_PORT
#error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && LCD_SERIAL_PORT == SERIAL_PORT_2
#error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
#endif
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
#ifndef ANYCUBIC_LCD_SERIAL_PORT
#error "The ANYCUBIC LCD requires ANYCUBIC_LCD_SERIAL_PORT to be defined in Configuration.h"
#elif ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT
#error "ANYCUBIC_LCD_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT_2
#error "ANYCUBIC_LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
#endif
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
#endif
/**
* FYSETC Mini 12864 RGB backlighting required
*/

View File

@ -45,7 +45,7 @@
#if ENABLED(MALYAN_LCD)
#define DEBUG_MALYAN_LCD
//#define DEBUG_MALYAN_LCD
#include "ui_api.h"
@ -61,10 +61,6 @@
#define DEBUG_OUT ENABLED(DEBUG_MALYAN_LCD)
#include "../../core/debug_out.h"
// On the Malyan M200, this will be Serial1. On a RAMPS board,
// it might not be.
#define LCD_SERIAL Serial1
// This is based on longest sys command + a filename, plus some buffer
// in case we encounter some data we don't recognize
// There is no evidence a line will ever be this long, but better safe than sorry

View File

@ -117,10 +117,10 @@
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define X_HARDWARE_SERIAL MSerial1
//#define Y_HARDWARE_SERIAL MSerial1
//#define Z_HARDWARE_SERIAL MSerial1
//#define E0_HARDWARE_SERIAL MSerial1
//
// Software serial

View File

@ -30,8 +30,8 @@
* Hardware serial communication ports.
*/
#if HAS_TMC_UART
#define X_HARDWARE_SERIAL Serial4
#define Y_HARDWARE_SERIAL Serial4
#define Z_HARDWARE_SERIAL Serial4
#define E0_HARDWARE_SERIAL Serial4
#define X_HARDWARE_SERIAL MSerial4
#define Y_HARDWARE_SERIAL MSerial4
#define Z_HARDWARE_SERIAL MSerial4
#define E0_HARDWARE_SERIAL MSerial4
#endif

View File

@ -52,8 +52,8 @@
* Hardware serial communication ports.
*/
#if HAS_TMC_UART
#define X_HARDWARE_SERIAL Serial4
#define Y_HARDWARE_SERIAL Serial4
#define Z_HARDWARE_SERIAL Serial4
#define E0_HARDWARE_SERIAL Serial4
#define X_HARDWARE_SERIAL MSerial4
#define Y_HARDWARE_SERIAL MSerial4
#define Z_HARDWARE_SERIAL MSerial4
#define E0_HARDWARE_SERIAL MSerial4
#endif

View File

@ -93,10 +93,10 @@
//
// Hardware serial with switch
//
#define X_HARDWARE_SERIAL Serial1
#define Y_HARDWARE_SERIAL Serial1
#define Z_HARDWARE_SERIAL Serial1
#define E0_HARDWARE_SERIAL Serial1
#define X_HARDWARE_SERIAL MSerial1
#define Y_HARDWARE_SERIAL MSerial1
#define Z_HARDWARE_SERIAL MSerial1
#define E0_HARDWARE_SERIAL MSerial1
// The 4xTMC2209 module doesn't have a serial multiplexer and
// needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0

View File

@ -188,17 +188,11 @@
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define X2_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Y2_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define Z2_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial1
//#define E2_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
//#define E4_HARDWARE_SERIAL Serial1
//#define X_HARDWARE_SERIAL MSerial1
//#define Y_HARDWARE_SERIAL MSerial1
//#define Z_HARDWARE_SERIAL MSerial1
//#define E0_HARDWARE_SERIAL MSerial1
//#define E1_HARDWARE_SERIAL MSerial1
// Unused servo pins may be repurposed with SoftwareSerialM
//#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN -- XS2 - 6

View File

@ -83,10 +83,10 @@
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define X_HARDWARE_SERIAL MSerial1
//#define Y_HARDWARE_SERIAL MSerial1
//#define Z_HARDWARE_SERIAL MSerial1
//#define E0_HARDWARE_SERIAL MSerial1
//
// Software serial

View File

@ -132,17 +132,11 @@
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define X2_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Y2_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define Z2_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial1
//#define E2_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
//#define E4_HARDWARE_SERIAL Serial1
//#define X_HARDWARE_SERIAL MSerial1
//#define Y_HARDWARE_SERIAL MSerial1
//#define Z_HARDWARE_SERIAL MSerial1
//#define E0_HARDWARE_SERIAL MSerial1
//#define E1_HARDWARE_SERIAL MSerial1
//
// Software serial

View File

@ -125,17 +125,12 @@
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define X2_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Y2_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define Z2_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial1
//#define E2_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
//#define E4_HARDWARE_SERIAL Serial1
//#define X_HARDWARE_SERIAL MSerial1
//#define Y_HARDWARE_SERIAL MSerial1
//#define Z_HARDWARE_SERIAL MSerial1
//#define E0_HARDWARE_SERIAL MSerial1
//#define E1_HARDWARE_SERIAL MSerial1
//#define E2_HARDWARE_SERIAL MSerial1
//
// Software serial

View File

@ -9,6 +9,7 @@ set -e
restore_configs
use_example_configs "delta/Malyan M300"
opt_disable AUTO_BED_LEVELING_3POINT
opt_set LCD_SERIAL_PORT 1
exec_test $1 $2 "Malyan M300 (delta)"
# cleanup