|
|
@ -37,7 +37,7 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
// Change EEPROM version if the structure changes
|
|
|
|
#define EEPROM_VERSION "V77" |
|
|
|
#define EEPROM_VERSION "V78" |
|
|
|
#define EEPROM_OFFSET 100 |
|
|
|
|
|
|
|
// Check the integrity of data offsets.
|
|
|
@ -135,7 +135,7 @@ |
|
|
|
|
|
|
|
typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5, E6, E7; } tmc_stepper_current_t; |
|
|
|
typedef struct { uint32_t X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5, E6, E7; } tmc_hybrid_threshold_t; |
|
|
|
typedef struct { int16_t X, Y, Z, X2; } tmc_sgt_t; |
|
|
|
typedef struct { int16_t X, Y, Z, X2, Y2, Z2, Z3, Z4; } tmc_sgt_t; |
|
|
|
typedef struct { bool X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5, E6, E7; } tmc_stealth_enabled_t; |
|
|
|
|
|
|
|
// Limit an index to an array size
|
|
|
@ -328,7 +328,7 @@ typedef struct SettingsDataStruct { |
|
|
|
//
|
|
|
|
tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
|
|
|
|
tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
|
|
|
|
tmc_sgt_t tmc_sgt; // M914 X Y Z X2
|
|
|
|
tmc_sgt_t tmc_sgt; // M914 X Y Z X2 Y2 Z2 Z3 Z4
|
|
|
|
tmc_stealth_enabled_t tmc_stealth_enabled; // M569 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
|
|
|
|
|
|
|
|
//
|
|
|
@ -1112,10 +1112,14 @@ void MarlinSettings::postprocess() { |
|
|
|
{ |
|
|
|
tmc_sgt_t tmc_sgt{0}; |
|
|
|
#if USE_SENSORLESS |
|
|
|
TERN_(X_SENSORLESS, tmc_sgt.X = stepperX.homing_threshold()); |
|
|
|
TERN_(X_SENSORLESS, tmc_sgt.X = stepperX.homing_threshold()); |
|
|
|
TERN_(X2_SENSORLESS, tmc_sgt.X2 = stepperX2.homing_threshold()); |
|
|
|
TERN_(Y_SENSORLESS, tmc_sgt.Y = stepperY.homing_threshold()); |
|
|
|
TERN_(Z_SENSORLESS, tmc_sgt.Z = stepperZ.homing_threshold()); |
|
|
|
TERN_(Y_SENSORLESS, tmc_sgt.Y = stepperY.homing_threshold()); |
|
|
|
TERN_(Y2_SENSORLESS, tmc_sgt.Y2 = stepperY2.homing_threshold()); |
|
|
|
TERN_(Z_SENSORLESS, tmc_sgt.Z = stepperZ.homing_threshold()); |
|
|
|
TERN_(Z2_SENSORLESS, tmc_sgt.Z2 = stepperZ2.homing_threshold()); |
|
|
|
TERN_(Z3_SENSORLESS, tmc_sgt.Z3 = stepperZ3.homing_threshold()); |
|
|
|
TERN_(Z4_SENSORLESS, tmc_sgt.Z4 = stepperZ4.homing_threshold()); |
|
|
|
#endif |
|
|
|
EEPROM_WRITE(tmc_sgt); |
|
|
|
} |
|
|
@ -1929,9 +1933,6 @@ void MarlinSettings::postprocess() { |
|
|
|
|
|
|
|
//
|
|
|
|
// TMC StallGuard threshold.
|
|
|
|
// X and X2 use the same value
|
|
|
|
// Y and Y2 use the same value
|
|
|
|
// Z, Z2, Z3 and Z4 use the same value
|
|
|
|
//
|
|
|
|
{ |
|
|
|
tmc_sgt_t tmc_sgt; |
|
|
@ -1939,37 +1940,14 @@ void MarlinSettings::postprocess() { |
|
|
|
EEPROM_READ(tmc_sgt); |
|
|
|
#if USE_SENSORLESS |
|
|
|
if (!validating) { |
|
|
|
#ifdef X_STALL_SENSITIVITY |
|
|
|
#if AXIS_HAS_STALLGUARD(X) |
|
|
|
stepperX.homing_threshold(tmc_sgt.X); |
|
|
|
#endif |
|
|
|
#if AXIS_HAS_STALLGUARD(X2) && !X2_SENSORLESS |
|
|
|
stepperX2.homing_threshold(tmc_sgt.X); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
TERN_(X_SENSORLESS, stepperX.homing_threshold(tmc_sgt.X)); |
|
|
|
TERN_(X2_SENSORLESS, stepperX2.homing_threshold(tmc_sgt.X2)); |
|
|
|
#ifdef Y_STALL_SENSITIVITY |
|
|
|
#if AXIS_HAS_STALLGUARD(Y) |
|
|
|
stepperY.homing_threshold(tmc_sgt.Y); |
|
|
|
#endif |
|
|
|
#if AXIS_HAS_STALLGUARD(Y2) |
|
|
|
stepperY2.homing_threshold(tmc_sgt.Y); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef Z_STALL_SENSITIVITY |
|
|
|
#if AXIS_HAS_STALLGUARD(Z) |
|
|
|
stepperZ.homing_threshold(tmc_sgt.Z); |
|
|
|
#endif |
|
|
|
#if AXIS_HAS_STALLGUARD(Z2) |
|
|
|
stepperZ2.homing_threshold(tmc_sgt.Z); |
|
|
|
#endif |
|
|
|
#if AXIS_HAS_STALLGUARD(Z3) |
|
|
|
stepperZ3.homing_threshold(tmc_sgt.Z); |
|
|
|
#endif |
|
|
|
#if AXIS_HAS_STALLGUARD(Z4) |
|
|
|
stepperZ4.homing_threshold(tmc_sgt.Z); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
TERN_(Y_SENSORLESS, stepperY.homing_threshold(tmc_sgt.Y)); |
|
|
|
TERN_(Y2_SENSORLESS, stepperY2.homing_threshold(tmc_sgt.Y2)); |
|
|
|
TERN_(Z_SENSORLESS, stepperZ.homing_threshold(tmc_sgt.Z)); |
|
|
|
TERN_(Z2_SENSORLESS, stepperZ2.homing_threshold(tmc_sgt.Z2)); |
|
|
|
TERN_(Z3_SENSORLESS, stepperZ3.homing_threshold(tmc_sgt.Z3)); |
|
|
|
TERN_(Z4_SENSORLESS, stepperZ4.homing_threshold(tmc_sgt.Z4)); |
|
|
|
} |
|
|
|
#endif |
|
|
|
} |
|
|
|