Browse Source

♻️ Patches for Zero Extruders (with TMC)

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
d3c56a76e7
  1. 4
      Marlin/src/core/types.h
  2. 88
      Marlin/src/feature/tmc_util.cpp
  3. 101
      Marlin/src/gcode/feature/L6470/M906.cpp
  4. 99
      Marlin/src/gcode/feature/trinamic/M569.cpp
  5. 101
      Marlin/src/gcode/feature/trinamic/M906.cpp
  6. 4
      Marlin/src/inc/Conditionals_LCD.h
  7. 4
      Marlin/src/inc/SanityCheck.h
  8. 8
      Marlin/src/module/planner_bezier.cpp
  9. 6
      Marlin/src/module/stepper.cpp
  10. 182
      Marlin/src/pins/pins_postprocess.h

4
Marlin/src/core/types.h

@ -360,7 +360,7 @@ struct XYZval {
FI void set(const XYval<T> pxy, const T pz) { x = pxy.x; y = pxy.y; z = pz; }
FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; }
FI void set(const T (&arr)[LINEAR_AXES]) { LINEAR_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2]); }
#if LINEAR_AXES >= XYZ
#if HAS_Z_AXIS
FI void set(LINEAR_AXIS_LIST(const T px, const T py, const T pz))
{ LINEAR_AXIS_CODE(x = px, y = py, z = pz); }
#endif
@ -475,7 +475,7 @@ struct XYZEval {
FI void set(const T px, const T py) { x = px; y = py; }
FI void set(const XYval<T> pxy) { x = pxy.x; y = pxy.y; }
FI void set(const XYZval<T> pxyz) { set(LINEAR_AXIS_LIST(pxyz.x, pxyz.y, pxyz.z)); }
#if LINEAR_AXES >= XYZ
#if HAS_Z_AXIS
FI void set(LINEAR_AXIS_LIST(const T px, const T py, const T pz)) {
LINEAR_AXIS_CODE(x = px, y = py, z = pz);
}

88
Marlin/src/feature/tmc_util.cpp

@ -770,16 +770,18 @@
#endif
}
if (print_y) {
#if AXIS_IS_TMC(Y)
tmc_status(stepperY, i);
#endif
#if AXIS_IS_TMC(Y2)
tmc_status(stepperY2, i);
#endif
}
#if LINEAR_AXES >= XY
if (print_y) {
#if AXIS_IS_TMC(Y)
tmc_status(stepperY, i);
#endif
#if AXIS_IS_TMC(Y2)
tmc_status(stepperY2, i);
#endif
}
#endif
if (print_z) {
if (TERN0(HAS_Z_AXIS, print_z)) {
#if AXIS_IS_TMC(Z)
tmc_status(stepperZ, i);
#endif
@ -794,7 +796,7 @@
#endif
}
if (print_e) {
if (TERN0(HAS_EXTRUDERS, print_e)) {
#if AXIS_IS_TMC(E0)
tmc_status(stepperE0, i);
#endif
@ -837,16 +839,18 @@
#endif
}
if (print_y) {
#if AXIS_IS_TMC(Y)
tmc_parse_drv_status(stepperY, i);
#endif
#if AXIS_IS_TMC(Y2)
tmc_parse_drv_status(stepperY2, i);
#endif
}
#if LINEAR_AXES >= XY
if (print_y) {
#if AXIS_IS_TMC(Y)
tmc_parse_drv_status(stepperY, i);
#endif
#if AXIS_IS_TMC(Y2)
tmc_parse_drv_status(stepperY2, i);
#endif
}
#endif
if (print_z) {
if (TERN0(HAS_Z_AXIS, print_z)) {
#if AXIS_IS_TMC(Z)
tmc_parse_drv_status(stepperZ, i);
#endif
@ -861,7 +865,7 @@
#endif
}
if (print_e) {
if (TERN0(HAS_EXTRUDERS, print_e)) {
#if AXIS_IS_TMC(E0)
tmc_parse_drv_status(stepperE0, i);
#endif
@ -1037,16 +1041,18 @@
#endif
}
if (print_y) {
#if AXIS_IS_TMC(Y)
tmc_get_registers(stepperY, i);
#endif
#if AXIS_IS_TMC(Y2)
tmc_get_registers(stepperY2, i);
#endif
}
#if LINEAR_AXES >= XY
if (print_y) {
#if AXIS_IS_TMC(Y)
tmc_get_registers(stepperY, i);
#endif
#if AXIS_IS_TMC(Y2)
tmc_get_registers(stepperY2, i);
#endif
}
#endif
if (print_z) {
if (TERN0(HAS_Z_AXIS, print_z)) {
#if AXIS_IS_TMC(Z)
tmc_get_registers(stepperZ, i);
#endif
@ -1061,7 +1067,7 @@
#endif
}
if (print_e) {
if (TERN0(HAS_EXTRUDERS, print_e)) {
#if AXIS_IS_TMC(E0)
tmc_get_registers(stepperE0, i);
#endif
@ -1242,16 +1248,18 @@ void test_tmc_connection(
#endif
}
if (test_y) {
#if AXIS_IS_TMC(Y)
axis_connection += test_connection(stepperY);
#endif
#if AXIS_IS_TMC(Y2)
axis_connection += test_connection(stepperY2);
#endif
}
#if LINEAR_AXES >= XY
if (test_y) {
#if AXIS_IS_TMC(Y)
axis_connection += test_connection(stepperY);
#endif
#if AXIS_IS_TMC(Y2)
axis_connection += test_connection(stepperY2);
#endif
}
#endif
if (test_z) {
if (TERN0(HAS_Z_AXIS, test_z)) {
#if AXIS_IS_TMC(Z)
axis_connection += test_connection(stepperZ);
#endif
@ -1266,7 +1274,7 @@ void test_tmc_connection(
#endif
}
if (test_e) {
if (TERN0(HAS_EXTRUDERS, test_e)) {
#if AXIS_IS_TMC(E0)
axis_connection += test_connection(stepperE0);
#endif

101
Marlin/src/gcode/feature/L6470/M906.cpp

@ -252,58 +252,67 @@ void GcodeSuite::M906() {
if (index == 1) L6470_SET_KVAL_HOLD(X2);
#endif
break;
case Y_AXIS:
#if AXIS_IS_L64XX(Y)
if (index == 0) L6470_SET_KVAL_HOLD(Y);
#endif
#if AXIS_IS_L64XX(Y2)
if (index == 1) L6470_SET_KVAL_HOLD(Y2);
#endif
break;
case Z_AXIS:
#if AXIS_IS_L64XX(Z)
if (index == 0) L6470_SET_KVAL_HOLD(Z);
#endif
#if AXIS_IS_L64XX(Z2)
if (index == 1) L6470_SET_KVAL_HOLD(Z2);
#endif
#if AXIS_IS_L64XX(Z3)
if (index == 2) L6470_SET_KVAL_HOLD(Z3);
#endif
#if AXIS_DRIVER_TYPE_Z4(L6470)
if (index == 3) L6470_SET_KVAL_HOLD(Z4);
#endif
break;
case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_IS_L64XX(E0)
case 0: L6470_SET_KVAL_HOLD(E0); break;
#endif
#if AXIS_IS_L64XX(E1)
case 1: L6470_SET_KVAL_HOLD(E1); break;
#endif
#if AXIS_IS_L64XX(E2)
case 2: L6470_SET_KVAL_HOLD(E2); break;
#if LINEAR_AXES >= XY
case Y_AXIS:
#if AXIS_IS_L64XX(Y)
if (index == 0) L6470_SET_KVAL_HOLD(Y);
#endif
#if AXIS_IS_L64XX(E3)
case 3: L6470_SET_KVAL_HOLD(E3); break;
#if AXIS_IS_L64XX(Y2)
if (index == 1) L6470_SET_KVAL_HOLD(Y2);
#endif
#if AXIS_IS_L64XX(E4)
case 4: L6470_SET_KVAL_HOLD(E4); break;
break;
#endif
#if HAS_Z_AXIS
case Z_AXIS:
#if AXIS_IS_L64XX(Z)
if (index == 0) L6470_SET_KVAL_HOLD(Z);
#endif
#if AXIS_IS_L64XX(E5)
case 5: L6470_SET_KVAL_HOLD(E5); break;
#if AXIS_IS_L64XX(Z2)
if (index == 1) L6470_SET_KVAL_HOLD(Z2);
#endif
#if AXIS_IS_L64XX(E6)
case 6: L6470_SET_KVAL_HOLD(E6); break;
#if AXIS_IS_L64XX(Z3)
if (index == 2) L6470_SET_KVAL_HOLD(Z3);
#endif
#if AXIS_IS_L64XX(E7)
case 7: L6470_SET_KVAL_HOLD(E7); break;
#if AXIS_DRIVER_TYPE_Z4(L6470)
if (index == 3) L6470_SET_KVAL_HOLD(Z4);
#endif
}
} break;
break;
#endif
#if HAS_EXTRUDERS
case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_IS_L64XX(E0)
case 0: L6470_SET_KVAL_HOLD(E0); break;
#endif
#if AXIS_IS_L64XX(E1)
case 1: L6470_SET_KVAL_HOLD(E1); break;
#endif
#if AXIS_IS_L64XX(E2)
case 2: L6470_SET_KVAL_HOLD(E2); break;
#endif
#if AXIS_IS_L64XX(E3)
case 3: L6470_SET_KVAL_HOLD(E3); break;
#endif
#if AXIS_IS_L64XX(E4)
case 4: L6470_SET_KVAL_HOLD(E4); break;
#endif
#if AXIS_IS_L64XX(E5)
case 5: L6470_SET_KVAL_HOLD(E5); break;
#endif
#if AXIS_IS_L64XX(E6)
case 6: L6470_SET_KVAL_HOLD(E6); break;
#endif
#if AXIS_IS_L64XX(E7)
case 7: L6470_SET_KVAL_HOLD(E7); break;
#endif
}
} break;
#endif
}
}

99
Marlin/src/gcode/feature/trinamic/M569.cpp

@ -60,57 +60,66 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
if (index == 1) TMC_SET_STEALTH(X2);
#endif
break;
case Y_AXIS:
#if AXIS_HAS_STEALTHCHOP(Y)
if (index == 0) TMC_SET_STEALTH(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
if (index == 1) TMC_SET_STEALTH(Y2);
#endif
break;
case Z_AXIS:
#if AXIS_HAS_STEALTHCHOP(Z)
if (index == 0) TMC_SET_STEALTH(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
if (index == 1) TMC_SET_STEALTH(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
if (index == 2) TMC_SET_STEALTH(Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(Z4)
if (index == 3) TMC_SET_STEALTH(Z4);
#endif
break;
case E_AXIS: {
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_HAS_STEALTHCHOP(E0)
case 0: TMC_SET_STEALTH(E0); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
case 1: TMC_SET_STEALTH(E1); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
case 2: TMC_SET_STEALTH(E2); break;
#if LINEAR_AXES >= XY
case Y_AXIS:
#if AXIS_HAS_STEALTHCHOP(Y)
if (index == 0) TMC_SET_STEALTH(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
case 3: TMC_SET_STEALTH(E3); break;
#if AXIS_HAS_STEALTHCHOP(Y2)
if (index == 1) TMC_SET_STEALTH(Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
case 4: TMC_SET_STEALTH(E4); break;
break;
#endif
#if HAS_Z_AXIS
case Z_AXIS:
#if AXIS_HAS_STEALTHCHOP(Z)
if (index == 0) TMC_SET_STEALTH(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
case 5: TMC_SET_STEALTH(E5); break;
#if AXIS_HAS_STEALTHCHOP(Z2)
if (index == 1) TMC_SET_STEALTH(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
case 6: TMC_SET_STEALTH(E6); break;
#if AXIS_HAS_STEALTHCHOP(Z3)
if (index == 2) TMC_SET_STEALTH(Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
case 7: TMC_SET_STEALTH(E7); break;
#if AXIS_HAS_STEALTHCHOP(Z4)
if (index == 3) TMC_SET_STEALTH(Z4);
#endif
}
} break;
break;
#endif
#if HAS_EXTRUDERS
case E_AXIS: {
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_HAS_STEALTHCHOP(E0)
case 0: TMC_SET_STEALTH(E0); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
case 1: TMC_SET_STEALTH(E1); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
case 2: TMC_SET_STEALTH(E2); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
case 3: TMC_SET_STEALTH(E3); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
case 4: TMC_SET_STEALTH(E4); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
case 5: TMC_SET_STEALTH(E5); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
case 6: TMC_SET_STEALTH(E6); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
case 7: TMC_SET_STEALTH(E7); break;
#endif
}
} break;
#endif
}
}
}

101
Marlin/src/gcode/feature/trinamic/M906.cpp

@ -63,58 +63,67 @@ void GcodeSuite::M906() {
if (index == 1) TMC_SET_CURRENT(X2);
#endif
break;
case Y_AXIS:
#if AXIS_IS_TMC(Y)
if (index == 0) TMC_SET_CURRENT(Y);
#endif
#if AXIS_IS_TMC(Y2)
if (index == 1) TMC_SET_CURRENT(Y2);
#endif
break;
case Z_AXIS:
#if AXIS_IS_TMC(Z)
if (index == 0) TMC_SET_CURRENT(Z);
#endif
#if AXIS_IS_TMC(Z2)
if (index == 1) TMC_SET_CURRENT(Z2);
#endif
#if AXIS_IS_TMC(Z3)
if (index == 2) TMC_SET_CURRENT(Z3);
#endif
#if AXIS_IS_TMC(Z4)
if (index == 3) TMC_SET_CURRENT(Z4);
#endif
break;
case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_IS_TMC(E0)
case 0: TMC_SET_CURRENT(E0); break;
#endif
#if AXIS_IS_TMC(E1)
case 1: TMC_SET_CURRENT(E1); break;
#endif
#if AXIS_IS_TMC(E2)
case 2: TMC_SET_CURRENT(E2); break;
#if LINEAR_AXES >= XY
case Y_AXIS:
#if AXIS_IS_TMC(Y)
if (index == 0) TMC_SET_CURRENT(Y);
#endif
#if AXIS_IS_TMC(E3)
case 3: TMC_SET_CURRENT(E3); break;
#if AXIS_IS_TMC(Y2)
if (index == 1) TMC_SET_CURRENT(Y2);
#endif
#if AXIS_IS_TMC(E4)
case 4: TMC_SET_CURRENT(E4); break;
break;
#endif
#if HAS_Z_AXIS
case Z_AXIS:
#if AXIS_IS_TMC(Z)
if (index == 0) TMC_SET_CURRENT(Z);
#endif
#if AXIS_IS_TMC(E5)
case 5: TMC_SET_CURRENT(E5); break;
#if AXIS_IS_TMC(Z2)
if (index == 1) TMC_SET_CURRENT(Z2);
#endif
#if AXIS_IS_TMC(E6)
case 6: TMC_SET_CURRENT(E6); break;
#if AXIS_IS_TMC(Z3)
if (index == 2) TMC_SET_CURRENT(Z3);
#endif
#if AXIS_IS_TMC(E7)
case 7: TMC_SET_CURRENT(E7); break;
#if AXIS_IS_TMC(Z4)
if (index == 3) TMC_SET_CURRENT(Z4);
#endif
}
} break;
break;
#endif
#if HAS_EXTRUDERS
case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_IS_TMC(E0)
case 0: TMC_SET_CURRENT(E0); break;
#endif
#if AXIS_IS_TMC(E1)
case 1: TMC_SET_CURRENT(E1); break;
#endif
#if AXIS_IS_TMC(E2)
case 2: TMC_SET_CURRENT(E2); break;
#endif
#if AXIS_IS_TMC(E3)
case 3: TMC_SET_CURRENT(E3); break;
#endif
#if AXIS_IS_TMC(E4)
case 4: TMC_SET_CURRENT(E4); break;
#endif
#if AXIS_IS_TMC(E5)
case 5: TMC_SET_CURRENT(E5); break;
#endif
#if AXIS_IS_TMC(E6)
case 6: TMC_SET_CURRENT(E6); break;
#endif
#if AXIS_IS_TMC(E7)
case 7: TMC_SET_CURRENT(E7); break;
#endif
}
} break;
#endif
}
}

4
Marlin/src/inc/Conditionals_LCD.h

@ -624,6 +624,10 @@
#define LOGICAL_AXES LINEAR_AXES
#endif
#if LINEAR_AXES >= XYZ
#define HAS_Z_AXIS 1
#endif
/**
* DISTINCT_E_FACTORS is set to give extruders (some) individual settings.
*

4
Marlin/src/inc/SanityCheck.h

@ -2959,6 +2959,10 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_EXTRA_HEIGHT to be set."
#elif !defined(GANTRY_CALIBRATION_FEEDRATE)
#error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_FEEDRATE to be set."
#elif ENABLED(Z_MULTI_ENDSTOPS)
#error "Sorry! MECHANICAL_GANTRY_CALIBRATION cannot be used with Z_MULTI_ENDSTOPS."
#elif ENABLED(Z_STEPPER_AUTO_ALIGN)
#error "Sorry! MECHANICAL_GANTRY_CALIBRATION cannot be used with Z_STEPPER_AUTO_ALIGN."
#endif
#if defined(GANTRY_CALIBRATION_SAFE_POSITION) && !defined(GANTRY_CALIBRATION_XY_PARK_FEEDRATE)
#error "GANTRY_CALIBRATION_SAFE_POSITION Requires GANTRY_CALIBRATION_XY_PARK_FEEDRATE to be set."

8
Marlin/src/module/planner_bezier.cpp

@ -181,11 +181,11 @@ void cubic_b_spline(
t = new_t;
// Compute and send new position
xyze_pos_t new_bez = {
xyze_pos_t new_bez = LOGICAL_AXIS_ARRAY(
interp(position.e, target.e, t), // FIXME. These two are wrong, since the parameter t is not linear in the distance.
new_pos0, new_pos1,
interp(position.z, target.z, t), // FIXME. These two are wrong, since the parameter t is
interp(position.e, target.e, t) // not linear in the distance.
};
interp(position.z, target.z, t)
);
apply_motion_limits(new_bez);
bez_target = new_bez;

6
Marlin/src/module/stepper.cpp

@ -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_TO_MIN) { \
if (ENABLED(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_TO_MIN) { \
if (ENABLED(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_TO_MIN) { \
if (ENABLED(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); \

182
Marlin/src/pins/pins_postprocess.h

@ -438,88 +438,7 @@
#define Z_STOP_PIN Z_MAX_PIN
#endif
//
// Disable unused endstop / probe pins
//
#define _STOP_IN_USE(N) (X2_USE_ENDSTOP == N || Y2_USE_ENDSTOP == N || Z2_USE_ENDSTOP == N || Z3_USE_ENDSTOP == N || Z4_USE_ENDSTOP == N)
#if _STOP_IN_USE(_XMAX_)
#define USE_XMAX_PLUG
#endif
#if _STOP_IN_USE(_YMAX_)
#define USE_YMAX_PLUG
#endif
#if _STOP_IN_USE(_ZMAX_)
#define USE_ZMAX_PLUG
#endif
#if _STOP_IN_USE(_XMIN_)
#define USE_XMIN_PLUG
#endif
#if _STOP_IN_USE(_YMIN_)
#define USE_YMIN_PLUG
#endif
#if _STOP_IN_USE(_ZMIN_)
#define USE_ZMIN_PLUG
#endif
#undef _STOP_IN_USE
#if !HAS_CUSTOM_PROBE_PIN
#undef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN -1
#endif
#if DISABLED(USE_XMAX_PLUG)
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif
#if DISABLED(USE_YMAX_PLUG)
#undef Y_MAX_PIN
#define Y_MAX_PIN -1
#endif
#if DISABLED(USE_ZMAX_PLUG)
#undef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif
#if DISABLED(USE_XMIN_PLUG)
#undef X_MIN_PIN
#define X_MIN_PIN -1
#endif
#if DISABLED(USE_YMIN_PLUG)
#undef Y_MIN_PIN
#define Y_MIN_PIN -1
#endif
#if DISABLED(USE_ZMIN_PLUG)
#undef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX
#undef X2_MIN_PIN
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MIN
#undef X2_MAX_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MAX
#undef Y2_MIN_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MIN
#undef Y2_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MAX
#undef Z2_MIN_PIN
#endif
#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_TO_MAX
#undef Z3_MIN_PIN
#endif
#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_TO_MAX
#undef Z4_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MIN
#undef Z4_MAX_PIN
#endif
// Filament Sensor first pin alias
#if HAS_FILAMENT_SENSOR
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
#else
@ -593,7 +512,7 @@
//
// Auto-assign pins for stallGuard sensorless homing
//
#if defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
#if !defined(X2_USE_ENDSTOP) && defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
#define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
#if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file...
#define X2_USE_ENDSTOP _XMIN_
@ -662,7 +581,8 @@
#define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
#endif
#endif
#if defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Y2_USE_ENDSTOP) && defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
#define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
#if DIAG_REMAPPED(Y2, X_MIN)
#define Y2_USE_ENDSTOP _XMIN_
@ -730,7 +650,8 @@
#define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
#endif
#endif
#if defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
#define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z2, X_MIN)
#define Z2_USE_ENDSTOP _XMIN_
@ -799,7 +720,8 @@
#define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
#endif
#endif
#if defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
#define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z3, X_MIN)
#define Z3_USE_ENDSTOP _XMIN_
@ -866,7 +788,8 @@
#define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX)
#endif
#endif
#if defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
#define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z4, X_MIN)
#define Z4_USE_ENDSTOP _XMIN_
@ -901,6 +824,91 @@
#define Z4_MS3_PIN -1
#endif
//
// Disable unused endstop / probe pins
//
#define _STOP_IN_USE(N) (X2_USE_ENDSTOP == N || Y2_USE_ENDSTOP == N || Z2_USE_ENDSTOP == N || Z3_USE_ENDSTOP == N || Z4_USE_ENDSTOP == N)
#if _STOP_IN_USE(_XMAX_)
#define USE_XMAX_PLUG
#endif
#if _STOP_IN_USE(_YMAX_)
#define USE_YMAX_PLUG
#endif
#if _STOP_IN_USE(_ZMAX_)
#define USE_ZMAX_PLUG
#endif
#if _STOP_IN_USE(_XMIN_)
#define USE_XMIN_PLUG
#endif
#if _STOP_IN_USE(_YMIN_)
#define USE_YMIN_PLUG
#endif
#if _STOP_IN_USE(_ZMIN_)
#define USE_ZMIN_PLUG
#endif
#undef _STOP_IN_USE
#if !HAS_CUSTOM_PROBE_PIN
#undef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN -1
#endif
#if DISABLED(USE_XMAX_PLUG)
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif
#if DISABLED(USE_YMAX_PLUG)
#undef Y_MAX_PIN
#define Y_MAX_PIN -1
#endif
#if DISABLED(USE_ZMAX_PLUG)
#undef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif
#if DISABLED(USE_XMIN_PLUG)
#undef X_MIN_PIN
#define X_MIN_PIN -1
#endif
#if DISABLED(USE_YMIN_PLUG)
#undef Y_MIN_PIN
#define Y_MIN_PIN -1
#endif
#if DISABLED(USE_ZMIN_PLUG)
#undef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX
#undef X2_MIN_PIN
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MIN
#undef X2_MAX_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MAX
#undef Y2_MIN_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MIN
#undef Y2_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MAX
#undef Z2_MIN_PIN
#endif
#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_TO_MAX
#undef Z3_MIN_PIN
#endif
#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_TO_MAX
#undef Z4_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MIN
#undef Z4_MAX_PIN
#endif
//
// Default DOGLCD SPI delays
//
#if HAS_MARLINUI_U8GLIB
#if !defined(ST7920_DELAY_1) && defined(BOARD_ST7920_DELAY_1)
#define ST7920_DELAY_1 BOARD_ST7920_DELAY_1

Loading…
Cancel
Save