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. 24
      Marlin/src/feature/tmc_util.cpp
  3. 9
      Marlin/src/gcode/feature/L6470/M906.cpp
  4. 9
      Marlin/src/gcode/feature/trinamic/M569.cpp
  5. 9
      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 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)[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]); } 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)) FI void set(LINEAR_AXIS_LIST(const T px, const T py, const T pz))
{ LINEAR_AXIS_CODE(x = px, y = py, z = pz); } { LINEAR_AXIS_CODE(x = px, y = py, z = pz); }
#endif #endif
@ -475,7 +475,7 @@ struct XYZEval {
FI void set(const T px, const T py) { x = px; y = py; } 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 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)); } 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)) { FI void set(LINEAR_AXIS_LIST(const T px, const T py, const T pz)) {
LINEAR_AXIS_CODE(x = px, y = py, z = pz); LINEAR_AXIS_CODE(x = px, y = py, z = pz);
} }

24
Marlin/src/feature/tmc_util.cpp

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

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

@ -252,6 +252,8 @@ void GcodeSuite::M906() {
if (index == 1) L6470_SET_KVAL_HOLD(X2); if (index == 1) L6470_SET_KVAL_HOLD(X2);
#endif #endif
break; break;
#if LINEAR_AXES >= XY
case Y_AXIS: case Y_AXIS:
#if AXIS_IS_L64XX(Y) #if AXIS_IS_L64XX(Y)
if (index == 0) L6470_SET_KVAL_HOLD(Y); if (index == 0) L6470_SET_KVAL_HOLD(Y);
@ -260,6 +262,9 @@ void GcodeSuite::M906() {
if (index == 1) L6470_SET_KVAL_HOLD(Y2); if (index == 1) L6470_SET_KVAL_HOLD(Y2);
#endif #endif
break; break;
#endif
#if HAS_Z_AXIS
case Z_AXIS: case Z_AXIS:
#if AXIS_IS_L64XX(Z) #if AXIS_IS_L64XX(Z)
if (index == 0) L6470_SET_KVAL_HOLD(Z); if (index == 0) L6470_SET_KVAL_HOLD(Z);
@ -274,6 +279,9 @@ void GcodeSuite::M906() {
if (index == 3) L6470_SET_KVAL_HOLD(Z4); if (index == 3) L6470_SET_KVAL_HOLD(Z4);
#endif #endif
break; break;
#endif
#if HAS_EXTRUDERS
case E_AXIS: { case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command(); const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return; if (target_extruder < 0) return;
@ -304,6 +312,7 @@ void GcodeSuite::M906() {
#endif #endif
} }
} break; } break;
#endif
} }
} }

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

@ -60,6 +60,8 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
if (index == 1) TMC_SET_STEALTH(X2); if (index == 1) TMC_SET_STEALTH(X2);
#endif #endif
break; break;
#if LINEAR_AXES >= XY
case Y_AXIS: case Y_AXIS:
#if AXIS_HAS_STEALTHCHOP(Y) #if AXIS_HAS_STEALTHCHOP(Y)
if (index == 0) TMC_SET_STEALTH(Y); if (index == 0) TMC_SET_STEALTH(Y);
@ -68,6 +70,9 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
if (index == 1) TMC_SET_STEALTH(Y2); if (index == 1) TMC_SET_STEALTH(Y2);
#endif #endif
break; break;
#endif
#if HAS_Z_AXIS
case Z_AXIS: case Z_AXIS:
#if AXIS_HAS_STEALTHCHOP(Z) #if AXIS_HAS_STEALTHCHOP(Z)
if (index == 0) TMC_SET_STEALTH(Z); if (index == 0) TMC_SET_STEALTH(Z);
@ -82,6 +87,9 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
if (index == 3) TMC_SET_STEALTH(Z4); if (index == 3) TMC_SET_STEALTH(Z4);
#endif #endif
break; break;
#endif
#if HAS_EXTRUDERS
case E_AXIS: { case E_AXIS: {
if (target_extruder < 0) return; if (target_extruder < 0) return;
switch (target_extruder) { switch (target_extruder) {
@ -111,6 +119,7 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
#endif #endif
} }
} break; } break;
#endif
} }
} }
} }

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

@ -63,6 +63,8 @@ void GcodeSuite::M906() {
if (index == 1) TMC_SET_CURRENT(X2); if (index == 1) TMC_SET_CURRENT(X2);
#endif #endif
break; break;
#if LINEAR_AXES >= XY
case Y_AXIS: case Y_AXIS:
#if AXIS_IS_TMC(Y) #if AXIS_IS_TMC(Y)
if (index == 0) TMC_SET_CURRENT(Y); if (index == 0) TMC_SET_CURRENT(Y);
@ -71,6 +73,9 @@ void GcodeSuite::M906() {
if (index == 1) TMC_SET_CURRENT(Y2); if (index == 1) TMC_SET_CURRENT(Y2);
#endif #endif
break; break;
#endif
#if HAS_Z_AXIS
case Z_AXIS: case Z_AXIS:
#if AXIS_IS_TMC(Z) #if AXIS_IS_TMC(Z)
if (index == 0) TMC_SET_CURRENT(Z); if (index == 0) TMC_SET_CURRENT(Z);
@ -85,6 +90,9 @@ void GcodeSuite::M906() {
if (index == 3) TMC_SET_CURRENT(Z4); if (index == 3) TMC_SET_CURRENT(Z4);
#endif #endif
break; break;
#endif
#if HAS_EXTRUDERS
case E_AXIS: { case E_AXIS: {
const int8_t target_extruder = get_target_extruder_from_command(); const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return; if (target_extruder < 0) return;
@ -115,6 +123,7 @@ void GcodeSuite::M906() {
#endif #endif
} }
} break; } break;
#endif
} }
} }

4
Marlin/src/inc/Conditionals_LCD.h

@ -624,6 +624,10 @@
#define LOGICAL_AXES LINEAR_AXES #define LOGICAL_AXES LINEAR_AXES
#endif #endif
#if LINEAR_AXES >= XYZ
#define HAS_Z_AXIS 1
#endif
/** /**
* DISTINCT_E_FACTORS is set to give extruders (some) individual settings. * 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." #error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_EXTRA_HEIGHT to be set."
#elif !defined(GANTRY_CALIBRATION_FEEDRATE) #elif !defined(GANTRY_CALIBRATION_FEEDRATE)
#error "MECHANICAL_GANTRY_CALIBRATION Requires GANTRY_CALIBRATION_FEEDRATE to be set." #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 #endif
#if defined(GANTRY_CALIBRATION_SAFE_POSITION) && !defined(GANTRY_CALIBRATION_XY_PARK_FEEDRATE) #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." #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; t = new_t;
// Compute and send new position // 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, new_pos0, new_pos1,
interp(position.z, target.z, t), // FIXME. These two are wrong, since the parameter t is interp(position.z, target.z, t)
interp(position.e, target.e, t) // not linear in the distance. );
};
apply_motion_limits(new_bez); apply_motion_limits(new_bez);
bez_target = 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) \ #define DUAL_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \ 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##_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); \ 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) \ #define TRIPLE_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \ 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##_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##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); \ 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) \ #define QUAD_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \ 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##_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##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); \ 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 #define Z_STOP_PIN Z_MAX_PIN
#endif #endif
// // Filament Sensor first pin alias
// 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
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN #define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
#else #else
@ -593,7 +512,7 @@
// //
// Auto-assign pins for stallGuard sensorless homing // 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) #define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
#if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file... #if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file...
#define X2_USE_ENDSTOP _XMIN_ #define X2_USE_ENDSTOP _XMIN_
@ -662,7 +581,8 @@
#define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX) #define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
#endif #endif
#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) #define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
#if DIAG_REMAPPED(Y2, X_MIN) #if DIAG_REMAPPED(Y2, X_MIN)
#define Y2_USE_ENDSTOP _XMIN_ #define Y2_USE_ENDSTOP _XMIN_
@ -730,7 +650,8 @@
#define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX) #define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
#endif #endif
#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) #define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z2, X_MIN) #if DIAG_REMAPPED(Z2, X_MIN)
#define Z2_USE_ENDSTOP _XMIN_ #define Z2_USE_ENDSTOP _XMIN_
@ -799,7 +720,8 @@
#define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX) #define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
#endif #endif
#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) #define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z3, X_MIN) #if DIAG_REMAPPED(Z3, X_MIN)
#define Z3_USE_ENDSTOP _XMIN_ #define Z3_USE_ENDSTOP _XMIN_
@ -866,7 +788,8 @@
#define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX) #define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX)
#endif #endif
#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) #define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z4, X_MIN) #if DIAG_REMAPPED(Z4, X_MIN)
#define Z4_USE_ENDSTOP _XMIN_ #define Z4_USE_ENDSTOP _XMIN_
@ -901,6 +824,91 @@
#define Z4_MS3_PIN -1 #define Z4_MS3_PIN -1
#endif #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 HAS_MARLINUI_U8GLIB
#if !defined(ST7920_DELAY_1) && defined(BOARD_ST7920_DELAY_1) #if !defined(ST7920_DELAY_1) && defined(BOARD_ST7920_DELAY_1)
#define ST7920_DELAY_1 BOARD_ST7920_DELAY_1 #define ST7920_DELAY_1 BOARD_ST7920_DELAY_1

Loading…
Cancel
Save