💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120)

This commit is contained in:
Scott Lahteine 2022-04-29 15:21:15 -05:00
parent 1e127a93c4
commit 1d8d8dccf4
36 changed files with 571 additions and 507 deletions

View file

@ -150,20 +150,40 @@
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
/**
* Define the number of coordinated linear axes.
* See https://github.com/DerAndere1/Marlin/wiki
* Each linear axis gets its own stepper control and endstop:
* Stepper Drivers
*
* Steppers: *_STEP_PIN, *_ENABLE_PIN, *_DIR_PIN, *_ENABLE_ON
* Endstops: *_STOP_PIN, USE_*MIN_PLUG, USE_*MAX_PLUG
* Axes: *_MIN_POS, *_MAX_POS, INVERT_*_DIR
* Planner: DEFAULT_AXIS_STEPS_PER_UNIT, DEFAULT_MAX_FEEDRATE
* DEFAULT_MAX_ACCELERATION, AXIS_RELATIVE_MODES,
* MICROSTEP_MODES, MANUAL_FEEDRATE
* These settings allow Marlin to tune stepper driver timing and enable advanced options for
* stepper drivers that support them. You may also override timing options in Configuration_adv.h.
*
* :[3, 4, 5, 6]
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
*
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
* TB6560, TB6600, TMC2100,
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
//#define LINEAR_AXES 3
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
//#define I_DRIVER_TYPE A4988
//#define J_DRIVER_TYPE A4988
//#define K_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
//#define E4_DRIVER_TYPE A4988
//#define E5_DRIVER_TYPE A4988
//#define E6_DRIVER_TYPE A4988
//#define E7_DRIVER_TYPE A4988
/**
* Axis codes for additional axes:
@ -178,14 +198,16 @@
* Regardless of the settings, firmware-internal axis IDs are
* I (AXIS4), J (AXIS5), K (AXIS6).
*/
#if LINEAR_AXES >= 4
#ifdef I_DRIVER_TYPE
#define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
#endif
#if LINEAR_AXES >= 5
#define AXIS5_NAME 'B' // :['A', 'B', 'C', 'U', 'V', 'W']
#ifdef J_DRIVER_TYPE
#define AXIS5_NAME 'B' // :['B', 'C', 'U', 'V', 'W']
#define AXIS5_ROTATES
#endif
#if LINEAR_AXES >= 6
#define AXIS6_NAME 'C' // :['A', 'B', 'C', 'U', 'V', 'W']
#ifdef K_DRIVER_TYPE
#define AXIS6_NAME 'C' // :['C', 'U', 'V', 'W']
#define AXIS6_ROTATES
#endif
// @section extruder
@ -898,44 +920,6 @@
#define K_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
/**
* Stepper Drivers
*
* These settings allow Marlin to tune stepper driver timing and enable advanced options for
* stepper drivers that support them. You may also override timing options in Configuration_adv.h.
*
* A4988 is assumed for unspecified drivers.
*
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
*
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
* TB6560, TB6600, TMC2100,
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
* TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
//#define I_DRIVER_TYPE A4988
//#define J_DRIVER_TYPE A4988
//#define K_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
//#define E4_DRIVER_TYPE A4988
//#define E5_DRIVER_TYPE A4988
//#define E6_DRIVER_TYPE A4988
//#define E7_DRIVER_TYPE A4988
// Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE

View file

@ -699,73 +699,6 @@
//#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1
#endif
/**
* Dual Steppers / Dual Endstops
*
* This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes.
*
* For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to
* spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop
* set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug
* that should be used for the second endstop. Extra endstops will appear in the output of 'M119'.
*
* Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors
* this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error
* in X2. Dual endstop offsets can be set at runtime with 'M666 X<offset> Y<offset> Z<offset>'.
*/
//#define X_DUAL_STEPPER_DRIVERS
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
//#define INVERT_X2_VS_X_DIR // Enable if X2 direction signal is opposite to X
//#define X_DUAL_ENDSTOPS
#if ENABLED(X_DUAL_ENDSTOPS)
#define X2_USE_ENDSTOP _XMAX_
#define X2_ENDSTOP_ADJUSTMENT 0
#endif
#endif
//#define Y_DUAL_STEPPER_DRIVERS
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
//#define INVERT_Y2_VS_Y_DIR // Enable if Y2 direction signal is opposite to Y
//#define Y_DUAL_ENDSTOPS
#if ENABLED(Y_DUAL_ENDSTOPS)
#define Y2_USE_ENDSTOP _YMAX_
#define Y2_ENDSTOP_ADJUSTMENT 0
#endif
#endif
//
// For Z set the number of stepper drivers
//
#define NUM_Z_STEPPER_DRIVERS 1 // (1-4) Z options change based on how many
#if NUM_Z_STEPPER_DRIVERS > 1
// Enable if Z motor direction signals are the opposite of Z1
//#define INVERT_Z2_VS_Z_DIR
//#define INVERT_Z3_VS_Z_DIR
//#define INVERT_Z4_VS_Z_DIR
//#define Z_MULTI_ENDSTOPS
#if ENABLED(Z_MULTI_ENDSTOPS)
#define Z2_USE_ENDSTOP _XMAX_
#define Z2_ENDSTOP_ADJUSTMENT 0
#if NUM_Z_STEPPER_DRIVERS >= 3
#define Z3_USE_ENDSTOP _YMAX_
#define Z3_ENDSTOP_ADJUSTMENT 0
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#define Z4_USE_ENDSTOP _ZMAX_
#define Z4_ENDSTOP_ADJUSTMENT 0
#endif
#endif
#endif
// Drive the E axis with two synchronized steppers
//#define E_DUAL_STEPPER_DRIVERS
#if ENABLED(E_DUAL_STEPPER_DRIVERS)
//#define INVERT_E1_VS_E0_DIR // Enable if the E motors need opposite DIR states
#endif
/**
* Dual X Carriage
*
@ -816,6 +749,77 @@
//#define EVENT_GCODE_IDEX_AFTER_MODECHANGE "G28X"
#endif
/**
* Multi-Stepper / Multi-Endstop
*
* When X2_DRIVER_TYPE is defined, this indicates that the X and X2 motors work in tandem.
* The following explanations for X also apply to Y and Z multi-stepper setups.
* Endstop offsets may be changed by 'M666 X<offset> Y<offset> Z<offset>' and stored to EEPROM.
*
* - Enable INVERT_X2_VS_X_DIR if the X2 motor requires an opposite DIR signal from X.
*
* - Enable X_DUAL_ENDSTOPS if the second motor has its own endstop, with adjustable offset.
*
* - Extra endstops are included in the output of 'M119'.
*
* - Set X_DUAL_ENDSTOP_ADJUSTMENT to the known error in the X2 endstop.
* Applied to the X2 motor on 'G28' / 'G28 X'.
* Get the offset by homing X and measuring the error.
* Also set with 'M666 X<offset>' and stored to EEPROM with 'M500'.
*
* - Use X2_USE_ENDSTOP to set the endstop plug by name. (_XMIN_, _XMAX_, _YMIN_, _YMAX_, _ZMIN_, _ZMAX_)
*/
#if HAS_X2_STEPPER && DISABLED(DUAL_X_CARRIAGE)
//#define INVERT_X2_VS_X_DIR // X2 direction signal is the opposite of X
//#define X_DUAL_ENDSTOPS // X2 has its own endstop
#if ENABLED(X_DUAL_ENDSTOPS)
#define X2_USE_ENDSTOP _XMAX_ // X2 endstop board plug. Don't forget to enable USE_*_PLUG.
#define X2_ENDSTOP_ADJUSTMENT 0 // X2 offset relative to X endstop
#endif
#endif
#if HAS_DUAL_Y_STEPPERS
//#define INVERT_Y2_VS_Y_DIR // Y2 direction signal is the opposite of Y
//#define Y_DUAL_ENDSTOPS // Y2 has its own endstop
#if ENABLED(Y_DUAL_ENDSTOPS)
#define Y2_USE_ENDSTOP _YMAX_ // Y2 endstop board plug. Don't forget to enable USE_*_PLUG.
#define Y2_ENDSTOP_ADJUSTMENT 0 // Y2 offset relative to Y endstop
#endif
#endif
//
// Multi-Z steppers
//
#ifdef Z2_DRIVER_TYPE
//#define INVERT_Z2_VS_Z_DIR // Z2 direction signal is the opposite of Z
//#define Z_MULTI_ENDSTOPS // Other Z axes have their own endstops
#if ENABLED(Z_MULTI_ENDSTOPS)
#define Z2_USE_ENDSTOP _XMAX_ // Z2 endstop board plug. Don't forget to enable USE_*_PLUG.
#define Z2_ENDSTOP_ADJUSTMENT 0 // Z2 offset relative to Y endstop
#endif
#ifdef Z3_DRIVER_TYPE
//#define INVERT_Z3_VS_Z_DIR // Z3 direction signal is the opposite of Z
#if ENABLED(Z_MULTI_ENDSTOPS)
#define Z3_USE_ENDSTOP _YMAX_ // Z3 endstop board plug. Don't forget to enable USE_*_PLUG.
#define Z3_ENDSTOP_ADJUSTMENT 0 // Z3 offset relative to Y endstop
#endif
#endif
#ifdef Z4_DRIVER_TYPE
//#define INVERT_Z4_VS_Z_DIR // Z4 direction signal is the opposite of Z
#if ENABLED(Z_MULTI_ENDSTOPS)
#define Z4_USE_ENDSTOP _ZMAX_ // Z4 endstop board plug. Don't forget to enable USE_*_PLUG.
#define Z4_ENDSTOP_ADJUSTMENT 0 // Z4 offset relative to Y endstop
#endif
#endif
#endif
// Drive the E axis with two synchronized steppers
//#define E_DUAL_STEPPER_DRIVERS
#if ENABLED(E_DUAL_STEPPER_DRIVERS)
//#define INVERT_E1_VS_E0_DIR // E direction signals are opposites
#endif
// Activate a solenoid on the active extruder with M380. Disable all with M381.
// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid.
//#define EXT_SOLENOID
@ -949,7 +953,7 @@
/**
* Z Stepper positions for more rapid convergence in bed alignment.
* Requires NUM_Z_STEPPER_DRIVERS to be 3 or 4.
* Requires 3 or 4 Z steppers.
*
* Define Stepper XY positions for Z1, Z2, Z3... corresponding to the screw
* positions in the bed carriage, with one position per Z stepper in stepper
@ -2419,7 +2423,7 @@
/**
* Extra G-code to run while executing tool-change commands. Can be used to use an additional
* stepper motor (I axis, see option LINEAR_AXES in Configuration.h) to drive the tool-changer.
* stepper motor (e.g., I axis in Configuration.h) to drive the tool-changer.
*/
//#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0
//#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1

View file

@ -64,11 +64,11 @@
#define AXIS_DRIVER_TYPE_J(T) _AXIS_DRIVER_TYPE(J,T)
#define AXIS_DRIVER_TYPE_K(T) _AXIS_DRIVER_TYPE(K,T)
#define AXIS_DRIVER_TYPE_X2(T) (EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) && _AXIS_DRIVER_TYPE(X2,T))
#define AXIS_DRIVER_TYPE_Y2(T) (ENABLED(Y_DUAL_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Y2,T))
#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPER_DRIVERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T))
#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPER_DRIVERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T))
#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPER_DRIVERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T))
#define AXIS_DRIVER_TYPE_X2(T) (HAS_X2_STEPPER && _AXIS_DRIVER_TYPE(X2,T))
#define AXIS_DRIVER_TYPE_Y2(T) (HAS_DUAL_Y_STEPPERS && _AXIS_DRIVER_TYPE(Y2,T))
#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T))
#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T))
#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T))
#define AXIS_DRIVER_TYPE_E(N,T) (E_STEPPERS > N && _AXIS_DRIVER_TYPE(E##N,T))
#define AXIS_DRIVER_TYPE_E0(T) AXIS_DRIVER_TYPE_E(0,T)

View file

@ -33,35 +33,35 @@
ZStepperAlign z_stepper_align;
xy_pos_t ZStepperAlign::xy[NUM_Z_STEPPER_DRIVERS];
xy_pos_t ZStepperAlign::xy[NUM_Z_STEPPERS];
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
xy_pos_t ZStepperAlign::stepper_xy[NUM_Z_STEPPER_DRIVERS];
xy_pos_t ZStepperAlign::stepper_xy[NUM_Z_STEPPERS];
#endif
void ZStepperAlign::reset_to_default() {
#ifdef Z_STEPPER_ALIGN_XY
constexpr xy_pos_t xy_init[] = Z_STEPPER_ALIGN_XY;
static_assert(COUNT(xy_init) == NUM_Z_STEPPER_DRIVERS,
static_assert(COUNT(xy_init) == NUM_Z_STEPPERS,
"Z_STEPPER_ALIGN_XY requires "
#if NUM_Z_STEPPER_DRIVERS == 4
#if NUM_Z_STEPPERS == 4
"four {X,Y} entries (Z, Z2, Z3, and Z4)."
#elif NUM_Z_STEPPER_DRIVERS == 3
#elif NUM_Z_STEPPERS == 3
"three {X,Y} entries (Z, Z2, and Z3)."
#else
"two {X,Y} entries (Z and Z2)."
#endif
);
#define VALIDATE_ALIGN_POINT(N) static_assert(N >= NUM_Z_STEPPER_DRIVERS || Probe::build_time::can_reach(xy_init[N]), \
#define VALIDATE_ALIGN_POINT(N) static_assert(N >= NUM_Z_STEPPERS || Probe::build_time::can_reach(xy_init[N]), \
"Z_STEPPER_ALIGN_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
VALIDATE_ALIGN_POINT(0); VALIDATE_ALIGN_POINT(1); VALIDATE_ALIGN_POINT(2); VALIDATE_ALIGN_POINT(3);
#else // !Z_STEPPER_ALIGN_XY
const xy_pos_t xy_init[] = {
#if NUM_Z_STEPPER_DRIVERS >= 3 // First probe point...
#if NUM_Z_STEPPERS >= 3 // First probe point...
#if !Z_STEPPERS_ORIENTATION
{ probe.min_x(), probe.min_y() }, // SW
#elif Z_STEPPERS_ORIENTATION == 1
@ -73,7 +73,7 @@ void ZStepperAlign::reset_to_default() {
#else
#error "Z_STEPPERS_ORIENTATION must be from 0 to 3 (first point SW, NW, NE, SE)."
#endif
#if NUM_Z_STEPPER_DRIVERS == 4 // 3 more points...
#if NUM_Z_STEPPERS == 4 // 3 more points...
#if !Z_STEPPERS_ORIENTATION
{ probe.min_x(), probe.max_y() }, { probe.max_x(), probe.max_y() }, { probe.max_x(), probe.min_y() } // SW
#elif Z_STEPPERS_ORIENTATION == 1
@ -106,11 +106,11 @@ void ZStepperAlign::reset_to_default() {
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
constexpr xy_pos_t stepper_xy_init[] = Z_STEPPER_ALIGN_STEPPER_XY;
static_assert(
COUNT(stepper_xy_init) == NUM_Z_STEPPER_DRIVERS,
COUNT(stepper_xy_init) == NUM_Z_STEPPERS,
"Z_STEPPER_ALIGN_STEPPER_XY requires "
#if NUM_Z_STEPPER_DRIVERS == 4
#if NUM_Z_STEPPERS == 4
"four {X,Y} entries (Z, Z2, Z3, and Z4)."
#elif NUM_Z_STEPPER_DRIVERS == 3
#elif NUM_Z_STEPPERS == 3
"three {X,Y} entries (Z, Z2, and Z3)."
#endif
);

View file

@ -29,10 +29,10 @@
class ZStepperAlign {
public:
static xy_pos_t xy[NUM_Z_STEPPER_DRIVERS];
static xy_pos_t xy[NUM_Z_STEPPERS];
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
static xy_pos_t stepper_xy[NUM_Z_STEPPER_DRIVERS];
static xy_pos_t stepper_xy[NUM_Z_STEPPERS];
#endif
static void reset_to_default();

View file

@ -91,7 +91,7 @@ void GcodeSuite::G34() {
digipot_i2c.set_current(Z_AXIS, target_current)
#elif HAS_TRINAMIC_CONFIG
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
static uint16_t previous_current_arr[NUM_Z_STEPPER_DRIVERS];
static uint16_t previous_current_arr[NUM_Z_STEPPERS];
#if AXIS_IS_TMC(Z)
previous_current_arr[0] = stepperZ.getMilliamps();
stepperZ.rms_current(target_current);

View file

@ -52,9 +52,9 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../core/debug_out.h"
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#define TRIPLE_Z 1
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#define QUAD_Z 1
#endif
#endif
@ -180,11 +180,11 @@ void GcodeSuite::G34() {
// This hack is un-done at the end of G34 - either by re-homing, or by using the probed heights of the last iteration.
#if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
float last_z_align_move[NUM_Z_STEPPER_DRIVERS] = ARRAY_N_1(NUM_Z_STEPPER_DRIVERS, 10000.0f);
float last_z_align_move[NUM_Z_STEPPERS] = ARRAY_N_1(NUM_Z_STEPPERS, 10000.0f);
#else
float last_z_align_level_indicator = 10000.0f;
#endif
float z_measured[NUM_Z_STEPPER_DRIVERS] = { 0 },
float z_measured[NUM_Z_STEPPERS] = { 0 },
z_maxdiff = 0.0f,
amplification = z_auto_align_amplification;
@ -217,9 +217,9 @@ void GcodeSuite::G34() {
float z_measured_max = -100000.0f;
// Probe all positions (one per Z-Stepper)
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
LOOP_L_N(i, NUM_Z_STEPPERS) {
// iteration odd/even --> downward / upward stepper sequence
const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPER_DRIVERS - 1 - i : i;
const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPERS - 1 - i : i;
// Safe clearance even on an incline
if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe);
@ -270,20 +270,20 @@ void GcodeSuite::G34() {
// This allows the actual adjustment logic to be shared by both algorithms.
linear_fit_data lfd;
incremental_LSF_reset(&lfd);
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
LOOP_L_N(i, NUM_Z_STEPPERS) {
SERIAL_ECHOLNPGM("PROBEPT_", i, ": ", z_measured[i]);
incremental_LSF(&lfd, z_stepper_align.xy[i], z_measured[i]);
}
finish_incremental_LSF(&lfd);
z_measured_min = 100000.0f;
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
LOOP_L_N(i, NUM_Z_STEPPERS) {
z_measured[i] = -(lfd.A * z_stepper_align.stepper_xy[i].x + lfd.B * z_stepper_align.stepper_xy[i].y + lfd.D);
z_measured_min = _MIN(z_measured_min, z_measured[i]);
}
SERIAL_ECHOLNPGM(
LIST_N(DOUBLE(NUM_Z_STEPPER_DRIVERS),
LIST_N(DOUBLE(NUM_Z_STEPPERS),
"Calculated Z1=", z_measured[0],
" Z2=", z_measured[1],
" Z3=", z_measured[2],
@ -307,7 +307,7 @@ void GcodeSuite::G34() {
#if HAS_STATUS_MESSAGE
char fstr1[10];
char msg[6 + (6 + 5) * NUM_Z_STEPPER_DRIVERS + 1]
char msg[6 + (6 + 5) * NUM_Z_STEPPERS + 1]
#if TRIPLE_Z
, fstr2[10], fstr3[10]
#if QUAD_Z
@ -345,12 +345,12 @@ void GcodeSuite::G34() {
// Calculate mean value as a reference
float z_measured_mean = 0.0f;
LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) z_measured_mean += z_measured[zstepper];
z_measured_mean /= NUM_Z_STEPPER_DRIVERS;
LOOP_L_N(zstepper, NUM_Z_STEPPERS) z_measured_mean += z_measured[zstepper];
z_measured_mean /= NUM_Z_STEPPERS;
// Calculate the sum of the absolute deviations from the mean value
float z_align_level_indicator = 0.0f;
LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS)
LOOP_L_N(zstepper, NUM_Z_STEPPERS)
z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean);
// If it's getting worse, stop and throw an error
@ -365,7 +365,7 @@ void GcodeSuite::G34() {
bool success_break = true;
// Correct the individual stepper offsets
LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) {
LOOP_L_N(zstepper, NUM_Z_STEPPERS) {
// Calculate current stepper move
float z_align_move = z_measured[zstepper] - z_measured_min;
const float z_align_abs = ABS(z_align_move);
@ -515,9 +515,9 @@ void GcodeSuite::M422() {
#endif
}
if (!WITHIN(position_index, 1, NUM_Z_STEPPER_DRIVERS)) {
if (!WITHIN(position_index, 1, NUM_Z_STEPPERS)) {
SERIAL_ECHOF(err_string);
SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPER_DRIVERS) ").");
SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPERS) ").");
return;
}
@ -544,7 +544,7 @@ void GcodeSuite::M422() {
void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
report_heading(forReplay, F(STR_Z_AUTO_ALIGN));
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
LOOP_L_N(i, NUM_Z_STEPPERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPGM_P(
PSTR(" M422 S"), i + 1,
@ -553,7 +553,7 @@ void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
);
}
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
LOOP_L_N(i, NUM_Z_STEPPERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPGM_P(
PSTR(" M422 W"), i + 1,

View file

@ -93,12 +93,12 @@
#if ENABLED(Z_MULTI_ENDSTOPS)
if (parser.seenval('Z')) {
const float z_adj = parser.value_linear_units();
#if NUM_Z_STEPPER_DRIVERS == 2
#if NUM_Z_STEPPERS == 2
endstops.z2_endstop_adj = z_adj;
#else
const int ind = parser.intval('S');
#define _SET_ZADJ(N) if (!ind || ind == N) endstops.z##N##_endstop_adj = z_adj;
REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _SET_ZADJ)
REPEAT_S(2, INCREMENT(NUM_Z_STEPPERS), _SET_ZADJ)
#endif
}
#endif
@ -114,11 +114,11 @@
SERIAL_ECHOLNPGM_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj));
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
SERIAL_ECHOPGM(" S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M666 S3 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M666 S4 Z", LINEAR_UNIT(endstops.z4_endstop_adj));
#endif

View file

@ -50,9 +50,9 @@
* W[linear] 0/1 Enable park & Z Raise
* X[linear] Park X (Requires TOOLCHANGE_PARK)
* Y[linear] Park Y (Requires TOOLCHANGE_PARK)
* I[linear] Park I (Requires TOOLCHANGE_PARK and NUM_AXES >= 4)
* J[linear] Park J (Requires TOOLCHANGE_PARK and NUM_AXES >= 5)
* K[linear] Park K (Requires TOOLCHANGE_PARK and NUM_AXES >= 6)
* I[linear] Park I (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 4)
* J[linear] Park J (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 5)
* K[linear] Park K (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 6)
* Z[linear] Z Raise
* F[speed] Fan Speed 0-255
* D[seconds] Fan time

View file

@ -34,7 +34,7 @@
#include "../../../module/tool_change.h"
#endif
#if ENABLED(HAS_PRUSA_MMU2)
#if HAS_PRUSA_MMU2
#include "../../../feature/mmu/mmu2.h"
#if ENABLED(MMU2_MENUS)
#include "../../../lcd/menu/menu_mmu2.h"

View file

@ -669,13 +669,37 @@
* Number of Linear Axes (e.g., XYZ)
* All the logical axes except for the tool (E) axis
*/
#ifndef LINEAR_AXES
#define LINEAR_AXES XYZ
#ifdef LINEAR_AXES
#undef LINEAR_AXES
#define LINEAR_AXES_WARNING 1
#endif
#ifdef K_DRIVER_TYPE
#define LINEAR_AXES 6
#elif defined(J_DRIVER_TYPE)
#define LINEAR_AXES 5
#elif defined(I_DRIVER_TYPE)
#define LINEAR_AXES 4
#elif defined(Z_DRIVER_TYPE)
#define LINEAR_AXES 3
#elif defined(Y_DRIVER_TYPE)
#define LINEAR_AXES 2
#else
#define LINEAR_AXES 1
#endif
#if LINEAR_AXES >= XY
#define HAS_Y_AXIS 1
#if LINEAR_AXES >= XYZ
#define HAS_Z_AXIS 1
#ifdef Z4_DRIVER_TYPE
#define NUM_Z_STEPPERS 4
#elif defined(Z3_DRIVER_TYPE)
#define NUM_Z_STEPPERS 3
#elif defined(Z2_DRIVER_TYPE)
#define NUM_Z_STEPPERS 2
#else
#define NUM_Z_STEPPERS 1
#endif
#if LINEAR_AXES >= 4
#define HAS_I_AXIS 1
#if LINEAR_AXES >= 5
@ -688,6 +712,156 @@
#endif
#endif
#if E_STEPPERS <= 0
#undef E0_DRIVER_TYPE
#endif
#if E_STEPPERS <= 1
#undef E1_DRIVER_TYPE
#endif
#if E_STEPPERS <= 2
#undef E2_DRIVER_TYPE
#endif
#if E_STEPPERS <= 3
#undef E3_DRIVER_TYPE
#endif
#if E_STEPPERS <= 4
#undef E4_DRIVER_TYPE
#endif
#if E_STEPPERS <= 5
#undef E5_DRIVER_TYPE
#endif
#if E_STEPPERS <= 6
#undef E6_DRIVER_TYPE
#endif
#if E_STEPPERS <= 7
#undef E7_DRIVER_TYPE
#endif
#if !HAS_Y_AXIS
#undef ENDSTOPPULLUP_YMIN
#undef ENDSTOPPULLUP_YMAX
#undef Y_MIN_ENDSTOP_INVERTING
#undef Y_MAX_ENDSTOP_INVERTING
#undef Y2_DRIVER_TYPE
#undef Y_ENABLE_ON
#undef DISABLE_Y
#undef INVERT_Y_DIR
#undef Y_HOME_DIR
#undef Y_MIN_POS
#undef Y_MAX_POS
#undef MANUAL_Y_HOME_POS
#endif
#if !HAS_Z_AXIS
#undef ENDSTOPPULLUP_ZMIN
#undef ENDSTOPPULLUP_ZMAX
#undef Z_MIN_ENDSTOP_INVERTING
#undef Z_MAX_ENDSTOP_INVERTING
#undef Z2_DRIVER_TYPE
#undef Z3_DRIVER_TYPE
#undef Z4_DRIVER_TYPE
#undef Z_ENABLE_ON
#undef DISABLE_Z
#undef INVERT_Z_DIR
#undef Z_HOME_DIR
#undef Z_MIN_POS
#undef Z_MAX_POS
#undef MANUAL_Z_HOME_POS
#endif
#if !HAS_I_AXIS
#undef ENDSTOPPULLUP_IMIN
#undef ENDSTOPPULLUP_IMAX
#undef I_MIN_ENDSTOP_INVERTING
#undef I_MAX_ENDSTOP_INVERTING
#undef I_ENABLE_ON
#undef DISABLE_I
#undef INVERT_I_DIR
#undef I_HOME_DIR
#undef I_MIN_POS
#undef I_MAX_POS
#undef MANUAL_I_HOME_POS
#endif
#if !HAS_J_AXIS
#undef ENDSTOPPULLUP_JMIN
#undef ENDSTOPPULLUP_JMAX
#undef J_MIN_ENDSTOP_INVERTING
#undef J_MAX_ENDSTOP_INVERTING
#undef J_ENABLE_ON
#undef DISABLE_J
#undef INVERT_J_DIR
#undef J_HOME_DIR
#undef J_MIN_POS
#undef J_MAX_POS
#undef MANUAL_J_HOME_POS
#endif
#if !HAS_K_AXIS
#undef ENDSTOPPULLUP_KMIN
#undef ENDSTOPPULLUP_KMAX
#undef K_MIN_ENDSTOP_INVERTING
#undef K_MAX_ENDSTOP_INVERTING
#undef K_ENABLE_ON
#undef DISABLE_K
#undef INVERT_K_DIR
#undef K_HOME_DIR
#undef K_MIN_POS
#undef K_MAX_POS
#undef MANUAL_K_HOME_POS
#endif
#if !HAS_U_AXIS
#undef ENDSTOPPULLUP_UMIN
#undef ENDSTOPPULLUP_UMAX
#undef U_MIN_ENDSTOP_INVERTING
#undef U_MAX_ENDSTOP_INVERTING
#undef U_ENABLE_ON
#undef DISABLE_U
#undef INVERT_U_DIR
#undef U_HOME_DIR
#undef U_MIN_POS
#undef U_MAX_POS
#undef MANUAL_U_HOME_POS
#endif
#if !HAS_V_AXIS
#undef ENDSTOPPULLUP_VMIN
#undef ENDSTOPPULLUP_VMAX
#undef V_MIN_ENDSTOP_INVERTING
#undef V_MAX_ENDSTOP_INVERTING
#undef V_ENABLE_ON
#undef DISABLE_V
#undef INVERT_V_DIR
#undef V_HOME_DIR
#undef V_MIN_POS
#undef V_MAX_POS
#undef MANUAL_V_HOME_POS
#endif
#if !HAS_W_AXIS
#undef ENDSTOPPULLUP_WMIN
#undef ENDSTOPPULLUP_WMAX
#undef W_MIN_ENDSTOP_INVERTING
#undef W_MAX_ENDSTOP_INVERTING
#undef W_ENABLE_ON
#undef DISABLE_W
#undef INVERT_W_DIR
#undef W_HOME_DIR
#undef W_MIN_POS
#undef W_MAX_POS
#undef MANUAL_W_HOME_POS
#endif
#ifdef X2_DRIVER_TYPE
#define HAS_X2_STEPPER 1
// Dual X Carriage isn't known yet. TODO: Consider moving it to Configuration.h.
#endif
#ifdef Y2_DRIVER_TYPE
#define HAS_Y2_STEPPER 1
#define HAS_DUAL_Y_STEPPERS 1
#endif
/**
* Number of Logical Axes (e.g., XYZE)
* All the logical axes that can be commanded directly by G-code.
@ -1136,95 +1310,6 @@
#define HAS_ETHERNET 1
#endif
// Fallback Stepper Driver types that don't depend on Configuration_adv.h
#ifndef X_DRIVER_TYPE
#define X_DRIVER_TYPE A4988
#endif
#ifndef X2_DRIVER_TYPE
#define X2_DRIVER_TYPE A4988
#endif
#ifndef Y_DRIVER_TYPE
#define Y_DRIVER_TYPE A4988
#endif
#ifndef Y2_DRIVER_TYPE
#define Y2_DRIVER_TYPE A4988
#endif
#ifndef Z_DRIVER_TYPE
#define Z_DRIVER_TYPE A4988
#endif
#ifndef Z2_DRIVER_TYPE
#define Z2_DRIVER_TYPE A4988
#endif
#ifndef Z3_DRIVER_TYPE
#define Z3_DRIVER_TYPE A4988
#endif
#ifndef Z4_DRIVER_TYPE
#define Z4_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 0
#undef E0_DRIVER_TYPE
#elif !defined(E0_DRIVER_TYPE)
#define E0_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 1
#undef E1_DRIVER_TYPE
#elif !defined(E1_DRIVER_TYPE)
#define E1_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 2
#undef E2_DRIVER_TYPE
#elif !defined(E2_DRIVER_TYPE)
#define E2_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 3
#undef E3_DRIVER_TYPE
#elif !defined(E3_DRIVER_TYPE)
#define E3_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 4
#undef E4_DRIVER_TYPE
#elif !defined(E4_DRIVER_TYPE)
#define E4_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 5
#undef E5_DRIVER_TYPE
#elif !defined(E5_DRIVER_TYPE)
#define E5_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 6
#undef E6_DRIVER_TYPE
#elif !defined(E6_DRIVER_TYPE)
#define E6_DRIVER_TYPE A4988
#endif
#if E_STEPPERS <= 7
#undef E7_DRIVER_TYPE
#elif !defined(E7_DRIVER_TYPE)
#define E7_DRIVER_TYPE A4988
#endif
// Fallback axis inverting
#ifndef INVERT_X_DIR
#define INVERT_X_DIR false
#endif
#if HAS_Y_AXIS && !defined(INVERT_Y_DIR)
#define INVERT_Y_DIR false
#endif
#if HAS_Z_AXIS && !defined(INVERT_Z_DIR)
#define INVERT_Z_DIR false
#endif
#if HAS_I_AXIS && !defined(INVERT_I_DIR)
#define INVERT_I_DIR false
#endif
#if HAS_J_AXIS && !defined(INVERT_J_DIR)
#define INVERT_J_DIR false
#endif
#if HAS_K_AXIS && !defined(INVERT_K_DIR)
#define INVERT_K_DIR false
#endif
#if HAS_EXTRUDERS && !defined(INVERT_E_DIR)
#define INVERT_E_DIR false
#endif
/**
* This setting is also used by M109 when trying to calculate
* a ballpark safe margin to prevent wait-forever situation.

View file

@ -650,33 +650,20 @@
#endif
// Multiple Z steppers
#ifndef NUM_Z_STEPPER_DRIVERS
#define NUM_Z_STEPPER_DRIVERS 1
#endif
// Fallback Stepper Driver types that depend on Configuration_adv.h
#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
#define HAS_X2_STEPPER 1
#else
#undef X2_DRIVER_TYPE
#endif
#if DISABLED(Y_DUAL_STEPPER_DRIVERS)
#undef Y2_DRIVER_TYPE
#endif
#if NUM_Z_STEPPER_DRIVERS < 4
#undef Z4_DRIVER_TYPE
#if NUM_Z_STEPPERS < 4
#undef INVERT_Z4_VS_Z_DIR
#if NUM_Z_STEPPER_DRIVERS < 3
#undef Z3_DRIVER_TYPE
#if NUM_Z_STEPPERS < 3
#undef INVERT_Z3_VS_Z_DIR
#if NUM_Z_STEPPER_DRIVERS < 2
#undef Z2_DRIVER_TYPE
#if NUM_Z_STEPPERS < 2
#undef INVERT_Z2_VS_Z_DIR
#endif
#endif
#endif
#if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE)
#define HAS_DUAL_X_STEPPERS 1
#endif
//
// Spindle/Laser power display types
// Defined here so sanity checks can use them
@ -944,7 +931,7 @@
#undef HOME_Z_FIRST
#undef HOMING_Z_WITH_PROBE
#undef ENABLE_LEVELING_FADE_HEIGHT
#undef NUM_Z_STEPPER_DRIVERS
#undef NUM_Z_STEPPERS
#undef CNC_WORKSPACE_PLANES
#if LINEAR_AXES < 2
#undef STEALTHCHOP_Y

View file

@ -1152,7 +1152,7 @@
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#if Z_HOME_TO_MAX
#ifndef Z3_MAX_ENDSTOP_INVERTING
#if Z3_USE_ENDSTOP == _XMIN_
@ -1284,7 +1284,7 @@
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#if Z_HOME_TO_MAX
#ifndef Z4_MAX_ENDSTOP_INVERTING
#if Z4_USE_ENDSTOP == _XMIN_
@ -1575,7 +1575,7 @@
#undef DISABLE_INACTIVE_Z
#endif
#if NUM_Z_STEPPER_DRIVERS >= 2
#if NUM_Z_STEPPERS >= 2
#if PIN_EXISTS(Z2_ENABLE) || AXIS_IS_L64XX(Z2) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2))
#define HAS_Z2_ENABLE 1
#endif
@ -1590,7 +1590,7 @@
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#if PIN_EXISTS(Z3_ENABLE) || AXIS_IS_L64XX(Z3) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3))
#define HAS_Z3_ENABLE 1
#endif
@ -1605,7 +1605,7 @@
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#if PIN_EXISTS(Z4_ENABLE) || AXIS_IS_L64XX(Z4) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4))
#define HAS_Z4_ENABLE 1
#endif
@ -1920,7 +1920,7 @@
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 0
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if HAS_DUAL_Y_STEPPERS
#if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)
#define Y2_SENSORLESS 1
#endif
@ -1958,7 +1958,7 @@
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 0
#endif
#if NUM_Z_STEPPER_DRIVERS >= 2
#if NUM_Z_STEPPERS >= 2
#if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)
#define Z2_SENSORLESS 1
#endif
@ -1975,7 +1975,7 @@
#define Z2_SLAVE_ADDRESS 0
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)
#define Z3_SENSORLESS 1
#endif
@ -1992,7 +1992,7 @@
#define Z3_SLAVE_ADDRESS 0
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#endif
@ -2309,8 +2309,8 @@
#define IS_X2_ENDSTOP(A,M) (ENABLED(X_DUAL_ENDSTOPS) && X2_USE_ENDSTOP == _##A##M##_)
#define IS_Y2_ENDSTOP(A,M) (ENABLED(Y_DUAL_ENDSTOPS) && Y2_USE_ENDSTOP == _##A##M##_)
#define IS_Z2_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_)
#define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_)
#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_)
#define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_)
#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_)
#define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M))
#if _HAS_STOP(X,MIN)

View file

@ -524,11 +524,11 @@
#elif defined(Z_QUAD_ENDSTOPS_ADJUSTMENT2) || defined(Z_QUAD_ENDSTOPS_ADJUSTMENT3) || defined(Z_QUAD_ENDSTOPS_ADJUSTMENT4)
#error "Z_QUAD_ENDSTOPS_ADJUSTMENT[234] is now Z[234]_ENDSTOP_ADJUSTMENT."
#elif defined(Z_DUAL_STEPPER_DRIVERS)
#error "Z_DUAL_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 2."
#error "Z_DUAL_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(Z_TRIPLE_STEPPER_DRIVERS)
#error "Z_TRIPLE_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 3."
#error "Z_TRIPLE_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(Z_QUAD_STEPPER_DRIVERS)
#error "Z_QUAD_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 4."
#error "Z_QUAD_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(Z_DUAL_ENDSTOPS) || defined(Z_TRIPLE_ENDSTOPS) || defined(Z_QUAD_ENDSTOPS)
#error "Z_(DUAL|TRIPLE|QUAD)_ENDSTOPS is now Z_MULTI_ENDSTOPS."
#elif defined(DUGS_UI_MOVE_DIS_OPTION)
@ -619,6 +619,12 @@
#error "Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS is now just Z_STEPPER_ALIGN_STEPPER_XY."
#elif defined(DWIN_CREALITY_LCD_ENHANCED)
#error "DWIN_CREALITY_LCD_ENHANCED is now DWIN_LCD_PROUI."
#elif defined(X_DUAL_STEPPER_DRIVERS)
#error "X_DUAL_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(Y_DUAL_STEPPER_DRIVERS)
#error "Y_DUAL_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(NUM_Z_STEPPER_DRIVERS)
#error "NUM_Z_STEPPER_DRIVERS is no longer needed and should be removed."
#endif
constexpr float arm[] = AXIS_RELATIVE_MODES;
@ -735,27 +741,21 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
* Multiple Stepper Drivers Per Axis
*/
#define GOOD_AXIS_PINS(A) (HAS_##A##_ENABLE && HAS_##A##_STEP && HAS_##A##_DIR)
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
#if ENABLED(DUAL_X_CARRIAGE)
#error "DUAL_X_CARRIAGE is not compatible with X_DUAL_STEPPER_DRIVERS."
#elif !GOOD_AXIS_PINS(X)
#error "X_DUAL_STEPPER_DRIVERS requires X2 pins to be defined."
#endif
#if HAS_X2_STEPPER && !GOOD_AXIS_PINS(X)
#error "If X2_DRIVER_TYPE is defined, then X2 ENABLE/STEP/DIR pins are also needed."
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !GOOD_AXIS_PINS(Y)
#error "Y_DUAL_STEPPER_DRIVERS requires Y2 pins to be defined."
#if HAS_DUAL_Y_STEPPERS && !GOOD_AXIS_PINS(Y)
#error "If Y2_DRIVER_TYPE is defined, then Y2 ENABLE/STEP/DIR pins are also needed."
#endif
#if HAS_Z_AXIS
#if !WITHIN(NUM_Z_STEPPER_DRIVERS, 1, 4)
#error "NUM_Z_STEPPER_DRIVERS must be an integer from 1 to 4."
#elif NUM_Z_STEPPER_DRIVERS == 2 && !GOOD_AXIS_PINS(Z2)
#error "If NUM_Z_STEPPER_DRIVERS is 2, you must define stepper pins for Z2."
#elif NUM_Z_STEPPER_DRIVERS == 3 && !(GOOD_AXIS_PINS(Z2) && GOOD_AXIS_PINS(Z3))
#error "If NUM_Z_STEPPER_DRIVERS is 3, you must define stepper pins for Z2 and Z3."
#elif NUM_Z_STEPPER_DRIVERS == 4 && !(GOOD_AXIS_PINS(Z2) && GOOD_AXIS_PINS(Z3) && GOOD_AXIS_PINS(Z4))
#error "If NUM_Z_STEPPER_DRIVERS is 4, you must define stepper pins for Z2, Z3, and Z4."
#if NUM_Z_STEPPERS >= 2 && !GOOD_AXIS_PINS(Z2)
#error "If Z2_DRIVER_TYPE is defined, then Z2 ENABLE/STEP/DIR pins are also needed."
#elif NUM_Z_STEPPERS >= 3 && !GOOD_AXIS_PINS(Z3)
#error "If Z3_DRIVER_TYPE is defined, then Z3 ENABLE/STEP/DIR pins are also needed."
#elif NUM_Z_STEPPERS >= 4 && !GOOD_AXIS_PINS(Z4)
#error "If Z4_DRIVER_TYPE is defined, then Z4 ENABLE/STEP/DIR pins are also needed."
#endif
#endif
@ -2531,10 +2531,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "Z_MULTI_ENDSTOPS is not compatible with DELTA."
#elif !Z2_USE_ENDSTOP
#error "Z2_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS."
#elif !Z3_USE_ENDSTOP && NUM_Z_STEPPER_DRIVERS >= 3
#error "Z3_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and NUM_Z_STEPPER_DRIVERS >= 3."
#elif !Z4_USE_ENDSTOP && NUM_Z_STEPPER_DRIVERS >= 4
#error "Z4_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and NUM_Z_STEPPER_DRIVERS >= 4."
#elif !Z3_USE_ENDSTOP && NUM_Z_STEPPERS >= 3
#error "Z3_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and Z3_DRIVER_TYPE."
#elif !Z4_USE_ENDSTOP && NUM_Z_STEPPERS >= 4
#error "Z4_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and Z4_DRIVER_TYPE."
#endif
#endif
@ -3504,14 +3504,14 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#if NUM_Z_STEPPER_DRIVERS <= 1
#error "Z_STEPPER_AUTO_ALIGN requires NUM_Z_STEPPER_DRIVERS greater than 1."
#if NUM_Z_STEPPERS <= 1
#error "Z_STEPPER_AUTO_ALIGN requires more than one Z stepper."
#elif !HAS_BED_PROBE
#error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe."
#elif HAS_Z_STEPPER_ALIGN_STEPPER_XY
static_assert(WITHIN(Z_STEPPER_ALIGN_AMP, 0.5, 2.0), "Z_STEPPER_ALIGN_AMP must be between 0.5 and 2.0.");
#if NUM_Z_STEPPER_DRIVERS < 3
#error "Z_STEPPER_ALIGN_STEPPER_XY requires NUM_Z_STEPPER_DRIVERS to be 3 or 4."
#if NUM_Z_STEPPERS < 3
#error "Z_STEPPER_ALIGN_STEPPER_XY requires 3 or 4 Z steppers."
#endif
#endif
#endif

View file

@ -35,6 +35,10 @@
#warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
#endif
#if LINEAR_AXES_WARNING
#warning "Note: LINEAR_AXES is now based on the *_DRIVER_TYPE settings so you can remove LINEAR_AXES from Configuration.h."
#endif
// Safety Features
#if DISABLED(USE_WATCHDOG)
#warning "Safety Alert! Enable USE_WATCHDOG for the final build!"

View file

@ -429,7 +429,7 @@ void menu_backlash();
START_MENU();
BACK_ITEM(MSG_ADVANCED_SETTINGS);
LOOP_NUM_AXES(a)
LOOP_LINEAR_AXES(a)
EDIT_ITEM_FAST_N(float5, a, MSG_VMAX_N, &planner.settings.max_feedrate_mm_s[a], 1, max_fr_edit_scaled[a]);
#if E_STEPPERS
@ -575,7 +575,7 @@ void menu_advanced_steps_per_mm() {
START_MENU();
BACK_ITEM(MSG_ADVANCED_SETTINGS);
LOOP_NUM_AXES(a)
LOOP_LINEAR_AXES(a)
EDIT_ITEM_FAST_N(float61, a, MSG_N_STEPS, &planner.settings.axis_steps_per_mm[a], 5, 9999, []{ planner.refresh_positioning(); });
#if ENABLED(DISTINCT_E_FACTORS)

View file

@ -66,14 +66,14 @@ void echo_yes_no(const bool yes) { DEBUG_ECHOPGM_P(yes ? PSTR(" YES") : PSTR(" N
uint8_t L64XX_Marlin::dir_commands[MAX_L64XX]; // array to hold direction command for each driver
#define _EN_ITEM(N) , INVERT_E##N##_DIR
#define _EN_ITEM(N) , ENABLED(INVERT_E##N##_DIR)
const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = {
LINEAR_AXIS_LIST(INVERT_X_DIR, INVERT_Y_DIR, INVERT_Z_DIR, INVERT_I_DIR, INVERT_J_DIR, INVERT_K_DIR)
, (INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2
, (INVERT_Y_DIR) ^ BOTH(Y_DUAL_STEPPER_DRIVERS, INVERT_Y2_VS_Y_DIR) // Y2
, (INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2
, (INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3
, (INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4
NUM_AXIS_LIST(ENABLED(INVERT_X_DIR), ENABLED(INVERT_Y_DIR), ENABLED(INVERT_Z_DIR), ENABLED(INVERT_I_DIR), ENABLED(INVERT_J_DIR), ENABLED(INVERT_K_DIR))
, ENABLED(INVERT_X_DIR) ^ BOTH(HAS_DUAL_X_STEPPERS, INVERT_X2_VS_X_DIR) // X2
, ENABLED(INVERT_Y_DIR) ^ BOTH(HAS_DUAL_Y_STEPPERS, INVERT_Y2_VS_Y_DIR) // Y2
, ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2
, ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3
, ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4
REPEAT(E_STEPPERS, _EN_ITEM)
};
#undef _EN_ITEM

View file

@ -81,9 +81,9 @@ Endstops::endstop_mask_t Endstops::live_state = 0;
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
float Endstops::z2_endstop_adj;
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
float Endstops::z3_endstop_adj;
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
float Endstops::z4_endstop_adj;
#endif
#endif
@ -708,14 +708,14 @@ void Endstops::update() {
#else
COPY_LIVE_STATE(Z_MIN, Z2_MIN);
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#if HAS_Z3_MIN
UPDATE_ENDSTOP_BIT(Z3, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z3_MIN);
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#if HAS_Z4_MIN
UPDATE_ENDSTOP_BIT(Z4, MIN);
#else
@ -740,14 +740,14 @@ void Endstops::update() {
#else
COPY_LIVE_STATE(Z_MAX, Z2_MAX);
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#if HAS_Z3_MAX
UPDATE_ENDSTOP_BIT(Z3, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z3_MAX);
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#if HAS_Z4_MAX
UPDATE_ENDSTOP_BIT(Z4, MAX);
#else
@ -930,9 +930,9 @@ void Endstops::update() {
#if DISABLED(Z_MULTI_ENDSTOPS)
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_ENDSTOP(Z, MINMAX)
#elif NUM_Z_STEPPER_DRIVERS == 4
#elif NUM_Z_STEPPERS == 4
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_QUAD_ENDSTOP(Z, MINMAX)
#elif NUM_Z_STEPPER_DRIVERS == 3
#elif NUM_Z_STEPPERS == 3
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_TRIPLE_ENDSTOP(Z, MINMAX)
#else
#define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)

View file

@ -58,11 +58,11 @@ enum EndstopEnum : char {
#if ENABLED(Z_MULTI_ENDSTOPS)
_ES_ITEM(HAS_Z_MIN, Z2_MIN)
_ES_ITEM(HAS_Z_MAX, Z2_MAX)
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
_ES_ITEM(HAS_Z_MIN, Z3_MIN)
_ES_ITEM(HAS_Z_MAX, Z3_MAX)
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
_ES_ITEM(HAS_Z_MIN, Z4_MIN)
_ES_ITEM(HAS_Z_MAX, Z4_MAX)
#endif
@ -114,10 +114,10 @@ class Endstops {
#if ENABLED(Z_MULTI_ENDSTOPS)
static float z2_endstop_adj;
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3
static float z3_endstop_adj;
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4
static float z4_endstop_adj;
#endif

View file

@ -1634,7 +1634,7 @@ void prepare_line_to_destination() {
phasePerUStep = PHASE_PER_MICROSTEP(X);
phaseCurrent = stepperX.get_microstep_counter();
effectorBackoutDir = -X_HOME_DIR;
stepperBackoutDir = INVERT_X_DIR ? effectorBackoutDir : -effectorBackoutDir;
stepperBackoutDir = IF_DISABLED(INVERT_X_DIR, -)effectorBackoutDir;
break;
#endif
#ifdef Y_MICROSTEPS
@ -1642,7 +1642,7 @@ void prepare_line_to_destination() {
phasePerUStep = PHASE_PER_MICROSTEP(Y);
phaseCurrent = stepperY.get_microstep_counter();
effectorBackoutDir = -Y_HOME_DIR;
stepperBackoutDir = INVERT_Y_DIR ? effectorBackoutDir : -effectorBackoutDir;
stepperBackoutDir = IF_DISABLED(INVERT_Y_DIR, -)effectorBackoutDir;
break;
#endif
#ifdef Z_MICROSTEPS
@ -1650,7 +1650,7 @@ void prepare_line_to_destination() {
phasePerUStep = PHASE_PER_MICROSTEP(Z);
phaseCurrent = stepperZ.get_microstep_counter();
effectorBackoutDir = -Z_HOME_DIR;
stepperBackoutDir = INVERT_Z_DIR ? effectorBackoutDir : -effectorBackoutDir;
stepperBackoutDir = IF_DISABLED(INVERT_Z_DIR, -)effectorBackoutDir;
break;
#endif
#ifdef I_MICROSTEPS
@ -1658,7 +1658,7 @@ void prepare_line_to_destination() {
phasePerUStep = PHASE_PER_MICROSTEP(I);
phaseCurrent = stepperI.get_microstep_counter();
effectorBackoutDir = -I_HOME_DIR;
stepperBackoutDir = INVERT_I_DIR ? effectorBackoutDir : -effectorBackoutDir;
stepperBackoutDir = IF_DISABLED(INVERT_I_DIR, -)effectorBackoutDir;
break;
#endif
#ifdef J_MICROSTEPS
@ -1666,7 +1666,7 @@ void prepare_line_to_destination() {
phasePerUStep = PHASE_PER_MICROSTEP(J);
phaseCurrent = stepperJ.get_microstep_counter();
effectorBackoutDir = -J_HOME_DIR;
stepperBackoutDir = INVERT_J_DIR ? effectorBackoutDir : -effectorBackoutDir;
stepperBackoutDir = IF_DISABLED(INVERT_J_DIR, -)effectorBackoutDir;
break;
#endif
#ifdef K_MICROSTEPS
@ -1674,7 +1674,7 @@ void prepare_line_to_destination() {
phasePerUStep = PHASE_PER_MICROSTEP(K);
phaseCurrent = stepperK.get_microstep_counter();
effectorBackoutDir = -K_HOME_DIR;
stepperBackoutDir = INVERT_K_DIR ? effectorBackoutDir : -effectorBackoutDir;
stepperBackoutDir = IF_DISABLED(INVERT_K_DIR, -)effectorBackoutDir;
break;
#endif
default: return;
@ -1882,7 +1882,7 @@ void prepare_line_to_destination() {
#if ENABLED(Z_MULTI_ENDSTOPS)
if (axis == Z_AXIS) {
#if NUM_Z_STEPPER_DRIVERS == 2
#if NUM_Z_STEPPERS == 2
const float adj = ABS(endstops.z2_endstop_adj);
if (adj) {
@ -1900,13 +1900,13 @@ void prepare_line_to_destination() {
adjustFunc_t lock[] = {
stepper.set_z1_lock, stepper.set_z2_lock, stepper.set_z3_lock
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
, stepper.set_z4_lock
#endif
};
float adj[] = {
0, endstops.z2_endstop_adj, endstops.z3_endstop_adj
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
, endstops.z4_endstop_adj
#endif
};
@ -1925,7 +1925,7 @@ void prepare_line_to_destination() {
lock[1] = lock[2], adj[1] = adj[2];
lock[2] = tempLock, adj[2] = tempAdj;
}
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
if (adj[3] < adj[2]) {
tempLock = lock[2], tempAdj = adj[2];
lock[2] = lock[3], adj[2] = adj[3];
@ -1950,14 +1950,14 @@ void prepare_line_to_destination() {
// lock the second stepper for the final correction
(*lock[1])(true);
do_homing_move(axis, adj[2] - adj[1]);
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
// lock the third stepper for the final correction
(*lock[2])(true);
do_homing_move(axis, adj[3] - adj[2]);
#endif
}
else {
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
(*lock[3])(true);
do_homing_move(axis, adj[2] - adj[3]);
#endif
@ -1970,7 +1970,7 @@ void prepare_line_to_destination() {
stepper.set_z1_lock(false);
stepper.set_z2_lock(false);
stepper.set_z3_lock(false);
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
stepper.set_z4_lock(false);
#endif

View file

@ -347,9 +347,9 @@ typedef struct SettingsDataStruct {
// Z_STEPPER_AUTO_ALIGN, HAS_Z_STEPPER_ALIGN_STEPPER_XY
//
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
xy_pos_t z_stepper_align_xy[NUM_Z_STEPPER_DRIVERS]; // M422 S X Y
xy_pos_t z_stepper_align_xy[NUM_Z_STEPPERS]; // M422 S X Y
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
xy_pos_t z_stepper_align_stepper_xy[NUM_Z_STEPPER_DRIVERS]; // M422 W X Y
xy_pos_t z_stepper_align_stepper_xy[NUM_Z_STEPPERS]; // M422 W X Y
#endif
#endif
@ -1009,13 +1009,13 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float
EEPROM_WRITE(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3
EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummyf);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4
EEPROM_WRITE(endstops.z4_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummyf);
@ -1943,12 +1943,12 @@ void MarlinSettings::postprocess() {
EEPROM_READ(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float
EEPROM_READ(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3
EEPROM_READ(endstops.z3_endstop_adj); // 1 float
#else
EEPROM_READ(dummyf);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4
EEPROM_READ(endstops.z4_endstop_adj); // 1 float
#else
EEPROM_READ(dummyf);
@ -2990,13 +2990,13 @@ void MarlinSettings::reset() {
#define Z2_ENDSTOP_ADJUSTMENT 0
#endif
endstops.z2_endstop_adj = Z2_ENDSTOP_ADJUSTMENT;
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#ifndef Z3_ENDSTOP_ADJUSTMENT
#define Z3_ENDSTOP_ADJUSTMENT 0
#endif
endstops.z3_endstop_adj = Z3_ENDSTOP_ADJUSTMENT;
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#ifndef Z4_ENDSTOP_ADJUSTMENT
#define Z4_ENDSTOP_ADJUSTMENT 0
#endif

View file

@ -177,9 +177,9 @@ bool Stepper::abort_current_block;
#if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN)
bool Stepper::locked_Z_motor = false, Stepper::locked_Z2_motor = false
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
, Stepper::locked_Z3_motor = false
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
, Stepper::locked_Z4_motor = false
#endif
#endif
@ -365,7 +365,7 @@ xyze_int8_t Stepper::count_direction{0};
A##4_STEP_WRITE(V); \
}
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
#if HAS_DUAL_X_STEPPERS
#define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) ^ ENABLED(INVERT_X2_VS_X_DIR)); }while(0)
#if ENABLED(X_DUAL_ENDSTOPS)
#define X_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(X,v)
@ -386,7 +386,7 @@ xyze_int8_t Stepper::count_direction{0};
#define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if HAS_DUAL_Y_STEPPERS
#define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE((v) ^ ENABLED(INVERT_Y2_VS_Y_DIR)); }while(0)
#if ENABLED(Y_DUAL_ENDSTOPS)
#define Y_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Y,v)
@ -398,7 +398,7 @@ xyze_int8_t Stepper::count_direction{0};
#define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v)
#endif
#if NUM_Z_STEPPER_DRIVERS == 4
#if NUM_Z_STEPPERS == 4
#define Z_APPLY_DIR(v,Q) do{ \
Z_DIR_WRITE(v); Z2_DIR_WRITE((v) ^ ENABLED(INVERT_Z2_VS_Z_DIR)); \
Z3_DIR_WRITE((v) ^ ENABLED(INVERT_Z3_VS_Z_DIR)); Z4_DIR_WRITE((v) ^ ENABLED(INVERT_Z4_VS_Z_DIR)); \
@ -410,7 +410,7 @@ xyze_int8_t Stepper::count_direction{0};
#else
#define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); Z3_STEP_WRITE(v); Z4_STEP_WRITE(v); }while(0)
#endif
#elif NUM_Z_STEPPER_DRIVERS == 3
#elif NUM_Z_STEPPERS == 3
#define Z_APPLY_DIR(v,Q) do{ \
Z_DIR_WRITE(v); Z2_DIR_WRITE((v) ^ ENABLED(INVERT_Z2_VS_Z_DIR)); Z3_DIR_WRITE((v) ^ ENABLED(INVERT_Z3_VS_Z_DIR)); \
}while(0)
@ -421,7 +421,7 @@ xyze_int8_t Stepper::count_direction{0};
#else
#define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); Z3_STEP_WRITE(v); }while(0)
#endif
#elif NUM_Z_STEPPER_DRIVERS == 2
#elif NUM_Z_STEPPERS == 2
#define Z_APPLY_DIR(v,Q) do{ Z_DIR_WRITE(v); Z2_DIR_WRITE((v) ^ ENABLED(INVERT_Z2_VS_Z_DIR)); }while(0)
#if ENABLED(Z_MULTI_ENDSTOPS)
#define Z_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Z,v)
@ -2564,19 +2564,19 @@ void Stepper::init() {
TERN_(HAS_X2_DIR, X2_DIR_INIT());
#if HAS_Y_DIR
Y_DIR_INIT();
#if BOTH(Y_DUAL_STEPPER_DRIVERS, HAS_Y2_DIR)
#if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_DIR)
Y2_DIR_INIT();
#endif
#endif
#if HAS_Z_DIR
Z_DIR_INIT();
#if NUM_Z_STEPPER_DRIVERS >= 2 && HAS_Z2_DIR
#if NUM_Z_STEPPERS >= 2 && HAS_Z2_DIR
Z2_DIR_INIT();
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3 && HAS_Z3_DIR
#if NUM_Z_STEPPERS >= 3 && HAS_Z3_DIR
Z3_DIR_INIT();
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4 && HAS_Z4_DIR
#if NUM_Z_STEPPERS >= 4 && HAS_Z4_DIR
Z4_DIR_INIT();
#endif
#endif
@ -2626,7 +2626,7 @@ void Stepper::init() {
#if HAS_Y_ENABLE
Y_ENABLE_INIT();
if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
#if BOTH(Y_DUAL_STEPPER_DRIVERS, HAS_Y2_ENABLE)
#if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_ENABLE)
Y2_ENABLE_INIT();
if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
#endif
@ -2634,15 +2634,15 @@ void Stepper::init() {
#if HAS_Z_ENABLE
Z_ENABLE_INIT();
if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
#if NUM_Z_STEPPER_DRIVERS >= 2 && HAS_Z2_ENABLE
#if NUM_Z_STEPPERS >= 2 && HAS_Z2_ENABLE
Z2_ENABLE_INIT();
if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3 && HAS_Z3_ENABLE
#if NUM_Z_STEPPERS >= 3 && HAS_Z3_ENABLE
Z3_ENABLE_INIT();
if (!Z_ENABLE_ON) Z3_ENABLE_WRITE(HIGH);
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4 && HAS_Z4_ENABLE
#if NUM_Z_STEPPERS >= 4 && HAS_Z4_ENABLE
Z4_ENABLE_INIT();
if (!Z_ENABLE_ON) Z4_ENABLE_WRITE(HIGH);
#endif
@ -2705,7 +2705,7 @@ void Stepper::init() {
// Init Step Pins
#if HAS_X_STEP
#if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE)
#if HAS_X2_STEPPER
X2_STEP_INIT();
X2_STEP_WRITE(INVERT_X_STEP_PIN);
#endif
@ -2713,7 +2713,7 @@ void Stepper::init() {
#endif
#if HAS_Y_STEP
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if HAS_DUAL_Y_STEPPERS
Y2_STEP_INIT();
Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
#endif
@ -2721,15 +2721,15 @@ void Stepper::init() {
#endif
#if HAS_Z_STEP
#if NUM_Z_STEPPER_DRIVERS >= 2
#if NUM_Z_STEPPERS >= 2
Z2_STEP_INIT();
Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
Z3_STEP_INIT();
Z3_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
Z4_STEP_INIT();
Z4_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif
@ -2965,7 +2965,7 @@ void Stepper::report_positions() {
#define _ENABLE_AXIS(A) enable_axis(_AXIS(A))
#define _READ_DIR(AXIS) AXIS ##_DIR_READ()
#define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
#define _INVERT_DIR(AXIS) ENABLED(INVERT_## AXIS ##_DIR)
#define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
#if MINIMUM_STEPPER_PULSE
@ -3108,21 +3108,21 @@ void Stepper::report_positions() {
I_DIR_READ(), J_DIR_READ(), K_DIR_READ()
);
X_DIR_WRITE(INVERT_X_DIR ^ z_direction);
X_DIR_WRITE(ENABLED(INVERT_X_DIR) ^ z_direction);
#ifdef Y_DIR_WRITE
Y_DIR_WRITE(INVERT_Y_DIR ^ z_direction);
Y_DIR_WRITE(ENABLED(INVERT_Y_DIR) ^ z_direction);
#endif
#ifdef Z_DIR_WRITE
Z_DIR_WRITE(INVERT_Z_DIR ^ z_direction);
Z_DIR_WRITE(ENABLED(INVERT_Z_DIR) ^ z_direction);
#endif
#ifdef I_DIR_WRITE
I_DIR_WRITE(INVERT_I_DIR ^ z_direction);
I_DIR_WRITE(ENABLED(INVERT_I_DIR) ^ z_direction);
#endif
#ifdef J_DIR_WRITE
J_DIR_WRITE(INVERT_J_DIR ^ z_direction);
J_DIR_WRITE(ENABLED(INVERT_J_DIR) ^ z_direction);
#endif
#ifdef K_DIR_WRITE
K_DIR_WRITE(INVERT_K_DIR ^ z_direction);
K_DIR_WRITE(ENABLED(INVERT_K_DIR) ^ z_direction);
#endif
DIR_WAIT_AFTER();

View file

@ -357,9 +357,9 @@ class Stepper {
#endif
#if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN)
static bool locked_Z_motor, locked_Z2_motor
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
, locked_Z3_motor
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
, locked_Z4_motor
#endif
#endif
@ -561,18 +561,18 @@ class Stepper {
#if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN)
FORCE_INLINE static void set_z1_lock(const bool state) { locked_Z_motor = state; }
FORCE_INLINE static void set_z2_lock(const bool state) { locked_Z2_motor = state; }
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
FORCE_INLINE static void set_z3_lock(const bool state) { locked_Z3_motor = state; }
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
FORCE_INLINE static void set_z4_lock(const bool state) { locked_Z4_motor = state; }
#endif
#endif
static void set_all_z_lock(const bool lock, const int8_t except=-1) {
set_z1_lock(lock ^ (except == 0));
set_z2_lock(lock ^ (except == 1));
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
set_z3_lock(lock ^ (except == 2));
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
set_z4_lock(lock ^ (except == 3));
#endif
#endif

View file

@ -405,91 +405,91 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#if EXTRUDERS > 7
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \
case 6: E3_DIR_WRITE( INVERT_E3_DIR); break; case 7: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
case 6: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; case 7: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
} }while(0)
#define REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
case 6: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 7: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
case 6: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; case 7: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
} }while(0)
#elif EXTRUDERS > 6
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \
case 6: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
case 6: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
} }while(0)
#define REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
case 6: E3_DIR_WRITE(!INVERT_E3_DIR); } }while(0)
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
case 6: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); } }while(0)
#elif EXTRUDERS > 5
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
} }while(0)
#define REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
} }while(0)
#elif EXTRUDERS > 4
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
} }while(0)
#define REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
} }while(0)
#elif EXTRUDERS > 3
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
} }while(0)
#define REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
} }while(0)
#elif EXTRUDERS > 2
#define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
#define NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
} }while(0)
#define REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
} }while(0)
#else
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(E ? INVERT_E0_DIR : !INVERT_E0_DIR); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR : INVERT_E0_DIR); }while(0)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(E ? ENABLED(INVERT_E0_DIR) : DISABLED(INVERT_E0_DIR)); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? DISABLED(INVERT_E0_DIR) : ENABLED(INVERT_E0_DIR)); }while(0)
#endif
#elif HAS_PRUSA_MMU2 // One multiplexed stepper driver
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR)
#define NORM_E_DIR(E) E0_DIR_WRITE(DISABLED(INVERT_E0_DIR))
#define REV_E_DIR(E) E0_DIR_WRITE( ENABLED(INVERT_E0_DIR))
#elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? DISABLED(INVERT_E0_DIR): ENABLED(INVERT_E0_DIR)); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? ENABLED(INVERT_E0_DIR): DISABLED(INVERT_E0_DIR)); }while(0)
#elif E_STEPPERS > 1
@ -500,16 +500,16 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; case 7: E7_STEP_WRITE(V); break; \
} }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \
case 6: E6_DIR_WRITE(!INVERT_E6_DIR); break; case 7: E7_DIR_WRITE(!INVERT_E7_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \
case 6: E6_DIR_WRITE(DISABLED(INVERT_E6_DIR)); break; case 7: E7_DIR_WRITE(DISABLED(INVERT_E7_DIR)); break; \
} }while(0)
#define _REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \
case 6: E6_DIR_WRITE( INVERT_E6_DIR); break; case 7: E7_DIR_WRITE( INVERT_E7_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \
case 6: E6_DIR_WRITE( ENABLED(INVERT_E6_DIR)); break; case 7: E7_DIR_WRITE( ENABLED(INVERT_E7_DIR)); break; \
} }while(0)
#elif E_STEPPERS > 6
@ -519,16 +519,16 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; \
} }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \
case 6: E6_DIR_WRITE(!INVERT_E6_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \
case 6: E6_DIR_WRITE(DISABLED(INVERT_E6_DIR)); break; \
} }while(0)
#define _REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \
case 6: E6_DIR_WRITE( INVERT_E6_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \
case 6: E6_DIR_WRITE( ENABLED(INVERT_E6_DIR)); break; \
} }while(0)
#elif E_STEPPERS > 5
@ -538,14 +538,14 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; \
} }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \
} }while(0)
#define _REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \
} }while(0)
#elif E_STEPPERS > 4
@ -555,14 +555,14 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 4: E4_STEP_WRITE(V); break; \
} }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; \
} }while(0)
#define _REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; \
} }while(0)
#elif E_STEPPERS > 3
@ -571,25 +571,25 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
} }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
} }while(0)
#define _REV_E_DIR(E) do{ switch (E) { \
case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
} }while(0)
#elif E_STEPPERS > 2
#define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }while(0)
#define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); } }while(0)
#define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); } }while(0)
#define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); } }while(0)
#else
#define _E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
#define _NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0)
#define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
#define _NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); } else { E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); } }while(0)
#define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); } else { E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); } }while(0)
#endif
#if HAS_DUPLICATION_MODE
@ -600,8 +600,8 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define _DUPE(N,T,V) E##N##_##T##_WRITE(V)
#endif
#define NDIR(N) _DUPE(N,DIR,!INVERT_E##N##_DIR)
#define RDIR(N) _DUPE(N,DIR, INVERT_E##N##_DIR)
#define NDIR(N) _DUPE(N,DIR,DISABLED(INVERT_E##N##_DIR))
#define RDIR(N) _DUPE(N,DIR, ENABLED(INVERT_E##N##_DIR))
#define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { DUPE(STEP,V); } else _E_STEP_WRITE(E,V); }while(0)
@ -647,13 +647,13 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#elif ENABLED(E_DUAL_STEPPER_DRIVERS)
#define E_STEP_WRITE(E,V) do{ E0_STEP_WRITE(V); E1_STEP_WRITE(V); }while(0)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); E1_DIR_WRITE(DISABLED(INVERT_E0_DIR) ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
#define REV_E_DIR(E) do{ E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); E1_DIR_WRITE( ENABLED(INVERT_E0_DIR) ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
#elif E_STEPPERS
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
#define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR)
#define NORM_E_DIR(E) E0_DIR_WRITE(DISABLED(INVERT_E0_DIR))
#define REV_E_DIR(E) E0_DIR_WRITE( ENABLED(INVERT_E0_DIR))
#else
#define E_STEP_WRITE(E,V) NOOP

View file

@ -468,10 +468,10 @@
#ifndef Z2_USE_ENDSTOP
#define Z2_USE_ENDSTOP _ZSTOP_
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3 && !defined(Z3_USE_ENDSTOP)
#if NUM_Z_STEPPERS >= 3 && !defined(Z3_USE_ENDSTOP)
#define Z3_USE_ENDSTOP _ZSTOP_
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4 && !defined(Z4_USE_ENDSTOP)
#if NUM_Z_STEPPERS >= 4 && !defined(Z4_USE_ENDSTOP)
#define Z4_USE_ENDSTOP _ZSTOP_
#endif
#endif
@ -688,14 +688,14 @@
#define X2_MS3_PIN -1
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !defined(Y2_DIAG_PIN) && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN)
#if HAS_DUAL_Y_STEPPERS && !defined(Y2_DIAG_PIN) && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN)
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
#else
#define Z2_E_INDEX Y2_E_INDEX
#endif
// The Y2 axis, if any, should be the next open extruder port
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if HAS_DUAL_Y_STEPPERS
#ifndef Y2_STEP_PIN
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
@ -774,14 +774,14 @@
#define Y2_MS3_PIN -1
#endif
#if NUM_Z_STEPPER_DRIVERS >= 2 && !defined(Z2_DIAG_PIN) && !defined(Z2_STEP_PIN) && !PIN_EXISTS(Z2_CS_PIN)
#if NUM_Z_STEPPERS >= 2 && !defined(Z2_DIAG_PIN) && !defined(Z2_STEP_PIN) && !PIN_EXISTS(Z2_CS_PIN)
#define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
#else
#define Z3_E_INDEX Z2_E_INDEX
#endif
// The Z2 axis, if any, should be the next open extruder port
#if NUM_Z_STEPPER_DRIVERS >= 2
#if NUM_Z_STEPPERS >= 2
#ifndef Z2_STEP_PIN
#define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
#define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
@ -860,14 +860,14 @@
#define Z2_MS3_PIN -1
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3 && !defined(Z3_DIAG_PIN) && !defined(Z3_STEP_PIN) && !PIN_EXISTS(Z3_CS_PIN)
#if NUM_Z_STEPPERS >= 3 && !defined(Z3_DIAG_PIN) && !defined(Z3_STEP_PIN) && !PIN_EXISTS(Z3_CS_PIN)
#define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
#else
#define Z4_E_INDEX Z3_E_INDEX
#endif
// The Z3 axis, if any, should be the next open extruder port
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#ifndef Z3_STEP_PIN
#define Z3_STEP_PIN _EPIN(Z3_E_INDEX, STEP)
#define Z3_DIR_PIN _EPIN(Z3_E_INDEX, DIR)
@ -946,14 +946,14 @@
#define Z3_MS3_PIN -1
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4 && !defined(Z4_DIAG_PIN) && !defined(Z4_STEP_PIN) && !PIN_EXISTS(Z4_CS_PIN)
#if NUM_Z_STEPPERS >= 4 && !defined(Z4_DIAG_PIN) && !defined(Z4_STEP_PIN) && !PIN_EXISTS(Z4_CS_PIN)
#define I_E_INDEX INCREMENT(Z4_E_INDEX)
#else
#define I_E_INDEX Z4_E_INDEX
#endif
// The Z4 axis, if any, should be the next open extruder port
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#ifndef Z4_STEP_PIN
#define Z4_STEP_PIN _EPIN(Z4_E_INDEX, STEP)
#define Z4_DIR_PIN _EPIN(Z4_E_INDEX, DIR)
@ -1396,16 +1396,16 @@
#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
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 3 || Z_HOME_TO_MAX
#undef Z3_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MIN
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 3 || Z_HOME_TO_MIN
#undef Z3_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MAX
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 4 || Z_HOME_TO_MAX
#undef Z4_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MIN
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 4 || Z_HOME_TO_MIN
#undef Z4_MAX_PIN
#endif

View file

@ -31,8 +31,8 @@
#if HOTENDS > 2 || E_STEPPERS > 2
#error "RL200v1 supports up to 2 hotends / E-steppers. Comment out this line to continue."
#elif NUM_Z_STEPPER_DRIVERS != 2
#error "RL200 uses dual Z stepper motors. Set NUM_Z_STEPPER_DRIVERS to 2 or comment out this line to continue."
#elif NUM_Z_STEPPERS != 2
#error "RL200 uses dual Z stepper motors. Set NUM_Z_STEPPERS to 2 or comment out this line to continue."
#elif !(AXIS_DRIVER_TYPE_X(DRV8825) && AXIS_DRIVER_TYPE_Y(DRV8825) && AXIS_DRIVER_TYPE_Z(DRV8825) && AXIS_DRIVER_TYPE_Z2(DRV8825) && AXIS_DRIVER_TYPE_E0(DRV8825))
#error "You must set ([XYZ]|Z2|E0)_DRIVER_TYPE to DRV8825 in Configuration.h for RL200."
#endif

View file

@ -118,7 +118,7 @@
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#if NUM_Z_STEPPER_DRIVERS == 2
#if NUM_Z_STEPPERS == 2
#define Z2_STEP_PIN 26 // E0 connector
#define Z2_DIR_PIN 28
#define Z2_ENABLE_PIN 24

View file

@ -110,7 +110,7 @@
// This board have the option to use an extra TMC2209 stepper, one of the use could be as a second extruder.
#if EXTRUDERS < 2
// TODO: Corregir aquí que cuando tenemos dos extrusores o lo que sea, utiliza los endstop que le sobran, osea los max, no hay Z2_endstop
#if NUM_Z_STEPPER_DRIVERS > 1
#if NUM_Z_STEPPERS > 1
#define Z2_STOP_PIN 14
#endif
#else

View file

@ -658,7 +658,7 @@
#define _X2_PINS
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if HAS_DUAL_Y_STEPPERS
#if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2)
#define _Y2_CS Y2_CS_PIN,
#else
@ -684,7 +684,7 @@
#define _Y2_PINS
#endif
#if NUM_Z_STEPPER_DRIVERS >= 2
#if NUM_Z_STEPPERS >= 2
#if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2)
#define _Z2_CS Z2_CS_PIN,
#else
@ -710,7 +710,7 @@
#define _Z2_PINS
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if NUM_Z_STEPPERS >= 3
#if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3)
#define _Z3_CS Z3_CS_PIN,
#else
@ -736,7 +736,7 @@
#define _Z3_PINS
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if NUM_Z_STEPPERS >= 4
#if PIN_EXISTS(Z4_CS) && AXIS_HAS_SPI(Z4)
#define _Z4_CS Z4_CS_PIN,
#else

View file

@ -22,7 +22,7 @@ exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers |
restore_configs
opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 \
NUM_Z_STEPPER_DRIVERS 4 \
Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z3_DRIVER_TYPE A4988 Z4_DRIVER_TYPE A4988 \
DEFAULT_Kp_LIST '{ 22.2, 20.0, 21.0, 19.0, 18.0 }' DEFAULT_Ki_LIST '{ 1.08 }' DEFAULT_Kd_LIST '{ 114.0, 112.0, 110.0, 108.0 }'
opt_enable TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_MIGRATION_FEATURE TOOLCHANGE_FS_SLOW_FIRST_PRIME TOOLCHANGE_FS_PRIME_FIRST_USED \
PID_PARAMS_PER_HOTEND Z_MULTI_ENDSTOPS

View file

@ -35,7 +35,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options
# RADDS with BLTouch, ABL(B), 3 x Z auto-align
#
restore_configs
opt_set MOTHERBOARD BOARD_RADDS NUM_Z_STEPPER_DRIVERS 3
opt_set MOTHERBOARD BOARD_RADDS Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z3_DRIVER_TYPE A4988
opt_enable USE_XMAX_PLUG USE_YMAX_PLUG ENDSTOPPULLUPS BLTOUCH AUTO_BED_LEVELING_BILINEAR \
Z_STEPPER_AUTO_ALIGN Z_STEPPER_ALIGN_STEPPER_XY Z_SAFE_HOMING
pins_set ramps/RAMPS X_MAX_PIN -1

View file

@ -16,7 +16,6 @@ opt_set MOTHERBOARD BOARD_AGCM4_RAMPS_144 SERIAL_PORT -1 \
RESTORE_LEVELING_AFTER_G28 false \
LCD_LANGUAGE it \
SDCARD_CONNECTION LCD \
NUM_Z_STEPPER_DRIVERS 2 \
HOMING_BUMP_MM '{ 0, 0, 0 }'
opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
FILAMENT_RUNOUT_SENSOR G26_MESH_VALIDATION MESH_EDIT_GFX_OVERLAY Z_SAFE_HOMING \

View file

@ -39,7 +39,7 @@ exec_test $1 $2 "(No PWM)" "$3"
restore_configs
opt_set MOTHERBOARD BOARD_ZRIB_V52 \
LCD_LANGUAGE pt REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 \
EXTRUDERS 2 TEMP_SENSOR_1 1
EXTRUDERS 2 TEMP_SENSOR_1 1 X2_DRIVER_TYPE A4988
opt_enable USE_XMAX_PLUG DUAL_X_CARRIAGE REPRAPWORLD_KEYPAD
exec_test $1 $2 "ZRIB_V52 | DUAL_X_CARRIAGE" "$3"

View file

@ -51,10 +51,11 @@ opt_set MOTHERBOARD BOARD_RAMBO \
DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \
MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \
AXIS_RELATIVE_MODES '{ false, false, false }' \
LEVEL_CORNERS_LEVELING_ORDER '{ LF, RF }'
LEVEL_CORNERS_LEVELING_ORDER '{ LF, RF }' \
X2_DRIVER_TYPE A4988 Y2_DRIVER_TYPE A4988
opt_enable USE_XMAX_PLUG USE_YMAX_PLUG USE_ZMAX_PLUG \
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER REVERSE_ENCODER_DIRECTION SDSUPPORT EEPROM_SETTINGS \
S_CURVE_ACCELERATION X_DUAL_STEPPER_DRIVERS X_DUAL_ENDSTOPS Y_DUAL_STEPPER_DRIVERS Y_DUAL_ENDSTOPS \
S_CURVE_ACCELERATION X_DUAL_ENDSTOPS Y_DUAL_ENDSTOPS \
ADAPTIVE_STEP_SMOOTHING CNC_COORDINATE_SYSTEMS GCODE_MOTION_MODES \
LEVEL_BED_CORNERS LEVEL_CENTER_TOO
opt_disable MIN_SOFTWARE_ENDSTOP_Z MAX_SOFTWARE_ENDSTOPS

View file

@ -101,7 +101,7 @@ exec_test $1 $2 "Teensy 3.5/3.6 COREXZ | BACKLASH" "$3"
# Enable Dual Z with Dual Z endstops
#
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY35_36 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2
opt_set MOTHERBOARD BOARD_TEENSY35_36 Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z2_MIN_PIN 2
opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
pins_set ramps/RAMPS X_MAX_PIN -1
exec_test $1 $2 "Dual Z with Dual Z endstops" "$3"

View file

@ -105,7 +105,7 @@ exec_test $1 $2 "Teensy 4.0/4.1 COREXZ" "$3"
# Enable Dual Z with Dual Z endstops
#
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY41 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2
opt_set MOTHERBOARD BOARD_TEENSY41 Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z2_MIN_PIN 2
opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
pins_set ramps/RAMPS X_MAX_PIN -1
exec_test $1 $2 "Dual Z with Dual Z endstops" "$3"