🎨 Flags for homing directions
This commit is contained in:
committed by
Scott Lahteine
parent
85fa8c55c9
commit
49b05ba989
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -221,10 +221,10 @@ 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),
|
||||
//const xy_pos_t pos { max_length(X_AXIS) , max_length(Y_AXIS) };
|
||||
//const float mlz = max_length(X_AXIS),
|
||||
|
||||
// Move all carriages together linearly until an endstop is hit.
|
||||
//do_blocking_move_to_xy_z(pos, mlz, homing_feedrate(Z_AXIS));
|
||||
|
@ -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); \
|
||||
|
Reference in New Issue
Block a user