diff --git a/Marlin/src/HAL/HAL_STM32/SoftwareSerial.cpp b/Marlin/src/HAL/HAL_STM32/SoftwareSerial.cpp index 2d2883f4ce3b..f6363aa1cf7d 100644 --- a/Marlin/src/HAL/HAL_STM32/SoftwareSerial.cpp +++ b/Marlin/src/HAL/HAL_STM32/SoftwareSerial.cpp @@ -34,7 +34,7 @@ // // Includes // -#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) +#if defined(PLATFORMIO) && defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) #include "SoftwareSerial.h" #include "timers.h"