[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

@ -2857,6 +2857,19 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
if (axis == Z_AXIS) probing_pause(true);
#endif
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
if (axis == X_AXIS) tmc_sensorless_homing(stepperX);
#endif
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
if (axis == Y_AXIS) tmc_sensorless_homing(stepperY);
#endif
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
if (axis == Z_AXIS) tmc_sensorless_homing(stepperZ);
#endif
#endif
// Tell the planner the axis is at 0
current_position[axis] = 0;
@ -2883,6 +2896,19 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
endstops.hit_on_purpose();
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
if (axis == X_AXIS) tmc_sensorless_homing(stepperX, false);
#endif
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
if (axis == Y_AXIS) tmc_sensorless_homing(stepperY, false);
#endif
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
if (axis == Z_AXIS) tmc_sensorless_homing(stepperZ, false);
#endif
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("<<< do_homing_move(", axis_codes[axis]);
@ -2946,16 +2972,6 @@ static void homeaxis(const AxisEnum axis) {
if (axis == Z_AXIS) stepper.set_homing_flag_z(true);
#endif
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130)
if (axis == X_AXIS) tmc_sensorless_homing(stepperX);
#endif
#if ENABLED(Y_IS_TMC2130)
if (axis == Y_AXIS) tmc_sensorless_homing(stepperY);
#endif
#endif
// Fast move towards endstop until triggered
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 1 Fast:");
@ -3056,16 +3072,6 @@ static void homeaxis(const AxisEnum axis) {
#endif
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130)
if (axis == X_AXIS) tmc_sensorless_homing(stepperX, false);
#endif
#if ENABLED(Y_IS_TMC2130)
if (axis == Y_AXIS) tmc_sensorless_homing(stepperY, false);
#endif
#endif
// Put away the Z probe
#if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS && STOW_PROBE()) return;
@ -3757,12 +3763,38 @@ inline void gcode_G4() {
ZERO(current_position);
sync_plan_position();
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
tmc_sensorless_homing(stepperX);
#endif
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
tmc_sensorless_homing(stepperY);
#endif
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
tmc_sensorless_homing(stepperZ);
#endif
#endif
// Move all carriages together linearly until an endstop is hit.
current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (delta_height + 10);
feedrate_mm_s = homing_feedrate(X_AXIS);
buffer_line_to_current_position();
stepper.synchronize();
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
#if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
tmc_sensorless_homing(stepperX, false);
#endif
#if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
tmc_sensorless_homing(stepperY, false);
#endif
#if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
tmc_sensorless_homing(stepperZ, false);
#endif
#endif
// If an endstop was not hit, then damage can occur if homing is continued.
// This can occur if the delta height not set correctly.
if (!(Endstops::endstop_hit_bits & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) {
@ -10586,17 +10618,29 @@ inline void gcode_M502() {
if (parser.seen(axis_codes[X_AXIS])) tmc_set_sgt(stepperX, extended_axis_codes[TMC_X], parser.value_int()); \
else tmc_get_sgt(stepperX, extended_axis_codes[TMC_X]); } while(0)
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
TMC_SET_GET_SGT(X,X);
#ifdef X_HOMING_SENSITIVITY
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
TMC_SET_GET_SGT(X,X);
#endif
#if ENABLED(X2_IS_TMC2130)
TMC_SET_GET_SGT(X,X2);
#endif
#endif
#if ENABLED(X2_IS_TMC2130)
TMC_SET_GET_SGT(X,X2);
#ifdef Y_HOMING_SENSITIVITY
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
TMC_SET_GET_SGT(Y,Y);
#endif
#if ENABLED(Y2_IS_TMC2130)
TMC_SET_GET_SGT(Y,Y2);
#endif
#endif
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
TMC_SET_GET_SGT(Y,Y);
#endif
#if ENABLED(Y2_IS_TMC2130)
TMC_SET_GET_SGT(Y,Y2);
#ifdef Z_HOMING_SENSITIVITY
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
TMC_SET_GET_SGT(Z,Z);
#endif
#if ENABLED(Z2_IS_TMC2130)
TMC_SET_GET_SGT(Z,Z2);
#endif
#endif
}
#endif // SENSORLESS_HOMING