diff --git a/Firmware/MarlinSerial.cpp b/Firmware/MarlinSerial.cpp index 5f1c5ce3..e09ddac3 100644 --- a/Firmware/MarlinSerial.cpp +++ b/Firmware/MarlinSerial.cpp @@ -30,7 +30,7 @@ uint8_t selectedSerialPort = 0; // this is so I can support Attiny series and any other chip without a UART #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H) -#if UART_PRESENT(SERIAL_PORT) +#ifdef HAS_UART ring_buffer rx_buffer = { { 0 }, 0, 0 }; #endif diff --git a/Firmware/MarlinSerial.h b/Firmware/MarlinSerial.h index 27e722bc..ebfc11c1 100644 --- a/Firmware/MarlinSerial.h +++ b/Firmware/MarlinSerial.h @@ -28,9 +28,12 @@ #endif // The presence of the UBRRH register is used to detect a UART. -#define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \ - (port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \ - (port == 3 && defined(UBRR3H))) +#if ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \ + (port == 1 && defined(UBRR1H)) || \ + (port == 2 && defined(UBRR2H)) || \ + (port == 3 && defined(UBRR3H))) +#define HAS_UART +#endif // 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) @@ -82,7 +85,7 @@ struct ring_buffer int tail; }; -#if UART_PRESENT(SERIAL_PORT) +#ifdef HAS_UART extern ring_buffer rx_buffer; #endif