mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
Improve Trinamic support in the EEPROM
This commit is contained in:
parent
a03502080e
commit
84bbd018ab
@ -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.
|
||||
@ -61,6 +61,8 @@
|
||||
|
||||
#if HAS_TRINAMIC
|
||||
#include "stepper_indirection.h"
|
||||
#include "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(AUTO_BED_LEVELING_UBL)
|
||||
@ -215,7 +217,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
|
||||
|
||||
//
|
||||
@ -673,7 +677,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(),
|
||||
@ -734,24 +738,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
|
||||
@ -760,7 +835,7 @@ void MarlinSettings::postprocess() {
|
||||
0
|
||||
#endif
|
||||
};
|
||||
EEPROM_WRITE(thrs);
|
||||
EEPROM_WRITE(tmc_sgt);
|
||||
|
||||
//
|
||||
// Linear Advance
|
||||
@ -1211,54 +1286,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
|
||||
|
||||
/*
|
||||
@ -1267,32 +1389,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
|
||||
}
|
||||
@ -1729,66 +1851,7 @@ void MarlinSettings::reset() {
|
||||
#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;
|
||||
@ -1827,6 +1890,18 @@ void MarlinSettings::reset() {
|
||||
|
||||
#define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START(); }while(0)
|
||||
|
||||
#if HAS_TRINAMIC
|
||||
void say_M906() { SERIAL_ECHOPGM(" M906 "); }
|
||||
void say_M913() { SERIAL_ECHOPGM(" M913 "); }
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
void say_M914() { SERIAL_ECHOPGM(" M914 "); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
void say_M603() { SERIAL_ECHOPGM(" M603 "); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M503 - Report current settings in RAM
|
||||
*
|
||||
@ -2109,6 +2184,7 @@ void MarlinSettings::reset() {
|
||||
#endif // HAS_LEVELING
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Endstop adjustment:");
|
||||
@ -2133,6 +2209,7 @@ void MarlinSettings::reset() {
|
||||
SERIAL_EOL();
|
||||
|
||||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Endstop adjustment:");
|
||||
@ -2149,7 +2226,8 @@ void MarlinSettings::reset() {
|
||||
SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(endstops.z_endstop_adj));
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
#endif // DELTA
|
||||
|
||||
#endif // [XYZ]_DUAL_ENDSTOPS
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
if (!forReplay) {
|
||||
@ -2288,88 +2366,159 @@ void MarlinSettings::reset() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TMC2130 stepper driver current
|
||||
*/
|
||||
#if HAS_TRINAMIC
|
||||
|
||||
/**
|
||||
* TMC2130 / TMC2208 / TRAMS stepper driver current
|
||||
*/
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Stepper driver current:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPGM(" M906");
|
||||
#if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" X ", stepperX.getCurrent());
|
||||
#if X_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("X", stepperX.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130) || ENABLED(Y_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" Y ", stepperY.getCurrent());
|
||||
#if X2_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("I1 X", stepperX2.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130) || ENABLED(Z_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" Z ", stepperZ.getCurrent());
|
||||
#if Y_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("Y", stepperY.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" X2 ", stepperX2.getCurrent());
|
||||
#if Y2_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("I1 Y", stepperY2.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" Y2 ", stepperY2.getCurrent());
|
||||
#if Z_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("Z", stepperZ.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" Z2 ", stepperZ2.getCurrent());
|
||||
#if Z2_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("I1 Z", stepperZ2.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" E0 ", stepperE0.getCurrent());
|
||||
#if E0_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("T0 E", stepperE0.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" E1 ", stepperE1.getCurrent());
|
||||
#if E_STEPPERS > 1 && E1_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("T1 E", stepperE1.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" E2 ", stepperE2.getCurrent());
|
||||
#if E_STEPPERS > 2 && E2_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("T2 E", stepperE2.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" E3 ", stepperE3.getCurrent());
|
||||
#if E_STEPPERS > 3 && E3_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("T3 E", stepperE3.getCurrent());
|
||||
#endif
|
||||
#if ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208)
|
||||
SERIAL_ECHOPAIR(" E4 ", stepperE4.getCurrent());
|
||||
#if E_STEPPERS > 4 && E4_IS_TRINAMIC
|
||||
say_M906();
|
||||
SERIAL_ECHOLNPAIR("T4 E", stepperE4.getCurrent());
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TMC2130 Sensorless homing thresholds
|
||||
*/
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
/**
|
||||
* TMC2130 / TMC2208 / TRAMS Hybrid Threshold
|
||||
*/
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Sensorless homing threshold:");
|
||||
SERIAL_ECHOLNPGM("Hybrid Threshold:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPGM(" M914");
|
||||
#ifdef X_HOMING_SENSITIVITY
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
SERIAL_ECHOPAIR(" X", stepperX.sgt());
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC2130)
|
||||
SERIAL_ECHOPAIR(" X2 ", stepperX2.sgt());
|
||||
#endif
|
||||
#if X_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("X", TMC_GET_PWMTHRS(X, X));
|
||||
#endif
|
||||
#ifdef Y_HOMING_SENSITIVITY
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
SERIAL_ECHOPAIR(" Y", stepperY.sgt());
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC2130)
|
||||
SERIAL_ECHOPAIR(" Y2 ", stepperY2.sgt());
|
||||
#endif
|
||||
#if X2_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("I1 X", TMC_GET_PWMTHRS(X, X2));
|
||||
#endif
|
||||
#ifdef Z_HOMING_SENSITIVITY
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
SERIAL_ECHOPAIR(" Z", stepperZ.sgt());
|
||||
#endif
|
||||
#if ENABLED(Z2_IS_TMC2130)
|
||||
SERIAL_ECHOPAIR(" Z2 ", stepperZ2.sgt());
|
||||
#endif
|
||||
#if Y_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("Y", TMC_GET_PWMTHRS(Y, Y));
|
||||
#endif
|
||||
#if Y2_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("I1 Y", TMC_GET_PWMTHRS(Y, Y2));
|
||||
#endif
|
||||
#if Z_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("Z", TMC_GET_PWMTHRS(Z, Z));
|
||||
#endif
|
||||
#if Z2_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("I1 Z", TMC_GET_PWMTHRS(Z, Z2));
|
||||
#endif
|
||||
#if E0_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("T0 E", TMC_GET_PWMTHRS(E, E0));
|
||||
#endif
|
||||
#if E_STEPPERS > 1 && E1_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("T1 E", TMC_GET_PWMTHRS(E, E1));
|
||||
#endif
|
||||
#if E_STEPPERS > 2 && E2_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("T2 E", TMC_GET_PWMTHRS(E, E2));
|
||||
#endif
|
||||
#if E_STEPPERS > 3 && E3_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("T3 E", TMC_GET_PWMTHRS(E, E3));
|
||||
#endif
|
||||
#if E_STEPPERS > 4 && E4_IS_TRINAMIC
|
||||
say_M913();
|
||||
SERIAL_ECHOLNPAIR("T4 E", TMC_GET_PWMTHRS(E, E4));
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TMC2130 Sensorless homing thresholds
|
||||
*/
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Sensorless homing threshold:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
#ifdef X_HOMING_SENSITIVITY
|
||||
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
|
||||
say_M914();
|
||||
SERIAL_ECHOLNPAIR("X", stepperX.sgt());
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC2130)
|
||||
say_M914();
|
||||
SERIAL_ECHOLNPAIR("I1 X", stepperX2.sgt());
|
||||
#endif
|
||||
#endif
|
||||
#ifdef Y_HOMING_SENSITIVITY
|
||||
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
|
||||
say_M914();
|
||||
SERIAL_ECHOLNPAIR("Y", stepperY.sgt());
|
||||
#endif
|
||||
#if ENABLED(Y2_IS_TMC2130)
|
||||
say_M914();
|
||||
SERIAL_ECHOLNPAIR("I1 Y", stepperY2.sgt());
|
||||
#endif
|
||||
#endif
|
||||
#ifdef Z_HOMING_SENSITIVITY
|
||||
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
|
||||
say_M914();
|
||||
SERIAL_ECHOLNPAIR("Z", stepperZ.sgt());
|
||||
#endif
|
||||
#if ENABLED(Z2_IS_TMC2130)
|
||||
say_M914();
|
||||
SERIAL_ECHOLNPAIR("I1 Z", stepperZ2.sgt());
|
||||
#endif
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
|
||||
#endif // HAS_TRINAMIC
|
||||
|
||||
/**
|
||||
* Linear Advance
|
||||
@ -2405,25 +2554,31 @@ void MarlinSettings::reset() {
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
#if EXTRUDERS == 1
|
||||
SERIAL_ECHOPAIR(" M603 L", LINEAR_UNIT(filament_change_load_length[0]));
|
||||
say_M603();
|
||||
SERIAL_ECHOPAIR("L", LINEAR_UNIT(filament_change_load_length[0]));
|
||||
SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(filament_change_unload_length[0]));
|
||||
#else
|
||||
SERIAL_ECHOPAIR(" M603 T0 L", LINEAR_UNIT(filament_change_load_length[0]));
|
||||
say_M603();
|
||||
SERIAL_ECHOPAIR("T0 L", LINEAR_UNIT(filament_change_load_length[0]));
|
||||
SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(filament_change_unload_length[0]));
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M603 T1 L", LINEAR_UNIT(filament_change_load_length[1]));
|
||||
say_M603();
|
||||
SERIAL_ECHOPAIR("T1 L", LINEAR_UNIT(filament_change_load_length[1]));
|
||||
SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(filament_change_unload_length[1]));
|
||||
#if EXTRUDERS > 2
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M603 T2 L", LINEAR_UNIT(filament_change_load_length[2]));
|
||||
say_M603();
|
||||
SERIAL_ECHOPAIR("T2 L", LINEAR_UNIT(filament_change_load_length[2]));
|
||||
SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(filament_change_unload_length[2]));
|
||||
#if EXTRUDERS > 3
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M603 T3 L", LINEAR_UNIT(filament_change_load_length[3]));
|
||||
say_M603();
|
||||
SERIAL_ECHOPAIR("T3 L", LINEAR_UNIT(filament_change_load_length[3]));
|
||||
SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(filament_change_unload_length[3]));
|
||||
#if EXTRUDERS > 4
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M603 T4 L", LINEAR_UNIT(filament_change_load_length[4]));
|
||||
say_M603();
|
||||
SERIAL_ECHOPAIR("T4 L", LINEAR_UNIT(filament_change_load_length[4]));
|
||||
SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(filament_change_unload_length[4]));
|
||||
#endif // EXTRUDERS > 4
|
||||
#endif // EXTRUDERS > 3
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user