🐛 Fix G38 with probe on Z_MIN (#22452)
This commit is contained in:
parent
4b2fdbeeb1
commit
1866f51d08
@ -771,7 +771,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set flags for enabled probes
|
* Set a flag for any type of bed probe, including the paper-test
|
||||||
*/
|
*/
|
||||||
#if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE)
|
#if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE)
|
||||||
#define HAS_BED_PROBE 1
|
#define HAS_BED_PROBE 1
|
||||||
@ -913,7 +913,7 @@
|
|||||||
#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && !BOTH(DELTA, SENSORLESS_PROBING)
|
#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && !BOTH(DELTA, SENSORLESS_PROBING)
|
||||||
#define USES_Z_MIN_PROBE_PIN 1
|
#define USES_Z_MIN_PROBE_PIN 1
|
||||||
#endif
|
#endif
|
||||||
#if Z_HOME_TO_MIN && (!USES_Z_MIN_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
|
#if Z_HOME_TO_MIN && TERN1(USES_Z_MIN_PROBE_PIN, ENABLED(USE_PROBE_FOR_Z_HOMING))
|
||||||
#define HOMING_Z_WITH_PROBE 1
|
#define HOMING_Z_WITH_PROBE 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef Z_PROBE_LOW_POINT
|
#ifndef Z_PROBE_LOW_POINT
|
||||||
|
@ -2533,7 +2533,7 @@
|
|||||||
#if PIN_EXISTS(Z4_MAX)
|
#if PIN_EXISTS(Z4_MAX)
|
||||||
#define HAS_Z4_MAX 1
|
#define HAS_Z4_MAX 1
|
||||||
#endif
|
#endif
|
||||||
#if BOTH(HAS_BED_PROBE, USES_Z_MIN_PROBE_PIN) && PIN_EXISTS(Z_MIN_PROBE)
|
#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
|
||||||
#define HAS_Z_MIN_PROBE_PIN 1
|
#define HAS_Z_MIN_PROBE_PIN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -596,14 +596,15 @@ void _O2 Endstops::report_states() {
|
|||||||
// endstop ISR or the Stepper ISR.
|
// endstop ISR or the Stepper ISR.
|
||||||
|
|
||||||
#if BOTH(DELTA, SENSORLESS_PROBING)
|
#if BOTH(DELTA, SENSORLESS_PROBING)
|
||||||
#define _ENDSTOP(AXIS, MINMAX) AXIS ##_MAX
|
#define __ENDSTOP(AXIS, ...) AXIS ##_MAX
|
||||||
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_MAX_PIN
|
#define _ENDSTOP_PIN(AXIS, ...) AXIS ##_MAX_PIN
|
||||||
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_MAX_ENDSTOP_INVERTING
|
#define _ENDSTOP_INVERTING(AXIS, ...) AXIS ##_MAX_ENDSTOP_INVERTING
|
||||||
#else
|
#else
|
||||||
#define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
|
#define __ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
|
||||||
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
|
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
|
||||||
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
|
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
|
||||||
#endif
|
#endif
|
||||||
|
#define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
|
||||||
|
|
||||||
// Check endstops - Could be called from Temperature ISR!
|
// Check endstops - Could be called from Temperature ISR!
|
||||||
void Endstops::update() {
|
void Endstops::update() {
|
||||||
@ -615,9 +616,10 @@ void Endstops::update() {
|
|||||||
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
|
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
|
||||||
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
|
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
|
||||||
|
|
||||||
#if BOTH(G38_PROBE_TARGET, HAS_Z_MIN_PROBE_PIN) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
|
#if ENABLED(G38_PROBE_TARGET) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
|
||||||
// If G38 command is active check Z_MIN_PROBE for ALL movement
|
#define HAS_G38_PROBE 1
|
||||||
if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
|
// For G38 moves check the probe's pin for ALL movement
|
||||||
|
if (G38_move) UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// With Dual X, endstops are only checked in the homing direction for the active extruder
|
// With Dual X, endstops are only checked in the homing direction for the active extruder
|
||||||
@ -746,7 +748,7 @@ void Endstops::update() {
|
|||||||
COPY_LIVE_STATE(Z_MAX, Z4_MAX);
|
COPY_LIVE_STATE(Z_MAX, Z4_MAX);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#elif !USES_Z_MIN_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN
|
#elif TERN1(USES_Z_MIN_PROBE_PIN, Z_MAX_PIN != Z_MIN_PROBE_PIN)
|
||||||
// If this pin isn't the bed probe it's the Z endstop
|
// If this pin isn't the bed probe it's the Z endstop
|
||||||
UPDATE_ENDSTOP_BIT(Z, MAX);
|
UPDATE_ENDSTOP_BIT(Z, MAX);
|
||||||
#endif
|
#endif
|
||||||
@ -930,15 +932,11 @@ void Endstops::update() {
|
|||||||
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
|
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOTH(G38_PROBE_TARGET, HAS_Z_MIN_PROBE_PIN) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
|
#if HAS_G38_PROBE
|
||||||
#if ENABLED(G38_PROBE_AWAY)
|
#define _G38_OPEN_STATE TERN(G38_PROBE_AWAY, (G38_move >= 4), LOW)
|
||||||
#define _G38_OPEN_STATE (G38_move >= 4)
|
// For G38 moves check the probe's pin for ALL movement
|
||||||
#else
|
if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN))) != _G38_OPEN_STATE) {
|
||||||
#define _G38_OPEN_STATE LOW
|
if (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, TERN(X_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(X_AXIS); }
|
||||||
#endif
|
|
||||||
// If G38 command is active check Z_MIN_PROBE for ALL movement
|
|
||||||
if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE)) != _G38_OPEN_STATE) {
|
|
||||||
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
|
#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); }
|
else if (stepper.axis_is_moving(Y_AXIS)) { _ENDSTOP_HIT(Y, TERN(Y_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(Y_AXIS); }
|
||||||
#endif
|
#endif
|
||||||
@ -1043,7 +1041,7 @@ void Endstops::update() {
|
|||||||
#if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_TO_MAX)
|
#if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_TO_MAX)
|
||||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||||
PROCESS_ENDSTOP_Z(MAX);
|
PROCESS_ENDSTOP_Z(MAX);
|
||||||
#elif !USES_Z_MIN_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN // No probe or probe is Z_MIN || Probe is not Z_MAX
|
#elif TERN1(USES_Z_MIN_PROBE_PIN, Z_MAX_PIN != Z_MIN_PROBE_PIN) // No probe or probe is Z_MIN || Probe is not Z_MAX
|
||||||
PROCESS_ENDSTOP(Z, MAX);
|
PROCESS_ENDSTOP(Z, MAX);
|
||||||
#endif
|
#endif
|
||||||
#if CORE_DIAG(XZ, X, MIN)
|
#if CORE_DIAG(XZ, X, MIN)
|
||||||
|
Loading…
Reference in New Issue
Block a user