Browse Source

Merge pull request #3375 from leptun/MK3_arduino_1.8.13

Fix arduino 1.8.13 warnings
Alex Voinea 2 years ago
parent
commit
2b18357fef
2 changed files with 8 additions and 5 deletions
  1. 1 1
      Firmware/MarlinSerial.cpp
  2. 7 4
      Firmware/MarlinSerial.h

+ 1 - 1
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
 

+ 7 - 4
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 ((SERIAL_PORT == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
+	(SERIAL_PORT == 1 && defined(UBRR1H)) || \
+	(SERIAL_PORT == 2 && defined(UBRR2H)) || \
+	(SERIAL_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