diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 8cc0eb4b336af46c7871ca30fd874e4040b31d39..391c12d9d59c1e346fee34068b073f38feeeecd8 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 8cc0eb4b336af46c7871ca30fd874e4040b31d39..391c12d9d59c1e346fee34068b073f38feeeecd8 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index c5a67c631bd587298c50f888550643f3d8b2b0df..a7793b41a0d3ec6ddf8f48981fac8f80c3231c17 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index f0ddf90ee921b30d7f60c2f6bf13ffca234f32b9..8bcc41e82cac5422477370fdb8850d3e4c342781 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 1838306ddda89b51e1219cba7d6676fb275a2754..69a1c7950c3fe0af9bcc74b91d57bf6bf64f42f8 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h index cd8f881623f9ca49e4a1e2ff35451f1bffa1363c..a948232ddd98334285e992fa45e54028b88a9e29 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h @@ -1149,6 +1149,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 60a4898bfa8d9fe676a3f97f43ee9904af681257..33e6ffaf86bad4c22189ba0efd85f8a00413e09f 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index dcd4a6c1851411fc5e44742a4c367b55a4fdd45c..1b4a0fb62feb8fb076aba84da34a604183dfd427 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 60a4898bfa8d9fe676a3f97f43ee9904af681257..33e6ffaf86bad4c22189ba0efd85f8a00413e09f 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 8db2403c5703efcaaea53af2a679f6d65439aa35..d2dd46bfa71fb25517e4cd98ec99dec7e4c56da1 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index a5f35d1094c2c87b64d8200cbbd2524b1d64e241..b9d20654a66f3ca8538838e062c6ca55d38796ed 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index e934e694e012feb975071cf72b573096d8878858..2a0c2e7056a9795644d1966f92bd69b36c69b847 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index b368ecd8ba1a998b9ac7e72341fac61f31a8633c..43f6aa2458e829005cde872a72981c1b51caced3 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index 0adb8d0e639ecfa863b6364520c3fa12efbe170c..b3c4add64ed43107a8eff76b40894ee20779ff50 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 21b2fc2d09614cd8f4daba8a23acc8c097629001..fc5c07c913001a1b3e8bbfe65c80fec528fcd699 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -985,7 +985,7 @@ #endif -// @section TMC2130 +// @section TMC2130, TMC2208 /** * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. @@ -999,7 +999,19 @@ */ //#define HAVE_TMC2130 -#if ENABLED(HAVE_TMC2130) +/** + * Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers. + * Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN + * to #_SERIAL_TX_PIN with a 1K resistor. + * The drivers can also be used with hardware serial. + * + * You'll also need the TMC2208Stepper Arduino library + * (https://github.com/teemuatlut/TMC2208Stepper). + */ +//#define HAVE_TMC2208 + +#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208) // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY //#define X_IS_TMC2130 @@ -1014,46 +1026,58 @@ //#define E3_IS_TMC2130 //#define E4_IS_TMC2130 + //#define X_IS_TMC2208 + //#define X2_IS_TMC2208 + //#define Y_IS_TMC2208 + //#define Y2_IS_TMC2208 + //#define Z_IS_TMC2208 + //#define Z2_IS_TMC2208 + //#define E0_IS_TMC2208 + //#define E1_IS_TMC2208 + //#define E2_IS_TMC2208 + //#define E3_IS_TMC2208 + //#define E4_IS_TMC2208 + /** * Stepper driver settings */ #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current - #define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. + #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. #define X_MICROSTEPS 16 // 0..256 - #define Y_CURRENT 1000 + #define Y_CURRENT 800 #define Y_MICROSTEPS 16 - #define Z_CURRENT 1000 + #define Z_CURRENT 800 #define Z_MICROSTEPS 16 - //#define X2_CURRENT 1000 - //#define X2_MICROSTEPS 16 + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 - //#define Y2_CURRENT 1000 - //#define Y2_MICROSTEPS 16 + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 - //#define Z2_CURRENT 1000 - //#define Z2_MICROSTEPS 16 + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 - //#define E0_CURRENT 1000 - //#define E0_MICROSTEPS 16 + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 - //#define E1_CURRENT 1000 - //#define E1_MICROSTEPS 16 + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 - //#define E2_CURRENT 1000 - //#define E2_MICROSTEPS 16 + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 - //#define E3_CURRENT 1000 - //#define E3_MICROSTEPS 16 + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 - //#define E4_CURRENT 1000 - //#define E4_MICROSTEPS 16 + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 /** * Use Trinamic's ultra quiet stepping mode. @@ -1062,24 +1086,22 @@ #define STEALTHCHOP /** - * Let Marlin automatically control stepper current. - * This is still an experimental feature. - * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, - * then decrease current by CURRENT_STEP until temperature prewarn is cleared. - * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX + * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * like overtemperature and short to ground. TMC2208 requires hardware serial. + * In the case of overtemperature Marlin can decrease the driver current until error condition clears. + * Other detected conditions can be used to stop the current print. * Relevant g-codes: * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. - * M906 S1 - Start adjusting current - * M906 S0 - Stop adjusting current * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. + * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) */ - //#define AUTOMATIC_CURRENT_CONTROL + //#define MONITOR_DRIVER_STATUS - #if ENABLED(AUTOMATIC_CURRENT_CONTROL) - #define CURRENT_STEP 50 // [mA] - #define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak + #if ENABLED(MONITOR_DRIVER_STATUS) + #define CURRENT_STEP_DOWN 50 // [mA] #define REPORT_CURRENT_CHANGE + #define STOP_ON_ERROR #endif /** @@ -1094,8 +1116,8 @@ #define X2_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100 - #define Z_HYBRID_THRESHOLD 4 - #define Z2_HYBRID_THRESHOLD 4 + #define Z_HYBRID_THRESHOLD 3 + #define Z2_HYBRID_THRESHOLD 3 #define E0_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30 @@ -1105,7 +1127,7 @@ /** * Use stallGuard2 to sense an obstacle and trigger an endstop. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. - * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. + * X and Y homing will always be done in spreadCycle mode. * * X/Y_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. @@ -1114,27 +1136,48 @@ * It is advised to set X/Y_HOME_BUMP_MM to 0. * M914 X/Y to live tune the setting */ - //#define SENSORLESS_HOMING + //#define SENSORLESS_HOMING // TMC2130 only #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 19 - #define Y_HOMING_SENSITIVITY 19 + #define X_HOMING_SENSITIVITY 8 + #define Y_HOMING_SENSITIVITY 8 + #endif + + /** + * Enable M122 debugging command for TMC stepper drivers. + * M122 S0/1 will enable continous reporting. + */ + //#define TMC_DEBUG + + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 #endif /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page * https://github.com/teemuatlut/TMC2130Stepper + * https://github.com/teemuatlut/TMC2208Stepper * * Example: - * #define TMC2130_ADV() { \ + * #define TMC_ADV() { \ * stepperX.diag0_temp_prewarn(1); \ - * stepperX.interpolate(0); \ + * stepperY.interpolate(0); \ * } */ - #define TMC2130_ADV() { } + #define TMC_ADV() { } -#endif // HAVE_TMC2130 +#endif // TMC2130 || TMC2208 // @section L6470 diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 650f7b0a5ba2154f9d71c87d54abde7dd8480ea6..3aad75b4630d060830edb9c837468286531bf8d5 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index 403d8e7a8feec1c5fdb10f9d5fac5f66c16835fb..aa8c95a43a078c3a5eff30d6bbe14379fe28be6d 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index d2c3e4c1c5fd13865f5bd5fc2fc4e9ea3f9429e6..db1908008636265d8a6685790d9019d989d024b6 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -1149,6 +1149,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index e5b7ee9932e3bcbdaf707b41d3ce1ec839c289b5..69d14539226b1278bd1e42ff2dc305eec09cafb2 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -1156,6 +1156,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index b8e965c93f656cb4c5fb4f83e5c3dd1668fe86d2..41d091873e64f07a00d74d17c4ff7be9f4e5fa92 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index 8b4b2b70e0deaaee2f30b604027e7fdc610a0217..3b5763b91a21175c35b4b7553dd8a258bdcbd59e 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 59d37dc30d228c83b78ef471fe06fc855250d6cd..1218b5a95a2674e30f605c055fbc0275aadc1d48 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -1137,6 +1137,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index b6f27505afd455bcac414222780e45e7c8d6ef1b..432d4df25dee0d40d764b9ea01b9d43181812d38 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index 57575d34c8f31c6ec6027e5e0853b48b0ceea271..9a94a75df62780633452376d5c63d9ef26821113 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index c18525912d869a2585b1d0516469875839d289c4..bb0d8a76000c6f3daa6c7026eec63860a5764fec 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -1159,6 +1159,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index bcf3e2b4c86e405ba199ded07bad760da218f254..afa648d11c12bb7a3a1325f3962f53fd76451329 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 1755cc571ea109cdb3506f9f3a5274283c19982a..023951cdec070a6c5a93cd690c7609f1926c3886 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -1150,6 +1150,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index cc4afd923e4a373e71220e67649c0c798c7c64d7..e1590bd9f40f1b0bfccddefbf498ab46963883b0 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1150,6 +1150,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index 83bde0e19ea558708511ac0b8844ebcb7f2afa46..4a2802c5b61b521c145bfe24e6e258d7c06ff0e4 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1150,6 +1150,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index 83bde0e19ea558708511ac0b8844ebcb7f2afa46..4a2802c5b61b521c145bfe24e6e258d7c06ff0e4 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -1150,6 +1150,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index 83bde0e19ea558708511ac0b8844ebcb7f2afa46..4a2802c5b61b521c145bfe24e6e258d7c06ff0e4 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -1150,6 +1150,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index 4543129674842ab13d10760826523b44623a9df2..ecd80f9b520d2282a5a3a5d5eb30851ab2baa635 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -1155,6 +1155,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index 18602a3ed6732bce9676573de8a7fb1693409a41..3234bd9fcbac8f43b909e1488599ba39472e82f4 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -1150,6 +1150,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 1a012652e3c837ad4f4d8feeea6c0cf0558a57b8..a8581c080223fccfa41c5adb11ca4290f4d6c8db 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index a3b327a607b12ee7413c040b7bf4e0ed5229528b..d0c280bbc796a13cac4a226d2a25635e03f0ed0d 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index a22b44a9215bbd1decb5f83a9e872447e6bb39dd..d01eb1ad7cbb89fa37c8667e328f19041228b321 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -1148,6 +1148,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 3ac5a05292f5c206149f10a99d9574b3e55891cc..a87df1c00a8bc3c3587b23115c61cce289c22c61 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -1149,6 +1149,20 @@ */ //#define TMC_DEBUG + /* + * Enable M915 Z axis calibration. + * Marlin will first adjust Z stepper current and then drive + * the Z axis to its' physical maximum. Finally it will home + * the Z axis to account for the lost steps. Use + * M915 S### to specify the current and + * M925 Z## to specify the extra Z height that's added to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 3a70528cfbac494d112d24150ab9b30e53d7a865..ef80495f6d120db01249341746bcf4b6fa3df24c 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -35,56 +35,6 @@ bool report_tmc_status = false; char extended_axis_codes[11][3] = { "X", "X2", "Y", "Y2", "Z", "Z2", "E0", "E1", "E2", "E3", "E4" }; -template<typename TMC> -void tmc_get_current(TMC &st, const char name[]) { - SERIAL_ECHO(name); - SERIAL_ECHOPGM(" axis driver current: "); - SERIAL_ECHOLN(st.getCurrent()); -} -template<typename TMC> -void tmc_set_current(TMC &st, const char name[], const int mA) { - st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER); - tmc_get_current(st, name); -} - -template<typename TMC> -void tmc_report_otpw(TMC &st, const char name[]) { - SERIAL_ECHO(name); - SERIAL_ECHOPGM(" axis temperature prewarn triggered: "); - serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); - SERIAL_EOL(); -} -template<typename TMC> -void tmc_clear_otpw(TMC &st, const char name[]) { - st.clear_otpw(); - SERIAL_ECHO(name); - SERIAL_ECHOLNPGM(" prewarn flag cleared"); -} - -template<typename TMC> -void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm) { - SERIAL_ECHO(name); - SERIAL_ECHOPGM(" stealthChop max speed set to "); - SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.TPWMTHRS() * spmm)); -} -template<typename TMC> -void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm) { - st.TPWMTHRS(12650000UL * st.microsteps() / (256 * thrs * spmm)); - tmc_get_pwmthrs(st, name, spmm); -} - -template<typename TMC> -void tmc_get_sgt(TMC &st, const char name[]) { - SERIAL_ECHO(name); - SERIAL_ECHOPGM(" driver homing sensitivity set to "); - MYSERIAL.println(st.sgt(), DEC); -} -template<typename TMC> -void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val) { - st.sgt(sgt_val); - tmc_get_sgt(st, name); -} - /* * Check for over temperature or short to ground error flags. * Report and log warning of overtemperature condition. diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 72d3b15bb579b91fe87404489a262a90b70b4d84..7741c7b4492f340ff8dda93a3a2e670aaf406f93 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -29,27 +29,58 @@ extern bool report_tmc_status; extern char extended_axis_codes[11][3]; + enum TMC_AxisEnum { TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2, TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4 }; template<typename TMC> -void tmc_get_current(TMC &st, const char name[]); +void tmc_get_current(TMC &st, const char name[]) { + SERIAL_ECHO(name); + SERIAL_ECHOPGM(" axis driver current: "); + SERIAL_ECHOLN(st.getCurrent()); +} template<typename TMC> -void tmc_set_current(TMC &st, const char name[], const int mA); +void tmc_set_current(TMC &st, const char name[], const int mA) { + st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER); + tmc_get_current(st, name); +} template<typename TMC> -void tmc_report_otpw(TMC &st, const char name[]); +void tmc_report_otpw(TMC &st, const char name[]) { + SERIAL_ECHO(name); + SERIAL_ECHOPGM(" axis temperature prewarn triggered: "); + serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); + SERIAL_EOL(); +} template<typename TMC> -void tmc_clear_otpw(TMC &st, const char name[]); +void tmc_clear_otpw(TMC &st, const char name[]) { + st.clear_otpw(); + SERIAL_ECHO(name); + SERIAL_ECHOLNPGM(" prewarn flag cleared"); +} template<typename TMC> -void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm); +void tmc_get_pwmthrs(TMC &st, const char name[], const uint16_t spmm) { + SERIAL_ECHO(name); + SERIAL_ECHOPGM(" stealthChop max speed set to "); + SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.TPWMTHRS() * spmm)); +} template<typename TMC> -void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm); +void tmc_set_pwmthrs(TMC &st, const char name[], const int32_t thrs, const uint32_t spmm) { + st.TPWMTHRS(12650000UL * st.microsteps() / (256 * thrs * spmm)); + tmc_get_pwmthrs(st, name, spmm); +} template<typename TMC> -void tmc_get_sgt(TMC &st, const char name[]); +void tmc_get_sgt(TMC &st, const char name[]) { + SERIAL_ECHO(name); + SERIAL_ECHOPGM(" driver homing sensitivity set to "); + MYSERIAL.println(st.sgt(), DEC); +} template<typename TMC> -void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val); +void tmc_set_sgt(TMC &st, const char name[], const int8_t sgt_val) { + st.sgt(sgt_val); + tmc_get_sgt(st, name); +} void _M122(); void monitor_tmc_driver(); diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index f566ba881916d6cd4cd43cd261b878365c51c4a6..843e2e7e9a604ad091b17a04a69b495565a93036 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -334,6 +334,6 @@ void _M122() { } // We need to call M122 from monitor_tmc_driver() as well but GcodeSuite::M122 is private. -inline void GcodeSuite::M122() { _M122(); } +void GcodeSuite::M122() { _M122(); } #endif // TMC_DEBUG diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index a93657d5554b3b8fab27f3b88cd5137b89e4310d..aa43f9269d12563b9c3ef4ad42e73dc45653bc66 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -33,7 +33,7 @@ * M906: Set motor current in milliamps using axis codes X, Y, Z, E * Report driver currents when no axis specified */ -inline void GcodeSuite::M906() { +void GcodeSuite::M906() { uint16_t values[XYZE]; LOOP_XYZE(i) values[i] = parser.intval(axis_codes[i]); diff --git a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp index 49402edbcddbf44ece69820d35468203eb4683b1..6cca7105d710c05a2a3839b8bf0d0389c22dc68a 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp @@ -28,12 +28,13 @@ #include "../../../feature/tmc_util.h" #include "../../../module/stepper_indirection.h" #include "../../../module/planner.h" +#include "../../queue.h" /** * M911: Report TMC stepper driver overtemperature pre-warn flag * The flag is held by the library and persist until manually cleared by M912 */ -inline void GcodeSuite::M911() { +void GcodeSuite::M911() { #if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS) tmc_report_otpw(stepperX, extended_axis_codes[TMC_X]); #endif @@ -51,7 +52,7 @@ inline void GcodeSuite::M911() { /** * M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library */ -inline void GcodeSuite::M912() { +void GcodeSuite::M912() { const bool clearX = parser.seen(axis_codes[X_AXIS]), clearY = parser.seen(axis_codes[Y_AXIS]), clearZ = parser.seen(axis_codes[Z_AXIS]), clearE = parser.seen(axis_codes[E_AXIS]), clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE); #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) @@ -78,7 +79,7 @@ inline void GcodeSuite::M912() { * M913: Set HYBRID_THRESHOLD speed. */ #if ENABLED(HYBRID_THRESHOLD) - inline void GcodeSuite::M913() { + void GcodeSuite::M913() { uint16_t values[XYZE]; LOOP_XYZE(i) values[i] = parser.intval(axis_codes[i]); @@ -137,7 +138,7 @@ inline void GcodeSuite::M912() { * M914: Set SENSORLESS_HOMING sensitivity. */ #if ENABLED(SENSORLESS_HOMING) - inline void GcodeSuite::M914() { + void GcodeSuite::M914() { #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX, extended_axis_codes[TMC_X], parser.value_int()); else tmc_get_sgt(stepperX, extended_axis_codes[TMC_X]); @@ -160,8 +161,8 @@ inline void GcodeSuite::M912() { /** * TMC Z axis calibration routine */ -#if ENABLED(TMC_Z_CALIBRATION) && (Z_IS_TRINAMIC || Z2_IS_TRINAMIC) - inline void GcodeSuite::M915() { +#if ENABLED(TMC_Z_CALIBRATION) + void GcodeSuite::M915() { uint16_t _rms = parser.seenval('S') ? parser.value_int() : CALIBRATION_CURRENT; uint16_t _z = parser.seenval('Z') ? parser.value_int() : CALIBRATION_EXTRA_HEIGHT; @@ -170,25 +171,33 @@ inline void GcodeSuite::M912() { return; } - uint16_t Z_current_1 = stepperZ.getCurrent(); - uint16_t Z2_current_1 = stepperZ.getCurrent(); + #if Z_IS_TRINAMIC + uint16_t Z_current_1 = stepperZ.getCurrent(); + stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); + #endif + #if Z2_IS_TRINAMIC + uint16_t Z2_current_1 = stepperZ2.getCurrent(); + stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); + #endif - stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); - stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); SERIAL_ECHOPAIR("\nCalibration current: Z", _rms); soft_endstops_enabled = false; do_blocking_move_to_z(Z_MAX_POS+_z); - stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER); - stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER); + #if Z_IS_TRINAMIC + stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER); + #endif + #if Z2_IS_TRINAMIC + stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER); + #endif do_blocking_move_to_z(Z_MAX_POS); soft_endstops_enabled = true; SERIAL_ECHOLNPGM("\nHoming Z because we lost steps"); - home_z_safely(); + enqueue_and_echo_commands_P(PSTR("G28 Z")); } #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 70e396f4ab1127d12fd1165d1cb74462c75631c8..31871866624edd1bb781f4ff1314e49ecd3bcf52 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -659,8 +659,10 @@ void GcodeSuite::process_parsed_command() { #endif #endif - #if HAVE_TRINAMIC - case 122: M122(); break; + #if HAS_TRINAMIC + #if ENABLED(TMC_DEBUG) + case 122: M122(); break; + #endif case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags @@ -670,6 +672,9 @@ void GcodeSuite::process_parsed_command() { #if ENABLED(SENSORLESS_HOMING) case 914: M914(); break; // M914: Set SENSORLESS_HOMING sensitivity. #endif + #if ENABLED(TMC_Z_CALIBRATION) + case 915: M915(); break; // M915: TMC Z axis calibration. + #endif #endif #if HAS_MICROSTEPS diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 1d033ba2f1c4ca502f26715836f390f0ca0663ea..f4278a9d695219135174f7e6ed5e4a008461fe46 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1491,6 +1491,12 @@ static_assert(1 >= 0 #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." #endif +#include "../feature/tmc_macros.h" + +#if ENABLED(TMC_Z_CALIBRATION) && !Z_IS_TRINAMIC && !Z2_IS_TRINAMIC + #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis" +#endif + /** * Make sure HAVE_L6470DRIVER is warranted */