🐛 Fix G38 with Z, support 9 axes (#25691)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Jay Robson 2023-04-20 06:58:42 +10:00 committed by GitHub
parent 19b4ae862b
commit fad1dcefbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View file

@ -341,21 +341,21 @@
#ifdef MANUAL_U_HOME_POS #ifdef MANUAL_U_HOME_POS
#define U_HOME_POS MANUAL_U_HOME_POS #define U_HOME_POS MANUAL_U_HOME_POS
#else #else
#define U_HOME_POS (U_HOME_DIR < 0 ? U_MIN_POS : U_MAX_POS) #define U_HOME_POS TERN(U_HOME_TO_MIN, U_MIN_POS, U_MAX_POS)
#endif #endif
#endif #endif
#if HAS_V_AXIS #if HAS_V_AXIS
#ifdef MANUAL_V_HOME_POS #ifdef MANUAL_V_HOME_POS
#define V_HOME_POS MANUAL_V_HOME_POS #define V_HOME_POS MANUAL_V_HOME_POS
#else #else
#define V_HOME_POS (V_HOME_DIR < 0 ? V_MIN_POS : V_MAX_POS) #define V_HOME_POS TERN(V_HOME_TO_MIN, V_MIN_POS, V_MAX_POS)
#endif #endif
#endif #endif
#if HAS_W_AXIS #if HAS_W_AXIS
#ifdef MANUAL_W_HOME_POS #ifdef MANUAL_W_HOME_POS
#define W_HOME_POS MANUAL_W_HOME_POS #define W_HOME_POS MANUAL_W_HOME_POS
#else #else
#define W_HOME_POS (W_HOME_DIR < 0 ? W_MIN_POS : W_MAX_POS) #define W_HOME_POS TERN(W_HOME_TO_MIN, W_MIN_POS, W_MAX_POS)
#endif #endif
#endif #endif

View file

@ -913,17 +913,13 @@ void Endstops::update() {
#endif #endif
#if HAS_G38_PROBE // TODO (DerAndere): Add support for HAS_I_AXIS #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 // 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))) == TERN1(G38_PROBE_AWAY, (G38_move < 4))) {
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); }
#endif
#if HAS_Z_AXIS
else if (stepper.axis_is_moving(Z_AXIS)) { _ENDSTOP_HIT(Z, TERN(Z_HOME_TO_MIN, MIN, MAX)); planner.endstop_triggered(Z_AXIS); }
#endif
G38_did_trigger = true; G38_did_trigger = true;
#define _G38_SET(Q) | (stepper.axis_is_moving(_AXIS(Q)) << _AXIS(Q))
#define _G38_RESP(Q) if (moving[_AXIS(Q)]) { _ENDSTOP_HIT(Q, ENDSTOP); planner.endstop_triggered(_AXIS(Q)); }
const Flags<NUM_AXES> moving = { value_t(NUM_AXES)(0 MAIN_AXIS_MAP(_G38_SET)) };
MAIN_AXIS_MAP(_G38_RESP);
} }
#endif #endif