From a891af2f7a8a548d451c4801771bc622e3da824c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 24 Mar 2018 15:26:11 -0400 Subject: [PATCH] Enforce minimum TMC2130 / TMC2208 libs --- Marlin/src/inc/SanityCheck.h | 128 +++++++++++----------- Marlin/src/module/stepper_indirection.cpp | 8 ++ platformio.ini | 4 +- 3 files changed, 75 insertions(+), 65 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 71992f4c26..7c3caae5c7 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1393,36 +1393,36 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * Make sure HAVE_TMC26X is warranted */ #if ENABLED(HAVE_TMC26X) && !( \ - ENABLED( X_IS_TMC26X) \ - || ENABLED(X2_IS_TMC26X) \ - || ENABLED( Y_IS_TMC26X) \ - || ENABLED(Y2_IS_TMC26X) \ - || ENABLED( Z_IS_TMC26X) \ - || ENABLED(Z2_IS_TMC26X) \ - || ENABLED(E0_IS_TMC26X) \ - || ENABLED(E1_IS_TMC26X) \ - || ENABLED(E2_IS_TMC26X) \ - || ENABLED(E3_IS_TMC26X) \ - || ENABLED(E4_IS_TMC26X) \ + ENABLED( X_IS_TMC26X ) \ + || ENABLED( X2_IS_TMC26X ) \ + || ENABLED( Y_IS_TMC26X ) \ + || ENABLED( Y2_IS_TMC26X ) \ + || ENABLED( Z_IS_TMC26X ) \ + || ENABLED( Z2_IS_TMC26X ) \ + || ENABLED( E0_IS_TMC26X ) \ + || ENABLED( E1_IS_TMC26X ) \ + || ENABLED( E2_IS_TMC26X ) \ + || ENABLED( E3_IS_TMC26X ) \ + || ENABLED( E4_IS_TMC26X ) \ ) #error "HAVE_TMC26X requires at least one TMC26X stepper to be set." #endif /** - * TMC2130 Requirements + * Make sure HAVE_TMC2130 is warranted */ #if ENABLED(HAVE_TMC2130) - #if !( ENABLED( X_IS_TMC2130) \ - || ENABLED(X2_IS_TMC2130) \ - || ENABLED( Y_IS_TMC2130) \ - || ENABLED(Y2_IS_TMC2130) \ - || ENABLED( Z_IS_TMC2130) \ - || ENABLED(Z2_IS_TMC2130) \ - || ENABLED(E0_IS_TMC2130) \ - || ENABLED(E1_IS_TMC2130) \ - || ENABLED(E2_IS_TMC2130) \ - || ENABLED(E3_IS_TMC2130) \ - || ENABLED(E4_IS_TMC2130) ) + #if !( ENABLED( X_IS_TMC2130 ) \ + || ENABLED( X2_IS_TMC2130 ) \ + || ENABLED( Y_IS_TMC2130 ) \ + || ENABLED( Y2_IS_TMC2130 ) \ + || ENABLED( Z_IS_TMC2130 ) \ + || ENABLED( Z2_IS_TMC2130 ) \ + || ENABLED( E0_IS_TMC2130 ) \ + || ENABLED( E1_IS_TMC2130 ) \ + || ENABLED( E2_IS_TMC2130 ) \ + || ENABLED( E3_IS_TMC2130 ) \ + || ENABLED( E4_IS_TMC2130 ) ) #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set." #elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." @@ -1476,36 +1476,38 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif /** - * TMC2208 Requirements + * Make sure HAVE_TMC2208 is warranted */ -#if ENABLED(HAVE_TMC2208) - #if !( ENABLED( X_IS_TMC2208) \ - || ENABLED(X2_IS_TMC2208) \ - || ENABLED( Y_IS_TMC2208) \ - || ENABLED(Y2_IS_TMC2208) \ - || ENABLED( Z_IS_TMC2208) \ - || ENABLED(Z2_IS_TMC2208) \ - || ENABLED(E0_IS_TMC2208) \ - || ENABLED(E1_IS_TMC2208) \ - || ENABLED(E2_IS_TMC2208) \ - || ENABLED(E3_IS_TMC2208) \ - || ENABLED(E4_IS_TMC2208 ) ) - #error "HAVE_TMC2208 requires at least one TMC2208 stepper to be set." - // Software UART and ENDSTOP_INTERRUPTS both use Pin Change interrupts (PCI) - #elif ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && \ - !( defined( X_HARDWARE_SERIAL) \ - || defined(X2_HARDWARE_SERIAL) \ - || defined( Y_HARDWARE_SERIAL) \ - || defined(Y2_HARDWARE_SERIAL) \ - || defined( Z_HARDWARE_SERIAL) \ - || defined(Z2_HARDWARE_SERIAL) \ - || defined(E0_HARDWARE_SERIAL) \ - || defined(E1_HARDWARE_SERIAL) \ - || defined(E2_HARDWARE_SERIAL) \ - || defined(E3_HARDWARE_SERIAL) \ - || defined(E4_HARDWARE_SERIAL) ) - #error "Select *_HARDWARE_SERIAL to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE." - #endif +#if ENABLED(HAVE_TMC2208) && !( \ + ENABLED( X_IS_TMC2208 ) \ + || ENABLED( X2_IS_TMC2208 ) \ + || ENABLED( Y_IS_TMC2208 ) \ + || ENABLED( Y2_IS_TMC2208 ) \ + || ENABLED( Z_IS_TMC2208 ) \ + || ENABLED( Z2_IS_TMC2208 ) \ + || ENABLED( E0_IS_TMC2208 ) \ + || ENABLED( E1_IS_TMC2208 ) \ + || ENABLED( E2_IS_TMC2208 ) \ + || ENABLED( E3_IS_TMC2208 ) ) + #error "HAVE_TMC2208 requires at least one TMC2208 stepper to be set." +#endif + +/** + * TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI) + */ +#if ENABLED(HAVE_TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \ + defined(X_HARDWARE_SERIAL ) \ + || defined(X2_HARDWARE_SERIAL) \ + || defined(Y_HARDWARE_SERIAL ) \ + || defined(Y2_HARDWARE_SERIAL) \ + || defined(Z_HARDWARE_SERIAL ) \ + || defined(Z2_HARDWARE_SERIAL) \ + || defined(E0_HARDWARE_SERIAL) \ + || defined(E1_HARDWARE_SERIAL) \ + || defined(E2_HARDWARE_SERIAL) \ + || defined(E3_HARDWARE_SERIAL) \ + || defined(E4_HARDWARE_SERIAL) ) + #error "select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE." #endif #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) @@ -1520,17 +1522,17 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * Make sure HAVE_L6470DRIVER is warranted */ #if ENABLED(HAVE_L6470DRIVER) && !( \ - ENABLED( X_IS_L6470) \ - || ENABLED(X2_IS_L6470) \ - || ENABLED( Y_IS_L6470) \ - || ENABLED(Y2_IS_L6470) \ - || ENABLED( Z_IS_L6470) \ - || ENABLED(Z2_IS_L6470) \ - || ENABLED(E0_IS_L6470) \ - || ENABLED(E1_IS_L6470) \ - || ENABLED(E2_IS_L6470) \ - || ENABLED(E3_IS_L6470) \ - || ENABLED(E4_IS_L6470) \ + ENABLED( X_IS_L6470 ) \ + || ENABLED( X2_IS_L6470 ) \ + || ENABLED( Y_IS_L6470 ) \ + || ENABLED( Y2_IS_L6470 ) \ + || ENABLED( Z_IS_L6470 ) \ + || ENABLED( Z2_IS_L6470 ) \ + || ENABLED( E0_IS_L6470 ) \ + || ENABLED( E1_IS_L6470 ) \ + || ENABLED( E2_IS_L6470 ) \ + || ENABLED( E3_IS_L6470 ) \ + || ENABLED( E4_IS_L6470 ) \ ) #error "HAVE_L6470DRIVER requires at least one L6470 stepper to be set." #endif diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index 1e54fc8768..274e1fd2cd 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -135,6 +135,10 @@ #include "planner.h" #include "../core/enum.h" + #if TMC2130STEPPER_VERSION < 0x020201 + #error "Update TMC2130Stepper library to 2.2.1 or newer." + #endif + #if ENABLED(TMC_USE_SW_SPI) #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) #else @@ -285,6 +289,10 @@ #include #include "planner.h" + #if TMC2208STEPPER_VERSION < 0x000101 + #error "Update TMC2208Stepper library to 0.1.1 or newer." + #endif + #define _TMC2208_DEFINE_HARDWARE(ST) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL) #define _TMC2208_DEFINE_SOFTWARE(ST) SoftwareSerial ST##_HARDWARE_SERIAL = SoftwareSerial(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN); \ TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL, ST##_SERIAL_RX_PIN > -1) diff --git a/platformio.ini b/platformio.ini index e809b009c9..aba312694b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -31,7 +31,7 @@ lib_deps = https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip LiquidCrystal_I2C@1.1.2 TMC2130Stepper - https://github.com/teemuatlut/TMC2208Stepper/archive/v0.0.4.zip + https://github.com/teemuatlut/TMC2208Stepper/archive/v0.1.1.zip Adafruit NeoPixel@1.1.3 https://github.com/lincomatic/LiquidTWI2/archive/30aa480.zip https://github.com/ameyer/Arduino-L6470/archive/0c5e5de.zip @@ -126,7 +126,7 @@ lib_ldf_mode = off lib_extra_dirs = frameworks lib_deps = CMSIS-LPC1768 https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip - TMC2130Stepper@>=2.2.0 + TMC2130Stepper@>=2.2.1 extra_scripts = Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py src_filter = ${common.default_src_filter} monitor_baud = 250000