From c95450016b1f42c09ae54a3b293b41de9ff15102 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 14 Mar 2018 22:03:53 -0500 Subject: [PATCH] Improve Trinamic support in the EEPROM --- Marlin/src/feature/tmc_util.h | 2 +- Marlin/src/module/configuration_store.cpp | 444 +++++++++++++--------- 2 files changed, 274 insertions(+), 172 deletions(-) diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 8ea7a862b9..544eaa07a4 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -35,7 +35,7 @@ extern bool report_tmc_status; -enum TMC_AxisEnum : char { TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2, TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4 }; +enum TMC_AxisEnum : char { TMC_X, TMC_Y, TMC_Z, TMC_X2, TMC_Y2, TMC_Z2, TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4 }; constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) { return 12650000UL * msteps / (256 * thrs * spmm); diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 96435a45e1..eb1d9db1d8 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V52" +#define EEPROM_VERSION "V53" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -74,8 +74,10 @@ #include "../module/probe.h" #endif -#if ENABLED(HAVE_TMC2130) +#if HAS_TRINAMIC #include "stepper_indirection.h" + #include "../feature/tmc_util.h" + #define TMC_GET_PWMTHRS(P,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[P##_AXIS]) #endif #if ENABLED(FWRETRACT) @@ -230,7 +232,9 @@ typedef struct SettingsDataStruct { // // HAS_TRINAMIC // - uint16_t tmc_stepper_current[11]; // M906 X Y Z X2 Y2 Z2 E0 E1 E2 E3 E4 + #define TMC_AXES (MAX_EXTRUDERS + 6) + uint16_t tmc_stepper_current[TMC_AXES]; // M906 X Y Z X2 Y2 Z2 E0 E1 E2 E3 E4 + uint32_t tmc_hybrid_threshold[TMC_AXES]; // M913 X Y Z X2 Y2 Z2 E0 E1 E2 E3 E4 int16_t tmc_sgt[XYZ]; // M914 X Y Z // @@ -658,7 +662,7 @@ void MarlinSettings::postprocess() { _FIELD_TEST(tmc_stepper_current); - uint16_t currents[11] = { + uint16_t tmc_stepper_current[TMC_AXES] = { #if HAS_TRINAMIC #if X_IS_TRINAMIC stepperX.getCurrent(), @@ -719,24 +723,95 @@ void MarlinSettings::postprocess() { 0 #endif }; - EEPROM_WRITE(currents); + EEPROM_WRITE(tmc_stepper_current); + + // + // Save TMC2130 or TMC2208 Hybrid Threshold, and placeholder values + // + + _FIELD_TEST(tmc_hybrid_threshold); + + uint32_t tmc_hybrid_threshold[TMC_AXES] = { + #if HAS_TRINAMIC + #if X_IS_TRINAMIC + TMC_GET_PWMTHRS(X, X), + #else + X_HYBRID_THRESHOLD, + #endif + #if Y_IS_TRINAMIC + TMC_GET_PWMTHRS(Y, Y), + #else + Y_HYBRID_THRESHOLD, + #endif + #if Z_IS_TRINAMIC + TMC_GET_PWMTHRS(Z, Z), + #else + Z_HYBRID_THRESHOLD, + #endif + #if X2_IS_TRINAMIC + TMC_GET_PWMTHRS(X, X2), + #else + X2_HYBRID_THRESHOLD, + #endif + #if Y2_IS_TRINAMIC + TMC_GET_PWMTHRS(Y, Y2), + #else + Y2_HYBRID_THRESHOLD, + #endif + #if Z2_IS_TRINAMIC + TMC_GET_PWMTHRS(Z, Z2), + #else + Z2_HYBRID_THRESHOLD, + #endif + #if E0_IS_TRINAMIC + TMC_GET_PWMTHRS(E, E0), + #else + E0_HYBRID_THRESHOLD, + #endif + #if E1_IS_TRINAMIC + TMC_GET_PWMTHRS(E, E1), + #else + E1_HYBRID_THRESHOLD, + #endif + #if E2_IS_TRINAMIC + TMC_GET_PWMTHRS(E, E2), + #else + E2_HYBRID_THRESHOLD, + #endif + #if E3_IS_TRINAMIC + TMC_GET_PWMTHRS(E, E3), + #else + E3_HYBRID_THRESHOLD, + #endif + #if E4_IS_TRINAMIC + TMC_GET_PWMTHRS(E, E4) + #else + E4_HYBRID_THRESHOLD + #endif + #else + 100, 100, 3, // X, Y, Z + 100, 100, 3, // X2, Y2, Z2 + 30, 30, 30, 30, 30 // E0, E1, E2, E3, E4 + #endif + }; + EEPROM_WRITE(tmc_hybrid_threshold); // // TMC2130 Sensorless homing threshold // - int16_t thrs[XYZ] = { + int16_t tmc_sgt[XYZ] = { #if ENABLED(SENSORLESS_HOMING) - #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY) + #if defined(X_HOMING_SENSITIVITY) && (ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)) stepperX.sgt(), #else 0, #endif - #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY) + #if defined(Y_HOMING_SENSITIVITY) && (ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)) stepperY.sgt(), #else 0 #endif - #if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY) + #if defined(Z_HOMING_SENSITIVITY) && (ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)) stepperZ.sgt() #else 0 @@ -745,7 +820,7 @@ void MarlinSettings::postprocess() { 0 #endif }; - EEPROM_WRITE(thrs); + EEPROM_WRITE(tmc_sgt); // // Linear Advance @@ -794,7 +869,7 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(planner.yz_skew_factor); #else dummy = 0.0f; - for (uint8_t q = XYZ; q--;) EEPROM_WRITE(dummy); + for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); #endif // @@ -1197,54 +1272,101 @@ void MarlinSettings::postprocess() { #endif + if (!validating) reset_stepper_drivers(); + // - // TMC2130 Stepper Current + // TMC2130 Stepper Settings // _FIELD_TEST(tmc_stepper_current); #if HAS_TRINAMIC - #define SET_CURR(N,Q) stepper##Q.setCurrent(currents[N] ? currents[N] : Q##_CURRENT, R_SENSE, HOLD_MULTIPLIER) - uint16_t currents[11]; + + #define SET_CURR(Q) stepper##Q.setCurrent(currents[TMC_##Q] ? currents[TMC_##Q] : Q##_CURRENT, R_SENSE, HOLD_MULTIPLIER) + uint16_t currents[TMC_AXES]; EEPROM_READ(currents); if (!validating) { #if X_IS_TRINAMIC - SET_CURR(0, X); + SET_CURR(X); #endif #if Y_IS_TRINAMIC - SET_CURR(1, Y); + SET_CURR(Y); #endif #if Z_IS_TRINAMIC - SET_CURR(2, Z); + SET_CURR(Z); #endif #if X2_IS_TRINAMIC - SET_CURR(3, X2); + SET_CURR(X2); #endif #if Y2_IS_TRINAMIC - SET_CURR(4, Y2); + SET_CURR(Y2); #endif #if Z2_IS_TRINAMIC - SET_CURR(5, Z2); + SET_CURR(Z2); #endif #if E0_IS_TRINAMIC - SET_CURR(6, E0); + SET_CURR(E0); #endif #if E1_IS_TRINAMIC - SET_CURR(7, E1); + SET_CURR(E1); #endif #if E2_IS_TRINAMIC - SET_CURR(8, E2); + SET_CURR(E2); #endif #if E3_IS_TRINAMIC - SET_CURR(9, E3); + SET_CURR(E3); #endif #if E4_IS_TRINAMIC - SET_CURR(10, E4); + SET_CURR(E4); #endif } #else uint16_t val; - for (uint8_t q=11; q--;) EEPROM_READ(val); + for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(val); + #endif + + #if HAS_TRINAMIC + #define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, TMC_##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[P##_AXIS]) + uint16_t tmc_hybrid_threshold[TMC_AXES]; + EEPROM_READ(tmc_hybrid_threshold); + if (!validating) { + #if X_IS_TRINAMIC + TMC_SET_PWMTHRS(X, X); + #endif + #if Y_IS_TRINAMIC + TMC_SET_PWMTHRS(Y, Y); + #endif + #if Z_IS_TRINAMIC + TMC_SET_PWMTHRS(Z, Z); + #endif + #if X2_IS_TRINAMIC + TMC_SET_PWMTHRS(X, X2); + #endif + #if Y2_IS_TRINAMIC + TMC_SET_PWMTHRS(Y, Y2); + #endif + #if Z2_IS_TRINAMIC + TMC_SET_PWMTHRS(Z, Z2); + #endif + #if E0_IS_TRINAMIC + TMC_SET_PWMTHRS(E, E0); + #endif + #if E1_IS_TRINAMIC + TMC_SET_PWMTHRS(E, E1); + #endif + #if E2_IS_TRINAMIC + TMC_SET_PWMTHRS(E, E2); + #endif + #if E3_IS_TRINAMIC + TMC_SET_PWMTHRS(E, E3); + #endif + #if E4_IS_TRINAMIC + TMC_SET_PWMTHRS(E, E4); + #endif + } + #else + uint16_t thrs_val; + for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(thrs_val); #endif /* @@ -1253,32 +1375,32 @@ void MarlinSettings::postprocess() { * Y and Y2 use the same value * Z and Z2 use the same value */ - int16_t thrs[XYZ]; - EEPROM_READ(thrs); + int16_t tmc_sgt[XYZ]; + EEPROM_READ(tmc_sgt); #if ENABLED(SENSORLESS_HOMING) if (!validating) { #ifdef X_HOMING_SENSITIVITY - #if ENABLED(X_IS_TMC2130) - stepperX.sgt(thrs[0]); + #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) + stepperX.sgt(tmc_sgt[0]); #endif #if ENABLED(X2_IS_TMC2130) - stepperX2.sgt(thrs[0]); + stepperX2.sgt(tmc_sgt[0]); #endif #endif #ifdef Y_HOMING_SENSITIVITY - #if ENABLED(Y_IS_TMC2130) - stepperY.sgt(thrs[1]); + #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) + stepperY.sgt(tmc_sgt[1]); #endif #if ENABLED(Y2_IS_TMC2130) - stepperY2.sgt(thrs[1]); + stepperY2.sgt(tmc_sgt[1]); #endif #endif #ifdef Z_HOMING_SENSITIVITY - #if ENABLED(Z_IS_TMC2130) - stepperZ.sgt(thrs[2]); + #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) + stepperZ.sgt(tmc_sgt[2]); #endif #if ENABLED(Z2_IS_TMC2130) - stepperZ2.sgt(thrs[2]); + stepperZ2.sgt(tmc_sgt[2]); #endif #endif } @@ -1338,7 +1460,7 @@ void MarlinSettings::postprocess() { EEPROM_READ(dummy); #endif #else - for (uint8_t q = XYZ; q--;) EEPROM_READ(dummy); + for (uint8_t q = 3; q--;) EEPROM_READ(dummy); #endif // @@ -1731,66 +1853,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif ); - #if X_IS_TRINAMIC - stepperX.setCurrent(X_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if Y_IS_TRINAMIC - stepperY.setCurrent(Y_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if Z_IS_TRINAMIC - stepperZ.setCurrent(Z_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if X2_IS_TRINAMIC - stepperX2.setCurrent(X2_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if Y2_IS_TRINAMIC - stepperY2.setCurrent(Y2_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if Z2_IS_TRINAMIC - stepperZ2.setCurrent(Z2_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if E0_IS_TRINAMIC - stepperE0.setCurrent(E0_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if E1_IS_TRINAMIC - stepperE1.setCurrent(E1_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if E2_IS_TRINAMIC - stepperE2.setCurrent(E2_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if E3_IS_TRINAMIC - stepperE3.setCurrent(E3_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - #if E4_IS_TRINAMIC - stepperE4.setCurrent(E4_CURRENT, R_SENSE, HOLD_MULTIPLIER); - #endif - - #if ENABLED(SENSORLESS_HOMING) - #ifdef X_HOMING_SENSITIVITY - #if ENABLED(X_IS_TMC2130) - stepperX.sgt(X_HOMING_SENSITIVITY); - #endif - #if ENABLED(X2_IS_TMC2130) - stepperX2.sgt(X_HOMING_SENSITIVITY); - #endif - #endif - #ifdef Y_HOMING_SENSITIVITY - #if ENABLED(Y_IS_TMC2130) - stepperY.sgt(Y_HOMING_SENSITIVITY); - #endif - #if ENABLED(Y2_IS_TMC2130) - stepperY2.sgt(Y_HOMING_SENSITIVITY); - #endif - #endif - #ifdef Z_HOMING_SENSITIVITY - #if ENABLED(Z_IS_TMC2130) - stepperZ.sgt(Z_HOMING_SENSITIVITY); - #endif - #if ENABLED(Z2_IS_TMC2130) - stepperZ2.sgt(Z_HOMING_SENSITIVITY); - #endif - #endif - #endif + reset_stepper_drivers(); #if ENABLED(LIN_ADVANCE) planner.extruder_advance_K = LIN_ADVANCE_K; @@ -1829,6 +1892,10 @@ void MarlinSettings::reset(PORTARG_SOLO) { #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0) + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void say_M603() { SERIAL_ECHOPGM_P(port, " M603 "); } + #endif + /** * M503 - Report current settings in RAM * @@ -1849,7 +1916,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " G2"); SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0'); SERIAL_ECHOPGM_P(port, " ; Units in "); - serialprintPGM(parser.linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n")); + serialprintPGM_P(port, parser.linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n")); #else #define LINEAR_UNIT(N) (N) #define VOLUMETRIC_UNIT(N) (N) @@ -2076,7 +2143,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOPAIR_P(port, " G29 S3 X", (int)px + 1); SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1); SERIAL_ECHOPGM_P(port, " Z"); - SERIAL_PROTOCOL_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5); + SERIAL_ECHO_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5); SERIAL_EOL_P(port); } } @@ -2103,7 +2170,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOPAIR_P(port, " G29 W I", (int)px + 1); SERIAL_ECHOPAIR_P(port, " J", (int)py + 1); SERIAL_ECHOPGM_P(port, " Z"); - SERIAL_PROTOCOL_F_P(port, LINEAR_UNIT(z_values[px][py]), 5); + SERIAL_ECHO_F_P(port, LINEAR_UNIT(z_values[px][py]), 5); SERIAL_EOL_P(port); } } @@ -2289,95 +2356,124 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " K"); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6); SERIAL_EOL_P(port); - #else + #else SERIAL_ECHOPGM_P(port, " M852 S"); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); SERIAL_EOL_P(port); #endif #endif - /** - * TMC2130 stepper driver current - */ #if HAS_TRINAMIC + + /** + * TMC2130 / TMC2208 / TRAMS stepper driver current + */ if (!forReplay) { CONFIG_ECHO_START; SERIAL_ECHOLNPGM_P(port, "Stepper driver current:"); } CONFIG_ECHO_START; SERIAL_ECHOPGM_P(port, " M906"); - #if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " X ", stepperX.getCurrent()); + #if X_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent()); + #elif X2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent()); #endif - #if ENABLED(Y_IS_TMC2130) || ENABLED(Y_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " Y ", stepperY.getCurrent()); + #if Y_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent()); + #elif Y2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent()); #endif - #if ENABLED(Z_IS_TMC2130) || ENABLED(Z_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " Z ", stepperZ.getCurrent()); + #if Z_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent()); + #elif Z2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent()); #endif - #if ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " X2 ", stepperX2.getCurrent()); + #if E0_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", stepperE0.getCurrent()); + #elif E1_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", stepperE1.getCurrent()); + #elif E2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", stepperE2.getCurrent()); + #elif E3_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", stepperE3.getCurrent()); + #elif E4_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", stepperE4.getCurrent()); #endif - #if ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " Y2 ", stepperY2.getCurrent()); - #endif - #if ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " Z2 ", stepperZ2.getCurrent()); - #endif - #if ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " E0 ", stepperE0.getCurrent()); - #endif - #if ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " E1 ", stepperE1.getCurrent()); - #endif - #if ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " E2 ", stepperE2.getCurrent()); - #endif - #if ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " E3 ", stepperE3.getCurrent()); - #endif - #if ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208) - SERIAL_ECHOPAIR_P(port, " E4 ", stepperE4.getCurrent()); - #endif - SERIAL_EOL_P(port); - #endif + SERIAL_EOL(); - /** - * TMC2130 Sensorless homing thresholds - */ - #if ENABLED(SENSORLESS_HOMING) + /** + * TMC2130 / TMC2208 / TRAMS Hybrid Threshold + */ if (!forReplay) { CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); + SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:"); } CONFIG_ECHO_START; - SERIAL_ECHOPGM_P(port, " M914"); - #ifdef X_HOMING_SENSITIVITY - #if ENABLED(X_IS_TMC2130) - SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); - #endif - #if ENABLED(X2_IS_TMC2130) - SERIAL_ECHOPAIR_P(port, " X2 ", stepperX2.sgt()); - #endif + SERIAL_ECHOPGM_P(port, " M913"); + #if X_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X)); + #elif X2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2)); #endif - #ifdef Y_HOMING_SENSITIVITY - #if ENABLED(Y_IS_TMC2130) - SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt()); - #endif - #if ENABLED(Y2_IS_TMC2130) - SERIAL_ECHOPAIR_P(port, " Y2 ", stepperY2.sgt()); - #endif + #if Y_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y)); + #elif Y2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2)); #endif - #ifdef Z_HOMING_SENSITIVITY - #if ENABLED(Z_IS_TMC2130) - SERIAL_ECHOPAIR_P(port, " Z ", stepperZ.sgt()); - #endif - #if ENABLED(Z2_IS_TMC2130) - SERIAL_ECHOPAIR_P(port, " Z2 ", stepperZ2.sgt()); - #endif + #if Z_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z)); + #elif Z2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2)); #endif - SERIAL_EOL_P(port); - #endif + #if E0_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", TMC_GET_PWMTHRS(E, E0)); + #elif E1_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", TMC_GET_PWMTHRS(E, E1)); + #elif E2_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", TMC_GET_PWMTHRS(E, E2)); + #elif E3_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", TMC_GET_PWMTHRS(E, E3)); + #elif E4_IS_TRINAMIC + SERIAL_ECHOPAIR_P(port, " E", TMC_GET_PWMTHRS(E, E4)); + #endif + SERIAL_EOL(); + + /** + * TMC2130 Sensorless homing thresholds + */ + #if ENABLED(SENSORLESS_HOMING) + if (!forReplay) { + CONFIG_ECHO_START; + SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); + } + CONFIG_ECHO_START; + SERIAL_ECHOPGM_P(port, " M914"); + #ifdef X_HOMING_SENSITIVITY + #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) + SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); + #elif ENABLED(X2_IS_TMC2130) + SERIAL_ECHOPAIR_P(port, " X", stepperX2.sgt()); + #endif + #endif + #ifdef Y_HOMING_SENSITIVITY + #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) + SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt()); + #elif ENABLED(Y2_IS_TMC2130) + SERIAL_ECHOPAIR_P(port, " Y", stepperY2.sgt()); + #endif + #endif + #ifdef Z_HOMING_SENSITIVITY + #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) + SERIAL_ECHOPAIR_P(port, " Z", stepperZ.sgt()); + #elif ENABLED(Z2_IS_TMC2130) + SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.sgt()); + #endif + #endif + SERIAL_EOL(); + #endif + + #endif // HAS_TRINAMIC /** * Linear Advance @@ -2413,25 +2509,31 @@ void MarlinSettings::reset(PORTARG_SOLO) { } CONFIG_ECHO_START; #if EXTRUDERS == 1 - SERIAL_ECHOPAIR_P(port, " M603 L", LINEAR_UNIT(filament_change_load_length[0])); + say_M603(); + SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(filament_change_load_length[0])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0])); #else - SERIAL_ECHOPAIR_P(port, " M603 T0 L", LINEAR_UNIT(filament_change_load_length[0])); + say_M603(); + SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(filament_change_load_length[0])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0])); CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M603 T1 L", LINEAR_UNIT(filament_change_load_length[1])); + say_M603(); + SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(filament_change_load_length[1])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[1])); #if EXTRUDERS > 2 CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M603 T2 L", LINEAR_UNIT(filament_change_load_length[2])); + say_M603(); + SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(filament_change_load_length[2])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[2])); #if EXTRUDERS > 3 CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M603 T3 L", LINEAR_UNIT(filament_change_load_length[3])); + say_M603(); + SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(filament_change_load_length[3])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[3])); #if EXTRUDERS > 4 CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M603 T4 L", LINEAR_UNIT(filament_change_load_length[4])); + say_M603(); + SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(filament_change_load_length[4])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[4])); #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3