Fix Z homing with custom probe pins (#18150)

This commit is contained in:
Jonathan Gilbert 2020-06-01 00:19:36 -05:00 committed by GitHub
parent 6515100807
commit e380498512
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1534,24 +1534,13 @@ void homeaxis(const AxisEnum axis) {
// Only Z homing (with probe) is permitted
if (axis != Z_AXIS) { BUZZ(100, 880); return; }
#else
#define _CAN_HOME(A) \
(axis == _AXIS(A) && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
#if X_SPI_SENSORLESS
#define CAN_HOME_X true
#else
#define CAN_HOME_X _CAN_HOME(X)
#endif
#if Y_SPI_SENSORLESS
#define CAN_HOME_Y true
#else
#define CAN_HOME_Y _CAN_HOME(Y)
#endif
#if Z_SPI_SENSORLESS
#define CAN_HOME_Z true
#else
#define CAN_HOME_Z _CAN_HOME(Z)
#endif
if (!CAN_HOME_X && !CAN_HOME_Y && !CAN_HOME_Z) return;
#define _CAN_HOME(A) (axis == _AXIS(A) && ( \
ENABLED(A##_SPI_SENSORLESS) \
|| (_AXIS(A) == Z_AXIS && ENABLED(HOMING_Z_WITH_PROBE)) \
|| (A##_MIN_PIN > 0 && A##_HOME_DIR < 0) \
|| (A##_MAX_PIN > 0 && A##_HOME_DIR > 0) \
))
if (!_CAN_HOME(X) && !_CAN_HOME(Y) && !_CAN_HOME(Z)) return;
#endif
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", axis_codes[axis], ")");