Add USB serial support to SERIAL_PORT_2 on DUE (#17245)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2.0.x
ellensp 5 years ago committed by GitHub
parent adb7a88428
commit cd4060a99c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,7 +94,6 @@
#endif #endif
#endif #endif
#include "MarlinSerial.h" #include "MarlinSerial.h"
#include "MarlinSerialUSB.h" #include "MarlinSerialUSB.h"

@ -629,23 +629,13 @@ void MarlinSerial<Cfg>::printFloat(double number, uint8_t digits) {
// If not using the USB port as serial port // If not using the USB port as serial port
#if SERIAL_PORT >= 0 #if SERIAL_PORT >= 0
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>; // Define
// Preinstantiate MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1; // Instantiate
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;
// Instantiate
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
#endif #endif
#ifdef SERIAL_PORT_2 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>; // Define
// Preinstantiate MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2; // Instantiate
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>;
// Instantiate
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
#endif #endif
#endif // ARDUINO_ARCH_SAM #endif // ARDUINO_ARCH_SAM

@ -172,13 +172,9 @@ struct MarlinSerialCfg {
}; };
#if SERIAL_PORT >= 0 #if SERIAL_PORT >= 0
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1; extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
#endif
#endif // SERIAL_PORT >= 0 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
#ifdef SERIAL_PORT_2
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2; extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
#endif #endif

@ -29,7 +29,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if SERIAL_PORT == -1 #if HAS_USB_SERIAL
#include "MarlinSerialUSB.h" #include "MarlinSerialUSB.h"
@ -283,8 +283,12 @@ void MarlinSerialUSB::printFloat(double number, uint8_t digits) {
} }
// Preinstantiate // Preinstantiate
MarlinSerialUSB customizedSerial1; #if SERIAL_PORT == -1
MarlinSerialUSB customizedSerial1;
#endif // SERIAL_PORT == -1 #endif
#if SERIAL_PORT_2 == -1
MarlinSerialUSB customizedSerial2;
#endif
#endif // HAS_USB_SERIAL
#endif // ARDUINO_ARCH_SAM #endif // ARDUINO_ARCH_SAM

@ -28,7 +28,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if SERIAL_PORT == -1 #if HAS_USB_SERIAL
#include <WString.h> #include <WString.h>
@ -88,6 +88,12 @@ private:
static void printFloat(double, uint8_t); static void printFloat(double, uint8_t);
}; };
extern MarlinSerialUSB customizedSerial1; #if SERIAL_PORT == -1
extern MarlinSerialUSB customizedSerial1;
#endif
#if SERIAL_PORT_2 == -1
extern MarlinSerialUSB customizedSerial2;
#endif
#endif // SERIAL_PORT == -1 #endif // HAS_USB_SERIAL

@ -683,6 +683,10 @@
#define SPI_SPEED SPI_FULL_SPEED #define SPI_SPEED SPI_FULL_SPEED
#endif #endif
#if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1
#define HAS_USB_SERIAL 1
#endif
/** /**
* This setting is also used by M109 when trying to calculate * This setting is also used by M109 when trying to calculate
* a ballpark safe margin to prevent wait-forever situation. * a ballpark safe margin to prevent wait-forever situation.

Loading…
Cancel
Save