|
@@ -596,14 +596,15 @@ void _O2 Endstops::report_states() {
|
596
|
596
|
// endstop ISR or the Stepper ISR.
|
597
|
597
|
|
598
|
598
|
#if BOTH(DELTA, SENSORLESS_PROBING)
|
599
|
|
- #define _ENDSTOP(AXIS, MINMAX) AXIS ##_MAX
|
600
|
|
- #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_MAX_PIN
|
601
|
|
- #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_MAX_ENDSTOP_INVERTING
|
|
599
|
+ #define __ENDSTOP(AXIS, ...) AXIS ##_MAX
|
|
600
|
+ #define _ENDSTOP_PIN(AXIS, ...) AXIS ##_MAX_PIN
|
|
601
|
+ #define _ENDSTOP_INVERTING(AXIS, ...) AXIS ##_MAX_ENDSTOP_INVERTING
|
602
|
602
|
#else
|
603
|
|
- #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
|
|
603
|
+ #define __ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
|
604
|
604
|
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
|
605
|
605
|
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
|
606
|
606
|
#endif
|
|
607
|
+#define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
|
607
|
608
|
|
608
|
609
|
// Check endstops - Could be called from Temperature ISR!
|
609
|
610
|
void Endstops::update() {
|
|
@@ -615,9 +616,10 @@ void Endstops::update() {
|
615
|
616
|
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
|
616
|
617
|
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
|
617
|
618
|
|
618
|
|
- #if BOTH(G38_PROBE_TARGET, HAS_Z_MIN_PROBE_PIN) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
|
619
|
|
- // If G38 command is active check Z_MIN_PROBE for ALL movement
|
620
|
|
- if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
|
|
619
|
+ #if ENABLED(G38_PROBE_TARGET) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
|
|
620
|
+ #define HAS_G38_PROBE 1
|
|
621
|
+ // For G38 moves check the probe's pin for ALL movement
|
|
622
|
+ if (G38_move) UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
|
621
|
623
|
#endif
|
622
|
624
|
|
623
|
625
|
// With Dual X, endstops are only checked in the homing direction for the active extruder
|
|
@@ -746,7 +748,7 @@ void Endstops::update() {
|
746
|
748
|
COPY_LIVE_STATE(Z_MAX, Z4_MAX);
|
747
|
749
|
#endif
|
748
|
750
|
#endif
|
749
|
|
- #elif !USES_Z_MIN_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN
|
|
751
|
+ #elif TERN1(USES_Z_MIN_PROBE_PIN, Z_MAX_PIN != Z_MIN_PROBE_PIN)
|
750
|
752
|
// If this pin isn't the bed probe it's the Z endstop
|
751
|
753
|
UPDATE_ENDSTOP_BIT(Z, MAX);
|
752
|
754
|
#endif
|
|
@@ -930,15 +932,11 @@ void Endstops::update() {
|
930
|
932
|
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
|
931
|
933
|
#endif
|
932
|
934
|
|
933
|
|
- #if BOTH(G38_PROBE_TARGET, HAS_Z_MIN_PROBE_PIN) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
|
934
|
|
- #if ENABLED(G38_PROBE_AWAY)
|
935
|
|
- #define _G38_OPEN_STATE (G38_move >= 4)
|
936
|
|
- #else
|
937
|
|
- #define _G38_OPEN_STATE LOW
|
938
|
|
- #endif
|
939
|
|
- // If G38 command is active check Z_MIN_PROBE for ALL movement
|
940
|
|
- if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE)) != _G38_OPEN_STATE) {
|
941
|
|
- if (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, TERN(X_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(X_AXIS); }
|
|
935
|
+ #if HAS_G38_PROBE
|
|
936
|
+ #define _G38_OPEN_STATE TERN(G38_PROBE_AWAY, (G38_move >= 4), LOW)
|
|
937
|
+ // For G38 moves check the probe's pin for ALL movement
|
|
938
|
+ if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN))) != _G38_OPEN_STATE) {
|
|
939
|
+ if (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, TERN(X_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(X_AXIS); }
|
942
|
940
|
#if HAS_Y_AXIS
|
943
|
941
|
else if (stepper.axis_is_moving(Y_AXIS)) { _ENDSTOP_HIT(Y, TERN(Y_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(Y_AXIS); }
|
944
|
942
|
#endif
|
|
@@ -1043,7 +1041,7 @@ void Endstops::update() {
|
1043
|
1041
|
#if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_TO_MAX)
|
1044
|
1042
|
#if ENABLED(Z_MULTI_ENDSTOPS)
|
1045
|
1043
|
PROCESS_ENDSTOP_Z(MAX);
|
1046
|
|
- #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
|
|
1044
|
+ #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
|
1047
|
1045
|
PROCESS_ENDSTOP(Z, MAX);
|
1048
|
1046
|
#endif
|
1049
|
1047
|
#if CORE_DIAG(XZ, X, MIN)
|