🎨 Flags for homing directions

This commit is contained in:
Scott Lahteine 2021-05-19 00:21:34 -05:00 committed by Scott Lahteine
parent 85fa8c55c9
commit 49b05ba989
27 changed files with 131 additions and 114 deletions

View file

@ -144,7 +144,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#error "Serial port pins (2) conflict with Z4 pins!"
#elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#error "Serial port pins (2) conflict with other pins!"
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
#elif Y_HOME_TO_MIN && IS_TX2(Y_STOP_PIN)
#error "Serial port pins (2) conflict with Y endstop pin!"
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
#error "Serial port pins (2) conflict with probe pin!"

View file

@ -375,7 +375,7 @@ void PrintJobRecovery::resume() {
gcode.process_subcommands_now_P(PSTR("G92.9E0")); // Reset E to 0
#if Z_HOME_DIR > 0
#if Z_HOME_TO_MAX
float z_now = z_raised;

View file

@ -73,7 +73,7 @@
current_position.set(0.0, 0.0);
sync_plan_position();
const int x_axis_home_dir = x_home_dir(active_extruder);
const int x_axis_home_dir = TOOL_X_HOME_DIR(active_extruder);
const float mlx = max_length(X_AXIS),
mly = max_length(Y_AXIS),

View file

@ -814,6 +814,23 @@
#endif
#endif // FILAMENT_RUNOUT_SENSOR
// Homing to Min or Max
#if X_HOME_DIR > 0
#define X_HOME_TO_MAX 1
#elif X_HOME_DIR < 0
#define X_HOME_TO_MIN 1
#endif
#if Y_HOME_DIR > 0
#define Y_HOME_TO_MAX 1
#elif Y_HOME_DIR < 0
#define Y_HOME_TO_MIN 1
#endif
#if Z_HOME_DIR > 0
#define Z_HOME_TO_MAX 1
#elif Z_HOME_DIR < 0
#define Z_HOME_TO_MIN 1
#endif
#if HAS_BED_PROBE
#if DISABLED(NOZZLE_AS_PROBE)
#define HAS_PROBE_XY_OFFSET 1
@ -821,7 +838,7 @@
#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && !BOTH(DELTA, SENSORLESS_PROBING)
#define HAS_CUSTOM_PROBE_PIN 1
#endif
#if Z_HOME_DIR < 0 && (!HAS_CUSTOM_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
#if Z_HOME_TO_MIN && (!HAS_CUSTOM_PROBE_PIN || ENABLED(USE_PROBE_FOR_Z_HOMING))
#define HOMING_Z_WITH_PROBE 1
#endif
#ifndef Z_PROBE_LOW_POINT
@ -843,7 +860,7 @@
#undef USE_PROBE_FOR_Z_HOMING
#endif
#if Z_HOME_DIR > 0
#if Z_HOME_TO_MAX
#define HOME_Z_FIRST // If homing away from BED do Z first
#endif

View file

@ -391,6 +391,12 @@
#define POLL_JOG
#endif
#if X2_HOME_DIR > 0
#define X2_HOME_TO_MAX 1
#elif X2_HOME_DIR < 0
#define X2_HOME_TO_MIN 1
#endif
#ifndef HOMING_BUMP_MM
#define HOMING_BUMP_MM { 0, 0, 0 }
#endif

View file

@ -155,7 +155,7 @@
#ifdef MANUAL_X_HOME_POS
#define X_HOME_POS MANUAL_X_HOME_POS
#else
#define X_END_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
#define X_END_POS TERN(X_HOME_TO_MIN, X_MIN_POS, X_MAX_POS)
#if ENABLED(BED_CENTER_AT_0_0)
#define X_HOME_POS TERN(DELTA, 0, X_END_POS)
#else
@ -166,7 +166,7 @@
#ifdef MANUAL_Y_HOME_POS
#define Y_HOME_POS MANUAL_Y_HOME_POS
#else
#define Y_END_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
#define Y_END_POS TERN(Y_HOME_TO_MIN, Y_MIN_POS, Y_MAX_POS)
#if ENABLED(BED_CENTER_AT_0_0)
#define Y_HOME_POS TERN(DELTA, 0, Y_END_POS)
#else
@ -177,7 +177,7 @@
#ifdef MANUAL_Z_HOME_POS
#define Z_HOME_POS MANUAL_Z_HOME_POS
#else
#define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
#define Z_HOME_POS TERN(Z_HOME_TO_MIN, Z_MIN_POS, Z_MAX_POS)
#endif
/**
@ -798,7 +798,7 @@
* X_DUAL_ENDSTOPS endstop reassignment
*/
#if ENABLED(X_DUAL_ENDSTOPS)
#if X_HOME_DIR > 0
#if X_HOME_TO_MAX
#ifndef X2_MAX_ENDSTOP_INVERTING
#if X2_USE_ENDSTOP == _XMIN_
#define X2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
@ -921,7 +921,7 @@
* Y_DUAL_ENDSTOPS endstop reassignment
*/
#if ENABLED(Y_DUAL_ENDSTOPS)
#if Y_HOME_DIR > 0
#if Y_HOME_TO_MAX
#ifndef Y2_MAX_ENDSTOP_INVERTING
#if Y2_USE_ENDSTOP == _XMIN_
#define Y2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
@ -1045,7 +1045,7 @@
*/
#if ENABLED(Z_MULTI_ENDSTOPS)
#if Z_HOME_DIR > 0
#if Z_HOME_TO_MAX
#ifndef Z2_MAX_ENDSTOP_INVERTING
#if Z2_USE_ENDSTOP == _XMIN_
#define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
@ -1164,7 +1164,7 @@
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if Z_HOME_DIR > 0
#if Z_HOME_TO_MAX
#ifndef Z3_MAX_ENDSTOP_INVERTING
#if Z3_USE_ENDSTOP == _XMIN_
#define Z3_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
@ -1284,7 +1284,7 @@
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if Z_HOME_DIR > 0
#if Z_HOME_TO_MAX
#ifndef Z4_MAX_ENDSTOP_INVERTING
#if Z4_USE_ENDSTOP == _XMIN_
#define Z4_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING

View file

@ -1682,7 +1682,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
* Allen Key
* Deploying the Allen Key probe uses big moves in z direction. Too dangerous for an unhomed z-axis.
*/
#if BOTH(Z_PROBE_ALLEN_KEY, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && Z_HOME_DIR < 0
#if ALL(Z_HOME_TO_MIN, Z_PROBE_ALLEN_KEY, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#error "You can't home to a Z min endstop with a Z_PROBE_ALLEN_KEY."
#endif
@ -1700,7 +1700,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "DUAL_X_CARRIAGE requires USE_XMAX_PLUG and an X Max Endstop."
#elif !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS)
#error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS."
#elif X_HOME_DIR != -1 || X2_HOME_DIR != 1
#elif X_HOME_TO_MAX || X2_HOME_TO_MIN
#error "DUAL_X_CARRIAGE requires X_HOME_DIR -1 and X2_HOME_DIR 1."
#endif
#endif
@ -2089,25 +2089,25 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
// Delta and Cartesian use 3 homing endstops
#if NONE(IS_SCARA, SPI_ENDSTOPS)
#if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
#if X_HOME_TO_MIN && DISABLED(USE_XMIN_PLUG)
#error "Enable USE_XMIN_PLUG when homing X to MIN."
#elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
#elif X_HOME_TO_MAX && DISABLED(USE_XMAX_PLUG)
#error "Enable USE_XMAX_PLUG when homing X to MAX."
#elif Y_HOME_DIR < 0 && DISABLED(USE_YMIN_PLUG)
#elif Y_HOME_TO_MIN && DISABLED(USE_YMIN_PLUG)
#error "Enable USE_YMIN_PLUG when homing Y to MIN."
#elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
#elif Y_HOME_TO_MAX && DISABLED(USE_YMAX_PLUG)
#error "Enable USE_YMAX_PLUG when homing Y to MAX."
#endif
#endif
// Z homing direction and plug usage flags
#if Z_HOME_DIR < 0 && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE)
#if Z_HOME_TO_MIN && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE)
#error "Enable USE_ZMIN_PLUG when homing Z to MIN."
#elif Z_HOME_DIR > 0 && ENABLED(USE_PROBE_FOR_Z_HOMING)
#elif Z_HOME_TO_MAX && ENABLED(USE_PROBE_FOR_Z_HOMING)
#error "Z_HOME_DIR must be -1 when homing Z with the probe."
#elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
#error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING."
#elif Z_HOME_DIR > 0 && DISABLED(USE_ZMAX_PLUG)
#elif Z_HOME_TO_MAX && DISABLED(USE_ZMAX_PLUG)
#error "Enable USE_ZMAX_PLUG when homing Z to MAX."
#endif
#endif
@ -2630,17 +2630,17 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#define Z_ENDSTOP_INVERTING !AXIS_DRIVER_TYPE(Z,TMC2209)
#if NONE(SPI_ENDSTOPS, ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS)
#if X_SENSORLESS && X_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_XMIN)
#if X_SENSORLESS && X_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_XMIN)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_XMAX)
#elif X_SENSORLESS && X_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_XMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_YMIN)
#elif Y_SENSORLESS && Y_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_YMIN)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_YMAX)
#elif Y_SENSORLESS && Y_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_YMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR < 0 && DISABLED(ENDSTOPPULLUP_ZMIN)
#elif Z_SENSORLESS && Z_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_ZMIN)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR > 0 && DISABLED(ENDSTOPPULLUP_ZMAX)
#elif Z_SENSORLESS && Z_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_ZMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) when homing to Z_MAX."
#endif
#endif
@ -2650,37 +2650,37 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#warning "SPI_ENDSTOPS may be unreliable with QUICK_HOME. Adjust back-offs for better results."
#endif
#else
#if X_SENSORLESS && X_HOME_DIR < 0 && X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
#if X_SENSORLESS && X_HOME_TO_MIN && X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
#if X_ENDSTOP_INVERTING
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = true when homing to X_MIN."
#else
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to X_MIN."
#endif
#elif X_SENSORLESS && X_HOME_DIR > 0 && X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
#elif X_SENSORLESS && X_HOME_TO_MAX && X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING
#if X_ENDSTOP_INVERTING
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = true when homing to X_MAX."
#else
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to X_MAX."
#endif
#elif Y_SENSORLESS && Y_HOME_DIR < 0 && Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
#elif Y_SENSORLESS && Y_HOME_TO_MIN && Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
#if Y_ENDSTOP_INVERTING
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = true when homing to Y_MIN."
#else
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MIN."
#endif
#elif Y_SENSORLESS && Y_HOME_DIR > 0 && Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
#elif Y_SENSORLESS && Y_HOME_TO_MAX && Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING
#if Y_ENDSTOP_INVERTING
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = true when homing to Y_MAX."
#else
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING = false when homing TMC2209 to Y_MAX."
#endif
#elif Z_SENSORLESS && Z_HOME_DIR < 0 && Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
#elif Z_SENSORLESS && Z_HOME_TO_MIN && Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
#if Z_ENDSTOP_INVERTING
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = true when homing to Z_MIN."
#else
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING = false when homing TMC2209 to Z_MIN."
#endif
#elif Z_SENSORLESS && Z_HOME_DIR > 0 && Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
#elif Z_SENSORLESS && Z_HOME_TO_MAX && Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING
#if Z_ENDSTOP_INVERTING
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING = true when homing to Z_MAX."
#else
@ -2918,9 +2918,9 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "POWER_LOSS_RECOVER_ZHOME cannot be used with Z_SAFE_HOMING."
#elif BOTH(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN)
#error "You can't enable POWER_LOSS_PULLUP and POWER_LOSS_PULLDOWN at the same time."
#elif ENABLED(POWER_LOSS_RECOVER_ZHOME) && Z_HOME_DIR > 0
#elif ENABLED(POWER_LOSS_RECOVER_ZHOME) && Z_HOME_TO_MAX
#error "POWER_LOSS_RECOVER_ZHOME is not needed on a machine that homes to ZMAX."
#elif BOTH(IS_CARTESIAN, POWER_LOSS_RECOVER_ZHOME) && Z_HOME_DIR < 0 && !defined(POWER_LOSS_ZHOME_POS)
#elif BOTH(IS_CARTESIAN, POWER_LOSS_RECOVER_ZHOME) && Z_HOME_TO_MIN && !defined(POWER_LOSS_ZHOME_POS)
#error "POWER_LOSS_RECOVER_ZHOME requires POWER_LOSS_ZHOME_POS for a Cartesian that homes to ZMIN."
#endif
#endif

View file

@ -66,7 +66,7 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) {
w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), mydata.e_rel[3], canMove(E3));
#endif
#endif
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
w.button(24, GET_TEXT_F(MSG_MOVE_Z_TO_TOP), !axis_should_home(Z_AXIS));
#endif
w.increments();

View file

@ -488,12 +488,12 @@ bool MarlinUI::get_blink() {
if (RRK(EN_KEYPAD_MIDDLE)) goto_screen(menu_move);
#if DISABLED(DELTA) && Z_HOME_DIR < 0
#if NONE(DELTA, Z_HOME_TO_MAX)
if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
#endif
if (homed) {
#if ENABLED(DELTA) || Z_HOME_DIR != -1
#if EITHER(DELTA, Z_HOME_TO_MAX)
if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
#endif
if (RRK(EN_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1);

View file

@ -513,14 +513,8 @@ void Endstops::update() {
#endif
// With Dual X, endstops are only checked in the homing direction for the active extruder
#if ENABLED(DUAL_X_CARRIAGE)
#define E0_ACTIVE stepper.last_moved_extruder == 0
#define X_MIN_TEST() ((X_HOME_DIR < 0 && E0_ACTIVE) || (X2_HOME_DIR < 0 && !E0_ACTIVE))
#define X_MAX_TEST() ((X_HOME_DIR > 0 && E0_ACTIVE) || (X2_HOME_DIR > 0 && !E0_ACTIVE))
#else
#define X_MIN_TEST() true
#define X_MAX_TEST() true
#endif
#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))
// Use HEAD for core axes, AXIS for others
#if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
@ -765,7 +759,7 @@ void Endstops::update() {
if (stepper.axis_is_moving(X_AXIS)) {
if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction
#if HAS_X_MIN || (X_SPI_SENSORLESS && X_HOME_DIR < 0)
#if HAS_X_MIN || (X_SPI_SENSORLESS && X_HOME_TO_MIN)
PROCESS_ENDSTOP_X(MIN);
#if CORE_DIAG(XY, Y, MIN)
PROCESS_CORE_ENDSTOP(Y,MIN,X,MIN);
@ -779,7 +773,7 @@ void Endstops::update() {
#endif
}
else { // +direction
#if HAS_X_MAX || (X_SPI_SENSORLESS && X_HOME_DIR > 0)
#if HAS_X_MAX || (X_SPI_SENSORLESS && X_HOME_TO_MAX)
PROCESS_ENDSTOP_X(MAX);
#if CORE_DIAG(XY, Y, MIN)
PROCESS_CORE_ENDSTOP(Y,MIN,X,MAX);
@ -796,7 +790,7 @@ void Endstops::update() {
if (stepper.axis_is_moving(Y_AXIS)) {
if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
#if HAS_Y_MIN || (Y_SPI_SENSORLESS && Y_HOME_DIR < 0)
#if HAS_Y_MIN || (Y_SPI_SENSORLESS && Y_HOME_TO_MIN)
PROCESS_ENDSTOP_Y(MIN);
#if CORE_DIAG(XY, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Y,MIN);
@ -810,7 +804,7 @@ void Endstops::update() {
#endif
}
else { // +direction
#if HAS_Y_MAX || (Y_SPI_SENSORLESS && Y_HOME_DIR > 0)
#if HAS_Y_MAX || (Y_SPI_SENSORLESS && Y_HOME_TO_MAX)
PROCESS_ENDSTOP_Y(MAX);
#if CORE_DIAG(XY, X, MIN)
PROCESS_CORE_ENDSTOP(X,MIN,Y,MAX);
@ -828,7 +822,7 @@ void Endstops::update() {
if (stepper.axis_is_moving(Z_AXIS)) {
if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
#if HAS_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_DIR < 0)
#if HAS_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_TO_MIN)
if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled)
&& TERN1(HAS_CUSTOM_PROBE_PIN, !z_probe_enabled)
) PROCESS_ENDSTOP_Z(MIN);
@ -849,7 +843,7 @@ void Endstops::update() {
#endif
}
else { // Z +direction. Gantry up, bed down.
#if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_DIR > 0)
#if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_TO_MAX)
#if ENABLED(Z_MULTI_ENDSTOPS)
PROCESS_ENDSTOP_Z(MAX);
#elif !HAS_CUSTOM_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN // No probe or probe is Z_MIN || Probe is not Z_MAX

View file

@ -62,9 +62,9 @@ enum EndstopEnum : char {
NUM_ENDSTOP_STATES
};
#define X_ENDSTOP (x_home_dir(active_extruder) < 0 ? X_MIN : X_MAX)
#define Y_ENDSTOP (Y_HOME_DIR < 0 ? Y_MIN : Y_MAX)
#define Z_ENDSTOP (Z_HOME_DIR < 0 ? TERN(HOMING_Z_WITH_PROBE, Z_MIN, Z_MIN_PROBE) : Z_MAX)
#define X_ENDSTOP TERN(X_HOME_TO_MAX, X_MAX, X_MIN)
#define Y_ENDSTOP TERN(Y_HOME_TO_MAX, Y_MAX, Y_MIN)
#define Z_ENDSTOP TERN(Z_HOME_TO_MAX, Z_MAX, TERN(HOMING_Z_WITH_PROBE, Z_MIN, Z_MIN_PROBE))
#undef __ES_ITEM
#undef _ES_ITEM

View file

@ -1378,7 +1378,7 @@ void prepare_line_to_destination() {
// Only do some things when moving towards an endstop
const int8_t axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
? x_home_dir(active_extruder) : home_dir(axis);
? TOOL_X_HOME_DIR(active_extruder) : home_dir(axis);
const bool is_home_dir = (axis_home_dir > 0) == (distance > 0);
#if ENABLED(SENSORLESS_HOMING)
@ -1562,8 +1562,8 @@ void prepare_line_to_destination() {
#define _CAN_HOME(A) (axis == _AXIS(A) && ( \
ENABLED(A##_SPI_SENSORLESS) \
|| (_AXIS(A) == Z_AXIS && ENABLED(HOMING_Z_WITH_PROBE)) \
|| (A##_MIN_PIN > -1 && A##_HOME_DIR < 0) \
|| (A##_MAX_PIN > -1 && A##_HOME_DIR > 0) \
|| TERN0(A##_HOME_TO_MIN, A##_MIN_PIN > -1) \
|| TERN0(A##_HOME_TO_MAX, A##_MAX_PIN > -1) \
))
if (!_CAN_HOME(X) && !_CAN_HOME(Y) && !_CAN_HOME(Z)) return;
#endif
@ -1571,7 +1571,7 @@ void prepare_line_to_destination() {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", AS_CHAR(axis_codes[axis]), ")");
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
? x_home_dir(active_extruder) : home_dir(axis);
? TOOL_X_HOME_DIR(active_extruder) : home_dir(axis);
//
// Homing Z with a probe? Raise Z (maybe) and deploy the Z probe.
@ -1916,7 +1916,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
/**
* Z Probe Z Homing? Account for the probe's Z offset.
*/
#if HAS_BED_PROBE && Z_HOME_DIR < 0
#if HAS_BED_PROBE && Z_HOME_TO_MIN
if (axis == Z_AXIS) {
#if HOMING_Z_WITH_PROBE

View file

@ -517,7 +517,7 @@ FORCE_INLINE bool all_axes_trusted() { return linear_bits
float x_home_pos(const uint8_t extruder);
FORCE_INLINE int x_home_dir(const uint8_t extruder) { return extruder ? X2_HOME_DIR : X_HOME_DIR; }
#define TOOL_X_HOME_DIR(T) ((T) ? X2_HOME_DIR : X_HOME_DIR)
void set_duplication_enabled(const bool dupe, const int8_t tool_index=-1);
void idex_set_mirrored_mode(const bool mirr);
@ -531,7 +531,7 @@ FORCE_INLINE bool all_axes_trusted() { return linear_bits
FORCE_INLINE void set_duplication_enabled(const bool dupe) { extruder_duplication_enabled = dupe; }
#endif
FORCE_INLINE int x_home_dir(const uint8_t) { return X_HOME_DIR; }
#define TOOL_X_HOME_DIR(T) X_HOME_DIR
#endif

View file

@ -221,7 +221,7 @@ float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SE
TERN_(Z_SENSORLESS, sensorless_t stealth_states_z = start_sensorless_homing_per_axis(Z_AXIS));
#endif
// const int x_axis_home_dir = x_home_dir(active_extruder);
//const int x_axis_home_dir = TOOL_X_HOME_DIR(active_extruder);
//const xy_pos_t pos { max_length(X_AXIS) , max_length(Y_AXIS) };
//const float mlz = max_length(X_AXIS),

View file

@ -259,7 +259,7 @@ xyze_int8_t Stepper::count_direction{0};
#define DUAL_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \
if (A##_HOME_DIR < 0) { \
if (A##_HOME_TO_MIN) { \
if (TERN0(HAS_##A##_MIN, !(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor)) A##_STEP_WRITE(V); \
if (TERN0(HAS_##A##2_MIN, !(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor)) A##2_STEP_WRITE(V); \
} \
@ -285,7 +285,7 @@ xyze_int8_t Stepper::count_direction{0};
#define TRIPLE_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \
if (A##_HOME_DIR < 0) { \
if (A##_HOME_TO_MIN) { \
if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \
if (!(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
if (!(TEST(endstops.state(), A##3_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##3_motor) A##3_STEP_WRITE(V); \
@ -316,7 +316,7 @@ xyze_int8_t Stepper::count_direction{0};
#define QUAD_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \
if (A##_HOME_DIR < 0) { \
if (A##_HOME_TO_MIN) { \
if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \
if (!(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
if (!(TEST(endstops.state(), A##3_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##3_motor) A##3_STEP_WRITE(V); \

View file

@ -38,7 +38,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN P1_28 // X+
#else
#define X_MIN_PIN P1_28 // X+
@ -50,7 +50,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN P1_26 // Y+
#else
#define Y_MIN_PIN P1_26 // Y+
@ -62,7 +62,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN P1_24 // Z+
#else
#define Z_MIN_PIN P1_24 // Z+

View file

@ -50,7 +50,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN P1_26 // E0DET
#else
#define X_MIN_PIN P1_26 // E0DET
@ -68,7 +68,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN P1_25 // E1DET
#else
#define Y_MIN_PIN P1_25 // E1DET
@ -86,7 +86,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN P1_00 // PWRDET
#else
#define Z_MIN_PIN P1_00 // PWRDET

View file

@ -50,7 +50,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN P1_28 // X+
#else
#define X_MIN_PIN P1_28 // X+
@ -62,7 +62,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN P1_26 // Y+
#else
#define Y_MIN_PIN P1_26 // Y+
@ -74,7 +74,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN P1_24 // Z+
#else
#define Z_MIN_PIN P1_24 // Z+

View file

@ -60,7 +60,7 @@
//
#if X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN P1_28 // X+
#else
#define X_MIN_PIN P1_28 // X+
@ -72,7 +72,7 @@
#if Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN P1_26 // Y+
#else
#define Y_MIN_PIN P1_26 // Y+
@ -84,7 +84,7 @@
#if Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN P1_24 // Z+
#else
#define Z_MIN_PIN P1_24 // Z+

View file

@ -385,7 +385,7 @@
// Assign endstop pins for boards with only 3 connectors
//
#ifdef X_STOP_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MIN_PIN X_STOP_PIN
#ifndef X_MAX_PIN
#define X_MAX_PIN -1
@ -396,14 +396,14 @@
#define X_MIN_PIN -1
#endif
#endif
#elif X_HOME_DIR < 0
#elif X_HOME_TO_MIN
#define X_STOP_PIN X_MIN_PIN
#else
#define X_STOP_PIN X_MAX_PIN
#endif
#ifdef Y_STOP_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MIN_PIN Y_STOP_PIN
#ifndef Y_MAX_PIN
#define Y_MAX_PIN -1
@ -414,14 +414,14 @@
#define Y_MIN_PIN -1
#endif
#endif
#elif Y_HOME_DIR < 0
#elif Y_HOME_TO_MIN
#define Y_STOP_PIN Y_MIN_PIN
#else
#define Y_STOP_PIN Y_MAX_PIN
#endif
#ifdef Z_STOP_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MIN_PIN Z_STOP_PIN
#ifndef Z_MAX_PIN
#define Z_MAX_PIN -1
@ -432,7 +432,7 @@
#define Z_MIN_PIN -1
#endif
#endif
#elif Z_HOME_DIR < 0
#elif Z_HOME_TO_MIN
#define Z_STOP_PIN Z_MIN_PIN
#else
#define Z_STOP_PIN Z_MAX_PIN
@ -489,34 +489,34 @@
#undef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_DIR > 0
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX
#undef X2_MIN_PIN
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_DIR < 0
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MIN
#undef X2_MAX_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_DIR > 0
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MAX
#undef Y2_MIN_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_DIR < 0
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MIN
#undef Y2_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_DIR > 0
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MAX
#undef Z2_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_DIR < 0
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MIN
#undef Z2_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_DIR > 0
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MAX
#undef Z3_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_DIR < 0
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MIN
#undef Z3_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_DIR > 0
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MAX
#undef Z4_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_DIR < 0
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MIN
#undef Z4_MAX_PIN
#endif

View file

@ -61,7 +61,7 @@
#else
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MIN_PIN X_DIAG_PIN
#define X_MAX_PIN 81 // X+
#else
@ -69,7 +69,7 @@
#define X_MAX_PIN X_DIAG_PIN
#endif
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MIN_PIN Y_DIAG_PIN
#define Y_MAX_PIN 57 // Y+
#else

View file

@ -71,7 +71,7 @@
#define E0_DIAG_PIN 78 // PB23
#define E1_DIAG_PIN 25 // PD0
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MIN_PIN X_DIAG_PIN
#define X_MAX_PIN 32
#else
@ -79,7 +79,7 @@
#define X_MAX_PIN X_DIAG_PIN
#endif
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MIN_PIN Y_DIAG_PIN
#define Y_MAX_PIN 15
#else

View file

@ -55,7 +55,7 @@
#define X2_DIR_PIN FPC10_PIN // X2DIR
#define X2_SERIAL_TX_PIN FPC12_PIN // X2UART
#define X2_SERIAL_RX_PIN FPC12_PIN // X2UART
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN FPC2_PIN // X2-STOP
#else
#define X_MIN_PIN FPC2_PIN // X2-STOP

View file

@ -69,7 +69,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN E0_DIAG_PIN // X+
#else
#define X_MIN_PIN E0_DIAG_PIN // X+
@ -81,7 +81,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN E1_DIAG_PIN // Y+
#else
#define Y_MIN_PIN E1_DIAG_PIN // Y+
@ -93,7 +93,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN E2_DIAG_PIN // Z+
#else
#define Z_MIN_PIN E2_DIAG_PIN // Z+

View file

@ -71,7 +71,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN E0_DIAG_PIN // E0DET
#else
#define X_MIN_PIN E0_DIAG_PIN // E0DET
@ -89,7 +89,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN E1_DIAG_PIN // E1DET
#else
#define Y_MIN_PIN E1_DIAG_PIN // E1DET
@ -107,7 +107,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN E2_DIAG_PIN // PWRDET
#else
#define Z_MIN_PIN E2_DIAG_PIN // PWRDET

View file

@ -71,7 +71,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN PE15 // E0
#else
#define X_MIN_PIN PE15 // E0
@ -83,7 +83,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN PE10 // E1
#else
#define Y_MIN_PIN PE10 // E1
@ -95,7 +95,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN PG5 // E2
#else
#define Z_MIN_PIN PG5 // E2

View file

@ -72,7 +72,7 @@
//
#ifdef X_STALL_SENSITIVITY
#define X_STOP_PIN X_DIAG_PIN
#if X_HOME_DIR < 0
#if X_HOME_TO_MIN
#define X_MAX_PIN PC2 // E0DET
#else
#define X_MIN_PIN PC2 // E0DET
@ -90,7 +90,7 @@
#ifdef Y_STALL_SENSITIVITY
#define Y_STOP_PIN Y_DIAG_PIN
#if Y_HOME_DIR < 0
#if Y_HOME_TO_MIN
#define Y_MAX_PIN PA0 // E1DET
#else
#define Y_MIN_PIN PA0 // E1DET
@ -108,7 +108,7 @@
#ifdef Z_STALL_SENSITIVITY
#define Z_STOP_PIN Z_DIAG_PIN
#if Z_HOME_DIR < 0
#if Z_HOME_TO_MIN
#define Z_MAX_PIN PC15 // PWRDET
#else
#define Z_MIN_PIN PC15 // PWRDET