[1.1.x] Enable Z axis and delta sensorless homing (#9532)

This commit is contained in:
Thomas Moore
2018-02-08 02:02:48 -06:00
committed by Scott Lahteine
parent f089bbbc93
commit a471cd26e1
41 changed files with 347 additions and 212 deletions

View File

@@ -37,7 +37,7 @@
*/
// Change EEPROM version if the structure changes
#define EEPROM_VERSION "V50"
#define EEPROM_VERSION "V51"
#define EEPROM_OFFSET 100
// Check the integrity of data offsets.
@@ -216,7 +216,7 @@ typedef struct SettingsDataStruct {
// HAS_TRINAMIC
//
uint16_t tmc_stepper_current[11]; // M906 X Y Z X2 Y2 Z2 E0 E1 E2 E3 E4
int16_t tmc_sgt[2]; // M914 X Y
int16_t tmc_sgt[XYZ]; // M914 X Y Z
//
// LIN_ADVANCE
@@ -740,15 +740,20 @@ void MarlinSettings::postprocess() {
//
// TMC2130 Sensorless homing threshold
//
int16_t thrs[2] = {
int16_t thrs[XYZ] = {
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130)
#if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
stepperX.sgt(),
#else
0,
#endif
#if ENABLED(Y_IS_TMC2130)
stepperY.sgt()
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
stepperY.sgt(),
#else
0
#endif
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
stepperZ.sgt()
#else
0
#endif
@@ -1263,22 +1268,35 @@ void MarlinSettings::postprocess() {
* TMC2130 Sensorless homing threshold.
* X and X2 use the same value
* Y and Y2 use the same value
* Z and Z2 use the same value
*/
int16_t thrs[2];
int16_t thrs[XYZ];
EEPROM_READ(thrs);
#if ENABLED(SENSORLESS_HOMING)
if (!validating) {
#if ENABLED(X_IS_TMC2130)
stepperX.sgt(thrs[0]);
#ifdef X_HOMING_SENSITIVITY
#if ENABLED(X_IS_TMC2130)
stepperX.sgt(thrs[0]);
#endif
#if ENABLED(X2_IS_TMC2130)
stepperX2.sgt(thrs[0]);
#endif
#endif
#if ENABLED(X2_IS_TMC2130)
stepperX2.sgt(thrs[0]);
#ifdef Y_HOMING_SENSITIVITY
#if ENABLED(Y_IS_TMC2130)
stepperY.sgt(thrs[1]);
#endif
#if ENABLED(Y2_IS_TMC2130)
stepperY2.sgt(thrs[1]);
#endif
#endif
#if ENABLED(Y_IS_TMC2130)
stepperY.sgt(thrs[1]);
#endif
#if ENABLED(Y2_IS_TMC2130)
stepperY2.sgt(thrs[1]);
#ifdef Z_HOMING_SENSITIVITY
#if ENABLED(Z_IS_TMC2130)
stepperZ.sgt(thrs[2]);
#endif
#if ENABLED(Z2_IS_TMC2130)
stepperZ2.sgt(thrs[2]);
#endif
#endif
}
#endif
@@ -1748,17 +1766,29 @@ void MarlinSettings::reset() {
#endif
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130)
stepperX.sgt(X_HOMING_SENSITIVITY);
#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
#if ENABLED(X2_IS_TMC2130)
stepperX2.sgt(X_HOMING_SENSITIVITY);
#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
#if ENABLED(Y_IS_TMC2130)
stepperY.sgt(Y_HOMING_SENSITIVITY);
#endif
#if ENABLED(Y2_IS_TMC2130)
stepperY2.sgt(Y_HOMING_SENSITIVITY);
#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
@@ -1768,8 +1798,8 @@ void MarlinSettings::reset() {
#endif
#if HAS_MOTOR_CURRENT_PWM
uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT;
for (uint8_t q = 3; q--;)
uint32_t tmp_motor_current_setting[XYZ] = PWM_MOTOR_CURRENT;
for (uint8_t q = XYZ; q--;)
stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q]));
#endif
@@ -2298,17 +2328,29 @@ void MarlinSettings::reset() {
}
CONFIG_ECHO_START;
SERIAL_ECHOPGM(" M914");
#if ENABLED(X_IS_TMC2130)
SERIAL_ECHOPAIR(" X", stepperX.sgt());
#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
#endif
#if ENABLED(X2_IS_TMC2130)
SERIAL_ECHOPAIR(" X2 ", stepperX2.sgt());
#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
#endif
#if ENABLED(Y_IS_TMC2130)
SERIAL_ECHOPAIR(" Y", stepperY.sgt());
#endif
#if ENABLED(X2_IS_TMC2130)
SERIAL_ECHOPAIR(" Y2 ", stepperY2.sgt());
#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
#endif
SERIAL_EOL();
#endif