Made G38 working

This commit is contained in:
Thomas Basler 2020-02-23 00:23:25 +01:00
parent e18caa24e2
commit b25f9ef79f

View File

@ -723,6 +723,11 @@ void Endstops::update() {
if (G38_move) UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
#endif
#if ENABLED(G38_PROBE_TARGET) && (ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && PIN_EXISTS(Z_MIN)) && !(CORE_IS_XY || CORE_IS_XZ)
// If G38 command is active check Z_MIN_PROBE for ALL movement
if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN);
#endif
// With Dual X, endstops are only checked in the homing direction for the active extruder
#define X_MIN_TEST() TERN1(DUAL_X_CARRIAGE, TERN0(X_HOME_TO_MIN, stepper.last_moved_extruder == 0) || TERN0(X2_HOME_TO_MIN, stepper.last_moved_extruder != 0))
#define X_MAX_TEST() TERN1(DUAL_X_CARRIAGE, TERN0(X_HOME_TO_MAX, stepper.last_moved_extruder == 0) || TERN0(X2_HOME_TO_MAX, stepper.last_moved_extruder != 0))
@ -1115,7 +1120,7 @@ void Endstops::update() {
#if HAS_G38_PROBE // TODO (DerAndere): Add support for HAS_I_AXIS
#define _G38_OPEN_STATE TERN(G38_PROBE_AWAY, (G38_move >= 4), LOW)
// For G38 moves check the probe's pin for ALL movement
if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN))) != _G38_OPEN_STATE) {
if (G38_move && (TEST_ENDSTOP(_ENDSTOP(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN))) != _G38_OPEN_STATE || TEST_ENDSTOP(_ENDSTOP(Z, MIN)))) {
if (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, TERN(X_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(X_AXIS); }
#if HAS_Y_AXIS
else if (stepper.axis_is_moving(Y_AXIS)) { _ENDSTOP_HIT(Y, TERN(Y_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(Y_AXIS); }