Browse Source

Improve Trinamic support in the EEPROM

pull/1/head
Scott Lahteine 7 years ago
parent
commit
c95450016b
  1. 2
      Marlin/src/feature/tmc_util.h
  2. 440
      Marlin/src/module/configuration_store.cpp

2
Marlin/src/feature/tmc_util.h

@ -35,7 +35,7 @@
extern bool report_tmc_status; 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) { constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) {
return 12650000UL * msteps / (256 * thrs * spmm); return 12650000UL * msteps / (256 * thrs * spmm);

440
Marlin/src/module/configuration_store.cpp

@ -37,7 +37,7 @@
*/ */
// Change EEPROM version if the structure changes // Change EEPROM version if the structure changes
#define EEPROM_VERSION "V52" #define EEPROM_VERSION "V53"
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
// Check the integrity of data offsets. // Check the integrity of data offsets.
@ -74,8 +74,10 @@
#include "../module/probe.h" #include "../module/probe.h"
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAS_TRINAMIC
#include "stepper_indirection.h" #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 #endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
@ -230,7 +232,9 @@ typedef struct SettingsDataStruct {
// //
// HAS_TRINAMIC // 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 int16_t tmc_sgt[XYZ]; // M914 X Y Z
// //
@ -658,7 +662,7 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(tmc_stepper_current); _FIELD_TEST(tmc_stepper_current);
uint16_t currents[11] = { uint16_t tmc_stepper_current[TMC_AXES] = {
#if HAS_TRINAMIC #if HAS_TRINAMIC
#if X_IS_TRINAMIC #if X_IS_TRINAMIC
stepperX.getCurrent(), stepperX.getCurrent(),
@ -719,24 +723,95 @@ void MarlinSettings::postprocess() {
0 0
#endif #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 // TMC2130 Sensorless homing threshold
// //
int16_t thrs[XYZ] = { int16_t tmc_sgt[XYZ] = {
#if ENABLED(SENSORLESS_HOMING) #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(), stepperX.sgt(),
#else #else
0, 0,
#endif #endif
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY) #if defined(Y_HOMING_SENSITIVITY) && (ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS))
stepperY.sgt(), stepperY.sgt(),
#else #else
0 0
#endif #endif
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY) #if defined(Z_HOMING_SENSITIVITY) && (ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS))
stepperZ.sgt() stepperZ.sgt()
#else #else
0 0
@ -745,7 +820,7 @@ void MarlinSettings::postprocess() {
0 0
#endif #endif
}; };
EEPROM_WRITE(thrs); EEPROM_WRITE(tmc_sgt);
// //
// Linear Advance // Linear Advance
@ -794,7 +869,7 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(planner.yz_skew_factor); EEPROM_WRITE(planner.yz_skew_factor);
#else #else
dummy = 0.0f; dummy = 0.0f;
for (uint8_t q = XYZ; q--;) EEPROM_WRITE(dummy); for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
#endif #endif
// //
@ -1197,54 +1272,101 @@ void MarlinSettings::postprocess() {
#endif #endif
if (!validating) reset_stepper_drivers();
// //
// TMC2130 Stepper Current // TMC2130 Stepper Settings
// //
_FIELD_TEST(tmc_stepper_current); _FIELD_TEST(tmc_stepper_current);
#if HAS_TRINAMIC #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); EEPROM_READ(currents);
if (!validating) { if (!validating) {
#if X_IS_TRINAMIC #if X_IS_TRINAMIC
SET_CURR(0, X); SET_CURR(X);
#endif #endif
#if Y_IS_TRINAMIC #if Y_IS_TRINAMIC
SET_CURR(1, Y); SET_CURR(Y);
#endif #endif
#if Z_IS_TRINAMIC #if Z_IS_TRINAMIC
SET_CURR(2, Z); SET_CURR(Z);
#endif #endif
#if X2_IS_TRINAMIC #if X2_IS_TRINAMIC
SET_CURR(3, X2); SET_CURR(X2);
#endif #endif
#if Y2_IS_TRINAMIC #if Y2_IS_TRINAMIC
SET_CURR(4, Y2); SET_CURR(Y2);
#endif #endif
#if Z2_IS_TRINAMIC #if Z2_IS_TRINAMIC
SET_CURR(5, Z2); SET_CURR(Z2);
#endif #endif
#if E0_IS_TRINAMIC #if E0_IS_TRINAMIC
SET_CURR(6, E0); SET_CURR(E0);
#endif #endif
#if E1_IS_TRINAMIC #if E1_IS_TRINAMIC
SET_CURR(7, E1); SET_CURR(E1);
#endif #endif
#if E2_IS_TRINAMIC #if E2_IS_TRINAMIC
SET_CURR(8, E2); SET_CURR(E2);
#endif #endif
#if E3_IS_TRINAMIC #if E3_IS_TRINAMIC
SET_CURR(9, E3); SET_CURR(E3);
#endif #endif
#if E4_IS_TRINAMIC #if E4_IS_TRINAMIC
SET_CURR(10, E4); SET_CURR(E4);
#endif #endif
} }
#else #else
uint16_t val; 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 #endif
/* /*
@ -1253,32 +1375,32 @@ void MarlinSettings::postprocess() {
* Y and Y2 use the same value * Y and Y2 use the same value
* Z and Z2 use the same value * Z and Z2 use the same value
*/ */
int16_t thrs[XYZ]; int16_t tmc_sgt[XYZ];
EEPROM_READ(thrs); EEPROM_READ(tmc_sgt);
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
if (!validating) { if (!validating) {
#ifdef X_HOMING_SENSITIVITY #ifdef X_HOMING_SENSITIVITY
#if ENABLED(X_IS_TMC2130) #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
stepperX.sgt(thrs[0]); stepperX.sgt(tmc_sgt[0]);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if ENABLED(X2_IS_TMC2130)
stepperX2.sgt(thrs[0]); stepperX2.sgt(tmc_sgt[0]);
#endif #endif
#endif #endif
#ifdef Y_HOMING_SENSITIVITY #ifdef Y_HOMING_SENSITIVITY
#if ENABLED(Y_IS_TMC2130) #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
stepperY.sgt(thrs[1]); stepperY.sgt(tmc_sgt[1]);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if ENABLED(Y2_IS_TMC2130)
stepperY2.sgt(thrs[1]); stepperY2.sgt(tmc_sgt[1]);
#endif #endif
#endif #endif
#ifdef Z_HOMING_SENSITIVITY #ifdef Z_HOMING_SENSITIVITY
#if ENABLED(Z_IS_TMC2130) #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
stepperZ.sgt(thrs[2]); stepperZ.sgt(tmc_sgt[2]);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if ENABLED(Z2_IS_TMC2130)
stepperZ2.sgt(thrs[2]); stepperZ2.sgt(tmc_sgt[2]);
#endif #endif
#endif #endif
} }
@ -1338,7 +1460,7 @@ void MarlinSettings::postprocess() {
EEPROM_READ(dummy); EEPROM_READ(dummy);
#endif #endif
#else #else
for (uint8_t q = XYZ; q--;) EEPROM_READ(dummy); for (uint8_t q = 3; q--;) EEPROM_READ(dummy);
#endif #endif
// //
@ -1731,66 +1853,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif #endif
); );
#if X_IS_TRINAMIC reset_stepper_drivers();
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
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
planner.extruder_advance_K = LIN_ADVANCE_K; 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) #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 * M503 - Report current settings in RAM
* *
@ -1849,7 +1916,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOPGM_P(port, " G2"); SERIAL_ECHOPGM_P(port, " G2");
SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0'); SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
SERIAL_ECHOPGM_P(port, " ; Units in "); 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 #else
#define LINEAR_UNIT(N) (N) #define LINEAR_UNIT(N) (N)
#define VOLUMETRIC_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, " G29 S3 X", (int)px + 1);
SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1); SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
SERIAL_ECHOPGM_P(port, " Z"); 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); 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, " G29 W I", (int)px + 1);
SERIAL_ECHOPAIR_P(port, " J", (int)py + 1); SERIAL_ECHOPAIR_P(port, " J", (int)py + 1);
SERIAL_ECHOPGM_P(port, " Z"); 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); SERIAL_EOL_P(port);
} }
} }
@ -2289,95 +2356,124 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOPGM_P(port, " K"); SERIAL_ECHOPGM_P(port, " K");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6);
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#else #else
SERIAL_ECHOPGM_P(port, " M852 S"); SERIAL_ECHOPGM_P(port, " M852 S");
SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6);
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#endif #endif
/**
* TMC2130 stepper driver current
*/
#if HAS_TRINAMIC #if HAS_TRINAMIC
/**
* TMC2130 / TMC2208 / TRAMS stepper driver current
*/
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Stepper driver current:"); SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOPGM_P(port, " M906"); SERIAL_ECHOPGM_P(port, " M906");
#if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208) #if X_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " X ", stepperX.getCurrent()); SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent());
#elif X2_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent());
#endif #endif
#if ENABLED(Y_IS_TMC2130) || ENABLED(Y_IS_TMC2208) #if Y_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " Y ", stepperY.getCurrent()); SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent());
#elif Y2_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent());
#endif #endif
#if ENABLED(Z_IS_TMC2130) || ENABLED(Z_IS_TMC2208) #if Z_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " Z ", stepperZ.getCurrent()); SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent());
#elif Z2_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent());
#endif #endif
#if ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208) #if E0_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " X2 ", stepperX2.getCurrent()); 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 #endif
#if ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208) SERIAL_EOL();
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
/** /**
* TMC2130 Sensorless homing thresholds * TMC2130 / TMC2208 / TRAMS Hybrid Threshold
*/ */
#if ENABLED(SENSORLESS_HOMING)
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOPGM_P(port, " M914"); SERIAL_ECHOPGM_P(port, " M913");
#ifdef X_HOMING_SENSITIVITY #if X_IS_TRINAMIC
#if ENABLED(X_IS_TMC2130) SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X));
SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); #elif X2_IS_TRINAMIC
#endif SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2));
#if ENABLED(X2_IS_TMC2130)
SERIAL_ECHOPAIR_P(port, " X2 ", stepperX2.sgt());
#endif
#endif #endif
#ifdef Y_HOMING_SENSITIVITY #if Y_IS_TRINAMIC
#if ENABLED(Y_IS_TMC2130) SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y));
SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt()); #elif Y2_IS_TRINAMIC
#endif SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2));
#if ENABLED(Y2_IS_TMC2130)
SERIAL_ECHOPAIR_P(port, " Y2 ", stepperY2.sgt());
#endif
#endif #endif
#ifdef Z_HOMING_SENSITIVITY #if Z_IS_TRINAMIC
#if ENABLED(Z_IS_TMC2130) SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z));
SERIAL_ECHOPAIR_P(port, " Z ", stepperZ.sgt()); #elif Z2_IS_TRINAMIC
SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2));
#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 #endif
#if ENABLED(Z2_IS_TMC2130) #ifdef Z_HOMING_SENSITIVITY
SERIAL_ECHOPAIR_P(port, " Z2 ", stepperZ2.sgt()); #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 #endif
SERIAL_EOL();
#endif #endif
SERIAL_EOL_P(port);
#endif #endif // HAS_TRINAMIC
/** /**
* Linear Advance * Linear Advance
@ -2413,25 +2509,31 @@ void MarlinSettings::reset(PORTARG_SOLO) {
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
#if EXTRUDERS == 1 #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])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0]));
#else #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])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0]));
CONFIG_ECHO_START; 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])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[1]));
#if EXTRUDERS > 2 #if EXTRUDERS > 2
CONFIG_ECHO_START; 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])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[2]));
#if EXTRUDERS > 3 #if EXTRUDERS > 3
CONFIG_ECHO_START; 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])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[3]));
#if EXTRUDERS > 4 #if EXTRUDERS > 4
CONFIG_ECHO_START; 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])); SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[4]));
#endif // EXTRUDERS > 4 #endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3 #endif // EXTRUDERS > 3

Loading…
Cancel
Save