diff --git a/Marlin/MarlinConfig.h b/Marlin/MarlinConfig.h index 245974eb74..5f77dba0e4 100644 --- a/Marlin/MarlinConfig.h +++ b/Marlin/MarlinConfig.h @@ -31,7 +31,7 @@ #include "Conditionals_LCD.h" #include "Configuration_adv.h" #include "pins.h" -#ifndef USBCON +#if defined(__AVR__) && !defined(USBCON) #define HardwareSerial_h // trick to disable the standard HWserial #endif #include "Arduino.h" diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp index dfea17cffc..1b288b67be 100644 --- a/Marlin/MarlinSerial.cpp +++ b/Marlin/MarlinSerial.cpp @@ -34,7 +34,7 @@ #include "MarlinConfig.h" -#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)) +#if !(defined(__AVR__) && defined(USBCON)) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)) #include "MarlinSerial.h" #include "Marlin.h" @@ -651,9 +651,9 @@ // Preinstantiate MarlinSerial customizedSerial; -#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) +#endif // !(__AVR__ && USBCON) && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) // For AT90USB targets use the UART for BT interfacing -#if defined(USBCON) && ENABLED(BLUETOOTH) +#if defined(__AVR__) && defined(USBCON) && ENABLED(BLUETOOTH) HardwareSerial bluetoothSerial; #endif diff --git a/Marlin/MarlinSerial.h b/Marlin/MarlinSerial.h index 8603b654f9..0cd15a599e 100644 --- a/Marlin/MarlinSerial.h +++ b/Marlin/MarlinSerial.h @@ -85,7 +85,7 @@ #define TX_BUFFER_SIZE 32 #endif -#ifndef USBCON +#if !(defined(__AVR__) && defined(USBCON)) #if RX_BUFFER_SIZE > 256 typedef uint16_t ring_buffer_pos_t; @@ -163,10 +163,10 @@ extern MarlinSerial customizedSerial; -#endif // !USBCON +#endif // !(__AVR__ && USBCON) // Use the UART for Bluetooth in AT90USB configurations -#if defined(USBCON) && ENABLED(BLUETOOTH) +#if defined(__AVR__) && defined(USBCON) && ENABLED(BLUETOOTH) extern HardwareSerial bluetoothSerial; #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index db4c5f0fe5..b3e0ff4499 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -13848,7 +13848,7 @@ void loop() { card.closefile(); SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); - #ifndef USBCON + #if !(defined(__AVR__) && defined(USBCON)) #if ENABLED(SERIAL_STATS_DROPPED_RX) SERIAL_ECHOLNPAIR("Dropped bytes: ", customizedSerial.dropped()); #endif @@ -13856,7 +13856,7 @@ void loop() { #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) SERIAL_ECHOLNPAIR("Max RX Queue Size: ", customizedSerial.rxMaxEnqueued()); #endif - #endif // !USBCON + #endif // !(__AVR__ && USBCON) ok_to_send(); } diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 77d7fa0e6a..15e49ddf91 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -275,7 +275,7 @@ /** * Serial */ -#ifndef USBCON +#if !(defined(__AVR__) && defined(USBCON)) #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024 #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)) @@ -1281,7 +1281,7 @@ static_assert(1 >= 0 /** * emergency-command parser */ -#if ENABLED(EMERGENCY_PARSER) && defined(USBCON) +#if ENABLED(EMERGENCY_PARSER) && defined(__AVR__) && defined(USBCON) #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)." #endif diff --git a/Marlin/serial.h b/Marlin/serial.h index 9946571213..dc1da87353 100644 --- a/Marlin/serial.h +++ b/Marlin/serial.h @@ -25,7 +25,7 @@ #include "MarlinConfig.h" -#ifdef USBCON +#if defined(__AVR__) && defined(USBCON) #include #if ENABLED(BLUETOOTH) extern HardwareSerial bluetoothSerial;