diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index ad2c755ba..f1410f1d4 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -131,7 +131,7 @@ #define AXIS_HAS_UART(A) ( AXIS_DRIVER_TYPE(A,TMC2208) \ || AXIS_DRIVER_TYPE(A,TMC2209) ) -#define AXIS_HAS_SW_SERIAL(A) ((AXIS_HAS_UART(A) && !defined(A##_HARDWARE_SERIAL))) +#define AXIS_HAS_SW_SERIAL(A) ((AXIS_HAS_UART(A) && !HAS_##A##_HARDWARE_SERIAL)) #define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ || AXIS_DRIVER_TYPE(A,TMC2160) \ diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 6785ea01e..55058a4d1 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1444,6 +1444,59 @@ #define HAS_Z4_MAX (PIN_EXISTS(Z4_MAX)) #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE)) +// Cannot use a macro with a defined() statement inside REPEAT macros. +// [AXIS]_HARDWARE_SERIAL definitions are typically strings which cannot be +// tested directly, as they will evaluate to 0. +#ifdef X_HARDWARE_SERIAL + #define HAS_X_HARDWARE_SERIAL 1 +#endif +#ifdef X2_HARDWARE_SERIAL + #define HAS_X2_HARDWARE_SERIAL 1 +#endif +#ifdef Y_HARDWARE_SERIAL + #define HAS_Y_HARDWARE_SERIAL 1 +#endif +#ifdef Y2_HARDWARE_SERIAL + #define HAS_Y2_HARDWARE_SERIAL 1 +#endif +#ifdef Z_HARDWARE_SERIAL + #define HAS_Z_HARDWARE_SERIAL 1 +#endif +#ifdef Z2_HARDWARE_SERIAL + #define HAS_Z2_HARDWARE_SERIAL 1 +#endif +#ifdef Z3_HARDWARE_SERIAL + #define HAS_Z3_HARDWARE_SERIAL 1 +#endif +#ifdef Z4_HARDWARE_SERIAL + #define HAS_Z4_HARDWARE_SERIAL 1 +#endif +#ifdef E0_HARDWARE_SERIAL + #define HAS_E0_HARDWARE_SERIAL 1 +#endif +#ifdef E1_HARDWARE_SERIAL + #define HAS_E1_HARDWARE_SERIAL 1 +#endif +#ifdef E2_HARDWARE_SERIAL + #define HAS_E2_HARDWARE_SERIAL 1 +#endif +#ifdef E3_HARDWARE_SERIAL + #define HAS_E3_HARDWARE_SERIAL 1 +#endif +#ifdef E4_HARDWARE_SERIAL + #define HAS_E4_HARDWARE_SERIAL 1 +#endif +#ifdef E5_HARDWARE_SERIAL + #define HAS_E5_HARDWARE_SERIAL 1 +#endif +#ifdef E6_HARDWARE_SERIAL + #define HAS_E6_HARDWARE_SERIAL 1 +#endif +#ifdef E7_HARDWARE_SERIAL + #define HAS_E7_HARDWARE_SERIAL 1 +#endif + + // // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface) // diff --git a/buildroot/share/tests/esp32-tests b/buildroot/share/tests/esp32-tests index 47f5d8176..18abab8b0 100755 --- a/buildroot/share/tests/esp32-tests +++ b/buildroot/share/tests/esp32-tests @@ -18,5 +18,20 @@ opt_set TX_BUFFER_SIZE 64 opt_add WEBSUPPORT exec_test $1 $2 "ESP32 with WIFISUPPORT and WEBSUPPORT" +# +# Build with TMC drivers using hardware serial +# +restore_configs +opt_set MOTHERBOARD BOARD_ESPRESSIF_ESP32 +opt_set X_DRIVER_TYPE TMC2209 +opt_set Y_DRIVER_TYPE TMC2208 +opt_set Z_DRIVER_TYPE TMC2209 +opt_set E0_DRIVER_TYPE TMC2209 +opt_set X_HARDWARE_SERIAL Serial1 +opt_set Y_HARDWARE_SERIAL Serial1 +opt_set Z_HARDWARE_SERIAL Serial1 +opt_set E0_HARDWARE_SERIAL Serial1 +exec_test $1 $2 "ESP32 with TMC Hardware Serial" + # cleanup restore_configs