HAL and serial cleanup
Co-Authored-By: Jason Smith <20053467+sjasonsmith@users.noreply.github.com>
This commit is contained in:
parent
928d874dea
commit
4b928b2da8
|
@ -81,12 +81,7 @@ typedef int8_t pin_t;
|
||||||
|
|
||||||
// Serial ports
|
// Serial ports
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
#if ENABLED(BLUETOOTH)
|
#define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
|
||||||
#define MYSERIAL0 bluetoothSerial
|
|
||||||
#else
|
|
||||||
#define MYSERIAL0 Serial
|
|
||||||
#endif
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#else
|
#else
|
||||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#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
|
#ifdef SERIAL_PORT_2
|
||||||
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#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
|
#endif
|
||||||
#define MYSERIAL1 customizedSerial2
|
#define MYSERIAL1 customizedSerial2
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef DGUS_SERIAL_PORT
|
||||||
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
|
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#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
|
#endif
|
||||||
#define DGUS_SERIAL internalDgusSerial
|
#define DGUS_SERIAL internalDgusSerial
|
||||||
|
|
||||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
|
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ANYCUBIC_LCD_SERIAL_PORT
|
#ifdef ANYCUBIC_LCD_SERIAL_PORT
|
||||||
#if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
|
#if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
|
||||||
#error "ANYCUBIC_LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#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
|
#endif
|
||||||
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
|
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -712,11 +712,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hookup ISR handlers
|
// 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();
|
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();
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,11 +729,11 @@
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
|
|
||||||
// Hookup ISR handlers
|
// 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();
|
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();
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,11 +749,11 @@
|
||||||
|
|
||||||
#ifdef INTERNAL_SERIAL_PORT
|
#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();
|
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();
|
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,11 +776,11 @@
|
||||||
return ret;
|
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();
|
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();
|
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,11 +794,11 @@
|
||||||
|
|
||||||
#ifdef ANYCUBIC_LCD_SERIAL_PORT
|
#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();
|
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();
|
MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,11 @@
|
||||||
|
|
||||||
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
|
// 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)
|
// 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
|
#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
|
#else
|
||||||
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
|
#define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##number##suffix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Registers used by MarlinSerial class (expanded depending on selected serial port)
|
// Registers used by MarlinSerial class (expanded depending on selected serial port)
|
||||||
|
|
|
@ -38,57 +38,34 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
// Define MYSERIAL0/1 before MarlinSerial includes!
|
// Define MYSERIAL0/1 before MarlinSerial includes!
|
||||||
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
|
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
|
||||||
#define MYSERIAL0 customizedSerial1
|
#define MYSERIAL0 customizedSerial1
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#else
|
#else
|
||||||
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
|
||||||
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
|
|
||||||
#define MYSERIAL1 customizedSerial2
|
#define MYSERIAL1 customizedSerial2
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 3)
|
||||||
#define MYSERIAL1 Serial
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 Serial1
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 Serial2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 Serial3
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef DGUS_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
#if DGUS_SERIAL_PORT == -1
|
||||||
#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
|
|
||||||
#define DGUS_SERIAL internalDgusSerial
|
#define DGUS_SERIAL internalDgusSerial
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
|
||||||
#define DGUS_SERIAL Serial
|
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,9 +58,6 @@ extern portMUX_TYPE spinlock;
|
||||||
#else
|
#else
|
||||||
#define MYSERIAL1 webSocketSerial
|
#define MYSERIAL1 webSocketSerial
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
|
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
|
||||||
|
|
|
@ -25,6 +25,12 @@
|
||||||
|
|
||||||
#include HAL_PATH(.,HAL.h)
|
#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)
|
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||||
|
|
||||||
#ifndef I2C_ADDRESS
|
#ifndef I2C_ADDRESS
|
||||||
|
|
|
@ -62,7 +62,6 @@ uint8_t _getc();
|
||||||
|
|
||||||
extern HalSerial usb_serial;
|
extern HalSerial usb_serial;
|
||||||
#define MYSERIAL0 usb_serial
|
#define MYSERIAL0 usb_serial
|
||||||
#define NUM_SERIAL 1
|
|
||||||
|
|
||||||
#define ST7920_DELAY_1 DELAY_NS(600)
|
#define ST7920_DELAY_1 DELAY_NS(600)
|
||||||
#define ST7920_DELAY_2 DELAY_NS(750)
|
#define ST7920_DELAY_2 DELAY_NS(750)
|
||||||
|
|
|
@ -107,7 +107,7 @@ int main() {
|
||||||
std::thread write_serial (write_serial_thread);
|
std::thread write_serial (write_serial_thread);
|
||||||
std::thread read_serial (read_serial_thread);
|
std::thread read_serial (read_serial_thread);
|
||||||
|
|
||||||
#if NUM_SERIAL > 0
|
#ifdef MYSERIAL0
|
||||||
MYSERIAL0.begin(BAUDRATE);
|
MYSERIAL0.begin(BAUDRATE);
|
||||||
SERIAL_ECHOLNPGM("x86_64 Initialized");
|
SERIAL_ECHOLNPGM("x86_64 Initialized");
|
||||||
SERIAL_FLUSHTX();
|
SERIAL_FLUSHTX();
|
||||||
|
|
|
@ -63,56 +63,33 @@ extern "C" volatile uint32_t _millis;
|
||||||
#define ST7920_DELAY_3 DELAY_NS(750)
|
#define ST7920_DELAY_3 DELAY_NS(750)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _MSERIAL(X) MSerial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define MSerial0 MSerial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 UsbSerial
|
#define MYSERIAL0 UsbSerial
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 MSerial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 MSerial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 MSerial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 MSerial3
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 UsbSerial
|
#define MYSERIAL1 UsbSerial
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 3)
|
||||||
#define MYSERIAL1 MSerial
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 MSerial1
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 MSerial2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 MSerial3
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef DGUS_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
#if DGUS_SERIAL_PORT == -1
|
||||||
#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 UsbSerial
|
#define DGUS_SERIAL UsbSerial
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
|
||||||
#define DGUS_SERIAL MSerial
|
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,6 +89,9 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
* Serial2 | P0_10 | P0_11 |
|
* Serial2 | P0_10 | P0_11 |
|
||||||
* Serial3 | P0_00 | P0_01 |
|
* 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)
|
#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_TX0(P) (P == P0_02)
|
||||||
#define IS_RX0(P) (P == P0_03)
|
#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
|
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
||||||
#define IS_TX1(P) (P == P0_15)
|
#define IS_TX1(P) (P == P0_15)
|
||||||
#define IS_RX1(P) (P == P0_16)
|
#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)
|
#if IS_TX1(TMC_SW_SCK)
|
||||||
#error "Serial port pins (1) conflict with other pins!"
|
#error "Serial port pins (1) conflict with other pins!"
|
||||||
#elif HAS_SPI_LCD
|
#elif HAS_SPI_LCD
|
||||||
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
||||||
#error "Serial port pins (1) conflict with Encoder Buttons!"
|
#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) \
|
#elif ANY_TX(1, SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, 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)
|
|| 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!"
|
#error "Serial port pins (1) conflict with LCD pins!"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#undef IS_TX1
|
#undef IS_TX1
|
||||||
#undef IS_RX1
|
#undef IS_RX1
|
||||||
|
#undef _IS_TX1_1
|
||||||
|
#undef _IS_RX1_1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
||||||
#define IS_TX2(P) (P == P0_10)
|
#define IS_TX2(P) (P == P0_10)
|
||||||
#define IS_RX2(P) (P == P0_11)
|
#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!"
|
#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!"
|
#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!"
|
#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!"
|
#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!"
|
#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!"
|
#error "Serial port pins (2) conflict with other pins!"
|
||||||
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
|
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
|
||||||
#error "Serial port pins (2) conflict with Y endstop pin!"
|
#error "Serial port pins (2) conflict with Y endstop pin!"
|
||||||
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
|
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
|
||||||
#error "Serial port pins (2) conflict with 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!"
|
#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)))
|
#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!"
|
#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!"
|
#error "Serial port pins (2) conflict with E stepper pins!"
|
||||||
#endif
|
#endif
|
||||||
#undef IS_TX2
|
#undef IS_TX2
|
||||||
#undef IS_RX2
|
#undef IS_RX2
|
||||||
|
#undef _IS_TX2_1
|
||||||
|
#undef _IS_RX2_1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
#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)
|
#define PIN_IS_RX3(P) (P##_PIN == P0_01)
|
||||||
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
|
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
|
||||||
#error "Serial port pins (3) conflict with X endstop pins!"
|
#error "Serial port pins (3) conflict with X endstop pins!"
|
||||||
#elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_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)
|
||||||
|| PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
|
|
||||||
#error "Serial port pins (3) conflict with X/Y axis UART pins!"
|
#error "Serial port pins (3) conflict with X/Y axis UART pins!"
|
||||||
#elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
|
#elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
|
||||||
#error "Serial port pins (3) conflict with X2 pins!"
|
#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
|
#undef PIN_IS_RX3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef ANY_TX
|
||||||
|
#undef ANY_RX
|
||||||
|
|
||||||
//
|
//
|
||||||
// Flag any i2c pin conflicts
|
// Flag any i2c pin conflicts
|
||||||
//
|
//
|
||||||
|
|
|
@ -35,56 +35,32 @@
|
||||||
|
|
||||||
// MYSERIAL0 required before MarlinSerial includes!
|
// MYSERIAL0 required before MarlinSerial includes!
|
||||||
|
|
||||||
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 Serial
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial4
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 Serial
|
#define MYSERIAL1 Serial
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 3)
|
||||||
#define MYSERIAL1 Serial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 Serial2
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 Serial3
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 Serial4
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef DGUS_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
#if DGUS_SERIAL_PORT == -1
|
||||||
#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 Serial
|
#define DGUS_SERIAL Serial
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
|
||||||
#define DGUS_SERIAL Serial1
|
#define MYSERIAL0 MSERIAL(DGUS_SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,82 +43,47 @@
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Defines
|
// Defines
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
#define _MSERIAL(X) MSerial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
|
||||||
#if SERIAL_PORT == 0
|
#if SERIAL_PORT == -1
|
||||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
|
||||||
#elif SERIAL_PORT == -1
|
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 1
|
#elif WITHIN(SERIAL_PORT, 1, 6)
|
||||||
#define MYSERIAL0 MSerial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#define NUM_SERIAL 2
|
#if SERIAL_PORT_2 == -1
|
||||||
#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
|
|
||||||
#define MYSERIAL1 SerialUSB
|
#define MYSERIAL1 SerialUSB
|
||||||
#elif SERIAL_PORT_2 == 1
|
#elif WITHIN(SERIAL_PORT_2, 1, 6)
|
||||||
#define MYSERIAL1 MSerial1
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#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
|
|
||||||
#else
|
#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
|
#endif
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DGUS_LCD
|
#if HAS_DGUS_LCD
|
||||||
#if DGUS_SERIAL_PORT == 0
|
#if DGUS_SERIAL_PORT == -1
|
||||||
#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
|
#define DGUS_SERIAL SerialUSB
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
#elif WITHIN(DGUS_SERIAL_PORT, 1, 6)
|
||||||
#define DGUS_SERIAL MSerial1
|
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
|
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
|
||||||
#endif
|
#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
|
* TODO: review this to return 1 for pins that are not analog input
|
||||||
|
|
|
@ -98,7 +98,7 @@ static inline void pwm_details(const pin_t pin) {
|
||||||
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
||||||
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||||
const char num = (
|
const char num = (
|
||||||
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
|
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||||
tdev == &timer8 ? '8' :
|
tdev == &timer8 ? '8' :
|
||||||
tdev == &timer5 ? '5' :
|
tdev == &timer5 ? '5' :
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#ifndef STM32_FLASH_SIZE
|
#ifndef STM32_FLASH_SIZE
|
||||||
#if defined(MCU_STM32F103RE) || defined(MCU_STM32F103VE)
|
#if EITHER(MCU_STM32F103RE, MCU_STM32F103VE)
|
||||||
#define STM32_FLASH_SIZE 512
|
#define STM32_FLASH_SIZE 512
|
||||||
#else
|
#else
|
||||||
#define STM32_FLASH_SIZE 256
|
#define STM32_FLASH_SIZE 256
|
||||||
|
@ -106,9 +106,6 @@
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL
|
#ifdef DGUS_SERIAL
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "../../feature/e_parser.h"
|
#include "../../feature/e_parser.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Increase priority of serial interrupts, to reduce overflow errors
|
||||||
#define UART_IRQ_PRIO 1
|
#define UART_IRQ_PRIO 1
|
||||||
|
|
||||||
class MarlinSerial : public HardwareSerial {
|
class MarlinSerial : public HardwareSerial {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
|
#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"
|
#include "sdio.h"
|
||||||
|
|
||||||
|
|
|
@ -46,24 +46,16 @@
|
||||||
// Serial override
|
// Serial override
|
||||||
//extern HalSerial usb_serial;
|
//extern HalSerial usb_serial;
|
||||||
|
|
||||||
|
#define _MSERIAL(X) SerialUART##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define SerialUART0 Serial1
|
||||||
|
|
||||||
#if defined(STM32F4) && SERIAL_PORT == 0
|
#if defined(STM32F4) && SERIAL_PORT == 0
|
||||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||||
#elif SERIAL_PORT == -1
|
#elif SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 6)
|
||||||
#define MYSERIAL0 Serial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,55 +63,22 @@
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if defined(STM32F4) && SERIAL_PORT_2 == 0
|
#if defined(STM32F4) && SERIAL_PORT_2 == 0
|
||||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#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
|
#elif SERIAL_PORT_2 == -1
|
||||||
#define MYSERIAL1 SerialUSB
|
#define MYSERIAL1 SerialUSB
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 6)
|
||||||
#define MYSERIAL1 Serial1
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef DGUS_SERIAL_PORT
|
||||||
#if defined(STM32F4) && DGUS_SERIAL_PORT == 0
|
#if defined(STM32F4) && DGUS_SERIAL_PORT == 0
|
||||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#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
|
#elif DGUS_SERIAL_PORT == -1
|
||||||
#define DGUS_SERIAL SerialUSB
|
#define DGUS_SERIAL SerialUSB
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
#elif WITHIN(DGUS_SERIAL_PORT, 0, 6)
|
||||||
#define DGUS_SERIAL Serial1
|
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,18 +49,14 @@
|
||||||
#define IS_TEENSY32 1
|
#define IS_TEENSY32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_SERIAL 1
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_SERVO_LIB libServo
|
#define HAL_SERVO_LIB libServo
|
||||||
|
|
|
@ -54,18 +54,14 @@
|
||||||
#define IS_TEENSY36 1
|
#define IS_TEENSY36 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_SERIAL 1
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_SERVO_LIB libServo
|
#define HAL_SERVO_LIB libServo
|
||||||
|
|
|
@ -50,59 +50,26 @@
|
||||||
#define IS_TEENSY41 1
|
#define IS_TEENSY41 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 8)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
|
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 usbSerial
|
#define MYSERIAL1 usbSerial
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 8)
|
||||||
#define MYSERIAL1 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT_2)
|
||||||
#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
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_SERVO_LIB libServo
|
#define HAL_SERVO_LIB libServo
|
||||||
|
|
|
@ -912,17 +912,15 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NUM_SERIAL > 0
|
MYSERIAL0.begin(BAUDRATE);
|
||||||
MYSERIAL0.begin(BAUDRATE);
|
uint32_t serial_connect_timeout = millis() + 1000UL;
|
||||||
uint32_t serial_connect_timeout = millis() + 1000UL;
|
while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
||||||
while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
#if HAS_MULTI_SERIAL
|
||||||
#if HAS_MULTI_SERIAL
|
MYSERIAL1.begin(BAUDRATE);
|
||||||
MYSERIAL1.begin(BAUDRATE);
|
serial_connect_timeout = millis() + 1000UL;
|
||||||
serial_connect_timeout = millis() + 1000UL;
|
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
||||||
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
|
||||||
#endif
|
|
||||||
SERIAL_ECHO_MSG("start");
|
|
||||||
#endif
|
#endif
|
||||||
|
SERIAL_ECHO_MSG("start");
|
||||||
|
|
||||||
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
|
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
|
||||||
mks_esp_wifi_init();
|
mks_esp_wifi_init();
|
||||||
|
|
|
@ -53,23 +53,10 @@ void GcodeSuite::M575() {
|
||||||
case 115200: case 250000: case 500000: case 1000000: {
|
case 115200: case 250000: case 500000: case 1000000: {
|
||||||
const int8_t port = parser.intval('P', -99);
|
const int8_t port = parser.intval('P', -99);
|
||||||
const bool set0 = (port == -99 || port == 0);
|
const bool set0 = (port == -99 || port == 0);
|
||||||
if (set0) {
|
if (set0) SERIAL_ECHO_MSG(" Serial ", '0', " baud rate set to ", baud);
|
||||||
SERIAL_ECHO_START();
|
|
||||||
SERIAL_ECHOLNPAIR(" Serial "
|
|
||||||
#if HAS_MULTI_SERIAL
|
|
||||||
, '0',
|
|
||||||
#else
|
|
||||||
"0"
|
|
||||||
#endif
|
|
||||||
" baud rate set to ", baud
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#if HAS_MULTI_SERIAL
|
#if HAS_MULTI_SERIAL
|
||||||
const bool set1 = (port == -99 || port == 1);
|
const bool set1 = (port == -99 || port == 1);
|
||||||
if (set1) {
|
if (set1) SERIAL_ECHO_MSG(" Serial ", '1', " baud rate set to ", baud);
|
||||||
SERIAL_ECHO_START();
|
|
||||||
SERIAL_ECHOLNPAIR(" Serial ", '1', " baud rate set to ", baud);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SERIAL_FLUSH();
|
SERIAL_FLUSH();
|
||||||
|
@ -85,4 +72,4 @@ void GcodeSuite::M575() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NUM_SERIAL > 0 && BAUD_RATE_GCODE
|
#endif // BAUD_RATE_GCODE
|
||||||
|
|
|
@ -582,12 +582,10 @@
|
||||||
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
|
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT > 7
|
#ifndef SERIAL_PORT
|
||||||
#error "Set SERIAL_PORT to the port on your board. Usually this is 0."
|
#error "SERIAL_PORT must be defined in Configuration.h"
|
||||||
#endif
|
#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."
|
||||||
#if defined(SERIAL_PORT_2) && NUM_SERIAL < 2
|
|
||||||
#error "SERIAL_PORT_2 is not supported for your MOTHERBOARD. Disable it to continue."
|
|
||||||
#endif
|
#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."
|
#error "Please enable only one LCD_SCREEN_ROT_* option: 0, 90, 180, or 270."
|
||||||
#endif
|
#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
|
* FYSETC Mini 12864 RGB backlighting required
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
#if ENABLED(MALYAN_LCD)
|
#if ENABLED(MALYAN_LCD)
|
||||||
|
|
||||||
#define DEBUG_MALYAN_LCD
|
//#define DEBUG_MALYAN_LCD
|
||||||
|
|
||||||
#include "ui_api.h"
|
#include "ui_api.h"
|
||||||
|
|
||||||
|
@ -61,10 +61,6 @@
|
||||||
#define DEBUG_OUT ENABLED(DEBUG_MALYAN_LCD)
|
#define DEBUG_OUT ENABLED(DEBUG_MALYAN_LCD)
|
||||||
#include "../../core/debug_out.h"
|
#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
|
// This is based on longest sys command + a filename, plus some buffer
|
||||||
// in case we encounter some data we don't recognize
|
// 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
|
// There is no evidence a line will ever be this long, but better safe than sorry
|
||||||
|
|
|
@ -117,10 +117,10 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
* If undefined software serial is used according to the pins below
|
* If undefined software serial is used according to the pins below
|
||||||
*/
|
*/
|
||||||
//#define X_HARDWARE_SERIAL Serial1
|
//#define X_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y_HARDWARE_SERIAL Serial1
|
//#define Y_HARDWARE_SERIAL MSerial1
|
||||||
//#define Z_HARDWARE_SERIAL Serial1
|
//#define Z_HARDWARE_SERIAL MSerial1
|
||||||
//#define E0_HARDWARE_SERIAL Serial1
|
//#define E0_HARDWARE_SERIAL MSerial1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Software serial
|
// Software serial
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
*/
|
*/
|
||||||
#if HAS_TMC_UART
|
#if HAS_TMC_UART
|
||||||
#define X_HARDWARE_SERIAL Serial4
|
#define X_HARDWARE_SERIAL MSerial4
|
||||||
#define Y_HARDWARE_SERIAL Serial4
|
#define Y_HARDWARE_SERIAL MSerial4
|
||||||
#define Z_HARDWARE_SERIAL Serial4
|
#define Z_HARDWARE_SERIAL MSerial4
|
||||||
#define E0_HARDWARE_SERIAL Serial4
|
#define E0_HARDWARE_SERIAL MSerial4
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
*/
|
*/
|
||||||
#if HAS_TMC_UART
|
#if HAS_TMC_UART
|
||||||
#define X_HARDWARE_SERIAL Serial4
|
#define X_HARDWARE_SERIAL MSerial4
|
||||||
#define Y_HARDWARE_SERIAL Serial4
|
#define Y_HARDWARE_SERIAL MSerial4
|
||||||
#define Z_HARDWARE_SERIAL Serial4
|
#define Z_HARDWARE_SERIAL MSerial4
|
||||||
#define E0_HARDWARE_SERIAL Serial4
|
#define E0_HARDWARE_SERIAL MSerial4
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -93,10 +93,10 @@
|
||||||
//
|
//
|
||||||
// Hardware serial with switch
|
// Hardware serial with switch
|
||||||
//
|
//
|
||||||
#define X_HARDWARE_SERIAL Serial1
|
#define X_HARDWARE_SERIAL MSerial1
|
||||||
#define Y_HARDWARE_SERIAL Serial1
|
#define Y_HARDWARE_SERIAL MSerial1
|
||||||
#define Z_HARDWARE_SERIAL Serial1
|
#define Z_HARDWARE_SERIAL MSerial1
|
||||||
#define E0_HARDWARE_SERIAL Serial1
|
#define E0_HARDWARE_SERIAL MSerial1
|
||||||
|
|
||||||
// The 4xTMC2209 module doesn't have a serial multiplexer and
|
// The 4xTMC2209 module doesn't have a serial multiplexer and
|
||||||
// needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0
|
// needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0
|
||||||
|
|
|
@ -188,17 +188,11 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
* If undefined software serial is used according to the pins below
|
* If undefined software serial is used according to the pins below
|
||||||
*/
|
*/
|
||||||
//#define X_HARDWARE_SERIAL Serial1
|
//#define X_HARDWARE_SERIAL MSerial1
|
||||||
//#define X2_HARDWARE_SERIAL Serial1
|
//#define Y_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y_HARDWARE_SERIAL Serial1
|
//#define Z_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y2_HARDWARE_SERIAL Serial1
|
//#define E0_HARDWARE_SERIAL MSerial1
|
||||||
//#define Z_HARDWARE_SERIAL Serial1
|
//#define E1_HARDWARE_SERIAL MSerial1
|
||||||
//#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
|
|
||||||
|
|
||||||
// Unused servo pins may be repurposed with SoftwareSerialM
|
// Unused servo pins may be repurposed with SoftwareSerialM
|
||||||
//#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN -- XS2 - 6
|
//#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN -- XS2 - 6
|
||||||
|
|
|
@ -83,10 +83,10 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
* If undefined software serial is used according to the pins below
|
* If undefined software serial is used according to the pins below
|
||||||
*/
|
*/
|
||||||
//#define X_HARDWARE_SERIAL Serial1
|
//#define X_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y_HARDWARE_SERIAL Serial1
|
//#define Y_HARDWARE_SERIAL MSerial1
|
||||||
//#define Z_HARDWARE_SERIAL Serial1
|
//#define Z_HARDWARE_SERIAL MSerial1
|
||||||
//#define E0_HARDWARE_SERIAL Serial1
|
//#define E0_HARDWARE_SERIAL MSerial1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Software serial
|
// Software serial
|
||||||
|
|
|
@ -132,17 +132,11 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
* If undefined software serial is used according to the pins below
|
* If undefined software serial is used according to the pins below
|
||||||
*/
|
*/
|
||||||
//#define X_HARDWARE_SERIAL Serial1
|
//#define X_HARDWARE_SERIAL MSerial1
|
||||||
//#define X2_HARDWARE_SERIAL Serial1
|
//#define Y_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y_HARDWARE_SERIAL Serial1
|
//#define Z_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y2_HARDWARE_SERIAL Serial1
|
//#define E0_HARDWARE_SERIAL MSerial1
|
||||||
//#define Z_HARDWARE_SERIAL Serial1
|
//#define E1_HARDWARE_SERIAL MSerial1
|
||||||
//#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
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Software serial
|
// Software serial
|
||||||
|
|
|
@ -125,17 +125,12 @@
|
||||||
* Hardware serial communication ports.
|
* Hardware serial communication ports.
|
||||||
* If undefined software serial is used according to the pins below
|
* If undefined software serial is used according to the pins below
|
||||||
*/
|
*/
|
||||||
//#define X_HARDWARE_SERIAL Serial1
|
//#define X_HARDWARE_SERIAL MSerial1
|
||||||
//#define X2_HARDWARE_SERIAL Serial1
|
//#define Y_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y_HARDWARE_SERIAL Serial1
|
//#define Z_HARDWARE_SERIAL MSerial1
|
||||||
//#define Y2_HARDWARE_SERIAL Serial1
|
//#define E0_HARDWARE_SERIAL MSerial1
|
||||||
//#define Z_HARDWARE_SERIAL Serial1
|
//#define E1_HARDWARE_SERIAL MSerial1
|
||||||
//#define Z2_HARDWARE_SERIAL Serial1
|
//#define E2_HARDWARE_SERIAL MSerial1
|
||||||
//#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
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Software serial
|
// Software serial
|
||||||
|
|
|
@ -9,6 +9,7 @@ set -e
|
||||||
restore_configs
|
restore_configs
|
||||||
use_example_configs "delta/Malyan M300"
|
use_example_configs "delta/Malyan M300"
|
||||||
opt_disable AUTO_BED_LEVELING_3POINT
|
opt_disable AUTO_BED_LEVELING_3POINT
|
||||||
|
opt_set LCD_SERIAL_PORT 1
|
||||||
exec_test $1 $2 "Malyan M300 (delta)"
|
exec_test $1 $2 "Malyan M300 (delta)"
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
|
|
Loading…
Reference in a new issue