Number serial from 1 to match settings

2.0.x
Scott Lahteine 4 years ago
parent 2c62886c71
commit dbd28eecc9

@ -25,7 +25,7 @@
#include "HAL.h" #include "HAL.h"
#ifdef USBCON #ifdef USBCON
DefaultSerial MSerial(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#ifdef BLUETOOTH #ifdef BLUETOOTH
BTSerial btSerial(false, bluetoothSerial); BTSerial btSerial(false, bluetoothSerial);
#endif #endif

@ -83,25 +83,25 @@ typedef int8_t pin_t;
// Serial ports // Serial ports
#ifdef USBCON #ifdef USBCON
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial; typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
#ifdef BLUETOOTH #ifdef BLUETOOTH
typedef ForwardSerial0Type< decltype(bluetoothSerial) > BTSerial; typedef ForwardSerial1Class< decltype(bluetoothSerial) > BTSerial;
extern BTSerial btSerial; extern BTSerial btSerial;
#endif #endif
#define MYSERIAL0 TERN(BLUETOOTH, btSerial, MSerial) #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#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."
#endif #endif
#define MYSERIAL0 customizedSerial1 #define MYSERIAL1 customizedSerial1
#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."
#endif #endif
#define MYSERIAL1 customizedSerial2 #define MYSERIAL2 customizedSerial2
#endif #endif
#endif #endif

@ -238,11 +238,11 @@
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED); static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT customizedSerial1; extern MSerialT customizedSerial1;
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2; extern MSerialT2 customizedSerial2;
#endif #endif
@ -262,7 +262,7 @@
static constexpr bool RX_OVERRUNS = false; static constexpr bool RX_OVERRUNS = false;
}; };
typedef Serial0Type< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3; typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
extern MSerialT3 mmuSerial; extern MSerialT3 mmuSerial;
#endif #endif
@ -292,12 +292,12 @@
}; };
typedef Serial0Type< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4; typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
extern MSerialT4 lcdSerial; extern MSerialT4 lcdSerial;
#endif #endif
// Use the UART for Bluetooth in AT90USB configurations // Use the UART for Bluetooth in AT90USB configurations
#if defined(USBCON) && ENABLED(BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
typedef Serial0Type<HardwareSerial> MSerialT5; typedef Serial1Class<HardwareSerial> MSerialT5;
extern MSerialT5 bluetoothSerial; extern MSerialT5 bluetoothSerial;
#endif #endif

@ -107,16 +107,16 @@ uint16_t HAL_adc_get_result() {
// Forward the default serial ports // Forward the default serial ports
#if ANY_SERIAL_IS(0) #if ANY_SERIAL_IS(0)
DefaultSerial MSerial(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#endif #endif
#if ANY_SERIAL_IS(1) #if ANY_SERIAL_IS(1)
DefaultSerial1 MSerial1(false, Serial1); DefaultSerial2 MSerial1(false, Serial1);
#endif #endif
#if ANY_SERIAL_IS(2) #if ANY_SERIAL_IS(2)
DefaultSerial2 MSerial2(false, Serial2); DefaultSerial3 MSerial2(false, Serial2);
#endif #endif
#if ANY_SERIAL_IS(3) #if ANY_SERIAL_IS(3)
DefaultSerial3 MSerial3(false, Serial3); DefaultSerial4 MSerial3(false, Serial3);
#endif #endif
#endif // ARDUINO_ARCH_SAM #endif // ARDUINO_ARCH_SAM

@ -38,33 +38,32 @@
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial; typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1; typedef ForwardSerial1Class< decltype(Serial1) > DefaultSerial2;
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2; typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3; typedef ForwardSerial1Class< decltype(Serial3) > DefaultSerial4;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
extern DefaultSerial1 MSerial1; extern DefaultSerial2 MSerial1;
extern DefaultSerial2 MSerial2; extern DefaultSerial3 MSerial2;
extern DefaultSerial3 MSerial3; extern DefaultSerial4 MSerial3;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
#define MSerial0 MSerial
// Define MYSERIAL0/1 before MarlinSerial includes! // Define MYSERIAL1/2 before MarlinSerial includes!
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER) #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL0 customizedSerial1 #define MYSERIAL1 customizedSerial1
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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 == -1 || ENABLED(EMERGENCY_PARSER) #if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial2 #define MYSERIAL2 customizedSerial2
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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

@ -141,11 +141,11 @@ struct MarlinSerialCfg {
}; };
#if SERIAL_PORT >= 0 #if SERIAL_PORT >= 0
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT customizedSerial1; extern MSerialT customizedSerial1;
#endif #endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2; extern MSerialT2 customizedSerial2;
#endif #endif

@ -50,7 +50,7 @@ struct MarlinSerialUSB {
FORCE_INLINE int rxMaxEnqueued() { return 0; } FORCE_INLINE int rxMaxEnqueued() { return 0; }
#endif #endif
}; };
typedef Serial0Type<MarlinSerialUSB> MSerialT; typedef Serial1Class<MarlinSerialUSB> MSerialT;
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
extern MSerialT customizedSerial1; extern MSerialT customizedSerial1;

@ -24,6 +24,6 @@
#include "FlushableHardwareSerial.h" #include "FlushableHardwareSerial.h"
Serial0Type<FlushableHardwareSerial> flushableSerial(false, 0); Serial1Class<FlushableHardwareSerial> flushableSerial(false, 0);
#endif #endif

@ -31,4 +31,4 @@ public:
FlushableHardwareSerial(int uart_nr) : HardwareSerial(uart_nr) {} FlushableHardwareSerial(int uart_nr) : HardwareSerial(uart_nr) {}
}; };
extern Serial0Type<FlushableHardwareSerial> flushableSerial; extern Serial1Class<FlushableHardwareSerial> flushableSerial;

@ -41,7 +41,7 @@
#endif #endif
#if ENABLED(ESP3D_WIFISUPPORT) #if ENABLED(ESP3D_WIFISUPPORT)
DefaultSerial MSerial(false, Serial2Socket); DefaultSerial1 MSerial0(false, Serial2Socket);
#endif #endif
// ------------------------ // ------------------------

@ -51,15 +51,15 @@
extern portMUX_TYPE spinlock; extern portMUX_TYPE spinlock;
#define MYSERIAL0 flushableSerial #define MYSERIAL1 flushableSerial
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT) #if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
#if ENABLED(ESP3D_WIFISUPPORT) #if ENABLED(ESP3D_WIFISUPPORT)
typedef ForwardSerial0Type< decltype(Serial2Socket) > DefaultSerial; typedef ForwardSerial1Class< decltype(Serial2Socket) > DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
#define MYSERIAL1 MSerial #define MYSERIAL2 MSerial0
#else #else
#define MYSERIAL1 webSocketSerial #define MYSERIAL2 webSocketSerial
#endif #endif
#endif #endif

@ -81,5 +81,5 @@ public:
#endif #endif
}; };
typedef Serial0Type<WebSocketSerial> MSerialT; typedef Serial1Class<WebSocketSerial> MSerialT;
extern MSerialT webSocketSerial; extern MSerialT webSocketSerial;

@ -61,7 +61,7 @@ uint8_t _getc();
#define SHARED_SERVOS HAS_SERVOS #define SHARED_SERVOS HAS_SERVOS
extern MSerialT usb_serial; extern MSerialT usb_serial;
#define MYSERIAL0 usb_serial #define MYSERIAL1 usb_serial
#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)

@ -115,4 +115,4 @@ struct HalSerial {
volatile bool host_connected; volatile bool host_connected;
}; };
typedef Serial0Type<HalSerial> MSerialT; typedef Serial1Class<HalSerial> MSerialT;

@ -105,8 +105,8 @@ 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);
#ifdef MYSERIAL0 #ifdef MYSERIAL1
MYSERIAL0.begin(BAUDRATE); MYSERIAL1.begin(BAUDRATE);
SERIAL_ECHOLNPGM("x86_64 Initialized"); SERIAL_ECHOLNPGM("x86_64 Initialized");
SERIAL_FLUSHTX(); SERIAL_FLUSHTX();
#endif #endif

@ -29,7 +29,7 @@
#include "watchdog.h" #include "watchdog.h"
#endif #endif
DefaultSerial USBSerial(false, UsbSerial); DefaultSerial1 USBSerial(false, UsbSerial);
uint32_t HAL_adc_reading = 0; uint32_t HAL_adc_reading = 0;

@ -60,26 +60,25 @@ extern "C" volatile uint32_t _millis;
#define ST7920_DELAY_3 DELAY_NS(750) #define ST7920_DELAY_3 DELAY_NS(750)
#endif #endif
typedef ForwardSerial0Type< decltype(UsbSerial) > DefaultSerial; typedef ForwardSerial1Class< decltype(UsbSerial) > DefaultSerial1;
extern DefaultSerial USBSerial; extern DefaultSerial1 USBSerial;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#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 MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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 == -1 #if SERIAL_PORT_2 == -1
#define MYSERIAL1 USBSerial #define MYSERIAL2 USBSerial
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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

@ -26,7 +26,7 @@
#if ANY_SERIAL_IS(0) #if ANY_SERIAL_IS(0)
MarlinSerial _MSerial(LPC_UART0); MarlinSerial _MSerial(LPC_UART0);
MSerialT MSerial(true, _MSerial); MSerialT MSerial0(true, _MSerial);
extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); } extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
#endif #endif
#if ANY_SERIAL_IS(1) #if ANY_SERIAL_IS(1)
@ -51,7 +51,7 @@
// Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro) // Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
if (false) {} if (false) {}
#if ANY_SERIAL_IS(0) #if ANY_SERIAL_IS(0)
else if (this == &_MSerial) emergency_parser.update(MSerial.emergency_state, c); else if (this == &_MSerial) emergency_parser.update(MSerial0.emergency_state, c);
#endif #endif
#if ANY_SERIAL_IS(1) #if ANY_SERIAL_IS(1)
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c); else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);

@ -54,8 +54,8 @@ public:
// On LPC176x framework, HardwareSerial does not implement the same interface as Arduino's Serial, so overloads // On LPC176x framework, HardwareSerial does not implement the same interface as Arduino's Serial, so overloads
// of 'available' and 'read' method are not used in this multiple inheritance scenario. // of 'available' and 'read' method are not used in this multiple inheritance scenario.
// Instead, use a ForwardSerial here that adapts the interface. // Instead, use a ForwardSerial here that adapts the interface.
typedef ForwardSerial0Type<MarlinSerial> MSerialT; typedef ForwardSerial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial; extern MSerialT MSerial0;
extern MSerialT MSerial1; extern MSerialT MSerial1;
extern MSerialT MSerial2; extern MSerialT MSerial2;
extern MSerialT MSerial3; extern MSerialT MSerial3;

@ -26,19 +26,19 @@
#ifdef ADAFRUIT_GRAND_CENTRAL_M4 #ifdef ADAFRUIT_GRAND_CENTRAL_M4
#if ANY_SERIAL_IS(-1) #if ANY_SERIAL_IS(-1)
DefaultSerial MSerial(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#endif #endif
#if ANY_SERIAL_IS(0) #if ANY_SERIAL_IS(0)
DefaultSerial1 MSerial1(false, Serial1); DefaultSerial2 MSerial1(false, Serial1);
#endif #endif
#if ANY_SERIAL_IS(1) #if ANY_SERIAL_IS(1)
DefaultSerial2 MSerial2(false, Serial2); DefaultSerial3 MSerial2(false, Serial2);
#endif #endif
#if ANY_SERIAL_IS(2) #if ANY_SERIAL_IS(2)
DefaultSerial3 MSerial3(false, Serial3); DefaultSerial4 MSerial3(false, Serial3);
#endif #endif
#if ANY_SERIAL_IS(3) #if ANY_SERIAL_IS(3)
DefaultSerial4 MSerial4(false, Serial4); DefaultSerial5 MSerial4(false, Serial4);
#endif #endif
#endif #endif

@ -32,36 +32,36 @@
#include "MarlinSerial_AGCM4.h" #include "MarlinSerial_AGCM4.h"
// Serial ports // Serial ports
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial; typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1; typedef ForwardSerial1Class< decltype(Serial1) > DefaultSerial2;
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2; typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3; typedef ForwardSerial1Class< decltype(Serial3) > DefaultSerial4;
typedef ForwardSerial0Type< decltype(Serial4) > DefaultSerial4; typedef ForwardSerial1Class< decltype(Serial4) > DefaultSerial5;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
extern DefaultSerial1 MSerial1; extern DefaultSerial2 MSerial1;
extern DefaultSerial2 MSerial2; extern DefaultSerial3 MSerial2;
extern DefaultSerial3 MSerial3; extern DefaultSerial4 MSerial3;
extern DefaultSerial4 MSerial4; extern DefaultSerial5 MSerial4;
// MYSERIAL0 required before MarlinSerial includes! // MYSERIAL1 required before MarlinSerial includes!
#define __MSERIAL(X) MSerial##X #define __MSERIAL(X) MSerial##X
#define _MSERIAL(X) __MSERIAL(X) #define _MSERIAL(X) __MSERIAL(X)
#define MSERIAL(X) _MSERIAL(INCREMENT(X)) #define MSERIAL(X) _MSERIAL(INCREMENT(X))
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#define MYSERIAL0 MSerial #define MYSERIAL1 MSerial0
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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 == -1 #if SERIAL_PORT_2 == -1
#define MYSERIAL1 MSerial #define MYSERIAL2 MSerial0
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@ -69,7 +69,7 @@
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if MMU2_SERIAL_PORT == -1 #if MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL MSerial #define MMU2_SERIAL MSerial0
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
@ -79,7 +79,7 @@
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1 #if LCD_SERIAL_PORT == -1
#define LCD_SERIAL MSerial #define LCD_SERIAL MSerial0
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else

@ -22,7 +22,7 @@
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef Serial0Type<Uart> UartT; typedef Serial1Class<Uart> UartT;
extern UartT Serial2; extern UartT Serial2;
extern UartT Serial3; extern UartT Serial3;

@ -29,7 +29,7 @@
#include "../shared/Delay.h" #include "../shared/Delay.h"
#ifdef USBCON #ifdef USBCON
DefaultSerial MSerial(false, SerialUSB); DefaultSerial1 MSerial0(false, SerialUSB);
#endif #endif
#if ENABLED(SRAM_EEPROM_EMULATION) #if ENABLED(SRAM_EEPROM_EMULATION)

@ -40,8 +40,8 @@
#ifdef USBCON #ifdef USBCON
#include <USBSerial.h> #include <USBSerial.h>
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef ForwardSerial0Type< decltype(SerialUSB) > DefaultSerial; typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
#endif #endif
// ------------------------ // ------------------------
@ -51,18 +51,18 @@
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#define MYSERIAL0 MSerial #define MYSERIAL1 MSerial0
#elif WITHIN(SERIAL_PORT, 1, 6) #elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be -1 or 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
#if SERIAL_PORT_2 == -1 #if SERIAL_PORT_2 == -1
#define MYSERIAL1 MSerial #define MYSERIAL2 MSerial0
#elif WITHIN(SERIAL_PORT_2, 1, 6) #elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be -1 or 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
@ -70,7 +70,7 @@
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if MMU2_SERIAL_PORT == -1 #if MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL MSerial #define MMU2_SERIAL MSerial0
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6) #elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
@ -80,7 +80,7 @@
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1 #if LCD_SERIAL_PORT == -1
#define LCD_SERIAL MSerial #define LCD_SERIAL MSerial0
#elif WITHIN(LCD_SERIAL_PORT, 1, 6) #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else

@ -42,7 +42,7 @@ protected:
usart_rx_callback_t _rx_callback; usart_rx_callback_t _rx_callback;
}; };
typedef Serial0Type<MarlinSerial> MSerialT; typedef Serial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial1; extern MSerialT MSerial1;
extern MSerialT MSerial2; extern MSerialT MSerial2;
extern MSerialT MSerial3; extern MSerialT MSerial3;

@ -84,7 +84,7 @@
#if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE #if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
USBSerial SerialUSB; USBSerial SerialUSB;
DefaultSerial MSerial(true, SerialUSB); DefaultSerial1 MSerial0(true, SerialUSB);
#if ENABLED(EMERGENCY_PARSER) #if ENABLED(EMERGENCY_PARSER)
#include "../libmaple/usb/stm32f1/usb_reg_map.h" #include "../libmaple/usb/stm32f1/usb_reg_map.h"
@ -107,7 +107,7 @@
len = usb_cdcacm_peek(buf, total); len = usb_cdcacm_peek(buf, total);
for (uint32 i = 0; i < len; i++) for (uint32 i = 0; i < len; i++)
emergency_parser.update(MSerial.emergency_state, buf[i + total - len]); emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
} }
#endif #endif
#endif #endif

@ -61,11 +61,11 @@
#endif #endif
#ifdef SERIAL_USB #ifdef SERIAL_USB
typedef ForwardSerial0Type< USBSerial > DefaultSerial; typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
#if !HAS_SD_HOST_DRIVE #if !HAS_SD_HOST_DRIVE
#define UsbSerial MSerial #define UsbSerial MSerial0
#else #else
#define UsbSerial MarlinCompositeSerial #define UsbSerial MarlinCompositeSerial
#endif #endif
@ -81,9 +81,9 @@
#endif #endif
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#define MYSERIAL0 UsbSerial #define MYSERIAL1 UsbSerial
#elif WITHIN(SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#elif NUM_UARTS == 5 #elif NUM_UARTS == 5
#error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration." #error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
@ -92,9 +92,9 @@
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1 #if SERIAL_PORT_2 == -1
#define MYSERIAL1 UsbSerial #define MYSERIAL2 UsbSerial
#elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS) #elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#elif NUM_UARTS == 5 #elif NUM_UARTS == 5
#error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration." #error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration."
#else #else

@ -44,8 +44,8 @@ static void TXBegin() {
#warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error." #warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error."
#warning "Disabling the severe error reporting feature currently because the used serial port is not a HW port." #warning "Disabling the severe error reporting feature currently because the used serial port is not a HW port."
#else #else
// We use MYSERIAL0 here, so we need to figure out how to get the linked register // We use MYSERIAL1 here, so we need to figure out how to get the linked register
struct usart_dev* dev = MYSERIAL0.c_dev(); struct usart_dev* dev = MYSERIAL1.c_dev();
// Or use this if removing libmaple // Or use this if removing libmaple
// int irq = dev->irq_num; // int irq = dev->irq_num;
@ -80,7 +80,7 @@ static void TXBegin() {
#define sw_barrier() __asm__ volatile("": : :"memory"); #define sw_barrier() __asm__ volatile("": : :"memory");
static void TX(char c) { static void TX(char c) {
#if WITHIN(SERIAL_PORT, 1, 6) #if WITHIN(SERIAL_PORT, 1, 6)
struct usart_dev* dev = MYSERIAL0.c_dev(); struct usart_dev* dev = MYSERIAL1.c_dev();
while (!(dev->regs->SR & USART_SR_TXE)) { while (!(dev->regs->SR & USART_SR_TXE)) {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
sw_barrier(); sw_barrier();

@ -134,12 +134,12 @@ constexpr bool IsSerialClassAllowed(const HardwareSerial&) { return false; }
// If you encounter this error, replace SerialX with MSerialX, for example MSerial3. // If you encounter this error, replace SerialX with MSerialX, for example MSerial3.
// Non-TMC ports were already validated in HAL.h, so do not require verbose error messages. // Non-TMC ports were already validated in HAL.h, so do not require verbose error messages.
#ifdef MYSERIAL0
CHECK_CFG_SERIAL(MYSERIAL0);
#endif
#ifdef MYSERIAL1 #ifdef MYSERIAL1
CHECK_CFG_SERIAL(MYSERIAL1); CHECK_CFG_SERIAL(MYSERIAL1);
#endif #endif
#ifdef MYSERIAL2
CHECK_CFG_SERIAL(MYSERIAL2);
#endif
#ifdef LCD_SERIAL #ifdef LCD_SERIAL
CHECK_CFG_SERIAL(LCD_SERIAL); CHECK_CFG_SERIAL(LCD_SERIAL);
#endif #endif

@ -47,7 +47,7 @@ struct MarlinSerial : public HardwareSerial {
#endif #endif
}; };
typedef Serial0Type<MarlinSerial> MSerialT; typedef Serial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial1; extern MSerialT MSerial1;
extern MSerialT MSerial2; extern MSerialT MSerial2;

@ -24,7 +24,7 @@
#define PRODUCT_ID 0x29 #define PRODUCT_ID 0x29
USBMassStorage MarlinMSC; USBMassStorage MarlinMSC;
Serial0Type<USBCompositeSerial> MarlinCompositeSerial(true); Serial1Class<USBCompositeSerial> MarlinCompositeSerial(true);
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"

@ -21,6 +21,6 @@
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
extern USBMassStorage MarlinMSC; extern USBMassStorage MarlinMSC;
extern Serial0Type<USBCompositeSerial> MarlinCompositeSerial; extern Serial1Class<USBCompositeSerial> MarlinCompositeSerial;
void MSC_SD_init(); void MSC_SD_init();

@ -31,7 +31,7 @@
#include <Wire.h> #include <Wire.h>
DefaultSerial MSerial(false); DefaultSerial1 MSerial0(false);
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
uint16_t HAL_adc_result; uint16_t HAL_adc_result;

@ -51,19 +51,18 @@
#endif #endif
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef Serial0Type<decltype(Serial)> DefaultSerial; typedef Serial1Class<decltype(Serial)> DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
typedef ForwardSerial0Type<decltype(SerialUSB)> USBSerialType; typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial; extern USBSerialType USBSerial;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#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 MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#endif #endif
#define HAL_SERVO_LIB libServo #define HAL_SERVO_LIB libServo

@ -31,7 +31,7 @@
#include <Wire.h> #include <Wire.h>
DefaultSerial MSerial(false); DefaultSerial1 MSerial0(false);
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
uint16_t HAL_adc_result, HAL_adc_select; uint16_t HAL_adc_result, HAL_adc_select;

@ -54,19 +54,18 @@
#endif #endif
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef Serial0Type<decltype(Serial)> DefaultSerial; typedef Serial1Class<decltype(Serial)> DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
typedef ForwardSerial0Type<decltype(SerialUSB)> USBSerialType; typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial; extern USBSerialType USBSerial;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#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 MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#endif #endif
#define HAL_SERVO_LIB libServo #define HAL_SERVO_LIB libServo

@ -32,7 +32,7 @@
#include <Wire.h> #include <Wire.h>
DefaultSerial MSerial(false); DefaultSerial1 MSerial0(false);
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
uint16_t HAL_adc_result, HAL_adc_select; uint16_t HAL_adc_result, HAL_adc_select;

@ -56,30 +56,29 @@
#endif #endif
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef Serial0Type<decltype(Serial)> DefaultSerial; typedef Serial1Class<decltype(Serial)> DefaultSerial1;
extern DefaultSerial MSerial; extern DefaultSerial1 MSerial0;
typedef ForwardSerial0Type<decltype(SerialUSB)> USBSerialType; typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial; extern USBSerialType USBSerial;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
#define MSerial0 MSerial
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#define MYSERIAL0 SerialUSB #define MYSERIAL1 SerialUSB
#elif WITHIN(SERIAL_PORT, 0, 8) #elif WITHIN(SERIAL_PORT, 0, 8)
#define MYSERIAL0 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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 == -1 #if SERIAL_PORT_2 == -1
#define MYSERIAL1 usbSerial #define MYSERIAL2 usbSerial
#elif SERIAL_PORT_2 == -2 #elif SERIAL_PORT_2 == -2
#define MYSERIAL1 ethernet.telnetClient #define MYSERIAL2 ethernet.telnetClient
#elif WITHIN(SERIAL_PORT_2, 0, 8) #elif WITHIN(SERIAL_PORT_2, 0, 8)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -2 to 8. Please update your configuration." #error "SERIAL_PORT_2 must be from -2 to 8. Please update your configuration."
#endif #endif

@ -43,12 +43,12 @@ PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMST
#else #else
#if HAS_ETHERNET #if HAS_ETHERNET
// Runtime checking of the condition variable // Runtime checking of the condition variable
ConditionalSerial<decltype(MYSERIAL1)> serialOut1(ethernet.have_telnet_client, MYSERIAL1, false); // Takes reference here ConditionalSerial<decltype(MYSERIAL2)> serialOut2(ethernet.have_telnet_client, MYSERIAL2, false); // Takes reference here
#else #else
// Don't pay for runtime checking a true variable, instead use the output directly // Don't pay for runtime checking a true variable, instead use the output directly
#define serialOut1 MYSERIAL1 #define serialOut2 MYSERIAL2
#endif #endif
SerialOutputT multiSerial(MYSERIAL0, serialOut1); SerialOutputT multiSerial(MYSERIAL1, serialOut2);
#endif #endif
#endif #endif

@ -69,15 +69,15 @@ extern uint8_t marlin_debug_flags;
#ifdef SERIAL_CATCHALL #ifdef SERIAL_CATCHALL
typedef MultiSerial<decltype(MYSERIAL), decltype(SERIAL_CATCHALL), 0> SerialOutputT; typedef MultiSerial<decltype(MYSERIAL), decltype(SERIAL_CATCHALL), 0> SerialOutputT;
#else #else
typedef MultiSerial<decltype(MYSERIAL0), TERN(HAS_ETHERNET, ConditionalSerial<decltype(MYSERIAL1)>, decltype(MYSERIAL1)), 0> SerialOutputT; typedef MultiSerial<decltype(MYSERIAL1), TERN(HAS_ETHERNET, ConditionalSerial<decltype(MYSERIAL2)>, decltype(MYSERIAL2)), 0> SerialOutputT;
#endif #endif
extern SerialOutputT multiSerial; extern SerialOutputT multiSerial;
#define _SERIAL_IMPL multiSerial #define _SERIAL_IMPL multiSerial
#else #else
#define _PORT_REDIRECT(n,p) NOOP #define _PORT_REDIRECT(n,p) NOOP
#define _PORT_RESTORE(n) NOOP #define _PORT_RESTORE(n) NOOP
#define SERIAL_ASSERT(P) NOOP #define SERIAL_ASSERT(P) NOOP
#define _SERIAL_IMPL MYSERIAL0 #define _SERIAL_IMPL MYSERIAL1
#endif #endif
#if ENABLED(MEATPACK) #if ENABLED(MEATPACK)

@ -257,8 +257,8 @@ struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset,
}; };
// Build the actual serial object depending on current configuration // Build the actual serial object depending on current configuration
#define Serial0Type TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, BaseSerial) #define Serial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, BaseSerial)
#define ForwardSerial0Type TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial) #define ForwardSerial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial)
#ifdef HAS_MULTI_SERIAL #ifdef HAS_MULTI_SERIAL
#define Serial1Type ConditionalSerial #define Serial2Class ConditionalSerial
#endif #endif

@ -124,7 +124,7 @@ void MarlinEthernet::check() {
if (!Ethernet.localIP()) break; if (!Ethernet.localIP()) break;
SERIAL_ECHOPGM("Successfully started telnet server with IP "); SERIAL_ECHOPGM("Successfully started telnet server with IP ");
MYSERIAL0.println(Ethernet.localIP()); MYSERIAL1.println(Ethernet.localIP());
linkState = LINKED; linkState = LINKED;
break; break;

@ -61,10 +61,10 @@ void GcodeSuite::M575() {
SERIAL_FLUSH(); SERIAL_FLUSH();
if (set0) { MYSERIAL0.end(); MYSERIAL0.begin(baud); } if (set0) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
#if HAS_MULTI_SERIAL #if HAS_MULTI_SERIAL
if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); } if (set1) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
#endif #endif
} break; } break;

@ -57,19 +57,19 @@ void GcodeSuite::M111() {
SERIAL_ECHOPGM(STR_DEBUG_OFF); SERIAL_ECHOPGM(STR_DEBUG_OFF);
#if !defined(__AVR__) || !defined(USBCON) #if !defined(__AVR__) || !defined(USBCON)
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL0.buffer_overruns()); SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
#endif #endif
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
SERIAL_ECHOPAIR("\nFraming Errors: ", MYSERIAL0.framing_errors()); SERIAL_ECHOPAIR("\nFraming Errors: ", MYSERIAL1.framing_errors());
#endif #endif
#if ENABLED(SERIAL_STATS_DROPPED_RX) #if ENABLED(SERIAL_STATS_DROPPED_RX)
SERIAL_ECHOPAIR("\nDropped bytes: ", MYSERIAL0.dropped()); SERIAL_ECHOPAIR("\nDropped bytes: ", MYSERIAL1.dropped());
#endif #endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued()); SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL1.rxMaxEnqueued());
#endif #endif
#endif // !__AVR__ || !USBCON #endif // !__AVR__ || !USBCON
} }

@ -635,10 +635,10 @@ void GCodeQueue::advance() {
#if !defined(__AVR__) || !defined(USBCON) #if !defined(__AVR__) || !defined(USBCON)
#if ENABLED(SERIAL_STATS_DROPPED_RX) #if ENABLED(SERIAL_STATS_DROPPED_RX)
SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL0.dropped()); SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL1.dropped());
#endif #endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
SERIAL_ECHOLNPAIR("Max RX Queue Size: ", MYSERIAL0.rxMaxEnqueued()); SERIAL_ECHOLNPAIR("Max RX Queue Size: ", MYSERIAL1.rxMaxEnqueued());
#endif #endif
#endif #endif

@ -80,7 +80,7 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c)
void lv_eom_hook(void *) void lv_eom_hook(void *)
{ {
// Message is done, let's remove the hook now // Message is done, let's remove the hook now
MYSERIAL0.setHook(); MYSERIAL1.setHook();
// We are back from the keyboard, so let's redraw ourselves // We are back from the keyboard, so let's redraw ourselves
draw_return_ui(); draw_return_ui();
} }

@ -164,7 +164,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
case GCodeCommand: case GCodeCommand:
if (!queue.ring_buffer.full(3)) { if (!queue.ring_buffer.full(3)) {
// Hook anything that goes to the serial port // Hook anything that goes to the serial port
MYSERIAL0.setHook(lv_serial_capt_hook, lv_eom_hook, 0); MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
queue.enqueue_one_now(ret_ta_txt); queue.enqueue_one_now(ret_ta_txt);
} }
lv_clear_keyboard(); lv_clear_keyboard();

@ -414,8 +414,8 @@ void update_usb_status(const bool forceUpdate) {
// This is mildly different than stock, which // This is mildly different than stock, which
// appears to use the usb discovery status. // appears to use the usb discovery status.
// This is more logical. // This is more logical.
if (last_usb_connected_status != MYSERIAL0.connected() || forceUpdate) { if (last_usb_connected_status != MYSERIAL1.connected() || forceUpdate) {
last_usb_connected_status = MYSERIAL0.connected(); last_usb_connected_status = MYSERIAL1.connected();
write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n")); write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n"));
} }
} }

@ -54,7 +54,7 @@
#define UHS_DEVICE_WINDOWS_USB_SPEC_VIOLATION_DESCRIPTOR_DEVICE 1 #define UHS_DEVICE_WINDOWS_USB_SPEC_VIOLATION_DESCRIPTOR_DEVICE 1
#define UHS_HOST_MAX_INTERFACE_DRIVERS 2 #define UHS_HOST_MAX_INTERFACE_DRIVERS 2
#define MASS_MAX_SUPPORTED_LUN 1 #define MASS_MAX_SUPPORTED_LUN 1
#define USB_HOST_SERIAL MYSERIAL0 #define USB_HOST_SERIAL MYSERIAL1
// Workaround for certain issues with UHS3 // Workaround for certain issues with UHS3
#define SKIP_PAGE3F // Required for IOGEAR media adapter #define SKIP_PAGE3F // Required for IOGEAR media adapter

@ -66,7 +66,7 @@
* For example Serial3. * For example Serial3.
*/ */
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
#define USB_HOST_SERIAL MYSERIAL0 #define USB_HOST_SERIAL MYSERIAL1
#endif #endif
#ifndef USB_HOST_SERIAL #ifndef USB_HOST_SERIAL

@ -32,12 +32,12 @@ This is easily done via type definition of the feature.
For example, to create a single serial interface with 2 serial outputs (one enabled at runtime and the other switchable): For example, to create a single serial interface with 2 serial outputs (one enabled at runtime and the other switchable):
```cpp ```cpp
typedef MultiSerial< RuntimeSerial<Serial>, ConditionalSerial<TelnetClient> > Serial0Type; typedef MultiSerial< RuntimeSerial<Serial>, ConditionalSerial<TelnetClient> > Serial1Class;
``` ```
To send the same output to 4 serial ports you could nest `MultiSerial` like this: To send the same output to 4 serial ports you could nest `MultiSerial` like this:
```cpp ```cpp
typedef MultiSerial< MultiSerial< BaseSerial<Serial>, BaseSerial<Serial1> >, MultiSerial< BaseSerial<Serial2>, BaseSerial<Serial3>, 2, 1>, 0, 2> Serial0Type; typedef MultiSerial< MultiSerial< BaseSerial<Serial>, BaseSerial<Serial1> >, MultiSerial< BaseSerial<Serial2>, BaseSerial<Serial3>, 2, 1>, 0, 2> Serial1Class;
``` ```
The magical numbers here are the step and offset for computing the serial port. Simplifying the above monster a bit: The magical numbers here are the step and offset for computing the serial port. Simplifying the above monster a bit:
```cpp ```cpp

Loading…
Cancel
Save