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