Add USE_MARLINSERIAL conditional

This commit is contained in:
Scott Lahteine 2018-05-24 05:47:55 -05:00
parent ebb839971d
commit 27c5ede796
7 changed files with 17 additions and 16 deletions

View File

@ -505,4 +505,6 @@
#define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER)) #define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED)) #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED))
#define USE_MARLINSERIAL !(defined(__AVR__) && defined(USBCON))
#endif // CONDITIONALS_LCD_H #endif // CONDITIONALS_LCD_H

View File

@ -30,7 +30,7 @@
#include "Conditionals_LCD.h" #include "Conditionals_LCD.h"
#include "Configuration_adv.h" #include "Configuration_adv.h"
#if defined(__AVR__) && !defined(USBCON) #if USE_MARLINSERIAL
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#endif #endif

View File

@ -34,7 +34,7 @@
#include "MarlinConfig.h" #include "MarlinConfig.h"
#if !(defined(__AVR__) && defined(USBCON)) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)) #if USE_MARLINSERIAL && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
#include "MarlinSerial.h" #include "MarlinSerial.h"
#include "Marlin.h" #include "Marlin.h"
@ -561,9 +561,9 @@
// Preinstantiate // Preinstantiate
MarlinSerial customizedSerial; MarlinSerial customizedSerial;
#endif // !(__AVR__ && USBCON) && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) #endif // USE_MARLINSERIAL && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
// For AT90USB targets use the UART for BT interfacing // For AT90USB targets use the UART for BT interfacing
#if defined(__AVR__) && defined(USBCON) && ENABLED(BLUETOOTH) #if !USE_MARLINSERIAL && ENABLED(BLUETOOTH)
HardwareSerial bluetoothSerial; HardwareSerial bluetoothSerial;
#endif #endif

View File

@ -85,7 +85,7 @@
#define TX_BUFFER_SIZE 32 #define TX_BUFFER_SIZE 32
#endif #endif
#if !(defined(__AVR__) && defined(USBCON)) #if USE_MARLINSERIAL
#if RX_BUFFER_SIZE > 256 #if RX_BUFFER_SIZE > 256
typedef uint16_t ring_buffer_pos_t; typedef uint16_t ring_buffer_pos_t;
@ -159,10 +159,10 @@
extern MarlinSerial customizedSerial; extern MarlinSerial customizedSerial;
#endif // !(__AVR__ && USBCON) #endif // USE_MARLINSERIAL
// Use the UART for Bluetooth in AT90USB configurations // Use the UART for Bluetooth in AT90USB configurations
#if defined(__AVR__) && defined(USBCON) && ENABLED(BLUETOOTH) #if !USE_MARLINSERIAL && ENABLED(BLUETOOTH)
extern HardwareSerial bluetoothSerial; extern HardwareSerial bluetoothSerial;
#endif #endif

View File

@ -14500,15 +14500,14 @@ void loop() {
card.closefile(); card.closefile();
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
#if !(defined(__AVR__) && defined(USBCON)) #if USE_MARLINSERIAL
#if ENABLED(SERIAL_STATS_DROPPED_RX) #if ENABLED(SERIAL_STATS_DROPPED_RX)
SERIAL_ECHOLNPAIR("Dropped bytes: ", customizedSerial.dropped()); SERIAL_ECHOLNPAIR("Dropped bytes: ", customizedSerial.dropped());
#endif #endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
SERIAL_ECHOLNPAIR("Max RX Queue Size: ", customizedSerial.rxMaxEnqueued()); SERIAL_ECHOLNPAIR("Max RX Queue Size: ", customizedSerial.rxMaxEnqueued());
#endif #endif
#endif // !(__AVR__ && USBCON) #endif
ok_to_send(); ok_to_send();
} }

View File

@ -307,7 +307,7 @@
/** /**
* Serial * Serial
*/ */
#if !(defined(__AVR__) && defined(USBCON)) #if USE_MARLINSERIAL
#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024 #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
#error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops." #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
#elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE)) #elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE))
@ -1274,7 +1274,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
/** /**
* emergency-command parser * emergency-command parser
*/ */
#if ENABLED(EMERGENCY_PARSER) && defined(__AVR__) && defined(USBCON) #if ENABLED(EMERGENCY_PARSER) && !USE_MARLINSERIAL
#error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)." #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
#endif #endif

View File

@ -25,7 +25,10 @@
#include "MarlinConfig.h" #include "MarlinConfig.h"
#if defined(__AVR__) && defined(USBCON) #if USE_MARLINSERIAL
#include "MarlinSerial.h"
#define MYSERIAL0 customizedSerial
#else
#include <HardwareSerial.h> #include <HardwareSerial.h>
#if ENABLED(BLUETOOTH) #if ENABLED(BLUETOOTH)
extern HardwareSerial bluetoothSerial; extern HardwareSerial bluetoothSerial;
@ -33,9 +36,6 @@
#else #else
#define MYSERIAL0 Serial #define MYSERIAL0 Serial
#endif // BLUETOOTH #endif // BLUETOOTH
#else
#include "MarlinSerial.h"
#define MYSERIAL0 customizedSerial
#endif #endif
extern const char echomagic[] PROGMEM; extern const char echomagic[] PROGMEM;